22 } |
22 } |
23 return reports, nil |
23 return reports, nil |
24 } |
24 } |
25 |
25 |
26 // ReportUser reports the user account |
26 // ReportUser reports the user account |
27 func (mc *Client) ReportUser(accountID int, statusIDs []int, comment string) (*Report, error) { |
27 func (mc *Client) ReportUser(accountID int64, statusIDs []int64, comment string) (*Report, error) { |
28 if accountID < 1 || comment == "" || len(statusIDs) < 1 { |
28 if accountID < 1 || comment == "" || len(statusIDs) < 1 { |
29 return nil, ErrInvalidParameter |
29 return nil, ErrInvalidParameter |
30 } |
30 } |
31 |
31 |
32 params := make(apiCallParams) |
32 params := make(apiCallParams) |
33 params["account_id"] = strconv.Itoa(accountID) |
33 params["account_id"] = strconv.FormatInt(accountID, 10) |
34 params["comment"] = comment |
34 params["comment"] = comment |
35 for i, id := range statusIDs { |
35 for i, id := range statusIDs { |
36 if id < 1 { |
36 if id < 1 { |
37 return nil, ErrInvalidID |
37 return nil, ErrInvalidID |
38 } |
38 } |
39 qID := fmt.Sprintf("status_ids[%d]", i+1) |
39 qID := fmt.Sprintf("status_ids[%d]", i+1) |
40 params[qID] = strconv.Itoa(id) |
40 params[qID] = strconv.FormatInt(id, 10) |
41 } |
41 } |
42 |
42 |
43 var report Report |
43 var report Report |
44 if err := mc.apiCall("reports", rest.Post, params, nil, nil, &report); err != nil { |
44 if err := mc.apiCall("reports", rest.Post, params, nil, nil, &report); err != nil { |
45 return nil, err |
45 return nil, err |