diff --git a/TwitchLib.Api.Core/RateLimiter/ComposedAwaitableConstraint.cs b/TwitchLib.Api.Core/RateLimiter/ComposedAwaitableConstraint.cs index 6bbac036..7e375868 100644 --- a/TwitchLib.Api.Core/RateLimiter/ComposedAwaitableConstraint.cs +++ b/TwitchLib.Api.Core/RateLimiter/ComposedAwaitableConstraint.cs @@ -5,11 +5,14 @@ namespace TwitchLib.Api.Core.RateLimiter { + /// + /// Composed Awaitable Constraint + /// public class ComposedAwaitableConstraint : IAwaitableConstraint { private IAwaitableConstraint _ac1; private IAwaitableConstraint _ac2; - private readonly SemaphoreSlim _semafore = new SemaphoreSlim(1, 1); + private readonly SemaphoreSlim _semafore = new(1, 1); internal ComposedAwaitableConstraint(IAwaitableConstraint ac1, IAwaitableConstraint ac2) { diff --git a/TwitchLib.Api.Helix/Analytics.cs b/TwitchLib.Api.Helix/Analytics.cs index f5563edc..4b122e3b 100644 --- a/TwitchLib.Api.Helix/Analytics.cs +++ b/TwitchLib.Api.Helix/Analytics.cs @@ -17,9 +17,6 @@ public class Analytics : ApiBase /// /// Analytics related APIs /// - /// - /// - /// public Analytics(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHandler http) : base(settings, rateLimiter, http) { } @@ -87,7 +84,7 @@ public Task GetGameAnalyticsAsync(string gameId = null { var getParams = new List> { - new KeyValuePair("first", first.ToString()) + new("first", first.ToString()) }; if (!string.IsNullOrWhiteSpace(gameId)) @@ -173,7 +170,7 @@ public Task GetExtensionAnalyticsAsync(string ext { var getParams = new List> { - new KeyValuePair("first", first.ToString()) + new("first", first.ToString()) }; if (!string.IsNullOrWhiteSpace(extensionId)) diff --git a/TwitchLib.Api.Helix/Bits.cs b/TwitchLib.Api.Helix/Bits.cs index a62a8c7b..35d48fc1 100644 --- a/TwitchLib.Api.Helix/Bits.cs +++ b/TwitchLib.Api.Helix/Bits.cs @@ -19,13 +19,14 @@ public Bits(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHandler ht { } + #region GetCheermotes + /// /// Retrieves the list of available Cheermotes, animated emotes to which viewers can assign Bits, to cheer in chat. Cheermotes returned are available throughout Twitch, in all Bits-enabled channels. /// /// D for the broadcaster who might own specialized Cheermotes. /// optional access token to override the use of the stored one in the TwitchAPI instance /// - #region GetCheermotes public Task GetCheermotesAsync(string broadcasterId = null, string accessToken = null) { var getParams = new List>(); @@ -67,7 +68,7 @@ public Task GetBitsLeaderboardAsync(int count = 10, { var getParams = new List> { - new KeyValuePair("count", count.ToString()) + new("count", count.ToString()) }; switch (period) @@ -115,7 +116,7 @@ public Task GetExtensionBitsProductsAsync(bool { var getParams = new List> { - new KeyValuePair("should_include_all", shouldIncludeAll.ToString().ToLower()) + new("should_include_all", shouldIncludeAll.ToString().ToLower()) }; return TwitchGetGenericAsync("/bits/extensions", ApiVersion.Helix, getParams, accessToken); diff --git a/TwitchLib.Api.Helix/ChannelPoints.cs b/TwitchLib.Api.Helix/ChannelPoints.cs index 782e35d0..bf01e10a 100644 --- a/TwitchLib.Api.Helix/ChannelPoints.cs +++ b/TwitchLib.Api.Helix/ChannelPoints.cs @@ -24,6 +24,7 @@ public ChannelPoints(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallH } #region CreateCustomRewards + /// /// Creates a Custom Reward on a channel. /// Required scope: channel:manage:redemptions @@ -40,7 +41,7 @@ public Task CreateCustomRewardsAsync(string broadca { var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId) + new("broadcaster_id", broadcasterId) }; return TwitchPostGenericAsync("/channel_points/custom_rewards", ApiVersion.Helix, JsonConvert.SerializeObject(request), getParams, accessToken); @@ -48,6 +49,7 @@ public Task CreateCustomRewardsAsync(string broadca #endregion #region DeleteCustomReward + /// /// Deletes a Custom Reward on a channel. /// Required scope: channel:manage:redemptions @@ -68,8 +70,8 @@ public Task DeleteCustomRewardAsync(string broadcasterId, string rewardId, strin { var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId), - new KeyValuePair("id", rewardId) + new("broadcaster_id", broadcasterId), + new("id", rewardId) }; return TwitchDeleteAsync("/channel_points/custom_rewards", ApiVersion.Helix, getParams, accessToken); @@ -77,6 +79,7 @@ public Task DeleteCustomRewardAsync(string broadcasterId, string rewardId, strin #endregion #region GetCustomReward + /// /// Returns a list of Custom Reward objects for the Custom Rewards on a channel. /// Required scope: channel:read:redemptions @@ -93,8 +96,8 @@ public Task GetCustomRewardAsync(string broadcasterId, { var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId), - new KeyValuePair("only_manageable_rewards", onlyManageableRewards.ToString().ToLower()) + new("broadcaster_id", broadcasterId), + new("only_manageable_rewards", onlyManageableRewards.ToString().ToLower()) }; if (rewardIds != null && rewardIds.Count > 0) @@ -107,6 +110,7 @@ public Task GetCustomRewardAsync(string broadcasterId, #endregion #region UpdateCustomReward + /// /// Updates a Custom Reward created on a channel. /// The Custom Reward specified by id must have been created by the ClientId attached to the user OAuth token. @@ -124,8 +128,8 @@ public Task UpdateCustomRewardAsync(string broadcast { var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId), - new KeyValuePair("id", rewardId) + new("broadcaster_id", broadcasterId), + new("id", rewardId) }; return TwitchPatchGenericAsync("/channel_points/custom_rewards", ApiVersion.Helix, JsonConvert.SerializeObject(request), getParams, accessToken); @@ -133,6 +137,7 @@ public Task UpdateCustomRewardAsync(string broadcast #endregion #region GetCustomRewardRedemption + /// /// Returns Custom Reward Redemption objects for a Custom Reward on a channel that was created by the same ClientId. /// Developers only have access to get and update redemptions for the rewards created programmatically by the same ClientId. @@ -164,8 +169,8 @@ public Task GetCustomRewardRedemptionAsync(st { var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId), - new KeyValuePair("reward_id", rewardId), + new("broadcaster_id", broadcasterId), + new("reward_id", rewardId), }; if (redemptionIds != null && redemptionIds.Count > 0) @@ -198,6 +203,7 @@ public Task GetCustomRewardRedemptionAsync(st #endregion #region UpdateCustomRewardRedemption + /// /// Updates a Custom Reward created on a channel. /// The Custom Reward specified by id must have been created by the ClientId attached to the user OAuth token. @@ -216,8 +222,8 @@ public Task UpdateRedemptionStatusAsync(string b { var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId), - new KeyValuePair("reward_id", rewardId) + new("broadcaster_id", broadcasterId), + new("reward_id", rewardId) }; getParams.AddRange(redemptionIds.Select(redemptionId => new KeyValuePair("id", redemptionId))); diff --git a/TwitchLib.Api.Helix/Channels.cs b/TwitchLib.Api.Helix/Channels.cs index fac8fe87..44723059 100644 --- a/TwitchLib.Api.Helix/Channels.cs +++ b/TwitchLib.Api.Helix/Channels.cs @@ -28,6 +28,7 @@ public Channels(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHandle } #region GetChannelInformation + /// /// Gets channel information for given user. /// @@ -42,7 +43,7 @@ public Task GetChannelInformationAsync(string bro var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId) + new("broadcaster_id", broadcasterId) }; return TwitchGetGenericAsync("/channels", ApiVersion.Helix, getParams, accessToken); @@ -50,6 +51,7 @@ public Task GetChannelInformationAsync(string bro #endregion #region ModifyChannelInformation + /// /// Modifies channel information for given user. /// Required scope: channel:manage:broadcast @@ -66,7 +68,7 @@ public async Task ModifyChannelInformationAsync(string broadcasterId, Modi var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId) + new("broadcaster_id", broadcasterId) }; var response = await TwitchPatchAsync("/channels", ApiVersion.Helix, JsonConvert.SerializeObject(request), getParams, accessToken); @@ -77,6 +79,7 @@ public async Task ModifyChannelInformationAsync(string broadcasterId, Modi #endregion #region GetChannelEditors + /// /// Gets a list of users who have editor permissions for a specific channel. /// Required scope: channel:read:editors @@ -92,7 +95,7 @@ public Task GetChannelEditorsAsync(string broadcaster var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId) + new("broadcaster_id", broadcasterId) }; return TwitchGetGenericAsync("/channels/editors", ApiVersion.Helix, getParams, accessToken); @@ -121,8 +124,8 @@ public Task GetVIPsAsync(string broadcasterId, List> { - new KeyValuePair("broadcaster_id", broadcasterId), - new KeyValuePair("first", first.ToString()) + new("broadcaster_id", broadcasterId), + new("first", first.ToString()) }; if (userIds != null) @@ -161,8 +164,8 @@ public Task AddChannelVIPAsync(string broadcasterId, string userId, string acces var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId), - new KeyValuePair("user_id", userId), + new("broadcaster_id", broadcasterId), + new("user_id", userId), }; return TwitchPostAsync("/channels/vips", ApiVersion.Helix, null, getParams, accessToken); @@ -170,7 +173,7 @@ public Task AddChannelVIPAsync(string broadcasterId, string userId, string acces #endregion - #region DeleteChannelVIP + #region RemoveChannelVIP /// /// Removes a VIP from the broadcaster’s chat room. @@ -190,8 +193,8 @@ public Task RemoveChannelVIPAsync(string broadcasterId, string userId, string ac var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId), - new KeyValuePair("user_id", userId), + new("broadcaster_id", broadcasterId), + new("user_id", userId), }; return TwitchDeleteAsync("/channels/vips", ApiVersion.Helix, getParams, accessToken); @@ -228,7 +231,7 @@ public Task GetFollowedChannelsAsync(string userId, var getParams = new List> { - new KeyValuePair("user_id", userId) + new("user_id", userId) }; if (!string.IsNullOrWhiteSpace(broadcasterId)) @@ -242,11 +245,11 @@ public Task GetFollowedChannelsAsync(string userId, } #endregion - + #region GetChannelFollowers /// - /// Gets a list of users that follow the specified broadcaster. + /// Gets a list of users that follow the specified broadcaster. Requires moderator:read:followers scope. /// You can also use this endpoint to see whether a specific user follows the broadcaster. /// /// The broadcaster’s ID. Returns the list of users that follow this broadcaster. @@ -269,7 +272,7 @@ public Task GetChannelFollowersAsync(string broadca var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId) + new("broadcaster_id", broadcasterId) }; if (!string.IsNullOrWhiteSpace(userId)) @@ -299,7 +302,7 @@ public Task GetAdScheduleAsync(string broadcasterId, stri var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId) + new("broadcaster_id", broadcasterId) }; return TwitchGetGenericAsync("/channels/ads", ApiVersion.Helix, getParams, accessToken); @@ -315,13 +318,13 @@ public Task GetAdScheduleAsync(string broadcasterId, stri /// 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) + public Task SnoozeNextAdAsync(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) + new("broadcaster_id", broadcasterId) }; return TwitchPostGenericAsync("/channels/ads/schedule/snooze", ApiVersion.Helix, null, getParams, accessToken); diff --git a/TwitchLib.Api.Helix/Charity.cs b/TwitchLib.Api.Helix/Charity.cs index 8f2e821b..9d306336 100644 --- a/TwitchLib.Api.Helix/Charity.cs +++ b/TwitchLib.Api.Helix/Charity.cs @@ -20,6 +20,7 @@ public Charity(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHandler } #region GetCharityCampaign + /// /// Gets information about the charity campaign that a broadcaster is running, such as their fundraising goal and the amount that’s been donated so far. /// Requires an user access token that includes the channel:read:charity scope. @@ -35,7 +36,7 @@ public Task GetCharityCampaignAsync(string broadcast var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId) + new("broadcaster_id", broadcasterId) }; return TwitchGetGenericAsync("/charity/campaigns", ApiVersion.Helix, getParams, accessToken); @@ -43,6 +44,7 @@ public Task GetCharityCampaignAsync(string broadcast #endregion #region GetCharityCampaignDonations + /// /// Gets the list of donations that users have made to the broadcaster’s active charity campaign. /// Requires a user access token that includes the channel:read:charity scope. @@ -63,8 +65,8 @@ public Task GetCharityCampaignDonationsAsyn var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId), - new KeyValuePair("first", first.ToString()) + new("broadcaster_id", broadcasterId), + new("first", first.ToString()) }; if (!string.IsNullOrWhiteSpace(after)) diff --git a/TwitchLib.Api.Helix/Clips.cs b/TwitchLib.Api.Helix/Clips.cs index ed38a881..c8775a99 100644 --- a/TwitchLib.Api.Helix/Clips.cs +++ b/TwitchLib.Api.Helix/Clips.cs @@ -21,6 +21,7 @@ public Clips(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHandler h { } #region GetClips + /// /// Gets clip information by clip ID (one or more), broadcaster ID (one only), or game ID (one only). /// Note: The clips service returns a maximum of 1000 clips. @@ -123,7 +124,7 @@ public Task CreateClipAsync(string broadcasterId, string ac { var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId) + new("broadcaster_id", broadcasterId) }; return TwitchPostGenericAsync("/clips", ApiVersion.Helix, null, getParams, accessToken); diff --git a/TwitchLib.Api.Helix/Entitlements.cs b/TwitchLib.Api.Helix/Entitlements.cs index 577e0b89..01c8d683 100644 --- a/TwitchLib.Api.Helix/Entitlements.cs +++ b/TwitchLib.Api.Helix/Entitlements.cs @@ -19,6 +19,7 @@ public Entitlements(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHa } #region GetDropsEntitlements + /// /// Gets a list of entitlements for a given organization that have been granted to a game, user, or both. /// The client ID associated with the access token must have ownership of the game: @@ -34,7 +35,7 @@ public Task GetDropsEntitlementsAsync(string id = { var getParams = new List> { - new KeyValuePair("first", first.ToString()) + new("first", first.ToString()) }; if(!string.IsNullOrWhiteSpace(id)) @@ -62,6 +63,7 @@ public Task GetDropsEntitlementsAsync(string id = #endregion #region UpdateDropsEntitlements + /// /// Updates the fulfillment status on a set of Drops entitlements, specified by their entitlement IDs. /// The client ID associated with the access token must have ownership of the game diff --git a/TwitchLib.Api.Helix/Extensions.cs b/TwitchLib.Api.Helix/Extensions.cs index 6cc712e3..19b7179c 100644 --- a/TwitchLib.Api.Helix/Extensions.cs +++ b/TwitchLib.Api.Helix/Extensions.cs @@ -42,7 +42,7 @@ public Task GetExtensionTransactionsAsync(stri var getParams = new List> { - new KeyValuePair("extension_id", extensionId) + new("extension_id", extensionId) }; if (ids != null) @@ -81,8 +81,8 @@ public Task GetExtensionLiveChannelsAsync(stri var getParams = new List> { - new KeyValuePair("extension_id", extensionId), - new KeyValuePair("first", first.ToString()) + new("extension_id", extensionId), + new("first", first.ToString()) }; if (!string.IsNullOrWhiteSpace(after)) @@ -109,7 +109,7 @@ public Task GetReleasedExtensionsAsync(string ext var getParams = new List> { - new KeyValuePair("extension_id", extensionId), + new("extension_id", extensionId), }; if (!string.IsNullOrWhiteSpace(extensionVersion)) diff --git a/TwitchLib.Api.Helix/Games.cs b/TwitchLib.Api.Helix/Games.cs index 63767f49..ad85d883 100644 --- a/TwitchLib.Api.Helix/Games.cs +++ b/TwitchLib.Api.Helix/Games.cs @@ -19,6 +19,7 @@ public Games(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHandler h } #region GetGames + /// /// Gets game information by game ID or name. /// For a query to be valid, name and/or id must be specified. @@ -76,6 +77,7 @@ public Task GetGamesAsync(List gameIds = null, List /// Gets games sorted by number of current viewers on Twitch, most popular first. /// @@ -92,7 +94,7 @@ public Task GetTopGamesAsync(string before = null, string a var getParams = new List> { - new KeyValuePair("first", first.ToString()) + new("first", first.ToString()) }; if (!string.IsNullOrWhiteSpace(before)) diff --git a/TwitchLib.Api.Helix/Goals.cs b/TwitchLib.Api.Helix/Goals.cs index 34de5076..fd127199 100644 --- a/TwitchLib.Api.Helix/Goals.cs +++ b/TwitchLib.Api.Helix/Goals.cs @@ -18,6 +18,7 @@ public Goals(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHandler h } #region GetCreatorGoals + /// /// Gets the broadcaster’s list of active goals. Use this to get the current progress of each goal. /// Requires a user OAuth access token with scope set to channel:read:goals. @@ -34,7 +35,7 @@ public Task GetCreatorGoalsAsync(string broadcasterId, var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId) + new("broadcaster_id", broadcasterId) }; return TwitchGetGenericAsync("/goals", ApiVersion.Helix, getParams, accessToken); diff --git a/TwitchLib.Api.Helix/GuestStar.cs b/TwitchLib.Api.Helix/GuestStar.cs index 3bb6b087..8d0070b0 100644 --- a/TwitchLib.Api.Helix/GuestStar.cs +++ b/TwitchLib.Api.Helix/GuestStar.cs @@ -13,6 +13,9 @@ namespace TwitchLib.Api.Helix; +/// +/// Gueststar related APIs +/// public class GuestStar : ApiBase { public GuestStar(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHandler http) : base(settings, @@ -413,8 +416,8 @@ public Task DeleteGuestStarSlotAsync(string broadcasterId, string moderatorId, s } #endregion - - #region DeleteGuestStarSlot + + #region UpdateGuestStarSlotSettings /// /// diff --git a/TwitchLib.Api.Helix/HypeTrain.cs b/TwitchLib.Api.Helix/HypeTrain.cs index cd044aad..ca88751b 100644 --- a/TwitchLib.Api.Helix/HypeTrain.cs +++ b/TwitchLib.Api.Helix/HypeTrain.cs @@ -17,6 +17,8 @@ public HypeTrain(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHandl { } + #region GetHypeTrainEvents + /// /// Gets the information of the most recent Hype Train of the given channel ID. /// When there is currently an active Hype Train, it returns information about that Hype Train. @@ -39,8 +41,8 @@ public Task GetHypeTrainEventsAsync(string broadcasterId, var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId), - new KeyValuePair("first", first.ToString()) + new("broadcaster_id", broadcasterId), + new("first", first.ToString()) }; if (!string.IsNullOrWhiteSpace(cursor)) @@ -48,5 +50,6 @@ public Task GetHypeTrainEventsAsync(string broadcasterId, return TwitchGetGenericAsync("/hypetrain/events", ApiVersion.Helix, getParams, accessToken); } + #endregion } } diff --git a/TwitchLib.Api.Helix/Polls.cs b/TwitchLib.Api.Helix/Polls.cs index 8bf73d77..c146c1b8 100644 --- a/TwitchLib.Api.Helix/Polls.cs +++ b/TwitchLib.Api.Helix/Polls.cs @@ -12,12 +12,17 @@ namespace TwitchLib.Api.Helix { + /// + /// Polls related APIs + /// public class Polls : ApiBase { public Polls(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHandler http) : base(settings, rateLimiter, http) { } + #region GetPolls + /// /// Get information about all polls or specific polls for a Twitch channel. Poll information is available for 90 days. /// Required scope: channel:read:polls @@ -36,8 +41,8 @@ public Task GetPollsAsync(string broadcasterId, List i { var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId), - new KeyValuePair("first", first.ToString()) + new("broadcaster_id", broadcasterId), + new("first", first.ToString()) }; if (ids != null && ids.Count > 0) @@ -50,6 +55,9 @@ public Task GetPollsAsync(string broadcasterId, List i return TwitchGetGenericAsync("/polls", ApiVersion.Helix, getParams, accessToken); } + #endregion + + #region CreatePollAsync /// /// Create a poll for a specific Twitch channel. @@ -62,6 +70,9 @@ public Task CreatePollAsync(CreatePollRequest request, strin { return TwitchPostGenericAsync("/polls", ApiVersion.Helix, JsonConvert.SerializeObject(request), accessToken: accessToken); } + #endregion + + #region EndPoll /// /// End a poll that is currently active. @@ -87,5 +98,6 @@ public Task EndPollAsync(string broadcasterId, string id, PollS return TwitchPatchGenericAsync("/polls", ApiVersion.Helix, json.ToString(), accessToken: accessToken); } + #endregion } } diff --git a/TwitchLib.Api.Helix/Predictions.cs b/TwitchLib.Api.Helix/Predictions.cs index 61ef1eca..66400882 100644 --- a/TwitchLib.Api.Helix/Predictions.cs +++ b/TwitchLib.Api.Helix/Predictions.cs @@ -21,6 +21,8 @@ public Predictions(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHan { } + #region GetPredictions + /// /// Get information about all Channel Points Predictions or specific Channel Points Predictions for a Twitch channel. /// Results are ordered by most recent, so it can be assumed that the currently active or locked Prediction will be the first item. @@ -41,8 +43,8 @@ public Task GetPredictionsAsync(string broadcasterId, Li { var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId), - new KeyValuePair("first", first.ToString()) + new("broadcaster_id", broadcasterId), + new("first", first.ToString()) }; if (ids != null && ids.Count > 0) @@ -53,6 +55,9 @@ public Task GetPredictionsAsync(string broadcasterId, Li return TwitchGetGenericAsync("/predictions", ApiVersion.Helix, getParams, accessToken); } + #endregion + + #region CreatePrediction /// /// Create a Channel Points Prediction for a specific Twitch channel. @@ -65,6 +70,9 @@ public Task CreatePredictionAsync(CreatePredictionRequ { return TwitchPostGenericAsync("/predictions", ApiVersion.Helix, JsonConvert.SerializeObject(request), accessToken: accessToken); } + #endregion + + #region EndPredictionAsync /// /// Lock, resolve, or cancel a Channel Points Prediction. @@ -100,5 +108,6 @@ public Task EndPredictionAsync(string broadcasterId, stri return TwitchPatchGenericAsync("/predictions", ApiVersion.Helix, json.ToString(), accessToken: accessToken); } + #endregion } } diff --git a/TwitchLib.Api.Helix/Raids.cs b/TwitchLib.Api.Helix/Raids.cs index 2a833193..b1ce4500 100644 --- a/TwitchLib.Api.Helix/Raids.cs +++ b/TwitchLib.Api.Helix/Raids.cs @@ -16,6 +16,8 @@ public Raids(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHandler h { } + #region StartRaid + /// /// Raid another channel by sending the broadcaster’s viewers to the targeted channel. /// Rate Limit: The limit is 10 requests within a 10-minute window. @@ -30,12 +32,15 @@ public Task StartRaidAsync(string fromBroadcasterId, string t { var getParams = new List> { - new KeyValuePair("from_broadcaster_id", fromBroadcasterId), - new KeyValuePair("to_broadcaster_id", toBroadcasterId) + new("from_broadcaster_id", fromBroadcasterId), + new("to_broadcaster_id", toBroadcasterId) }; return TwitchPostGenericAsync("/raids", ApiVersion.Helix, string.Empty, getParams: getParams, accessToken: accessToken); } + #endregion + + #region CancelRaid /// /// Cancel a pending raid. @@ -50,10 +55,11 @@ public Task CancelRaidAsync(string broadcasterId, string accessToken = null) { var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId), + new("broadcaster_id", broadcasterId), }; return TwitchDeleteAsync("/raids", ApiVersion.Helix, getParams: getParams, accessToken: accessToken); } + #endregion } } diff --git a/TwitchLib.Api.Helix/Schedule.cs b/TwitchLib.Api.Helix/Schedule.cs index a978d9c5..10903073 100644 --- a/TwitchLib.Api.Helix/Schedule.cs +++ b/TwitchLib.Api.Helix/Schedule.cs @@ -21,6 +21,8 @@ public class Schedule : ApiBase public Schedule(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHandler http) : base(settings, rateLimiter, http) { } + #region GetChannelStreamSchedule + /// /// Gets all scheduled broadcasts or specific scheduled broadcasts from a channel’s stream schedule. /// Scheduled broadcasts are defined as “stream segments” in the API. @@ -52,8 +54,8 @@ public Task GetChannelStreamScheduleAsync(stri { var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId), - new KeyValuePair("first", first.ToString()) + new("broadcaster_id", broadcasterId), + new("first", first.ToString()) }; if (segmentIds != null && segmentIds.Count > 0) @@ -72,6 +74,9 @@ public Task GetChannelStreamScheduleAsync(stri return TwitchGetGenericAsync("/schedule", ApiVersion.Helix, getParams, accessToken); } + #endregion + + #region UpdateChannelStreamScheduleAsync /// /// Update the settings for a channel’s stream schedule. @@ -103,7 +108,7 @@ public Task UpdateChannelStreamScheduleAsync(string broadcasterId, bool? isVacat { var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId) + new("broadcaster_id", broadcasterId) }; if (isVacationEnabled.HasValue) @@ -120,6 +125,9 @@ public Task UpdateChannelStreamScheduleAsync(string broadcasterId, bool? isVacat return TwitchPatchAsync("/schedule/settings", ApiVersion.Helix, null, getParams, accessToken); } + #endregion + + #region CreateChannelStreamScheduleSegment /// /// Create a single scheduled broadcast or a recurring scheduled broadcast for a channel’s stream schedule. @@ -134,11 +142,14 @@ public Task CreateChannelStreamScheduleSegme { var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId) + new("broadcaster_id", broadcasterId) }; return TwitchPostGenericAsync("/schedule/segment", ApiVersion.Helix, JsonConvert.SerializeObject(payload), getParams, accessToken); } + #endregion + + #region UpdateChannelStreamScheduleSegment /// /// Update a single scheduled broadcast or a recurring scheduled broadcast for a channel’s stream schedule. @@ -155,12 +166,15 @@ public Task UpdateChannelStreamScheduleSegme { var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId), - new KeyValuePair("id", segmentId) + new("broadcaster_id", broadcasterId), + new("id", segmentId) }; return TwitchPatchGenericAsync("/schedule/segment", ApiVersion.Helix, JsonConvert.SerializeObject(payload), getParams, accessToken); } + #endregion + + #region DeleteChannelStreamScheduleSegment /// /// Delete a single scheduled broadcast or a recurring scheduled broadcast for a channel’s stream schedule. @@ -175,12 +189,15 @@ public Task DeleteChannelStreamScheduleSegmentAsync(string broadcasterId, string { var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId), - new KeyValuePair("id", segmentId) + new("broadcaster_id", broadcasterId), + new("id", segmentId) }; return TwitchDeleteAsync("/schedule/segment", ApiVersion.Helix, getParams, accessToken); } + #endregion + + #region GetChanneliCalendar /// /// Gets all scheduled broadcasts from a channel’s stream schedule as an iCalendar. @@ -191,10 +208,11 @@ public Task GetChanneliCalendarAsync(string broadcasterId) { var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId) + new("broadcaster_id", broadcasterId) }; return TwitchGetAsync("/schedule/icalendar", ApiVersion.Helix, getParams); } + #endregion } } diff --git a/TwitchLib.Api.Helix/Search.cs b/TwitchLib.Api.Helix/Search.cs index f8c37a23..6d88c868 100644 --- a/TwitchLib.Api.Helix/Search.cs +++ b/TwitchLib.Api.Helix/Search.cs @@ -38,7 +38,7 @@ public Task SearchCategoriesAsync(string encodedSearch var getParams = new List> { - new KeyValuePair("query", encodedSearchQuery) + new("query", encodedSearchQuery) }; if (!string.IsNullOrWhiteSpace(after)) @@ -75,8 +75,8 @@ public Task SearchChannelsAsync(string encodedSearchQuer var getParams = new List> { - new KeyValuePair("query", encodedSearchQuery), - new KeyValuePair("live_only", liveOnly.ToString()) + new("query", encodedSearchQuery), + new("live_only", liveOnly.ToString()) }; if (!string.IsNullOrWhiteSpace(after)) diff --git a/TwitchLib.Api.Helix/Subscriptions.cs b/TwitchLib.Api.Helix/Subscriptions.cs index aaac69b6..6d0dc877 100644 --- a/TwitchLib.Api.Helix/Subscriptions.cs +++ b/TwitchLib.Api.Helix/Subscriptions.cs @@ -18,6 +18,8 @@ public Subscriptions(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallH { } + #region CheckUserSubscription + /// /// Checks if a specific user (userId) is subscribed to a specific channel (broadcasterId). /// Requires User access token with scope user:read:subscriptions @@ -39,12 +41,15 @@ public Task CheckUserSubscriptionAsync(string bro var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId), - new KeyValuePair("user_id", userId) + new("broadcaster_id", broadcasterId), + new("user_id", userId) }; return TwitchGetGenericAsync("/subscriptions/user", ApiVersion.Helix, getParams, accessToken); } + #endregion + + #region GetUserSubscriptions /// /// Gets a list of users that subscribe to the specified broadcaster filtered by a list of UserIds. @@ -65,13 +70,16 @@ public Task GetUserSubscriptionsAsync(string broad var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId) + new("broadcaster_id", broadcasterId) }; getParams.AddRange(userIds.Select(userId => new KeyValuePair("user_id", userId))); return TwitchGetGenericAsync("/subscriptions", ApiVersion.Helix, getParams, accessToken); } + #endregion + + #region GetBroadcasterSubscriptions /// /// Gets a list of users that subscribe to the specified broadcaster. @@ -93,8 +101,8 @@ public Task GetBroadcasterSubscriptionsAsyn var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId), - new KeyValuePair("first", first.ToString()) + new("broadcaster_id", broadcasterId), + new("first", first.ToString()) }; if (!string.IsNullOrWhiteSpace(after)) @@ -102,5 +110,6 @@ public Task GetBroadcasterSubscriptionsAsyn return TwitchGetGenericAsync("/subscriptions", ApiVersion.Helix, getParams, accessToken); } + #endregion } } diff --git a/TwitchLib.Api.Helix/Teams.cs b/TwitchLib.Api.Helix/Teams.cs index b1461e67..4f79905c 100644 --- a/TwitchLib.Api.Helix/Teams.cs +++ b/TwitchLib.Api.Helix/Teams.cs @@ -16,6 +16,8 @@ public Teams(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHandler h { } + #region GetChannelTeams + /// /// Retrieves a list of Twitch Teams of which the specified channel/broadcaster is a member. /// @@ -26,11 +28,14 @@ public Task GetChannelTeamsAsync(string broadcasterId, { var getParams = new List> { - new KeyValuePair("broadcaster_id", broadcasterId) + new("broadcaster_id", broadcasterId) }; return TwitchGetGenericAsync("/teams/channel", ApiVersion.Helix, getParams, accessToken); } + #endregion + + #region GetTeams /// /// Gets information for a specific Twitch Team. @@ -51,5 +56,6 @@ public Task GetTeamsAsync(string teamId = null, string teamNam return TwitchGetGenericAsync("/teams", ApiVersion.Helix, getParams, accessToken); } + #endregion } } \ No newline at end of file diff --git a/TwitchLib.Api.Helix/Videos.cs b/TwitchLib.Api.Helix/Videos.cs index bdb1bb61..f7d944b2 100644 --- a/TwitchLib.Api.Helix/Videos.cs +++ b/TwitchLib.Api.Helix/Videos.cs @@ -20,6 +20,8 @@ public Videos(IApiSettings settings, IRateLimiter rateLimiter, IHttpCallHandler { } + #region DeleteVideos + /// /// Deletes one or more videos. Videos are past broadcasts, Highlights, or uploads. /// Invalid Video IDs will be ignored (i.e. IDs provided that do not have a video associated with it). @@ -39,6 +41,9 @@ public Task DeleteVideosAsync(List videoIds, strin return TwitchDeleteGenericAsync("/videos", ApiVersion.Helix, getParams, accessToken); } + #endregion + + #region GetVideos /// /// Gets video information by one or more video IDs, user ID, or game ID. @@ -56,7 +61,6 @@ public Task DeleteVideosAsync(List videoIds, strin /// Sort order of the videos. /// Type of video. /// optional access token to override the use of the stored one in the TwitchAPI instance - /// /// /// public Task GetVideosAsync(List videoIds = null, string userId = null, string gameId = null, string after = null, string before = null, int first = 20, string language = null, Period period = Period.All, VideoSort sort = VideoSort.Time, VideoType type = VideoType.All, string accessToken = null) @@ -147,5 +151,6 @@ public Task GetVideosAsync(List videoIds = null, stri return TwitchGetGenericAsync("/videos", ApiVersion.Helix, getParams, accessToken); } + #endregion } } \ No newline at end of file diff --git a/TwitchLib.Api.Helix/Whispers.cs b/TwitchLib.Api.Helix/Whispers.cs index 314c4923..3955e7d4 100644 --- a/TwitchLib.Api.Helix/Whispers.cs +++ b/TwitchLib.Api.Helix/Whispers.cs @@ -46,8 +46,8 @@ public Task SendWhisperAsync(string fromUserId, string toUserId, string message, var getParams = new List> { - new KeyValuePair("from_user_id", fromUserId), - new KeyValuePair("to_user_id", toUserId), + new("from_user_id", fromUserId), + new("to_user_id", toUserId), }; // This should be updated to have a Request Class in the future. diff --git a/TwitchLib.Api/Auth/Auth.cs b/TwitchLib.Api/Auth/Auth.cs index 801352ab..e96efbe4 100644 --- a/TwitchLib.Api/Auth/Auth.cs +++ b/TwitchLib.Api/Auth/Auth.cs @@ -36,10 +36,10 @@ public Task RefreshAuthTokenAsync(string refreshToken, string c var getParams = new List> { - new KeyValuePair("grant_type", "refresh_token"), - new KeyValuePair("refresh_token", refreshToken), - new KeyValuePair("client_id", internalClientId), - new KeyValuePair("client_secret", clientSecret) + new("grant_type", "refresh_token"), + new("refresh_token", refreshToken), + new("client_id", internalClientId), + new("client_secret", clientSecret) }; return TwitchPostGenericAsync("/token", ApiVersion.Auth, null, getParams, null, internalClientId); @@ -106,11 +106,11 @@ public Task GetAccessTokenFromCodeAsync(string code, string cl var getParams = new List> { - new KeyValuePair("grant_type", "authorization_code"), - new KeyValuePair("code", code), - new KeyValuePair("client_id", internalClientId), - new KeyValuePair("client_secret", clientSecret), - new KeyValuePair("redirect_uri", redirectUri) + new("grant_type", "authorization_code"), + new("code", code), + new("client_id", internalClientId), + new("client_secret", clientSecret), + new("redirect_uri", redirectUri) }; return TwitchPostGenericAsync("/token", ApiVersion.Auth, null, getParams, null, internalClientId);