-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing GetSharedChatSession endpoint & ContentClassificationLabe…
…lEnum (#412) * Add politics or sensitive social issues ContentClassificationLabelEnum * Add GetSharedChatSession endpoint
- Loading branch information
Showing
5 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
TwitchLib.Api.Helix.Models/SharedChat/GetSharedChatSession/GetSharedChatSessionResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Newtonsoft.Json; | ||
using TwitchLib.Api.Helix.Models.GuestStar; | ||
|
||
namespace TwitchLib.Api.Helix.Models.SharedChat.GetSharedChatSession; | ||
|
||
/// <summary> | ||
/// Get shared chat session response object. | ||
/// </summary> | ||
public class GetSharedChatSessionResponse | ||
{ | ||
/// <summary> | ||
/// <para>A list that contains the channels shared chat sessions</para> | ||
/// </summary> | ||
[JsonProperty(PropertyName = "data")] | ||
public SharedChatSession[] Data { get; protected set; } | ||
} |
15 changes: 15 additions & 0 deletions
15
TwitchLib.Api.Helix.Models/SharedChat/SharedChatParticipant.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace TwitchLib.Api.Helix.Models.SharedChat; | ||
|
||
/// <summary> | ||
/// A participant in the shared chat session. | ||
/// </summary> | ||
public class SharedChatParticipant | ||
{ | ||
/// <summary> | ||
/// The User ID of the participant's channel. | ||
/// </summary> | ||
[JsonProperty(PropertyName = "broadcaster_id")] | ||
public string BroadcasterId { get; protected set; } | ||
} |
39 changes: 39 additions & 0 deletions
39
TwitchLib.Api.Helix.Models/SharedChat/SharedChatSession.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace TwitchLib.Api.Helix.Models.SharedChat; | ||
|
||
/// <summary> | ||
/// The shared chat session details | ||
/// </summary> | ||
public class SharedChatSession | ||
{ | ||
/// <summary> | ||
/// The unique identifier for the shared chat session. | ||
/// </summary> | ||
[JsonProperty(PropertyName = "session_id")] | ||
public string SessionId { get; protected set; } | ||
|
||
/// <summary> | ||
/// The User ID of the host channel. | ||
/// </summary> | ||
[JsonProperty(PropertyName = "host_broadcaster_id")] | ||
public string HostBroadcasterId { get; protected set; } | ||
|
||
/// <summary> | ||
/// The list of participants in the session. | ||
/// </summary> | ||
[JsonProperty(PropertyName = "participants")] | ||
public SharedChatParticipant[] Participants { get; protected set; } | ||
|
||
/// <summary> | ||
/// The UTC date and time (in RFC3339 format) for when the session was created. | ||
/// </summary> | ||
[JsonProperty(PropertyName = "created_at")] | ||
public string CreatedAt { get; protected set; } | ||
|
||
/// <summary> | ||
/// The UTC date and time (in RFC3339 format) for when the session was last updated. | ||
/// </summary> | ||
[JsonProperty(PropertyName = "updated_at")] | ||
public string UpdatedAt { get; protected set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System.Collections.Generic; | ||
using System.Threading.Tasks; | ||
using Newtonsoft.Json; | ||
using TwitchLib.Api.Core; | ||
using TwitchLib.Api.Core.Enums; | ||
using TwitchLib.Api.Core.Exceptions; | ||
using TwitchLib.Api.Core.Interfaces; | ||
using TwitchLib.Api.Helix.Models.GuestStar.CreateGuestStarSession; | ||
using TwitchLib.Api.Helix.Models.GuestStar.GetChannelGuestStarSettings; | ||
using TwitchLib.Api.Helix.Models.GuestStar.GetGuestStarInvites; | ||
using TwitchLib.Api.Helix.Models.GuestStar.GetGuestStarSession; | ||
using TwitchLib.Api.Helix.Models.GuestStar.UpdateChannelGuestStarSettings; | ||
using TwitchLib.Api.Helix.Models.SharedChat.GetSharedChatSession; | ||
|
||
namespace TwitchLib.Api.Helix; | ||
|
||
/// <summary> | ||
/// Shared Chat related APIs | ||
/// </summary> | ||
public class SharedChat : ApiBase | ||
{ | ||
public SharedChat(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHandler http) : base(settings, | ||
rateLimiter, http) | ||
{} | ||
|
||
#region GetSharedChatSession | ||
|
||
/// <summary> | ||
/// <para><see href="https://dev.twitch.tv/docs/api/reference/#get-shared-chat-session"> | ||
/// Twitch Docs: Get Shared Chat Session</see></para> | ||
/// <para>Retrieves the active shared chat session for a channel.</para> | ||
/// </summary> | ||
/// <param name="broadcasterId">The User ID of the channel broadcaster.</param> | ||
/// <param name="accessToken">Optional access token to override the use of the stored one in the TwitchAPI instance</param> | ||
/// <returns cref="GetChannelGuestStarSettingsResponse"></returns> | ||
/// <exception cref="BadParameterException"></exception> | ||
public Task<GetSharedChatSessionResponse> GetSharedChatSessionAsync(string broadcasterId, string accessToken = null) | ||
{ | ||
if (string.IsNullOrWhiteSpace(broadcasterId)) | ||
throw new BadParameterException("broadcasterId must be set"); | ||
|
||
var getParams = new List<KeyValuePair<string, string>> | ||
{ | ||
new("broadcaster_id", broadcasterId) | ||
}; | ||
|
||
return TwitchGetGenericAsync<GetSharedChatSessionResponse>("/shared_chat/session", ApiVersion.Helix, getParams, accessToken); | ||
} | ||
|
||
#endregion | ||
} |