forked from PagerDuty/go-pagerduty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotification.go
40 lines (35 loc) · 934 Bytes
/
notification.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package pagerduty
import (
"github.com/google/go-querystring/query"
)
type Notification struct {
ID string `json:"id"`
Type string
StartedAt string `json:"started_at"`
Address string
User APIObject
}
type ListNotificationOptions struct {
APIListObject
TimeZone string `url:"time_zone,omitempty"`
Since string `url:"since,omitempty"`
Until string `url:"until,omitempty"`
Filter string `url:"filter,omitempty"`
Includes []string `url:"include,omitempty"`
}
type ListNotificationsResponse struct {
APIListObject
Notifications []Notification
}
func (c *Client) ListNotifications(o ListNotificationOptions) (*ListNotificationsResponse, error) {
v, err := query.Values(o)
if err != nil {
return nil, err
}
resp, err := c.Get("/notifications?" + v.Encode())
if err != nil {
return nil, err
}
var result ListNotificationsResponse
return &result, c.decodeJson(resp, &result)
}