-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnotification.go
45 lines (38 loc) · 1.53 KB
/
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
41
42
43
44
45
package clubhouse
import "net/http"
type Notification struct {
Channel *string `json:"channel,omitempty"`
EventID *int `json:"event_id,omitempty"`
IsUnread bool `json:"is_unread"`
Message string `json:"message"`
NotificationID int `json:"notification_id"`
TimeCreated string `json:"time_created"`
Type int `json:"type"`
UserProfile UserProfile `json:"user_profile"`
}
type GetActionableNotificationsResponse struct {
PageResponse
Notifications []Notification `json:"notifications"`
}
func (c *Client) GetActionableNotifications() (*GetNotificationsResponse, *http.Response, error) {
apiRes := new(GetNotificationsResponse)
apiError := new(APIError)
res, err := c.sling.New().Get("get_actionable_notifications").Receive(apiRes, apiError)
return apiRes, res, relevantError(err, *apiError)
}
type GetNotificationsParams struct {
Page *int `json:"-" url:"page,omitempty"`
PageSize *int `json:"-" url:"page_size,omitempty"`
}
type GetNotificationsResponse struct {
Response
Count int `json:"count"`
Disabled bool `json:"disabled"`
Notifications []Notification `json:"notifications"`
}
func (c *Client) GetNotifications(params *GetNotificationsParams) (*GetNotificationsResponse, *http.Response, error) {
apiRes := new(GetNotificationsResponse)
apiError := new(APIError)
res, err := c.sling.New().Get("get_notifications").QueryStruct(params).Receive(apiRes, apiError)
return apiRes, res, relevantError(err, *apiError)
}