2024-03-03 14:09:31 -05:00
|
|
|
|
package gueststar
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
2024-03-07 19:41:05 -05:00
|
|
|
|
"fmt"
|
2024-03-03 14:09:31 -05:00
|
|
|
|
"net/http"
|
|
|
|
|
"net/url"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type UpdateChannelGuestStarSettingsRequest struct {
|
|
|
|
|
// Flag determining if Guest Star moderators have access to control whether a guest is live once assigned to a slot.
|
|
|
|
|
IsModeratorSendLiveEnabled *bool `json:"is_moderator_send_live_enabled,omitempty"`
|
|
|
|
|
|
|
|
|
|
// Number of slots the Guest Star call interface will allow the host to add to a call. Required to be between 1 and 6.
|
|
|
|
|
SlotCount *int `json:"slot_count,omitempty"`
|
|
|
|
|
|
|
|
|
|
// Flag determining if Browser Sources subscribed to sessions on this channel should output audio
|
|
|
|
|
IsBrowserSourceAudioEnabled *bool `json:"is_browser_source_audio_enabled,omitempty"`
|
|
|
|
|
|
|
|
|
|
// This setting determines how the guests within a session should be laid out within the browser source. Can be one of the following values:
|
|
|
|
|
//
|
|
|
|
|
// TILED_LAYOUT: All live guests are tiled within the browser source with the same size.
|
|
|
|
|
//
|
|
|
|
|
// SCREENSHARE_LAYOUT: All live guests are tiled within the browser source with the same size.
|
|
|
|
|
// If there is an active screen share, it is sized larger than the other guests.
|
|
|
|
|
//
|
|
|
|
|
// HORIZONTAL_LAYOUT: All live guests are arranged in a horizontal bar within the browser source
|
|
|
|
|
//
|
|
|
|
|
// VERTICAL_LAYOUT: All live guests are arranged in a vertical bar within the browser source
|
|
|
|
|
GroupLayout *string `json:"group_layout,omitempty"`
|
|
|
|
|
|
|
|
|
|
// Flag determining if Guest Star should regenerate the auth token associated with the channel’s browser sources.
|
|
|
|
|
// Providing a true value for this will immediately invalidate all browser sources previously configured in your streaming software.
|
|
|
|
|
RegenerateBrowserSources *bool `json:"regenerate_browser_sources,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Mutates the channel settings for configuration of the Guest Star feature for a particular host.
|
|
|
|
|
//
|
|
|
|
|
// Query parameter broadcaster_id must match the user_id in the User-Access token
|
|
|
|
|
// Requires OAuth Scope: channel:manage:guest_star
|
|
|
|
|
func (g *GuestStar) UpdateChannelGuestStarSettings(ctx context.Context, BroadcasterID string, body *UpdateChannelGuestStarSettingsRequest) error {
|
|
|
|
|
endpoint := g.baseUrl.ResolveReference(&url.URL{Path: "guest_star/channel_settings", RawQuery: url.Values{"broadcaster_id": {BroadcasterID}}.Encode()})
|
|
|
|
|
|
|
|
|
|
req, err := http.NewRequestWithContext(ctx, http.MethodPut, endpoint.String(), nil)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
res, err := g.client.Do(req)
|
|
|
|
|
if err != nil {
|
|
|
|
|
return err
|
|
|
|
|
}
|
|
|
|
|
defer res.Body.Close()
|
|
|
|
|
|
2024-03-07 19:41:05 -05:00
|
|
|
|
statusOK := res.StatusCode >= 200 && res.StatusCode < 300
|
|
|
|
|
if !statusOK {
|
|
|
|
|
return fmt.Errorf("failed to update channel guest star settings (%d)", res.StatusCode)
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-03 14:09:31 -05:00
|
|
|
|
return nil
|
|
|
|
|
}
|