Skip to content

Commit

Permalink
Add GuestStar APIs (#377)
Browse files Browse the repository at this point in the history
* Add GuestStar Models

* Add GuestStar Api Section to Helix

* implement Get/Update Channel Guest Star Settings

* Implement GuestStar Session APIs

* Implement GuestStar Invite APIs

* implement Guest Star Slot APIs

* fix typo
  • Loading branch information
Syzuna authored Nov 6, 2023
1 parent 3b6bfd3 commit 1b109f5
Show file tree
Hide file tree
Showing 14 changed files with 745 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Newtonsoft.Json;

namespace TwitchLib.Api.Helix.Models.GuestStar.CreateGuestStarSession;

public class CreateGuestStarSessionResponse
{
/// <summary>
/// <para>Summary of the session details.</para>
/// </summary>
[JsonProperty(PropertyName = "data")]
public GuestStarSession[] Data { get; protected set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Newtonsoft.Json;

namespace TwitchLib.Api.Helix.Models.GuestStar.CreateGuestStarSession;

public class EndGuestStarSessionResponse
{
/// <summary>
/// <para>Summary of the session details when the session was ended.</para>
/// </summary>
[JsonProperty(PropertyName = "data")]
public GuestStarSession[] Data { get; protected set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Newtonsoft.Json;

namespace TwitchLib.Api.Helix.Models.GuestStar.GetChannelGuestStarSettings;

public class GetChannelGuestStarSettingsResponse
{
/// <summary>
/// <para>A list that contains the channels guest star settings</para>
/// </summary>
[JsonProperty(PropertyName = "data")]
public GuestStarSettings[] Data { get; protected set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Newtonsoft.Json;

namespace TwitchLib.Api.Helix.Models.GuestStar.GetChannelGuestStarSettings;

public class GuestStarSettings : GuestStarSettingsBase
{
/// <summary>
/// View only token to generate browser source URLs
/// </summary>
[JsonProperty(PropertyName = "browser_source_token")]
public string BrowserSourceToken { get; protected set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Newtonsoft.Json;

namespace TwitchLib.Api.Helix.Models.GuestStar.GetGuestStarInvites;

public class GetGuestStarInvitesResponse
{
/// <summary>
/// <para>A list of invite objects describing the invited user as well as their ready status.</para>
/// </summary>
[JsonProperty(PropertyName = "data")]
public GuestStarInvite[] Data { get; protected set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using Newtonsoft.Json;

namespace TwitchLib.Api.Helix.Models.GuestStar.GetGuestStarInvites;

public class GuestStarInvite
{
/// <summary>
/// Twitch User ID corresponding to the invited guest
/// </summary>
[JsonProperty(PropertyName = "user_id")]
public string UserId { get; protected set; }

/// <summary>
/// Timestamp when this user was invited to the session.
/// </summary>
[JsonProperty(PropertyName = "invited_at")]
public string InvitedAt { get; protected set; }

/// <summary>
/// Status representing the invited user’s join state. Can be one of the following:
/// <para>INVITED: The user has been invited to the session but has not acknowledged it.</para>
/// <para>ACCEPTED: The invited user has acknowledged the invite and joined the waiting room, but may still be setting up their media devices or otherwise preparing to join the call.</para>
/// <para>READY: The invited user has signaled they are ready to join the call from the waiting room.</para>
/// </summary>
[JsonProperty(PropertyName = "status")]
public string Status { get; protected set; }

/// <summary>
/// Flag signaling that the invited user has chosen to disable their local video device. The user has hidden themselves, but they may choose to reveal their video feed upon joining the session.
/// </summary>
[JsonProperty(PropertyName = "is_video_enabled")]
public bool IsVideoEnabled { get; protected set; }

/// <summary>
/// Flag signaling that the invited user has chosen to disable their local audio device. The user has muted themselves, but they may choose to unmute their audio feed upon joining the session.
/// </summary>
[JsonProperty(PropertyName = "is_audio_enabled")]
public bool IsAudioEnabled { get; protected set; }

/// <summary>
/// Flag signaling that the invited user has chosen to disable their local video device. The user has hidden themselves, but they may choose to reveal their video feed upon joining the session.
/// </summary>
[JsonProperty(PropertyName = "is_video_available")]
public bool IsVideoAvailable { get; protected set; }

/// <summary>
/// Flag signaling that the invited user has chosen to disable their local audio device. The user has muted themselves, but they may choose to unmute their audio feed upon joining the session.
/// </summary>
[JsonProperty(PropertyName = "is_audio_available")]
public bool IsAudioAvailable { get; protected set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Newtonsoft.Json;

namespace TwitchLib.Api.Helix.Models.GuestStar.GetGuestStarSession;

public class GetGuestStarSessionResponse
{
/// <summary>
/// <para>A list that contains the channels guest star sessions</para>
/// </summary>
[JsonProperty(PropertyName = "data")]
public GuestStarSession[] Data { get; protected set; }
}
65 changes: 65 additions & 0 deletions TwitchLib.Api.Helix.Models/GuestStar/GuestStarGuest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using System;
using Newtonsoft.Json;

namespace TwitchLib.Api.Helix.Models.GuestStar;

public class GuestStarGuest
{
/// <summary>
/// ID representing this guest’s slot assignment.
/// <para>Host is always in slot "0"</para>
/// <para>Guests are assigned the following consecutive IDs (e.g, "1", "2", "3", etc)</para>
/// <para>Screen Share is represented as a special guest with the ID "SCREENSHARE"</para>
/// <para>The identifier here matches the ID referenced in browser source links used in broadcasting software.</para>
/// </summary>
[JsonProperty(PropertyName = "slot_id")]
public string SlotId { get; protected set; }

/// <summary>
/// Flag determining whether or not the guest is visible in the browser source in the host’s streaming software.
/// </summary>
[JsonProperty(PropertyName = "is_live")]
public bool IsLive { get; protected set; }

/// <summary>
/// User ID of the guest assigned to this slot.
/// </summary>
[JsonProperty(PropertyName = "user_id")]
public string UserId { get; protected set; }

/// <summary>
/// Display name of the guest assigned to this slot.
/// </summary>
[JsonProperty(PropertyName = "user_display_name")]
public string UserDisplayName { get; protected set; }

/// <summary>
/// Login of the guest assigned to this slot.
/// </summary>
[JsonProperty(PropertyName = "user_login")]
public string UserLogin { get; protected set; }

/// <summary>
/// Value from 0 to 100 representing the host’s volume setting for this guest.
/// </summary>
[JsonProperty(PropertyName = "volume")]
public int Volume { get; protected set; }

/// <summary>
/// Timestamp when this guest was assigned a slot in the session.
/// </summary>
[JsonProperty(PropertyName = "assigned_at")]
public string AssignedAt { get; protected set; }

/// <summary>
/// Information about the guest’s audio settings
/// </summary>
[JsonProperty(PropertyName = "audio_settings")]
public GuestStarMediaSettings AudioSettings { get; protected set; }

/// <summary>
/// Information about the guest’s video settings
/// </summary>
[JsonProperty(PropertyName = "video_settings")]
public GuestStarMediaSettings VideoSettings { get; protected set; }
}
22 changes: 22 additions & 0 deletions TwitchLib.Api.Helix.Models/GuestStar/GuestStarMediaSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Newtonsoft.Json;

namespace TwitchLib.Api.Helix.Models.GuestStar;

public class GuestStarMediaSettings
{
/// <summary>
/// Flag determining whether the guest has an appropriate audio/video device available to be transmitted to the session.
/// </summary>
[JsonProperty(PropertyName = "is_available")]
public bool IsAvailable { get; protected set; }
/// <summary>
/// Flag determining whether the host is allowing the guest’s audio/video to be seen or heard within the session.
/// </summary>
[JsonProperty(PropertyName = "is_host_enabled")]
public bool IsHostEnabled { get; protected set; }
/// <summary>
/// Flag determining whether the guest is allowing their audio/video to be transmitted to the session.
/// </summary>
[JsonProperty(PropertyName = "is_guest_enabled")]
public bool IsGuestEnabled { get; protected set; }
}
18 changes: 18 additions & 0 deletions TwitchLib.Api.Helix.Models/GuestStar/GuestStarSession.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Newtonsoft.Json;

namespace TwitchLib.Api.Helix.Models.GuestStar;

public class GuestStarSession
{
/// <summary>
/// ID uniquely representing the Guest Star session.
/// </summary>
[JsonProperty(PropertyName = "id")]
public string Id { get; protected set; }

/// <summary>
/// List of guests currently interacting with the Guest Star session.
/// </summary>
[JsonProperty(PropertyName = "guests")]
public GuestStarGuest[] Guests { get; protected set; }
}
29 changes: 29 additions & 0 deletions TwitchLib.Api.Helix.Models/GuestStar/GuestStarSettingsBase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Newtonsoft.Json;

namespace TwitchLib.Api.Helix.Models.GuestStar;

public abstract class GuestStarSettingsBase
{
/// <summary>
/// Flag determining if Guest Star moderators have access to control whether a guest is live once assigned to a slot.
/// </summary>
[JsonProperty(PropertyName = "is_moderator_send_live_enabled")]
public bool IsModeratorSendLiveEnabled { get; protected set; }
/// <summary>
/// Number of slots the Guest Star call interface will allow the host to add to a call. Required to be between 1 and 6.
/// </summary>
[JsonProperty(PropertyName = "slot_count")]
public int SlotCount { get; protected set; }
/// <summary>
/// Flag determining if Browser Sources subscribed to sessions on this channel should output audio
/// </summary>
[JsonProperty(PropertyName = "is_browser_source_audio_enabled")]
public bool IsBrowserSourceAudioEnabled { get; protected set; }
/// <summary>
/// This setting determines how the guests within a session should be laid out within the browser source. Can be one of the following values:
/// <para>TILED_LAYOUT: All live guests are tiled within the browser source with the same size.</para>
/// <para>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.</para>
/// </summary>
[JsonProperty(PropertyName = "group_layout")]
public string GroupLayout { get; protected set; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Newtonsoft.Json;

namespace TwitchLib.Api.Helix.Models.GuestStar.UpdateChannelGuestStarSettings;

/// <summary>
/// <para>Request to update guest star settings</para>
/// </summary>
public class UpdateChannelGuestStarSettingsRequest : GuestStarSettingsBase
{
/// <summary>
/// Flag determining if Guest Star should regenerate the auth token associated with the channel’s browser sources.
/// <para>Providing a true value for this will immediately invalidate all browser sources previously configured in your streaming software.</para>
/// </summary>
[JsonProperty(PropertyName = "regenerate_browser_sources")]
public bool RegenerateBrowserSources { get; protected set; }
}
Loading

0 comments on commit 1b109f5

Please sign in to comment.