diff --git a/TwitchLib.Api.Core.Enums/AuthScopesEnum.cs b/TwitchLib.Api.Core.Enums/AuthScopesEnum.cs
index 6b9bebd8..6929b140 100644
--- a/TwitchLib.Api.Core.Enums/AuthScopesEnum.cs
+++ b/TwitchLib.Api.Core.Enums/AuthScopesEnum.cs
@@ -48,12 +48,22 @@ public enum AuthScopes
/// View Bits information for a channel.
///
Bits_Read,
+
+ ///
+ /// Allows the client’s bot users access to a channel.
+ ///
+ Channel_Bot,
///
/// Run commercials on a channel.
///
Channel_Edit_Commercial,
-
+
+ ///
+ /// Manage ads schedule on a channel.
+ ///
+ Channel_Manage_Ads,
+
///
/// Manage a channel’s broadcast configuration, including updating channel configuration and managing stream markers and stream tags.
///
@@ -108,7 +118,12 @@ public enum AuthScopes
/// Add or remove the VIP role from users in your channel.
///
Channel_Manage_VIPs,
-
+
+ ///
+ /// Read the ads schedule and details on your channel.
+ ///
+ Channel_Read_Ads,
+
///
/// Read charity campaign details and user donations on your channel.
///
@@ -263,7 +278,13 @@ public enum AuthScopes
/// View a broadcaster’s shoutouts.
///
Moderator_Read_Shoutouts,
-
+
+
+ ///
+ /// Allows client’s bot to act as this user.
+ ///
+ User_Bot,
+
///
/// Manage a user object.
///
@@ -299,6 +320,11 @@ public enum AuthScopes
/// View a user’s broadcasting configuration, including Extension configurations.
///
User_Read_Broadcast,
+
+ ///
+ /// View live stream chat and room messages.
+ ///
+ User_Read_Chat,
///
/// View a user’s email address.
diff --git a/TwitchLib.Api.Core/Common/Helpers.cs b/TwitchLib.Api.Core/Common/Helpers.cs
index 7d6f62fc..37fc827c 100644
--- a/TwitchLib.Api.Core/Common/Helpers.cs
+++ b/TwitchLib.Api.Core/Common/Helpers.cs
@@ -34,6 +34,8 @@ public static string AuthScopesToString(AuthScopes scope)
AuthScopes.Analytics_Read_Extensions => "analytics:read:extensions",
AuthScopes.Analytics_Read_Games => "analytics:read:games",
AuthScopes.Bits_Read => "bits:read",
+ AuthScopes.Channel_Bot => "channel:bot",
+ AuthScopes.Channel_Manage_Ads => "channel:manage:ads",
AuthScopes.Channel_Edit_Commercial => "channel:edit:commercial",
AuthScopes.Channel_Manage_Broadcast => "channel:manage:broadcast",
AuthScopes.Channel_Manage_Extensions => "channel:manage:extensions",
@@ -46,6 +48,7 @@ public static string AuthScopesToString(AuthScopes scope)
AuthScopes.Channel_Manage_VIPs => "channel:manage:vips",
AuthScopes.Channel_Manage_Guest_Star => "channel:manage:guest_star",
AuthScopes.Channel_Manage_Raids => "channel:manage:raids",
+ AuthScopes.Channel_Read_Ads => "channel:read:ads",
AuthScopes.Channel_Read_Charity => "channel:read:charity",
AuthScopes.Channel_Read_Editors => "channel:read:editors",
AuthScopes.Channel_Read_Goals => "channel:read:goals",
@@ -59,10 +62,12 @@ public static string AuthScopesToString(AuthScopes scope)
AuthScopes.Channel_Read_Guest_Star => "channel:read:guest_star",
AuthScopes.Clips_Edit => "clips:edit",
AuthScopes.Moderation_Read => "moderation:read",
+ AuthScopes.User_Bot => "user:bot",
AuthScopes.User_Edit => "user:edit",
AuthScopes.User_Edit_Follows => "user:edit:follows",
AuthScopes.User_Read_BlockedUsers => "user:read:blocked_users",
AuthScopes.User_Read_Broadcast => "user:read:broadcast",
+ AuthScopes.User_Read_Chat => "user:read:chat",
AuthScopes.User_Read_Email => "user:read:email",
AuthScopes.User_Read_Follows => "user:read:follows",
AuthScopes.User_Read_Subscriptions => "user:read:subscriptions",
@@ -110,7 +115,9 @@ public static AuthScopes StringToScope(string scope)
"analytics:read:extensions" => AuthScopes.Analytics_Read_Extensions,
"analytics:read:games" => AuthScopes.Analytics_Read_Games,
"bits:read" => AuthScopes.Bits_Read,
+ "channel:bot" => AuthScopes.Channel_Bot,
"channel:edit:commercial" => AuthScopes.Channel_Edit_Commercial,
+ "channel:manage:ads" => AuthScopes.Channel_Manage_Ads,
"channel:manage:broadcast" => AuthScopes.Channel_Manage_Broadcast,
"channel:manage:extensions" => AuthScopes.Channel_Manage_Extensions,
"channel:manage:moderators" => AuthScopes.Channel_Manage_Moderators,
@@ -122,6 +129,7 @@ public static AuthScopes StringToScope(string scope)
"channel:manage:vips" => AuthScopes.Channel_Manage_VIPs,
"channel:manage:guest_star" => AuthScopes.Channel_Manage_Guest_Star,
"channel:manage:raids" => AuthScopes.Channel_Manage_Raids,
+ "channel:read:ads" => AuthScopes.Channel_Read_Ads,
"channel:read:charity" => AuthScopes.Channel_Read_Charity,
"channel:read:editors" => AuthScopes.Channel_Read_Editors,
"channel:read:goals" => AuthScopes.Channel_Read_Goals,
@@ -135,10 +143,12 @@ public static AuthScopes StringToScope(string scope)
"channel:read:guest_star" => AuthScopes.Channel_Read_Guest_Star,
"clips:edit" => AuthScopes.Clips_Edit,
"moderation:read" => AuthScopes.Moderation_Read,
+ "user:bot" => AuthScopes.User_Bot,
"user:edit" => AuthScopes.User_Edit,
"user:edit:follows" => AuthScopes.User_Edit_Follows,
"user:read:blocked_users" => AuthScopes.User_Read_BlockedUsers,
"user:read:broadcast" => AuthScopes.User_Read_Broadcast,
+ "user:read:chat" => AuthScopes.User_Read_Chat,
"user:read:email" => AuthScopes.User_Read_Email,
"user:read:follows" => AuthScopes.User_Read_Follows,
"user:read:subscriptions" => AuthScopes.User_Read_Subscriptions,
diff --git a/TwitchLib.Api.Helix.Models/Channels/GetAdSchedule/AdSchedule.cs b/TwitchLib.Api.Helix.Models/Channels/GetAdSchedule/AdSchedule.cs
new file mode 100644
index 00000000..2808f19a
--- /dev/null
+++ b/TwitchLib.Api.Helix.Models/Channels/GetAdSchedule/AdSchedule.cs
@@ -0,0 +1,44 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TwitchLib.Api.Helix.Models.Channels.GetAdSchedule
+{
+ ///
+ /// Contains information related to the channel’s ad schedule.
+ ///
+ public class AdSchedule
+ {
+ ///
+ /// The number of snoozes available for the broadcaster.
+ ///
+ [JsonProperty(PropertyName = "snooze_count")]
+ public int SnoozeCount { get; protected set; }
+ ///
+ /// The UTC timestamp when the broadcaster will gain an additional snooze, in RFC3339 format.
+ ///
+ [JsonProperty(PropertyName = "snooze_refresh_at")]
+ public string SnoozeRefreshAt { get; protected set; }
+ ///
+ /// The UTC timestamp of the broadcaster’s next scheduled ad, in RFC3339 format. Empty if the channel has no ad scheduled or is not live.
+ ///
+ [JsonProperty(PropertyName = "next_ad_at")]
+ public string NextAdAt { get; protected set; }
+ ///
+ /// The length in seconds of the scheduled upcoming ad break.
+ ///
+ [JsonProperty(PropertyName = "lengths_seconds")]
+ public int LengthsSeconds { get;protected set; }
+ ///
+ /// The UTC timestamp of the broadcaster’s last ad-break, in RFC3339 format. Empty if the channel has not run an ad or is not live.
+ ///
+ [JsonProperty(PropertyName = "last_ad_at")]
+ public string LastAdAt { get; protected set; }
+ ///
+ /// The amount of pre-roll free time remaining for the channel in seconds. Returns 0 if they are currently not pre-roll free.
+ ///
+ [JsonProperty(PropertyName = "preroll_free_time_seconds")]
+ public int PrerollFreeTimeSeconds { get; protected set; }
+ }
+}
diff --git a/TwitchLib.Api.Helix.Models/Channels/GetAdSchedule/GetAdScheduleResponse.cs b/TwitchLib.Api.Helix.Models/Channels/GetAdSchedule/GetAdScheduleResponse.cs
new file mode 100644
index 00000000..37f13e75
--- /dev/null
+++ b/TwitchLib.Api.Helix.Models/Channels/GetAdSchedule/GetAdScheduleResponse.cs
@@ -0,0 +1,19 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TwitchLib.Api.Helix.Models.Channels.GetAdSchedule
+{
+ ///
+ /// Response to getting ad schedule
+ ///
+ public class GetAdScheduleResponse
+ {
+ ///
+ /// A list that contains information related to the channel’s ad schedule.
+ ///
+ [JsonProperty(PropertyName = "data")]
+ public AdSchedule[] Data { get; protected set; }
+ }
+}
diff --git a/TwitchLib.Api.Helix.Models/Channels/SnoozeNextAd/SnoozeNextAd.cs b/TwitchLib.Api.Helix.Models/Channels/SnoozeNextAd/SnoozeNextAd.cs
new file mode 100644
index 00000000..071c7592
--- /dev/null
+++ b/TwitchLib.Api.Helix.Models/Channels/SnoozeNextAd/SnoozeNextAd.cs
@@ -0,0 +1,29 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TwitchLib.Api.Helix.Models.Channels.SnoozeNextAd
+{
+ ///
+ /// Contains information about the channel’s snoozes and next upcoming ad after successfully snoozing.
+ ///
+ public class SnoozeNextAd
+ {
+ ///
+ /// The number of snoozes available for the broadcaster.
+ ///
+ [JsonProperty(PropertyName = "snooze_count")]
+ public int SnoozeCount { get; protected set; }
+ ///
+ /// The UTC timestamp when the broadcaster will gain an additional snooze, in RFC3339 format.
+ ///
+ [JsonProperty(PropertyName = "snooze_refresh_at")]
+ public string SnoozeRefreshAt { get; protected set; }
+ ///
+ /// The UTC timestamp of the broadcaster’s next scheduled ad, in RFC3339 format.
+ ///
+ [JsonProperty(PropertyName = "next_ad_at")]
+ public string NextAdAt { get; protected set; }
+ }
+}
diff --git a/TwitchLib.Api.Helix.Models/Channels/SnoozeNextAd/SnoozeNextAdResponse.cs b/TwitchLib.Api.Helix.Models/Channels/SnoozeNextAd/SnoozeNextAdResponse.cs
new file mode 100644
index 00000000..401f673e
--- /dev/null
+++ b/TwitchLib.Api.Helix.Models/Channels/SnoozeNextAd/SnoozeNextAdResponse.cs
@@ -0,0 +1,19 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace TwitchLib.Api.Helix.Models.Channels.SnoozeNextAd
+{
+ ///
+ /// Response to attempting to snooze an ad.
+ ///
+ public class SnoozeNextAdResponse
+ {
+ ///
+ /// A list that contains information about the channel’s snoozes and next upcoming ad after successfully snoozing.
+ ///
+ [JsonProperty(PropertyName = "data")]
+ public SnoozeNextAd[] Data { get; protected set; }
+ }
+}
diff --git a/TwitchLib.Api.Helix/Channels.cs b/TwitchLib.Api.Helix/Channels.cs
index 926b4818..971b5fd8 100644
--- a/TwitchLib.Api.Helix/Channels.cs
+++ b/TwitchLib.Api.Helix/Channels.cs
@@ -6,12 +6,14 @@
using TwitchLib.Api.Core.Enums;
using TwitchLib.Api.Core.Exceptions;
using TwitchLib.Api.Core.Interfaces;
+using TwitchLib.Api.Helix.Models.Channels.GetAdSchedule;
using TwitchLib.Api.Helix.Models.Channels.GetChannelEditors;
using TwitchLib.Api.Helix.Models.Channels.GetChannelFollowers;
using TwitchLib.Api.Helix.Models.Channels.GetChannelInformation;
using TwitchLib.Api.Helix.Models.Channels.GetChannelVIPs;
using TwitchLib.Api.Helix.Models.Channels.GetFollowedChannels;
using TwitchLib.Api.Helix.Models.Channels.ModifyChannelInformation;
+using TwitchLib.Api.Helix.Models.Channels.SnoozeNextAd;
namespace TwitchLib.Api.Helix
{
@@ -280,5 +282,50 @@ public Task GetChannelFollowersAsync(string broadca
}
#endregion
+
+ #region GetAdSchedule
+
+ ///
+ /// Returns ad schedule related information, including snooze, when the last ad was run, when the next ad is scheduled, and if the channel is currently in pre-roll free time.
+ ///
+ /// The broadcaster's ID. Ad schedule is relevant to this broadcaster, and so should the auth.
+ /// Optional access token to override the use of the stored one in the TwitchAPI instance
+ ///
+ public Task GetAdScheduleAsync(string broadcasterId, string accessToken = null)
+ {
+ if (string.IsNullOrWhiteSpace(broadcasterId))
+ throw new BadParameterException("broadcasterId must be set");
+ var getParams = new List>
+ {
+
+ new KeyValuePair("broadcaster_id", broadcasterId)
+ };
+
+ return TwitchGetGenericAsync("/channels/ads", ApiVersion.Helix, getParams, accessToken);
+ }
+
+ #endregion
+
+ #region SnoozeNextAd
+
+ ///
+ /// If available, pushes back the timestamp of the upcoming automatic mid-roll ad by 5 minutes. This endpoint duplicates the snooze functionality in the creator dashboard’s Ads Manager.
+ ///
+ /// The broadcaster's ID. Ad snoozing is relevant to this broadcaster, and so should the auth.
+ /// Optional access token to override the use of the stored one in the TwitchAPI instance
+ ///
+ public Task SnoozeNextAd(string broadcasterId, string accessToken = null)
+ {
+ if (string.IsNullOrWhiteSpace(broadcasterId))
+ throw new BadParameterException("broadcasterId must be set");
+ var getParams = new List>
+ {
+ new KeyValuePair("broadcaster_id", broadcasterId)
+ };
+
+ return TwitchPostGenericAsync("/channels/ads/schedule/snooze", ApiVersion.Helix, null, getParams, accessToken);
+ }
+
+ #endregion
}
}