Commit Graph

467 Commits (08be497fae653fed9d6c12f14e4ec215cfba7237)

Author SHA1 Message Date
rjp 08be497fae Revert to simple `io.Writer` with client-resetting
After going through several other solutions, there's no clean way
to use an `io.Writer` but also be able to call `Reset()` between
writes.  Filehandles can't `Reset()` and buffers can't `Seek()`.
But then if you supplied `os.Stderr`, you'd be expecting appending
and a `Seek()` would be nonsense.

My own preference would be to make `JSONWriter` a strict `*bytes.Buffer`
which lets the library handle the resetting and the client do any
outputting if required - I can't see much value in ever supplying
a non-`bytes.Buffer` as `JSONWriter`.
2023-05-25 08:36:53 +01:00
rjp 51e4324c7a Better handling of "save the JSON"
As suggested by 'mattn, use a `TeeReader` with an `io.Writer` to keep
the semantics of `json.NewDecoder().Decode()` whilst also being able
to save the JSON if requested by the client.

However we need to use our own interface (`WriteResetter`) in order to
be able to call `Reset()` on the underlying buffer (which does somewhat
limit the usage to buffers instead of generic `io.Writer` and may not
be the 100% ideal solution.)
2023-05-25 08:05:58 +01:00
rjp 333d71452a A simple test for retained JSON 2023-05-23 09:00:54 +01:00
rjp 63cf193a13 Gate the JSON saving behind a client flag
This way the library will behave as it used to for anyone who doesn't
explicitly set `client.SaveJSON` to be `true`.  No surprises = good.
2023-05-23 08:33:15 +01:00
rjp 78d8d7fc43 Keep the API JSON around (briefly)
For my archival purposes, I like to keep the raw API JSON around
as it often contains things not picked up by the various objects.

e.g. getting a status from my Akkoma instance contains a whole
`pleroma` extension block that's not reflected in `mastodon.Status`.

