go-twitch/api/gueststar/update_gueststar_slot_setti...

62 lines
2.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 UpdateGuestStarSlotSettingsParams struct {
// The ID of the broadcaster running the Guest Star session.
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 ID of the Guest Star session in which to update a slots settings.
SessionID string `url:"session_id"`
// The slot assignment that has previously been assigned to a user.
SlotID int `url:"slot_id"`
// Flag indicating whether the slot is allowed to share their audio with the rest of the session.
// If false, the slot will be muted in any views containing the slot.
IsAudioEnabled *bool `url:"is_audio_enabled"`
// Flag indicating whether the slot is allowed to share their video with the rest of the session.
// If false, the slot will have no video shared in any views containing the slot.
IsVideoEnabled *bool `url:"is_video_enabled"`
// Flag indicating whether the user assigned to this slot is visible/can be heard from any public subscriptions.
// Generally, this determines whether or not the slot is enabled in any broadcasting software integrations.
IsLive *bool `url:"is_live"`
// Value from 0-100 that controls the audio volume for shared views containing the slot.
Volume *int `url:"volume"`
}
// Allows a user to update slot settings for a particular guest within a Guest Star session, such as allowing the user to share audio or video within the call as a host. These settings will be broadcasted to all subscribers which control their view of the guest in that slot. One or more of the optional parameters to this API can be specified at any time.
//
// 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) UpdateGuestStarSlotSettings(ctx context.Context, params *UpdateGuestStarSlotSettingsParams) error {
v, _ := query.Values(params)
endpoint := g.baseUrl.ResolveReference(&url.URL{Path: "guest_star/slot_settings", RawQuery: v.Encode()})
req, err := http.NewRequestWithContext(ctx, http.MethodPost, 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
}