package moderation import ( "context" "net/http" "net/url" "github.com/google/go-querystring/query" ) type AddChannelModeratorParams struct { // The ID of the broadcaster that owns the chat room. This ID must match the user ID in the access token. BroadcasterID string `url:"broadcaster_id"` // The ID of the user to add as a moderator in the broadcaster’s chat room. UserID string `url:"user_id"` } // Adds a moderator to the broadcaster’s chat room. // // Rate Limits: The broadcaster may add a maximum of 10 moderators within a 10-second window. // // Requires a user access token that includes the channel:manage:moderators scope. func (m *Moderation) AddChannelModerator(ctx context.Context, params *AddChannelModeratorParams) error { v, _ := query.Values(params) endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "moderation/moderators", RawQuery: v.Encode()}) req, err := http.NewRequestWithContext(ctx, http.MethodPost, endpoint.String(), nil) if err != nil { return err } res, err := m.client.Do(req) if err != nil { return err } defer res.Body.Close() return nil }