-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsubscriptions.go
35 lines (30 loc) · 1011 Bytes
/
subscriptions.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
package rc
// Generated by https://quicktype.io
type Subscriptions struct {
Update []Subscription `json:"update"`
Remove []Subscription `json:"remove"`
Success bool `json:"success"`
}
type Subscription struct {
Type string `json:"t"`
Timestamp string `json:"ts"`
Name string `json:"name"`
Fname interface{} `json:"fname"`
RoomID string `json:"rid"`
User User `json:"u"`
Open bool `json:"open"`
Alert bool `json:"alert"`
Unread int64 `json:"unread"`
UserMentions int64 `json:"userMentions"`
GroupMentions int64 `json:"groupMentions"`
UpdatedAt string `json:"_updatedAt"`
ID string `json:"_id"`
}
func (c *Client) GetSubscriptions() ([]Subscription, error) {
subs := &Subscriptions{}
if err := c.c.get("/subscriptions.get", nil).JSON(&subs); err != nil {
return nil, err
}
updates := subs.Update
return updates, nil
}