--- a/report.go Sat Apr 15 21:08:34 2017 +0200
+++ b/report.go Sat Apr 15 21:08:34 2017 +0200
@@ -1,6 +1,7 @@
package gondole
import (
+ "fmt"
"strconv"
"github.com/sendgrid/rest"
@@ -16,7 +17,6 @@
}
// ReportUser reports the user account
-// NOTE: Currently only the first statusID is sent.
func (g *Client) ReportUser(accountID int, statusIDs []int, comment string) (*Report, error) {
if accountID < 1 || comment == "" || len(statusIDs) < 1 {
return nil, ErrInvalidParameter
@@ -24,9 +24,11 @@
params := make(apiCallParams)
params["account_id"] = strconv.Itoa(accountID)
- // XXX Sending only the first one since I'm not sure arrays work
- params["status_ids"] = strconv.Itoa(statusIDs[0])
params["comment"] = comment
+ for i, id := range statusIDs {
+ qID := fmt.Sprintf("status_ids[%d]", i+1)
+ params[qID] = strconv.Itoa(id)
+ }
var report Report
if err := g.apiCall("reports", rest.Post, params, &report); err != nil {