Commit Graph

73 Commits (20bc690d8d07dbac139d6dc302014b65fc2d3073)

Author SHA1 Message Date
dtluna 34e64bb423 Make Client.Config public 2019-08-22 14:21:32 +09:00
Christian Muehlhaeuser 8a48862adc Use a slightly more aggressive backoff approach
Doubling the backoff every iteration turned out to be a bit
too relaxed for the common situations where you run into API
throttling. This change gives the API enough room to breathe,
but re-tries requests just a little more often.
2019-08-08 16:47:43 +09:00
Yasuhiro Matsumoto 3268207afe Set User-Agent 2019-06-22 01:32:52 +09:00
Christian Muehlhaeuser c09198f7c9 Fixed pagination parsing for non-numeric IDs
Mastodon API's pagination IDs are not guaranteed to be in a numeric format.
This happens to be the case for the tootsuite implementation, but others
use UUIDs or flake IDs for pagination.

This also simplifies the code a bit and luckily shouldn't break backwards
compatibility since they're already of type ID in the Pagination struct.
2019-05-17 10:55:38 +09:00
Christian Muehlhaeuser bb2662b33c Handle HTTP 429 responses with a request backoff approach
Since it's difficult to wrap all possible go-mastodon API calls in a backoff
algorithm outside of the package itself, I decided to implement a simple
version of it in go-mastodon's doAPI itself.

This works nicely, but could be improved in two ways still:

- Abort sleeping when context gets cancelled
- Make backoff optional / configurable

Personally, I still think this is a good start and probably fits most of
go-mastodon's use-cases. It certainly beats string-grepping for status code
"429" in clients.
2019-05-14 14:52:36 +09:00
Brian C. Lindner e804ee7eb2 Added UploadMediaFromReader 2019-03-11 14:18:07 +09:00
178inaba b8bb5ae68c Add MinID to Pagination 2019-02-15 10:03:18 +09:00
Jessica Paczuski 6bf95fc751 Rename Size -> AttachmentSize 2019-02-06 19:06:00 +09:00
Jessica Paczuski 814e71920d Add Meta field to Attachment 2019-02-06 19:06:00 +09:00
Christian Muehlhaeuser 4def10a243 Updated entities and json structs for API v2.6.0
Added missing fields to various structs and sorted them in the same order as
the original mastodon API documentation does. This should make it easier to
compare go-mastodon's structs with the original documentation.
2018-11-25 23:15:20 +09:00
Ben Lubar c5945152ec Add convenience function to authenticate using OAuth2.
This is required for users who have 2-factor authentication enabled, and is generally safer because users don't need to give their password to third-party software.
2018-11-22 21:37:40 +09:00
Ben Lubar 61705d1f2b Add missing fields in Account.
See https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#account

