diff --git a/incident.go b/incident.go index 418f9d4f..ae74f535 100644 --- a/incident.go +++ b/incident.go @@ -557,19 +557,19 @@ type ResponderRequestTargets struct { // ResponderRequestOptions defines the input options for the Create Responder function. type ResponderRequestOptions struct { - From string `json:"-"` - Message string `json:"message"` - RequesterID string `json:"requester_id"` - Targets []ResponderRequestTarget `json:"responder_request_targets"` + From string `json:"-"` + Message string `json:"message"` + RequesterID string `json:"requester_id"` + Targets []ResponderRequestTargets `json:"responder_request_targets"` } // ResponderRequest contains the API structure for an incident responder request. type ResponderRequest struct { - Incident Incident `json:"incident"` - Requester User `json:"requester,omitempty"` - RequestedAt string `json:"request_at,omitempty"` - Message string `json:"message,omitempty"` - Targets ResponderRequestTargets `json:"responder_request_targets"` + Incident Incident `json:"incident"` + Requester User `json:"requester,omitempty"` + RequestedAt string `json:"request_at,omitempty"` + Message string `json:"message,omitempty"` + Targets []ResponderRequestTargets `json:"responder_request_targets"` } // ResponderRequest will submit a request to have a responder join an incident. diff --git a/incident_test.go b/incident_test.go index ae98b7f8..7278a178 100644 --- a/incident_test.go +++ b/incident_test.go @@ -544,7 +544,7 @@ func TestIncident_ResponderRequest(t *testing.T) { "type": "user_reference" }, "message": "Help", - "responder_request_targets": { + "responder_request_targets": [{ "responder_request_target": { "id": "PJ25ZYX", "type": "user_reference", @@ -555,7 +555,7 @@ func TestIncident_ResponderRequest(t *testing.T) { } } } - } + }] } }`)) }) @@ -566,11 +566,15 @@ func TestIncident_ResponderRequest(t *testing.T) { r.ID = "PJ25ZYX" r.Type = "user_reference" + targets := []ResponderRequestTargets{ + ResponderRequestTargets{Target: r}, + } + input := ResponderRequestOptions{ From: from, Message: "help", RequesterID: "PL1JMK5", - Targets: []ResponderRequestTarget{r}, + Targets: targets, } user := User{} @@ -583,12 +587,16 @@ func TestIncident_ResponderRequest(t *testing.T) { target.Responders.State = "pending" target.Responders.User.ID = "PJ25ZYX" + targets = []ResponderRequestTargets{ + ResponderRequestTargets{Target: target}, + } + want := &ResponderRequestResponse{ ResponderRequest: ResponderRequest{ Incident: Incident{}, Requester: user, Message: "Help", - Targets: ResponderRequestTargets{target}, + Targets: targets, }, } res, err := client.ResponderRequest(id, input)