Open RasmusLindroth opened 1 year ago
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.
: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
New features
status
now has fieldfiltered
GetTimelineHashtagMultiple(...)
get multiple hashtags in one callTagInfo(...)
,TagFollow(...)
,TagUnfollow(...)
,TagsFollowed(...)
AccountsSearchResolve(...)
same asAccountsSearch(...)
with the addition of the resolve parameterGetNotificationsExclude(...)
same asGetNotifications(...)
with the option to exclude notifications of selected typedBug fixes
AddToList(...)
andRemoveFromList(...)
used the parameteraccounts_ids
instead ofaccounts_ids[]