Commit Graph

391 Commits

Author SHA1 Message Date
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
26fcedc8aa Update badge 2019-06-22 02:17:37 +09:00
Yasuhiro Matsumoto
536597515d Temporary disable test with -race 2019-06-22 02:17:37 +09:00
Yasuhiro Matsumoto
8826198705 Only tip 2019-06-22 02:17:37 +09:00
Yasuhiro Matsumoto
23fc4c7953 Switch to codecov 2019-06-22 02:17:37 +09:00
Yasuhiro Matsumoto
559ed99cdf Add direct
Closes #102
2019-06-22 01:52:45 +09:00
Yasuhiro Matsumoto
3268207afe Set User-Agent 2019-06-22 01:32:52 +09:00
buckket
8f6192e26b Add /api/v1/notifications/dismiss 2019-05-17 10:56:15 +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
178inaba
f51571807d Add go.mod 2019-05-14 14:57:23 +09:00
buckket
e71411ef96 All parameters are now of pointer type and thus can be nil 2019-05-14 14:53:54 +09:00
buckket
636b33ad1c Renamed Source to AccountSource 2019-05-14 14:53:54 +09:00
buckket
68ca31fccd Add support for Field, Source and Locked parameters to AccountUpdate() 2019-05-14 14:53:54 +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
Christian Muehlhaeuser
e725c81450 Added tests for list API calls 2019-05-12 23:58:10 +09:00
Ben Lubar
9427a55316 Add list timeline support. 2019-05-12 23:58:10 +09:00
Ben Lubar
3e2bdc63c7 Add streaming list support. 2019-05-12 23:58:10 +09:00
Ben Lubar
6f05c48bf6 Add list API support. 2019-05-12 23:58:10 +09:00
Brian C. Lindner
e804ee7eb2 Added UploadMediaFromReader 2019-03-11 14:18:07 +09:00
178inaba
efa05aa949 Fix TestNewPagination
Add min_id error pattern.
2019-02-15 10:03:18 +09:00
178inaba
460b971f54 Fix TestPaginationSetValues 2019-02-15 10:03:18 +09:00
178inaba
1fcdf9f501 Fix TestPaginationSetValues 2019-02-15 10:03:18 +09:00
178inaba
5fd7d16157 Fix followers command
Set empty for SinceID.
2019-02-15 10:03:18 +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
Christian Muehlhaeuser
3daf61de23 Fixed tests for Go 1.11 2018-11-25 23:09:03 +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
Strubbl
2ebf34adae add info about missing lists APIs in Readme
https://docs.joinmastodon.org/api/rest/lists/
2018-11-14 18:14:05 +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
Spotlight
48920165ef Correct the spelling of sensitive 2018-10-21 21:36:53 +09:00
Yasuhiro Matsumoto
2ccbcfe14d add some fields for instance command 2018-01-29 14:09:10 +09:00
Yasuhiro Matsumoto
5d863ccf79 add tests for instance 2018-01-29 13:55:37 +09:00
Yamagishi Kazutoshi
f0445dd4da fix 2018-01-29 13:30:15 +09:00
Yamagishi Kazutoshi
faab8cdc27 Add new attributes for instance 2018-01-29 13:30:15 +09:00
Yasuhiro Matsumoto
b9e51b2916 fix typo 2018-01-29 13:26:33 +09:00
Yasuhiro Matsumoto
0022a53649 add instance_activity/instance_peers command 2018-01-29 13:26:33 +09:00
mattn
84ffd85539
Merge pull request #73 from mattn/fix-test
fix test
2018-01-29 13:26:00 +09:00
Yasuhiro Matsumoto
f505a4f6ae fix test 2018-01-29 13:21:56 +09:00
mattn
e946e2a506
Merge pull request #70 from ykzts/instance-activity
Add GetInstanceActivity and GetInstancePeers
2018-01-29 13:13:29 +09:00
Yamagishi Kazutoshi
e0de6af209 Add GetInstanceActivity and GetInstancePeers 2018-01-29 12:33:17 +09:00
mattn
0d8819ecaf
Merge pull request #69 from mattn/fix-68
Fix 68
2017-11-30 15:00:12 +09:00
Yasuhiro Matsumoto
a98b28c817 add test 2017-11-30 14:55:18 +09:00
Yasuhiro Matsumoto
83242d96ca fix #68 2017-11-30 14:53:54 +09:00
mattn
0a6f156537
Merge pull request #67 from mattn/fix-66
fix #66
2017-11-20 10:11:47 +09:00
Yasuhiro Matsumoto
81259792b7 handle float64/string both 2017-11-20 10:04:53 +09:00
Yasuhiro Matsumoto
3002812c02 fix #66 2017-11-20 09:58:20 +09:00
Yasuhiro Matsumoto
bd72aa305d fix test 2017-10-26 15:18:07 +09:00
Yasuhiro Matsumoto
2866ebbdc5 fix test 2017-10-26 15:02:33 +09:00