From 84004eff3996ba5bbcd18a44664e3b800e40c0c1 Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Wed, 19 Apr 2017 18:09:43 +0900 Subject: [PATCH] fix Report --- report.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/report.go b/report.go index f58d063..c4b32ef 100644 --- a/report.go +++ b/report.go @@ -2,7 +2,9 @@ package mastodon import ( "context" + "fmt" "net/http" + "net/url" ) // Report hold information for mastodon report. @@ -22,9 +24,15 @@ func (c *Client) GetReports(ctx context.Context) ([]*Report, error) { } // Report reports the report -func (c *Client) Report(ctx context.Context, id int64) (*Report, error) { +func (c *Client) Report(ctx context.Context, accountId int64, ids []int64, comment string) (*Report, error) { + params := url.Values{} + params.Set("account_id", fmt.Sprint(accountId)) + for _, id := range ids { + params.Add("status_ids[]", fmt.Sprint(id)) + } + params.Set("comment", comment) var report Report - err := c.doAPI(ctx, http.MethodPost, "/api/v1/reports", nil, &report, nil) + err := c.doAPI(ctx, http.MethodPost, "/api/v1/reports", params, &report, nil) if err != nil { return nil, err }