Skip to content

Commit

Permalink
move StartCommercialAsync to Channels class; remove Ads class (#392)
Browse files Browse the repository at this point in the history
* move StartCommercialAsync to Channels class; remove Ads classs
  • Loading branch information
swiftyspiffy authored May 27, 2024
1 parent d794ad5 commit 1ac5740
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Newtonsoft.Json;

namespace TwitchLib.Api.Helix.Models.Ads
namespace TwitchLib.Api.Helix.Models.Channels.StartCommercial
{
/// <summary>
/// <para>Request Body for StartCommercial</para>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Newtonsoft.Json;

namespace TwitchLib.Api.Helix.Models.Ads
namespace TwitchLib.Api.Helix.Models.Channels.StartCommercial
{
/// <summary>
/// The response for starting a commercial on a specified channel.
Expand Down
39 changes: 0 additions & 39 deletions TwitchLib.Api.Helix/Ads.cs

This file was deleted.

21 changes: 21 additions & 0 deletions TwitchLib.Api.Helix/Channels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using TwitchLib.Api.Helix.Models.Channels.GetFollowedChannels;
using TwitchLib.Api.Helix.Models.Channels.ModifyChannelInformation;
using TwitchLib.Api.Helix.Models.Channels.SnoozeNextAd;
using TwitchLib.Api.Helix.Models.Channels.StartCommercial;

namespace TwitchLib.Api.Helix
{
Expand Down Expand Up @@ -327,5 +328,25 @@ public Task<SnoozeNextAdResponse> SnoozeNextAd(string broadcasterId, string acce
}

#endregion

#region StartCommercial

/// <summary>
/// <para><see href="https://dev.twitch.tv/docs/api/reference/#start-commercial">
/// Twitch Docs: Start Commercial</see></para>
/// <para>Starts a commercial on the specified channel.</para>
/// <para>Only partners and affiliates may run commercials and they must be streaming live at the time.
/// Only the broadcaster may start a commercial - the broadcaster’s editors and moderators may not start commercials on behalf of the broadcaster.</para>
/// <para><b>Requires a user access token that includes the channel:edit:commercial scope.</b></para>
/// </summary>
/// <param name="request" cref="StartCommercialRequest"></param>
/// <param name="accessToken">Optional access token to override the use of the stored one in the TwitchAPI instance.</param>
/// <returns cref="StartCommercialResponse"></returns>
public Task<StartCommercialResponse> StartCommercialAsync(StartCommercialRequest request, string accessToken = null)
{
return TwitchPostGenericAsync<StartCommercialResponse>("/channels/commercial", ApiVersion.Helix, JsonConvert.SerializeObject(request), null, accessToken);
}

#endregion
}
}
5 changes: 0 additions & 5 deletions TwitchLib.Api.Helix/Helix.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ public class Helix
/// </summary>
public Analytics Analytics { get; }
/// <summary>
/// Ads related Helix APIs
/// </summary>
public Ads Ads { get; }
/// <summary>
/// Bits related Helix APIs
/// </summary>
public Bits Bits { get; }
Expand Down Expand Up @@ -148,7 +144,6 @@ public Helix(ILoggerFactory loggerFactory = null, IRateLimiter rateLimiter = nul
Settings = settings ?? new ApiSettings();

Analytics = new Analytics(Settings, rateLimiter, http);
Ads = new Ads(Settings, rateLimiter, http);
Bits = new Bits(Settings, rateLimiter, http);
Chat = new Chat(Settings, rateLimiter, http);
Channels = new Channels(Settings, rateLimiter, http);
Expand Down

0 comments on commit 1ac5740

Please sign in to comment.