go-mastodon
go-mastodon copied to clipboard
Add more endpoints and some bug fixes
New features
-
status
now has fieldfiltered
-
GetTimelineHashtagMultiple(...)
get multiple hashtags in one call -
TagInfo(...)
,TagFollow(...)
,TagUnfollow(...)
,TagsFollowed(...)
-
AccountsSearchResolve(...)
same asAccountsSearch(...)
with the addition of the resolve parameter -
GetNotificationsExclude(...)
same asGetNotifications(...)
with the option to exclude notifications of selected typed
Bug fixes
-
AddToList(...)
andRemoveFromList(...)
used the parameteraccounts_ids
instead ofaccounts_ids[]
- Streaming conversations/direct didn't use the correct event. Also added direct streaming for the websocket implementation
Codecov Report
Base: 87.51% // Head: 88.37% // Increases project coverage by +0.86%
:tada:
Coverage data is based on head (
2b33d0e
) compared to base (9faaa4f
). Patch coverage: 100.00% of modified lines in pull request are covered.
Additional details and impacted files
@@ Coverage Diff @@
## master #172 +/- ##
==========================================
+ Coverage 87.51% 88.37% +0.86%
==========================================
Files 15 16 +1
Lines 1354 1437 +83
==========================================
+ Hits 1185 1270 +85
+ Misses 125 123 -2
Partials 44 44
Impacted Files | Coverage Δ | |
---|---|---|
filters.go | 96.55% <ø> (ø) |
|
mastodon.go | 73.86% <ø> (ø) |
|
accounts.go | 100.00% <100.00%> (ø) |
|
lists.go | 95.16% <100.00%> (ø) |
|
notification.go | 80.76% <100.00%> (+1.89%) |
:arrow_up: |
status.go | 82.26% <100.00%> (+1.21%) |
:arrow_up: |
streaming.go | 97.70% <100.00%> (+0.12%) |
:arrow_up: |
streaming_ws.go | 97.82% <100.00%> (+1.67%) |
:arrow_up: |
tags.go | 100.00% <100.00%> (ø) |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Hi!
Drive-by comment, because I've been looking at this repo and thinking about a problem you're touching:
I suspect that adding "parameter" struct arguments would be more durable than adding individual functions for every type of parameter you wish to pass.
For example, in this change, you propose adding GetNotificationsExclude with a string[] of excludes:
func (c *Client) GetNotificationsExclude(ctx context.Context, exclude *[]string, pg *Pagination) ([]*Notification, error
For endpoints that need to be added with > a dozen [0] optional parameters, this is not going to work.
I'd propose, instead, modifying GetNotifications to take a new parameter struct as an argument:
type NotificationsParams struct {
MaxID ID
SinceID ID
MinID ID
Limit int64
Types []string
ExcludeTypes []string
AccountID ID
}
func (c *Client) GetNotifications(ctx context.Context, params NotificationParams, pg *Pagination) ([]*Notification, error
I think that "param" structs with one field per potential argument would be easy for users of this API, by making the behavior much more consistent. By keeping the names of the functions matching the API endpoint names, and providing a consistent mechanism for specifying all params, we can reduce confusion and provide a single style for supporting all endpoints and params.
[0] https://docs.joinmastodon.org/methods/admin/accounts/#v1 [1] https://docs.joinmastodon.org/methods/notifications/#query-parameters