Skip to content

Commit

Permalink
Make ResponderRequestTarget.Responders a slice (#493)
Browse files Browse the repository at this point in the history
This commit also tweaks the json key name as the previous key did not
match the key used in production.
  • Loading branch information
allyjweir authored Aug 16, 2023
1 parent 043968a commit c1b5040
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion incident.go
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ type ResponderRequestResponse struct {
// ResponderRequestTarget specifies an individual target for the responder request.
type ResponderRequestTarget struct {
APIObject
Responders IncidentResponders `json:"incident_responders,omitempty"`
Responders []IncidentResponders `json:"incidents_responders,omitempty"`
}

// ResponderRequestTargetWrapper is a wrapper for a ResponderRequestTarget.
Expand Down
27 changes: 20 additions & 7 deletions incident_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -811,12 +811,16 @@ func TestIncident_ResponderRequest(t *testing.T) {
"responder_request_target": {
"id": "PJ25ZYX",
"type": "user_reference",
"incident_responders": {
"state": "pending",
"user": {
"id": "PJ25ZYX"
"incidents_responders": [
{
"state": "pending",
"user": {
"id": "PJ25ZYX",
"type": "user_reference",
"summary": "dave"
}
}
}
]
}
}]
}
Expand Down Expand Up @@ -846,8 +850,17 @@ func TestIncident_ResponderRequest(t *testing.T) {
want_target := ResponderRequestTarget{}
want_target.ID = "PJ25ZYX"
want_target.Type = "user_reference"
want_target.Responders.State = "pending"
want_target.Responders.User.ID = "PJ25ZYX"

want_target.Responders = []IncidentResponders{
{
State: "pending",
User: APIObject{
ID: "PJ25ZYX",
Type: "user_reference",
Summary: "dave",
},
},
}

want_target_wrapper := ResponderRequestTargetWrapper{Target: want_target}
want_targets := []ResponderRequestTargetWrapper{want_target_wrapper}
Expand Down

0 comments on commit c1b5040

Please sign in to comment.