go-twitch/api/moderation/remove_channel_vip.go

44 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package moderation
import (
"context"
"net/http"
"net/url"
"github.com/google/go-querystring/query"
)
type RemoveChannelVIPParams struct {
// The ID of the user to remove VIP status from.
UserID string `url:"user_id"`
// The ID of the broadcaster who owns the channel where the user has VIP status.
BroadcasterID string `url:"broadcaster_id"`
}
// Removes the specified user as a VIP in the broadcasters channel.
//
// If the broadcaster is removing the users VIP status, the ID in the broadcaster_id query parameter must match the user ID in the access token;
// otherwise, if the user is removing their VIP status themselves, the ID in the user_id query parameter must match the user ID in the access token.
//
// Rate Limits: The broadcaster may remove a maximum of 10 VIPs within a 10-second window.
//
// Requires a user access token that includes the channel:manage:vips scope.
func (m *Moderation) RemoveChannelVIP(ctx context.Context, params *RemoveChannelVIPParams) error {
v, _ := query.Values(params)
endpoint := m.baseUrl.ResolveReference(&url.URL{Path: "channels/vips", RawQuery: v.Encode()})
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, 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
}