Skip to content

Commit

Permalink
Add support for escalation_policy.on_call_handoff_notifications field
Browse files Browse the repository at this point in the history
  • Loading branch information
zonorti committed Nov 26, 2021
1 parent 9190a3b commit 25b469f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
13 changes: 7 additions & 6 deletions escalation_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ type EscalationRule struct {
// EscalationPolicy is a collection of escalation rules.
type EscalationPolicy struct {
APIObject
Name string `json:"name,omitempty"`
EscalationRules []EscalationRule `json:"escalation_rules,omitempty"`
Services []APIObject `json:"services,omitempty"`
NumLoops uint `json:"num_loops,omitempty"`
Teams []APIReference `json:"teams"`
Description string `json:"description,omitempty"`
Name string `json:"name,omitempty"`
EscalationRules []EscalationRule `json:"escalation_rules,omitempty"`
Services []APIObject `json:"services,omitempty"`
NumLoops uint `json:"num_loops,omitempty"`
Teams []APIReference `json:"teams"`
Description string `json:"description,omitempty"`
OnCallHandoffNotifications string `json:"on_call_handoff_notifications,omitempty"`
}

// ListEscalationPoliciesResponse is the data structure returned from calling the ListEscalationPolicies API endpoint.
Expand Down
25 changes: 25 additions & 0 deletions escalation_policy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,28 @@ func TestEscalationPolicy_UpdateTeams(t *testing.T) {
}
testEqual(t, want, res)
}

func TestEscalationPolicy_GetOnCallHandoffNotifications(t *testing.T) {
setup()
defer teardown()

mux.HandleFunc("/escalation_policies/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
_, _ = w.Write([]byte(`{"escalation_policy": {"id": "1", "on_call_handoff_notifications": "if_has_services"}}`))
})
client := defaultTestClient(server.URL, "foo")
var opts *GetEscalationPolicyOptions
res, err := client.GetEscalationPolicy("1", opts)

want := &EscalationPolicy{
APIObject: APIObject{
ID: "1",
},
OnCallHandoffNotifications: "if_has_services",
}

if err != nil {
t.Fatal(err)
}
testEqual(t, want, res)
}

0 comments on commit 25b469f

Please sign in to comment.