go-mastodon icon indicating copy to clipboard operation
go-mastodon copied to clipboard

param name for client.AddToList should be account_ids[] not account_ids

Open judell opened this issue 1 year ago • 0 comments

Currently the URL that's produced is like so:

https://social.coop/api/v1/lists/1064/accounts?account_ids=109348240344188934

Which returns 200 but does not add to the list.

This will actually add to the list:

https://social.coop/api/v1/lists/1064/accounts?account_ids[]=109348240344188934

I made this change to complete my task, but not raising a PR because I'm not sure where else this might be happening.

+++ b/lists.go
@@ -90,7 +90,7 @@ func (c *Client) DeleteList(ctx context.Context, id ID) error {
 func (c *Client) AddToList(ctx context.Context, list ID, accounts ...ID) error {
        params := url.Values{}
        for _, acct := range accounts {
-               params.Add("account_ids", string(acct))
+               params.Add("account_ids[]", string(acct))
        }

judell avatar Apr 06 '23 03:04 judell