Maybe this should be gated by an option when creating the `Client`
since it's probably only relevant to 1% of library users.
2023-05-23 08:27:55 +01:00
Brint E. Kriebel 9faaa4f0dc Add support for edited statuses
ActivityPub supports "status.update" for editing statuses. These should
be made available for streams.
2022-12-28 23:59:18 +09:00
till 6e810f25fa Chore: update actions and go versions
Resolves: #157
2022-12-28 23:55:58 +09:00
till 3203150fd3 Update: support configuration
This exposes settings for clients, so it's nice to be able to
access it directly.
2022-12-28 23:51:48 +09:00
Michal Vyskocil 29bb16009b fix go vet warnings: call to (*T).Fatalf from a non-test goroutine
The goroutine started from test must not call t.Fatal, but t.Error. Adds
a sync.WaitGroup to make sure all goroutines have a chance to report an
error before test stops.
2022-12-13 09:12:56 +09:00
Raffaele Sena ae970802cf Add command timeline-tag to search for statuses matching the tag.
Since `search` only return the list of tags matching the search, this is
helpful to actually see the statuses for a particular tag.
2022-12-01 02:49:06 +09:00
Rasmus Lindroth 98f591c5e2 add comment for GetStatusSource 2022-11-30 08:16:07 +09:00
Rasmus Lindroth 51f9d7f999 add source, history for statuses and option to update a status 2022-11-30 08:16:07 +09:00
Yasuhiro Matsumoto b597f437a9
use urfave/cli/v2 2022-11-27 13:24:42 +09:00
Rasmus Lindroth 5f0c9a21c2 add support for language 2022-11-17 07:16:38 +09:00
Darren O'Connor be61205708 Remove unused variables 2022-11-17 07:15:36 +09:00
Darren O'Connor 9e1af56ceb remove redundent return statements 2022-11-16 10:49:14 +09:00
Darren O'Connor f76d33a68c switch os.ReadFile to ioutil.ReadFile due to Ubuntu 15 test failing 2022-11-15 13:44:33 +09:00
Darren O'Connor e5c082de35 Add UploadMediaFromBytes function 2022-11-15 13:44:33 +09:00
Darren O'Connor 309dce6ff3 minor spelling fixes 2022-11-14 09:04:46 +09:00
Mark Ayers 114537dcc0 Update install instruction 2022-11-12 21:58:04 +09:00
Tyr Mactire 7dfe81e233 docs 2022-08-27 13:35:59 +09:00
Tyr Mactire 2a3ac1d1d5 Client Credentials 2022-08-27 13:35:59 +09:00
Yasuhiro Matsumoto d272534ac7
Separate go.mod 2022-06-04 23:01:37 +09:00
Rasmus Lindroth b2204e0d6a add support for pinned posts 2022-06-04 22:56:14 +09:00
Rasmus Lindroth c6a292132e add Discoverable and Source on Account 2022-06-04 22:56:14 +09:00
Alexander Bakker 87278bda2e Use bufio.Reader instead of bufio.Scanner when streaming
I occasionally run into "bufio.Scanner: token too long" while
streaming. This change should prevent that from happening.
2022-05-03 22:16:38 +09:00
Rasmus Lindroth f436c5397c fix slash 2022-05-01 22:52:28 +09:00
Rasmus Lindroth dfa87f3a80 add support for filters 2022-05-01 22:52:28 +09:00
Marian Steinbach 7745e19ff7 Only set Authorization header when AccessToken is set 2021-12-14 20:55:46 +09:00
Marian Steinbach 45d75e8085 Update badge in README to point to pkg.go.dev 2021-11-23 23:53:31 +09:00
shine 62214db600 document bookmark APIs
follows d39c10b which introduced the bookmark APIs.
2021-11-06 11:01:00 +09:00
Rasmus Lindroth 4cbbf813dc add test for PostStatus 2021-11-06 11:00:42 +09:00
Rasmus Lindroth ae6cc11820 Add support for creating polls 2021-11-06 11:00:42 +09:00
Rasmus Lindroth 58c3891813 Add support to vote on polls. Add more fields to Poll 2021-11-05 00:02:01 +09:00
Yasuhiro Matsumoto a0db0ed8a0
Update dependencies 2021-11-04 23:06:26 +09:00
Yasuhiro Matsumoto 1dd699ecee
Update README.md 2021-11-04 23:05:34 +09:00
Yasuhiro Matsumoto f5813a9d88
Enable GitHub Workflows 2021-11-04 23:04:38 +09:00
Rasmus Lindroth d39c10ba5e Add bookmark support 2021-06-30 00:13:05 +09:00
Masahiro Furudate 86627ec7d6 Fix godoc badge to godev badge 2021-05-15 23:43:04 +09:00
WaybackBot bf42b86b9f Add streaming direct support 2021-05-15 23:42:50 +09:00
WaybackBot eb26687c84 Update README 2021-05-15 23:42:50 +09:00
Hanage999 8c434b5282 Replace deprecated /api/v1/notifications/dismiss with new API 2021-05-15 23:42:24 +09:00
Ollivier Robert 6abe72ddb0 Fix TestCmdTimelone() as well. 2021-04-17 21:32:10 +09:00
Ollivier Robert d6cb307605 Remove leftover Logf() call. 2021-04-17 21:32:10 +09:00
Ollivier Robert 2ae3a80997 Fix tests to use data from Conversation, not Timelines. 2021-04-17 21:32:10 +09:00
Ollivier Robert 932595ebec Fix allocation. 2021-04-17 21:32:10 +09:00
Ollivier Robert 2f161cfa50 Allocate space to prevent SIGSEGV. 2021-04-17 21:32:10 +09:00
Ollivier Robert adff0e83b9 Use Conversations. 2021-04-17 21:32:10 +09:00
Masahiro Furudate 315df7d916 Add Media struct and UploadMediaFromMedia method 2020-07-27 10:41:06 +09:00
Christian Muehlhaeuser 3e91c76504 Added polls entity, available since API 2.8.0 2020-03-02 11:39:13 +09:00