package gueststar import ( "context" "fmt" "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() statusOK := res.StatusCode >= 200 && res.StatusCode < 300 if !statusOK { return fmt.Errorf("failed to update channel guest star settings (%d)", res.StatusCode) } return nil }