go-twitch/api/gueststar/delete_gueststar_invite.go

47 lines
1.4 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 gueststar
import (
"context"
"net/http"
"net/url"
"github.com/google/go-querystring/query"
)
type DeleteGuestStarInviteParams struct {
// The ID of the broadcaster you want to end a Guest Star session for. Provided broadcaster_id must match the user_id in the auth token.
BroadcasterID string `url:"broadcaster_id"`
// The ID of the broadcaster or a user that has permission to moderate the broadcasters chat room.
// This ID must match the user ID in the user access token.
ModeratorID string `url:"moderator_id"`
// The session ID for the invite to be revoked on behalf of the broadcaster.
SessionID string `url:"session_id"`
// Twitch User ID for the guest to revoke the Guest Star session invite from.
GuestID string `url:"guest_id"`
}
// Revokes a previously sent invite for a Guest Star session.
//
// Query parameter moderator_id must match the user_id in the User-Access token
// Requires OAuth Scope: channel:manage:guest_star or moderator:manage:guest_star
func (g *GuestStar) DeleteGuestStarInvite(ctx context.Context, params *DeleteGuestStarInviteParams) error {
v, _ := query.Values(params)
endpoint := g.baseUrl.ResolveReference(&url.URL{Path: "guest_star/invite", RawQuery: v.Encode()})
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, endpoint.String(), nil)
if err != nil {
return err
}
res, err := g.client.Do(req)
if err != nil {
return err
}
defer res.Body.Close()
return nil
}