Also fixes a spurious pagination-related error.
2018-10-21 21:37:19 +09:00
utam0k 1d165763fa Add Emojis to Status 2017-10-26 14:53:27 +09:00
Yasuhiro Matsumoto 730317321a also convert to string in attachments, pagenation 2017-10-25 10:22:39 +09:00
178inaba b433e93615 Add package documents 2017-05-14 04:59:56 +09:00
178inaba 4033436175 Fix to set MaxID and SinceID to exclusive 2017-05-08 13:44:49 +09:00
178inaba f283f05671 Fix Pagination variable from *int64 to int64 2017-05-07 01:36:25 +09:00
178inaba 22f47735b4 Add processing when pagination is nil 2017-05-06 23:34:42 +09:00
178inaba 134128cb56 Fix to not return *Pagination 2017-05-06 23:03:19 +09:00
178inaba eacd4e066d Fix doAPI pagination 2017-05-04 23:35:00 +09:00
178inaba d32c4d4ed1 Add Pagination 2017-05-04 21:56:54 +09:00
178inaba d1b5f4b1fb Fix for ineffassign . 2017-04-20 21:29:10 +09:00
TSUYUSATO Kitsune fb53d41dd9 Correct context uses
`doAPI`'s `context` does not work due to `WithContext` immutability.
`Authenticate` and `RegisterApp` does not use `context` although they
needs `context`, so their `context` does not work also. This commit fixes
them and add test cases.
2017-04-19 18:53:55 +09:00
Yasuhiro Matsumoto 00bd1f0aba fix linkHeader restrictly 2017-04-19 17:48:42 +09:00
178inaba aa0f9563ac Fix to parse API error 2017-04-19 14:32:53 +09:00
Yasuhiro Matsumoto 20174d5b4a Merge branch 'master' of github.com:mattn/go-mastodon 2017-04-18 17:18:17 +09:00
Yasuhiro Matsumoto 2debac3055 read all elements 2017-04-18 17:11:49 +09:00
Yasuhiro Matsumoto 9ccb5101ec take pointer for "next" variable 2017-04-18 17:08:48 +09:00
178inaba a7e0c19d35 Fix get query to request url 2017-04-18 01:59:52 +09:00
Yasuhiro Matsumoto af67397430 add UploadMedia 2017-04-17 13:54:36 +09:00
Yasuhiro Matsumoto 6fe43e545a Use Request.WithContext 2017-04-17 12:25:20 +09:00
Yasuhiro Matsumoto 5e84b57bf3 breaking compatibility changes. take context for first arguments. 2017-04-17 11:10:29 +09:00
mattn c17c887064 Merge pull request #16 from 178inaba/follow_requests
Add FollowRequestAuthorize and FollowRequestReject
2017-04-17 01:34:21 +09:00
178inaba 104663d1e6 Fix doAPI error handling 2017-04-17 00:03:05 +09:00
Yasuhiro Matsumoto 70b6261e34 golint & go vet 2017-04-16 23:38:53 +09:00
mattn 0d53c41623 Merge pull request #13 from 178inaba/update_credentials
Add AccountUpdate
2017-04-16 20:01:22 +09:00
178inaba a25056d2cc Add Content-Type header to doAPI 2017-04-16 00:47:23 +09:00
Yasuhiro Matsumoto 05c270286a add argstr 2017-04-15 23:21:37 +09:00
178inaba c63f290928 Fix var name url to u 2017-04-15 04:36:27 +09:00
Yasuhiro Matsumoto acb5a81b87 add GetStatus, GetStatusContext 2017-04-15 00:22:44 +09:00
Yasuhiro Matsumoto aa99f8559a Merge branch 'master' of git://github.com/mattn/go-mastodon 2017-04-15 00:10:12 +09:00
Yasuhiro Matsumoto 746688274d implement structs 2017-04-15 00:10:04 +09:00
178inaba 9dee3fc07f Fix POST to http.MethodPost 2017-04-14 23:59:11 +09:00
178inaba b4e56b6ff8 Fix GET to http.MethodGet 2017-04-14 23:56:07 +09:00
Yasuhiro Matsumoto fa43a46aa5 separate files 2017-04-14 23:45:03 +09:00
Yasuhiro Matsumoto 2af857818d add some APIs for Accounts
* AccountFollow
* AccountUnfollow
* AccountBlock
* AccountUnblock
* AccountMute
* AccountUnmute
* GetAccountRelationship
* AccountsSearch
2017-04-14 23:37:29 +09:00
Yasuhiro Matsumoto 98c1da299f should not return 2017-04-14 19:30:15 +09:00
Yasuhiro Matsumoto 713996d9d8 separate func 2017-04-14 19:26:53 +09:00
Yasuhiro Matsumoto 9d84dcf8a7 fix doc 2017-04-14 19:22:56 +09:00
Yasuhiro Matsumoto 44a8f8e593 set urn:ietf:wg:oauth:2.0:oob if RedirectURIs is not set 2017-04-14 18:19:12 +09:00