Commit Graph

86 Commits

Author SHA1 Message Date
gutmet
7274b5e624 simplify unduly by requiring client state to be initialized once 2022-11-20 20:36:27 +01:00
gutmet
ac39fb12dd remove context.Context 2022-11-20 18:03:36 +01:00
gutmet
2542bf46ba remove dependencies and client 2022-11-19 20:02:47 +01:00
Rasmus Lindroth
5f0c9a21c2 add support for language 2022-11-17 07:16:38 +09:00
Darren O'Connor
309dce6ff3 minor spelling fixes 2022-11-14 09:04:46 +09:00
Tyr Mactire
2a3ac1d1d5 Client Credentials 2022-08-27 13:35:59 +09:00
Rasmus Lindroth
ae6cc11820 Add support for creating polls 2021-11-06 11:00:42 +09:00
Masahiro Furudate
315df7d916 Add Media struct and UploadMediaFromMedia method 2020-07-27 10:41:06 +09:00
Christian Muehlhaeuser
1c0769492b Fix History struct members 2020-03-02 11:37:33 +09:00
Christian Muehlhaeuser
75578dd249 Update search to use v2 API endpoint
v1 has been disabled on most instances by now.
The change is minor: hash-tags are now reported as proper structs
instead of a simple string-array.
2020-03-02 11:37:25 +09:00
Ben Lubar
c9e2d23df3 Make ScheduledAt a pointer. 2019-09-30 17:17:15 +09:00
Ben Lubar
977e6c550e Add support for creating scheduled posts 2019-09-30 17:17:15 +09:00
Ben Lubar
934e685e7a Add convenience constants for post visibilities 2019-09-30 17:17:15 +09:00
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