Skip to content

Commit

Permalink
couple of syntax and unmarshaling fixes. closes PagerDuty#232
Browse files Browse the repository at this point in the history
  • Loading branch information
Erog38 committed Jul 16, 2020
1 parent ab036b7 commit 4c106de
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
12 changes: 6 additions & 6 deletions incident.go
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ type ListIncidentLogEntriesOptions struct {
Includes []string `url:"include,omitempty,brackets"`
IsOverview bool `url:"is_overview,omitempty"`
TimeZone string `url:"time_zone,omitempty"`
Since string `url:since,omitempty`
Until string `url:until,omitempty`
Since string `url:"since,omitempty"`
Until string `url:"until,omitempty"`
}

// ListIncidentLogEntries lists existing log entries for the specified incident.
Expand Down Expand Up @@ -439,10 +439,10 @@ 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.
Expand Down
2 changes: 1 addition & 1 deletion incident_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ func TestIncident_ResponderRequest(t *testing.T) {
From: from,
Message: "help",
RequesterID: "PL1JMK5",
Targets: []ResponderRequestTarget{r},
Targets: []ResponderRequestTargets{{r}},
}

user := User{}
Expand Down
8 changes: 7 additions & 1 deletion webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type IncidentDetails struct {
Urgency string `json:"urgency"`
ResolveReason *string `json:"resolve_reason"`
AlertCounts AlertCounts `json:"alert_counts"`
Alerts []WebhookAlert `json:"alerts"`
Metadata interface{} `json:"metadata"`
Description string `json:"description"`
}
Expand All @@ -40,11 +41,16 @@ type WebhookPayloadMessages struct {
type WebhookPayload struct {
ID string `json:"id"`
Event string `json:"event"`
CreatedOn time.Time `json:"created_on`
CreatedOn time.Time `json:"created_on"`
Incident IncidentDetails `json:"incident"`
LogEntries []LogEntry `json:"log_entries"`
}

// WebhookAlert describes the alert of the incident
type WebhookAlert struct {
AlertKey string `json:"alert_key"`
}

// DecodeWebhook decodes a webhook from a response object.
func DecodeWebhook(r io.Reader) (*WebhookPayloadMessages, error) {
var payload WebhookPayloadMessages
Expand Down

0 comments on commit 4c106de

Please sign in to comment.