mattn / go-mastodon

mastodon client for golang
MIT License
599 stars 85 forks source link

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

Open judell opened 1 year ago

judell commented 1 year ago

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))
        }