forked from nicklaw5/helix
-
Notifications
You must be signed in to change notification settings - Fork 1
/
channels_editors.go
36 lines (29 loc) · 957 Bytes
/
channels_editors.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
package helix
type ChannelEditorsParams struct {
BroadcasterID string `query:"broadcaster_id"`
}
type ManyChannelEditors struct {
ChannelEditors []ChannelEditor `json:"data"`
}
// ChannelEditor
type ChannelEditor struct {
UserID string `json:"user_id"`
UserName string `json:"user_name"`
CreatedAt Time `json:"created_at"`
}
type ChannelEditorsResponse struct {
ResponseCommon
Data ManyChannelEditors
}
// GetChannelEditors Get a list of users who have editor permissions for a specific channel
// Required scope: channel:read:editors
func (c *Client) GetChannelEditors(params *ChannelEditorsParams) (*ChannelEditorsResponse, error) {
resp, err := c.get("/channels/editors", &ManyChannelEditors{}, params)
if err != nil {
return nil, err
}
editors := &ChannelEditorsResponse{}
resp.HydrateResponseCommon(&editors.ResponseCommon)
editors.Data.ChannelEditors = resp.Data.(*ManyChannelEditors).ChannelEditors
return editors, nil
}