configuration.go 1008 B

1234567891011121314151617181920212223242526272829303132
  1. package anaconda
  2. import (
  3. "net/url"
  4. )
  5. type Configuration struct {
  6. CharactersReservedPerMedia int `json:"characters_reserved_per_media"`
  7. MaxMediaPerUpload int `json:"max_media_per_upload"`
  8. NonUsernamePaths []string `json:"non_username_paths"`
  9. PhotoSizeLimit int `json:"photo_size_limit"`
  10. PhotoSizes struct {
  11. Thumb photoSize `json:"thumb"`
  12. Small photoSize `json:"small"`
  13. Medium photoSize `json:"medium"`
  14. Large photoSize `json:"large"`
  15. } `json:"photo_sizes"`
  16. ShortUrlLength int `json:"short_url_length"`
  17. ShortUrlLengthHttps int `json:"short_url_length_https"`
  18. }
  19. type photoSize struct {
  20. H int `json:"h"`
  21. W int `json:"w"`
  22. Resize string `json:"resize"`
  23. }
  24. func (a TwitterApi) GetConfiguration(v url.Values) (conf Configuration, err error) {
  25. response_ch := make(chan response)
  26. a.queryQueue <- query{a.baseUrl + "/help/configuration.json", v, &conf, _GET, response_ch}
  27. return conf, (<-response_ch).err
  28. }