├── .gitattributes ├── .gitignore ├── .travis.yml ├── LICENSE.txt ├── README.md ├── StreamingClient.Base ├── Model │ └── OAuth │ │ ├── OAuthShortCodeModel.cs │ │ └── OAuthTokenModel.cs ├── Services │ └── OAuthRestServiceBase.cs ├── StreamingClient.Base.csproj ├── StreamingClient.Base.xml ├── Util │ ├── DateTimeOffsetExtensions.cs │ ├── DictionaryExtensions.cs │ ├── EnumHelper.cs │ ├── HttpRateLimitedRestRequestException.cs │ ├── HttpResponseMessageExtensions.cs │ ├── HttpRestRequestException.cs │ ├── JArrayExtensions.cs │ ├── JSONSerializerHelper.cs │ ├── Logger.cs │ ├── NameAttribute.cs │ ├── StringEnumNameConverter.cs │ ├── StringExtensions.cs │ └── Validator.cs └── Web │ ├── AdvancedHttpClient.cs │ ├── ClientWebSocketBase.cs │ ├── LocalHttpListenerServer.cs │ ├── LocalOAuthHttpListenerServer.cs │ └── WebSocketBase.cs ├── Trovo ├── Samples │ └── Trovo.ChatSample.Console │ │ ├── Program.cs │ │ └── Trovo.ChatSample.Console.csproj ├── Trovo.Base.UnitTests │ ├── ChannelsServiceUnitTests.cs │ ├── Trovo.Base.UnitTests.csproj │ ├── UnitTestBase.cs │ └── UsersServiceUnitTests.cs └── Trovo.Base │ ├── Clients │ └── ChatClient.cs │ ├── Models │ ├── Category │ │ └── CategoryModel.cs │ ├── Channels │ │ ├── ChannelFollowerModel.cs │ │ ├── ChannelModel.cs │ │ ├── ChannelSocialLinkModel.cs │ │ ├── ChannelSubscriberModel.cs │ │ ├── PrivateChannelModel.cs │ │ └── TopChannelModel.cs │ ├── Chat │ │ ├── ChatEmoteModel.cs │ │ ├── ChatMessageModel.cs │ │ ├── ChatPacketModel.cs │ │ └── ChatViewersModel.cs │ ├── PageDataResponseModel.cs │ └── Users │ │ ├── PrivateUserModel.cs │ │ └── UserModel.cs │ ├── Services │ ├── CategoryService.cs │ ├── ChannelsService.cs │ ├── ChatService.cs │ ├── OAuthService.cs │ ├── TrovoServiceBase.cs │ └── UsersService.cs │ ├── Trovo.Base.csproj │ └── TrovoConnection.cs ├── Twitch ├── Samples │ ├── Twitch.ChatSample.Console │ │ ├── App.config │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Twitch.ChatSample.Console.csproj │ │ └── packages.config │ ├── Twitch.ExtensionSample.API │ │ ├── Controllers │ │ │ └── SampleController.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── Startup.cs │ │ ├── Twitch.ExtensionSample.API.csproj │ │ ├── appsettings.Development.json │ │ └── appsettings.json │ ├── Twitch.PubSubSample.Console │ │ ├── App.config │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── Twitch.PubSubSample.Console.csproj │ │ └── packages.config │ ├── Twitch.WebhooksSample.API │ │ ├── Controllers │ │ │ └── SampleController.cs │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── Startup.cs │ │ ├── Twitch.WebhooksSample.API.csproj │ │ ├── appsettings.Development.json │ │ └── appsettings.json │ └── packages │ │ ├── Google.Apis.1.48.0 │ │ ├── .signature.p7s │ │ ├── LICENSE │ │ ├── NuGetIcon.png │ │ └── lib │ │ │ ├── net45 │ │ │ ├── Google.Apis.PlatformServices.dll │ │ │ ├── Google.Apis.dll │ │ │ └── Google.Apis.xml │ │ │ ├── netstandard1.3 │ │ │ ├── Google.Apis.dll │ │ │ └── Google.Apis.xml │ │ │ └── netstandard2.0 │ │ │ ├── Google.Apis.dll │ │ │ └── Google.Apis.xml │ │ ├── Google.Apis.Auth.1.48.0 │ │ ├── .signature.p7s │ │ ├── LICENSE │ │ ├── NuGetIcon.png │ │ └── lib │ │ │ ├── net45 │ │ │ ├── Google.Apis.Auth.PlatformServices.dll │ │ │ ├── Google.Apis.Auth.dll │ │ │ └── Google.Apis.Auth.xml │ │ │ ├── netstandard1.3 │ │ │ ├── Google.Apis.Auth.PlatformServices.dll │ │ │ ├── Google.Apis.Auth.dll │ │ │ └── Google.Apis.Auth.xml │ │ │ └── netstandard2.0 │ │ │ ├── Google.Apis.Auth.PlatformServices.dll │ │ │ ├── Google.Apis.Auth.dll │ │ │ └── Google.Apis.Auth.xml │ │ ├── Google.Apis.Core.1.48.0 │ │ ├── .signature.p7s │ │ ├── LICENSE │ │ ├── NuGetIcon.png │ │ └── lib │ │ │ ├── net45 │ │ │ ├── Google.Apis.Core.dll │ │ │ └── Google.Apis.Core.xml │ │ │ ├── netstandard1.3 │ │ │ ├── Google.Apis.Core.dll │ │ │ └── Google.Apis.Core.xml │ │ │ └── netstandard2.0 │ │ │ ├── Google.Apis.Core.dll │ │ │ └── Google.Apis.Core.xml │ │ ├── Google.Apis.YouTube.v3.1.47.0.2008 │ │ ├── .signature.p7s │ │ ├── LICENSE │ │ └── lib │ │ │ ├── net40 │ │ │ ├── Google.Apis.YouTube.v3.dll │ │ │ └── Google.Apis.YouTube.v3.xml │ │ │ ├── net45 │ │ │ ├── Google.Apis.YouTube.v3.dll │ │ │ └── Google.Apis.YouTube.v3.xml │ │ │ ├── netstandard1.0 │ │ │ ├── Google.Apis.YouTube.v3.dll │ │ │ └── Google.Apis.YouTube.v3.xml │ │ │ ├── netstandard1.3 │ │ │ ├── Google.Apis.YouTube.v3.dll │ │ │ └── Google.Apis.YouTube.v3.xml │ │ │ └── netstandard2.0 │ │ │ ├── Google.Apis.YouTube.v3.dll │ │ │ └── Google.Apis.YouTube.v3.xml │ │ ├── Google.Apis.YouTubePartner.v1.1.35.1.1334 │ │ ├── .signature.p7s │ │ └── lib │ │ │ ├── net40 │ │ │ ├── Google.Apis.YouTubePartner.v1.dll │ │ │ └── Google.Apis.YouTubePartner.v1.xml │ │ │ ├── net45 │ │ │ ├── Google.Apis.YouTubePartner.v1.dll │ │ │ └── Google.Apis.YouTubePartner.v1.xml │ │ │ ├── netstandard1.0 │ │ │ ├── Google.Apis.YouTubePartner.v1.dll │ │ │ └── Google.Apis.YouTubePartner.v1.xml │ │ │ ├── netstandard1.3 │ │ │ ├── Google.Apis.YouTubePartner.v1.dll │ │ │ └── Google.Apis.YouTubePartner.v1.xml │ │ │ └── netstandard2.0 │ │ │ ├── Google.Apis.YouTubePartner.v1.dll │ │ │ └── Google.Apis.YouTubePartner.v1.xml │ │ └── Newtonsoft.Json.12.0.3 │ │ ├── .signature.p7s │ │ ├── LICENSE.md │ │ ├── lib │ │ ├── net20 │ │ │ ├── Newtonsoft.Json.dll │ │ │ └── Newtonsoft.Json.xml │ │ ├── net35 │ │ │ ├── Newtonsoft.Json.dll │ │ │ └── Newtonsoft.Json.xml │ │ ├── net40 │ │ │ ├── Newtonsoft.Json.dll │ │ │ └── Newtonsoft.Json.xml │ │ ├── net45 │ │ │ ├── Newtonsoft.Json.dll │ │ │ └── Newtonsoft.Json.xml │ │ ├── netstandard1.0 │ │ │ ├── Newtonsoft.Json.dll │ │ │ └── Newtonsoft.Json.xml │ │ ├── netstandard1.3 │ │ │ ├── Newtonsoft.Json.dll │ │ │ └── Newtonsoft.Json.xml │ │ ├── netstandard2.0 │ │ │ ├── Newtonsoft.Json.dll │ │ │ └── Newtonsoft.Json.xml │ │ ├── portable-net40+sl5+win8+wp8+wpa81 │ │ │ ├── Newtonsoft.Json.dll │ │ │ └── Newtonsoft.Json.xml │ │ └── portable-net45+win8+wp8+wpa81 │ │ │ ├── Newtonsoft.Json.dll │ │ │ └── Newtonsoft.Json.xml │ │ └── packageIcon.png ├── Twitch.Base.UnitTests │ ├── NewAPI │ │ ├── AdsServiceUnitTests.cs │ │ ├── BitsServiceUnitTests.cs │ │ ├── ChannelPointsServiceUnitTests.cs │ │ ├── ChannelsServiceUnitTests.cs │ │ ├── ChatServiceUnitTests.cs │ │ ├── ClipsServiceUnitTests.cs │ │ ├── EventSubServiceUnitTests.cs │ │ ├── GamesServiceUnitTests.cs │ │ ├── ScheduleServiceUnitTests.cs │ │ ├── StreamsServiceUnitTests.cs │ │ ├── SubscriptionsServiceUnitTests.cs │ │ ├── TeamsServiceUnitTests.cs │ │ └── UsersServiceUnitTests.cs │ ├── Twitch.Base.UnitTests.csproj │ ├── TwitchConnectionUnitTests.cs │ └── UnitTestBase.cs ├── Twitch.Base │ ├── Clients │ │ ├── ChatClient.cs │ │ ├── EventSubClient.cs │ │ ├── FDGTChatClient.cs │ │ └── PubSubClient.cs │ ├── Models │ │ ├── Clients │ │ │ ├── Chat │ │ │ │ ├── ChatClearChatPacketModel.cs │ │ │ │ ├── ChatClearMessagePacketModel.cs │ │ │ │ ├── ChatGlobalUserStatePacketModel.cs │ │ │ │ ├── ChatMessagePacketModel.cs │ │ │ │ ├── ChatNoticePacketModel.cs │ │ │ │ ├── ChatPacketModelBase.cs │ │ │ │ ├── ChatRawPacketModel.cs │ │ │ │ ├── ChatRoomStatePacketModel.cs │ │ │ │ ├── ChatUserJoinPacketModel.cs │ │ │ │ ├── ChatUserLeavePacketModel.cs │ │ │ │ ├── ChatUserNoticePacketModel.cs │ │ │ │ ├── ChatUserPacketModelBase.cs │ │ │ │ ├── ChatUserStatePacketModel.cs │ │ │ │ ├── ChatUsersListPacketModel.cs │ │ │ │ └── ChatWhisperMessagePacketModel.cs │ │ │ ├── EventSub │ │ │ │ ├── EventSubMessageBase.cs │ │ │ │ ├── KeepAliveMessage.cs │ │ │ │ ├── MessageMetadata.cs │ │ │ │ ├── MessageType.cs │ │ │ │ ├── NotificationMessage.cs │ │ │ │ ├── NotificationMessagePayload.cs │ │ │ │ ├── ReconnectMessage.cs │ │ │ │ ├── ReconnectMessagePayload.cs │ │ │ │ ├── RevocationMessage.cs │ │ │ │ ├── RevocationMessagePayload.cs │ │ │ │ ├── Session.cs │ │ │ │ ├── Subscription.cs │ │ │ │ ├── Transport.cs │ │ │ │ ├── WelcomeMessage.cs │ │ │ │ └── WelcomeMessagePayload.cs │ │ │ └── PubSub │ │ │ │ ├── Messages │ │ │ │ ├── PubSubBitBadgeEventModel.cs │ │ │ │ ├── PubSubBitsEventV1Model.cs │ │ │ │ ├── PubSubBitsEventV2Model.cs │ │ │ │ ├── PubSubChannelPointsRedeemedEventModel.cs │ │ │ │ ├── PubSubSubscriptionsEventModel.cs │ │ │ │ ├── PubSubSubscriptionsGiftEventModel.cs │ │ │ │ └── PubSubWhisperEventModel.cs │ │ │ │ ├── PubSubListenTopicModel.cs │ │ │ │ ├── PubSubMessagePacketModel.cs │ │ │ │ ├── PubSubPacketModel.cs │ │ │ │ └── PubSubResponsePacketModel.cs │ │ └── NewAPI │ │ │ ├── Ads │ │ │ ├── AdResponseModel.cs │ │ │ ├── AdScheduleModel.cs │ │ │ └── AdSnoozeResponseModel.cs │ │ │ ├── Bits │ │ │ ├── BitsCheermoteModel.cs │ │ │ └── BitsLeaderboardModel.cs │ │ │ ├── ChannelPoints │ │ │ ├── CustomChannelPointRewardModel.cs │ │ │ └── CustomChannelPointRewardRedemptionModel.cs │ │ │ ├── Channels │ │ │ ├── ChannelBannedEventModel.cs │ │ │ ├── ChannelBannedUserModel.cs │ │ │ ├── ChannelContentClassificationLabelModel.cs │ │ │ ├── ChannelEditorUserModel.cs │ │ │ ├── ChannelFollowedModel.cs │ │ │ ├── ChannelFollowerModel.cs │ │ │ ├── ChannelHypeTrainModel.cs │ │ │ ├── ChannelInformationModel.cs │ │ │ ├── ChannelModeratorEventModel.cs │ │ │ └── ChannelModeratorUserModel.cs │ │ │ ├── Charity │ │ │ ├── CharityCampaignAmountModel.cs │ │ │ ├── CharityCampaignDonationModel.cs │ │ │ └── CharityCampaignModel.cs │ │ │ ├── Chat │ │ │ ├── AnnouncementModel.cs │ │ │ ├── ChatBadgeModel.cs │ │ │ ├── ChatEmoteModel.cs │ │ │ ├── ChatSettingsModel.cs │ │ │ └── ChatterModel.cs │ │ │ ├── Clips │ │ │ ├── ClipCreationModel.cs │ │ │ └── ClipModel.cs │ │ │ ├── EventSub │ │ │ ├── EventSubSubscriptionChallengeModel.cs │ │ │ ├── EventSubSubscriptionModel.cs │ │ │ ├── EventSubSubscriptionNotificationModel.cs │ │ │ └── EventSubTransportModel.cs │ │ │ ├── Games │ │ │ └── GameModel.cs │ │ │ ├── NewTwitchAPIDataRestResult.cs │ │ │ ├── NewTwitchAPISingleDataRestResult.cs │ │ │ ├── Polls │ │ │ ├── PollChoiceModel.cs │ │ │ └── PollModel.cs │ │ │ ├── Predictions │ │ │ ├── PredictionModel.cs │ │ │ ├── PredictionOutcomeModel.cs │ │ │ └── PredictionOutcomeTopPredictorModel.cs │ │ │ ├── Schedule │ │ │ ├── ScheduleModel.cs │ │ │ ├── ScheduleSegmentCategoryModel.cs │ │ │ ├── ScheduleSegmentModel.cs │ │ │ └── ScheduleVacationModel.cs │ │ │ ├── Streams │ │ │ ├── StreamMarkerModel.cs │ │ │ └── StreamModel.cs │ │ │ ├── Subscriptions │ │ │ └── SubscriptionModel.cs │ │ │ ├── Teams │ │ │ ├── TeamMemberModel.cs │ │ │ └── TeamModel.cs │ │ │ ├── Users │ │ │ └── UserModel.cs │ │ │ └── Webhook │ │ │ ├── WebhookSubscriptionModel.cs │ │ │ └── WebhookSubscriptionRegistrationModel.cs │ ├── Services │ │ ├── NewAPI │ │ │ ├── AdsService.cs │ │ │ ├── BitsService.cs │ │ │ ├── ChannelPointsService.cs │ │ │ ├── ChannelsService.cs │ │ │ ├── CharityService.cs │ │ │ ├── ChatService.cs │ │ │ ├── ClipsService.cs │ │ │ ├── EventSubService.cs │ │ │ ├── GamesService.cs │ │ │ ├── NewTwitchAPIServiceBase.cs │ │ │ ├── NewTwitchAPIServices.cs │ │ │ ├── PollsService.cs │ │ │ ├── PredictionsService.cs │ │ │ ├── ScheduleService.cs │ │ │ ├── StreamsService.cs │ │ │ ├── SubscriptionsService.cs │ │ │ ├── TeamsService.cs │ │ │ ├── UsersService.cs │ │ │ └── WebhooksService.cs │ │ ├── OAuthService.cs │ │ └── TwitchServiceBase.cs │ ├── Twitch - Backup.Base.csproj │ ├── Twitch.Base.csproj │ └── TwitchConnection.cs ├── Twitch.Extensions.Base │ ├── Models │ │ ├── BroadcastBodyModel.cs │ │ ├── ConfigurationModel.cs │ │ ├── ExtensionChatMessageModel.cs │ │ └── TwitchJWTTokenPayloadModel.cs │ ├── Services │ │ └── TwitchExtensionService.cs │ └── Twitch.Extensions.Base.csproj └── Twitch.Webhooks.Base │ ├── Models │ ├── WebhookResultModel.cs │ └── WebhookSubscriptionVerificationModel.cs │ ├── Services │ └── TwitchWebhookService.cs │ └── Twitch.Webhooks.Base.csproj ├── YouTube ├── Samples │ ├── YouTube.ChatSample.Console │ │ ├── App.config │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── YouTube.ChatSample.Console.csproj │ │ └── packages.config │ └── YouTube.VideoUploadSample.Console │ │ ├── App.config │ │ ├── Program.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── YouTube.VideoUploadSample.Console.csproj │ │ ├── packages.config │ │ ├── thumbnail.jpg │ │ └── video.mp4 ├── YouTube.Base.UnitTests │ ├── ChannelsServiceUnitTests.cs │ ├── CommentsServiceUnitTests.cs │ ├── LiveBroadcastsServiceUnitTests.cs │ ├── PlaylistsServiceUnitTests.cs │ ├── SubscriptionsServiceUnitTests.cs │ ├── UnitTestBase.cs │ ├── VideosServiceUnitTests.cs │ ├── YouTube.Base.UnitTests.csproj │ └── YouTubeConnectionUnitTests.cs └── YouTube.Base │ ├── Clients │ └── ChatClient.cs │ ├── Model │ ├── LiveChatMessagesResultModel.cs │ ├── YouTubeModelBase.cs │ └── YouTubePagedResult.cs │ ├── Properties │ └── launchSettings.json │ ├── Services │ ├── ChannelsService.cs │ ├── CommentsService.cs │ ├── LiveBroadcastsService.cs │ ├── LiveChatService.cs │ ├── MembershipService.cs │ ├── OAuthService.cs │ ├── PlaylistsService.cs │ ├── SubscriptionsService.cs │ ├── VideosService.cs │ └── YouTubeServiceBase.cs │ ├── YouTube.Base.csproj │ └── YouTubeConnection.cs ├── streaming-client-csharp.sln └── streaming-client-samples-csharp.sln /.travis.yml: -------------------------------------------------------------------------------- 1 | language: csharp 2 | solution: streaming-client-csharp.sln 3 | mono: none 4 | dotnet: 2.0.0 5 | dist: trusty 6 | 7 | script: 8 | - dotnet restore streaming-client-csharp.sln 9 | - dotnet msbuild streaming-client-csharp.sln -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-2020 Matthew Olivo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /StreamingClient.Base/Model/OAuth/OAuthShortCodeModel.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | using System.Runtime.Serialization; 4 | 5 | namespace StreamingClient.Base.Model.OAuth 6 | { 7 | /// 8 | /// A Short Code used for getting a token from an OAuth service. 9 | /// 10 | public class OAuthShortCodeModel 11 | { 12 | /// 13 | /// The code that the user must enter to approve the authentication. 14 | /// 15 | public string code { get; set; } 16 | /// 17 | /// The end-URL identifier to use when opening the authentication webpage. 18 | /// 19 | public string handle { get; set; } 20 | /// 21 | /// The expiration time of the short code in seconds from when it was obtained. 22 | /// 23 | [JsonProperty("expires_in")] 24 | public int expiresIn { get; set; } 25 | 26 | /// 27 | /// The time when the token was obtained. 28 | /// 29 | [DataMember] 30 | public DateTimeOffset AcquiredDateTime { get; set; } 31 | 32 | /// 33 | /// The expiration time of the token. 34 | /// 35 | [JsonIgnore] 36 | public DateTimeOffset ExpirationDateTime { get { return this.AcquiredDateTime.AddSeconds(this.expiresIn); } } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /StreamingClient.Base/StreamingClient.Base.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | StreamingClient.Base 6 | StreamingClient.Base 7 | Copyright © Matthew Olivo (SaviorXTanren) 2017-2021 8 | Matthew Olivo 9 | Matthew Olivo 10 | true 11 | 1.0.0.13 12 | A library used for multiple streaming libraries to share common code logic. 13 | 14 | For more information, please see our project site: https://github.com/SaviorXTanren/StreamingClientLibrary 15 | Streaming Bot Chat Library 16 | StreamingClientLibrary.Base 17 | Streaming Client Library 18 | Adding scope list to OAuth Token 19 | 1.0.0.13 20 | 1.0.0.13 21 | https://github.com/SaviorXTanren/StreamingClientLibrary 22 | https://github.com/SaviorXTanren/StreamingClientLibrary 23 | false 24 | true 25 | 26 | 27 | 28 | StreamingClient.Base.xml 29 | 30 | 31 | 32 | S:\Code\mixer-client-csharp\StreamingClient.Base\StreamingClient.Base.xml 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /StreamingClient.Base/Util/DateTimeOffsetExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace StreamingClient.Base.Util 4 | { 5 | /// 6 | /// Extension methods for the DateTimeOffset class. 7 | /// 8 | public static class DateTimeOffsetExtensions 9 | { 10 | /// 11 | /// Creates a DateTimeOffset from a UTC Unix time in milliseconds. 12 | /// 13 | /// The total milliseconds in UTC Unix time 14 | /// The equivalent DateTimeOffset 15 | public static DateTimeOffset FromUTCUnixTimeMilliseconds(long milliseconds) { return DateTimeOffset.FromUnixTimeMilliseconds(milliseconds).ToOffset(DateTimeOffset.Now.Offset); } 16 | 17 | /// 18 | /// Creates a DateTimeOffset from a UTC Unix time in seconds. 19 | /// 20 | /// The total secpnds in UTC Unix time 21 | /// The equivalent DateTimeOffset 22 | public static DateTimeOffset FromUTCUnixTimeSeconds(long seconds) { return DateTimeOffset.FromUnixTimeSeconds(seconds).ToOffset(DateTimeOffset.Now.Offset); } 23 | 24 | /// 25 | /// Creates a DateTimeOffset from an ISO 8601 string. 26 | /// 27 | /// The total milliseconds in ISO 8601 time 28 | /// The equivalent DateTimeOffset 29 | public static DateTimeOffset FromUTCISO8601String(string dateTime) { return DateTimeOffset.Parse(dateTime).ToOffset(DateTimeOffset.Now.Offset); } 30 | 31 | /// 32 | /// Creates an ISO 8601 string. 33 | /// 34 | /// The DateTimeOffset to convert 35 | /// The equivalent ISO 8601 string 36 | public static string ToUTCISO8601String(this DateTimeOffset dateTime) { return dateTime.ToOffset(DateTimeOffset.UtcNow.Offset).ToString("s"); } 37 | 38 | /// 39 | /// Creates an RFC 3339 string 40 | /// 41 | /// The DateTimeOffset to convert 42 | /// The equivalent RFC 3339 string 43 | public static string ToRFC3339String(this DateTimeOffset dateTime) { return dateTime.ToUTCISO8601String() + "Z"; } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /StreamingClient.Base/Util/DictionaryExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace StreamingClient.Base.Util 4 | { 5 | /// 6 | /// Extension methods for the Dictionary class 7 | /// 8 | public static class DictionaryExtensions 9 | { 10 | /// 11 | /// Gets the value at the specified key or the default of the value class type. 12 | /// 13 | /// The dictionary to search through 14 | /// The key to look up 15 | /// The value at the specified key or the default of the value class type 16 | public static V GetOrDefault(this Dictionary dictionary, K key) 17 | { 18 | if (dictionary.ContainsKey(key)) 19 | { 20 | return dictionary[key]; 21 | } 22 | return default(V); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /StreamingClient.Base/Util/HttpRateLimitedRestRequestException.cs: -------------------------------------------------------------------------------- 1 | using StreamingClient.Base.Web; 2 | using System.Net.Http; 3 | 4 | namespace StreamingClient.Base.Util 5 | { 6 | /// 7 | /// An exception detailing the rate limiting of an Http REST web request. 8 | /// 9 | public class HttpRateLimitedRestRequestException : HttpRestRequestException 10 | { 11 | /// 12 | /// The rate limit bucket that is being throttled. 13 | /// 14 | public string RateLimitBucket { get; set; } 15 | 16 | /// 17 | /// Partial data from the request, if any. 18 | /// 19 | public object PartialData { get; set; } 20 | 21 | /// 22 | /// Creates a new instance of the HttpRateLimitedRestRequestException with a web request response. 23 | /// 24 | /// The response of the rate limited web request 25 | public HttpRateLimitedRestRequestException(HttpResponseMessage response) 26 | : base(response) 27 | { 28 | this.RateLimitBucket = response.GetHeaderValue(HttpRequestRateLimits.MixerRateLimitResetHeader); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /StreamingClient.Base/Util/HttpRestRequestException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net.Http; 3 | 4 | namespace StreamingClient.Base.Util 5 | { 6 | /// 7 | /// An exception detailing the failure of an Http REST web request. 8 | /// 9 | public class HttpRestRequestException : HttpRequestException 10 | { 11 | /// 12 | /// The response of the request. 13 | /// 14 | public HttpResponseMessage Response { get; set; } 15 | 16 | /// 17 | /// Creates a new instance of the HttpRestRequestException. 18 | /// 19 | public HttpRestRequestException() : base() { } 20 | 21 | /// 22 | /// Creates a new instance of the HttpRestRequestException with a specified message. 23 | /// 24 | /// The message of the exception 25 | public HttpRestRequestException(string message) : base(message) { } 26 | 27 | /// 28 | /// Creates a new instance of the HttpRestRequestException with a specified message & inner exception. 29 | /// 30 | /// The message of the exception 31 | /// The inner exception 32 | public HttpRestRequestException(string message, Exception inner) : base(message, inner) { } 33 | 34 | /// 35 | /// Creates a new instance of the HttpRestRequestException with a web request response. 36 | /// 37 | /// The response of the failing web request 38 | public HttpRestRequestException(HttpResponseMessage response) 39 | : this(response.ReasonPhrase) 40 | { 41 | this.Response = response; 42 | } 43 | 44 | /// 45 | /// Returns a string representation of the object. 46 | /// 47 | /// A string representation of the object 48 | public override string ToString() 49 | { 50 | return $"{this.Response.RequestMessage.RequestUri} - {this.Response.StatusCode} - {this.Response.ReasonPhrase} - {this.Response.GetCallLength()}" + Environment.NewLine + 51 | this.Response.Content.ReadAsStringAsync().Result + Environment.NewLine + base.ToString(); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /StreamingClient.Base/Util/JArrayExtensions.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using System.Collections.Generic; 3 | 4 | namespace StreamingClient.Base.Util 5 | { 6 | /// 7 | /// Extension methods for the JArray class 8 | /// 9 | public static class JArrayExtensions 10 | { 11 | /// 12 | /// Converts a JArray to a typed list of objects. 13 | /// 14 | /// The type of objects in the array 15 | /// The JArray to convert 16 | /// The converted list of objects 17 | public static List ToTypedArray(this JArray array) 18 | { 19 | List results = new List(); 20 | if (array != null) 21 | { 22 | foreach (JToken token in array) 23 | { 24 | results.Add(token.ToObject()); 25 | } 26 | } 27 | return results; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /StreamingClient.Base/Util/NameAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace StreamingClient.Base.Util 4 | { 5 | /// 6 | /// An attribute that tracks the public-facing name of an item. 7 | /// 8 | [AttributeUsage(AttributeTargets.All)] 9 | public class NameAttribute : Attribute 10 | { 11 | /// 12 | /// The default, public-facing name. 13 | /// 14 | public static readonly NameAttribute Default; 15 | 16 | /// 17 | /// The public-facing name of the item. 18 | /// 19 | public string Name { get; private set; } 20 | 21 | /// 22 | /// Creates a new instance of the NameAttribute class. 23 | /// 24 | public NameAttribute() : this(string.Empty) { } 25 | 26 | /// 27 | /// Creates a new instance of the NameAttribute class with a specified name. 28 | /// 29 | /// The public-facing name 30 | public NameAttribute(string name) { this.Name = name; } 31 | 32 | /// 33 | /// Checks whether the following objects are equal. 34 | /// 35 | /// The other object to check 36 | /// Whether the two objects are equal 37 | public override bool Equals(object obj) 38 | { 39 | if (obj is NameAttribute) 40 | { 41 | NameAttribute other = (NameAttribute)obj; 42 | return this.Name.Equals(other.Name); 43 | } 44 | return false; 45 | } 46 | 47 | /// 48 | /// Returns the hash code for this string. 49 | /// 50 | /// Returns the hash code for this string. 51 | public override int GetHashCode() { return this.Name.GetHashCode(); } 52 | 53 | /// 54 | /// Whether this instance is the default attribute. 55 | /// 56 | /// true if this instance is the default attribute for the class; otherwise, false. 57 | public override bool IsDefaultAttribute() { return this.Equals(NameAttribute.Default); } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /StreamingClient.Base/Util/StringEnumNameConverter.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | 4 | namespace StreamingClient.Base.Util 5 | { 6 | /// 7 | /// This converts from Enum value to name and back 8 | /// 9 | public class StringEnumNameConverter : JsonConverter 10 | { 11 | /// 12 | /// Checks to see if this converter can work on the requested type. 13 | /// 14 | /// The type to convert to. 15 | /// True if it can convert. 16 | public override bool CanConvert(Type objectType) 17 | { 18 | return objectType.IsEnum; 19 | } 20 | 21 | /// 22 | /// Reads the raw json to parse to enum 23 | /// 24 | /// The Json reader to read from. 25 | /// The type being converted to. 26 | /// The current value. 27 | /// The serializer being used. 28 | /// 29 | public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) 30 | { 31 | if (reader.TokenType == JsonToken.String) 32 | { 33 | var enumText = reader.Value?.ToString(); 34 | return EnumHelper.GetEnumValueFromString(objectType, enumText); 35 | } 36 | 37 | throw new JsonSerializationException($"Unexpected token {reader.TokenType} when parsing enum."); 38 | } 39 | 40 | /// 41 | /// Write out the enum as a string. 42 | /// 43 | /// The writer being used. 44 | /// The enum value. 45 | /// The serializer being used. 46 | public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) 47 | { 48 | if (value == null) 49 | { 50 | writer.WriteNull(); 51 | return; 52 | } 53 | 54 | Enum e = (Enum)value; 55 | var name = EnumHelper.GetEnumName(value.GetType(), e); 56 | writer.WriteValue(name); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /StreamingClient.Base/Util/StringExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Text; 3 | 4 | namespace StreamingClient.Base.Util 5 | { 6 | /// 7 | /// Extension methods for the String class. 8 | /// 9 | public static class StringExtensions 10 | { 11 | /// 12 | /// Converts a string to it's base64 equivalent string. 13 | /// 14 | /// 15 | /// 16 | public static string ToBase64String(this string str) 17 | { 18 | byte[] bytes = Encoding.UTF8.GetBytes(str); 19 | return Convert.ToBase64String(bytes); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Trovo/Samples/Trovo.ChatSample.Console/Trovo.ChatSample.Console.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp3.1 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Trovo/Trovo.Base.UnitTests/Trovo.Base.UnitTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Trovo/Trovo.Base.UnitTests/UnitTestBase.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Threading.Tasks; 5 | 6 | namespace Trovo.Base.UnitTests 7 | { 8 | public abstract class UnitTestBase 9 | { 10 | public const string clientID = ""; 11 | public const string clientSecret = ""; 12 | 13 | public static readonly List scopes = new List() 14 | { 15 | OAuthClientScopeEnum.chat_connect, 16 | OAuthClientScopeEnum.chat_send_self, 17 | OAuthClientScopeEnum.send_to_my_channel, 18 | OAuthClientScopeEnum.manage_messages, 19 | 20 | OAuthClientScopeEnum.channel_details_self, 21 | OAuthClientScopeEnum.channel_update_self, 22 | OAuthClientScopeEnum.channel_subscriptions, 23 | 24 | OAuthClientScopeEnum.user_details_self, 25 | }; 26 | 27 | private static TrovoConnection connection; 28 | 29 | public static TrovoConnection GetTrovoClient() 30 | { 31 | if (UnitTestBase.connection == null) 32 | { 33 | UnitTestBase.connection = TrovoConnection.ConnectViaLocalhostOAuthBrowser(clientID, clientSecret, scopes).Result; 34 | } 35 | 36 | Assert.IsNotNull(UnitTestBase.connection); 37 | return UnitTestBase.connection; 38 | } 39 | 40 | protected static void TestWrapper(Func function) 41 | { 42 | try 43 | { 44 | TrovoConnection connection = UnitTestBase.GetTrovoClient(); 45 | function(connection).Wait(); 46 | } 47 | catch (AggregateException aex) 48 | { 49 | Assert.Fail(aex.InnerException.ToString()); 50 | } 51 | catch (Exception ex) 52 | { 53 | Assert.Fail(ex.ToString()); 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Trovo/Trovo.Base.UnitTests/UsersServiceUnitTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using Trovo.Base.Models.Users; 3 | 4 | namespace Trovo.Base.UnitTests 5 | { 6 | [TestClass] 7 | public class UsersServiceUnitTests : UnitTestBase 8 | { 9 | [TestMethod] 10 | public void GetCurrentUser() 11 | { 12 | TestWrapper(async (TrovoConnection connection) => 13 | { 14 | PrivateUserModel user = await connection.Users.GetCurrentUser(); 15 | 16 | Assert.IsNotNull(user); 17 | Assert.IsTrue(!string.IsNullOrEmpty(user.userId)); 18 | Assert.IsTrue(!string.IsNullOrEmpty(user.userName)); 19 | }); 20 | } 21 | 22 | [TestMethod] 23 | public void GetUser() 24 | { 25 | TestWrapper(async (TrovoConnection connection) => 26 | { 27 | PrivateUserModel privateUser = await connection.Users.GetCurrentUser(); 28 | 29 | Assert.IsNotNull(privateUser); 30 | Assert.IsTrue(!string.IsNullOrEmpty(privateUser.userId)); 31 | Assert.IsTrue(!string.IsNullOrEmpty(privateUser.userName)); 32 | 33 | UserModel user = await connection.Users.GetUser(privateUser.userName); 34 | 35 | Assert.IsNotNull(user); 36 | Assert.IsTrue(!string.IsNullOrEmpty(user.user_id)); 37 | Assert.IsTrue(!string.IsNullOrEmpty(user.username)); 38 | }); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Trovo/Trovo.Base/Models/Category/CategoryModel.cs: -------------------------------------------------------------------------------- 1 | namespace Trovo.Base.Models.Category 2 | { 3 | /// 4 | /// Information about a category. 5 | /// 6 | public class CategoryModel 7 | { 8 | /// 9 | /// The ID of the category. 10 | /// 11 | public string id { get; set; } 12 | 13 | /// 14 | /// The full name of the category. 15 | /// 16 | public string name { get; set; } 17 | 18 | /// 19 | /// The short name of the category. 20 | /// 21 | public string short_name { get; set; } 22 | 23 | /// 24 | /// The url of the category's icon. 25 | /// 26 | public string icon_url { get; set; } 27 | 28 | /// 29 | /// The description of the category. 30 | /// 31 | public string desc { get; set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Trovo/Trovo.Base/Models/Channels/ChannelFollowerModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Runtime.Serialization; 3 | 4 | namespace Trovo.Base.Models.Channels 5 | { 6 | /// 7 | /// Information about a channel follower. 8 | /// 9 | [DataContract] 10 | public class ChannelFollowerModel 11 | { 12 | /// 13 | /// Unique id of a user. 14 | /// 15 | [DataMember] 16 | public string user_id { get; set; } 17 | 18 | /// 19 | /// The display name of a user, displayed in chats, channels and all across Trovo. This could be different from username. 20 | /// 21 | [DataMember] 22 | public string nickname { get; set; } 23 | 24 | /// 25 | /// User's profile picture 26 | /// 27 | [DataMember] 28 | public string profile_pic { get; set; } 29 | 30 | /// 31 | /// Return the following time 32 | /// 33 | [DataMember] 34 | public string followed_at { get; set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Trovo/Trovo.Base/Models/Channels/ChannelSocialLinkModel.cs: -------------------------------------------------------------------------------- 1 | namespace Trovo.Base.Models.Channels 2 | { 3 | /// 4 | /// Information about a social media link. 5 | /// 6 | public class ChannelSocialLinkModel 7 | { 8 | /// 9 | /// The type of social media link. 10 | /// 11 | public string type { get; set; } 12 | /// 13 | /// The URL of the social media link. 14 | /// 15 | public string url { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Trovo/Trovo.Base/Models/Channels/ChannelSubscriberModel.cs: -------------------------------------------------------------------------------- 1 | using Trovo.Base.Models.Users; 2 | 3 | namespace Trovo.Base.Models.Channels 4 | { 5 | /// 6 | /// Information about a channel subscriber. 7 | /// 8 | public class ChannelSubscriberModel 9 | { 10 | /// 11 | /// The user information. 12 | /// 13 | public UserModel user { get; set; } 14 | 15 | /// 16 | /// Unix timestamp of when the user subscribed to the channel. 17 | /// 18 | public long? sub_created_at { get; set; } 19 | 20 | /// 21 | /// The level of the subscription 22 | /// 23 | public string sub_lv { get; set; } 24 | 25 | /// 26 | /// The tier of the subscription 27 | /// 28 | public string sub_tier { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Trovo/Trovo.Base/Models/Channels/PrivateChannelModel.cs: -------------------------------------------------------------------------------- 1 | namespace Trovo.Base.Models.Channels 2 | { 3 | /// 4 | /// Private information for a channel. 5 | /// 6 | public class PrivateChannelModel : ChannelModel 7 | { 8 | /// 9 | /// The ID of the user. 10 | /// 11 | public string uid { get; set; } 12 | /// 13 | /// The ID of the channel. 14 | /// 15 | public string channel_id { get; set; } 16 | /// 17 | /// The stream key for the user. 18 | /// 19 | public string stream_key { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Trovo/Trovo.Base/Models/Chat/ChatPacketModel.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using System; 3 | 4 | namespace Trovo.Base.Models.Chat 5 | { 6 | /// 7 | /// Information about a chat packet. 8 | /// 9 | public class ChatPacketModel 10 | { 11 | /// 12 | /// The type of packet. 13 | /// 14 | public string type { get; set; } 15 | /// 16 | /// The unique ID of the packet. 17 | /// 18 | public string nonce { get; set; } 19 | /// 20 | /// Errors from the connection, 21 | /// 22 | public string error { get; set; } 23 | /// 24 | /// The data of the packet. 25 | /// 26 | public JObject data { get; set; } 27 | 28 | /// 29 | /// Creates a new instance of the ChatPacketModel 30 | /// 31 | public ChatPacketModel() { } 32 | 33 | /// 34 | /// Creates a new instance of the ChatPacketModel 35 | /// 36 | /// The type of packet 37 | public ChatPacketModel(string type) 38 | { 39 | this.type = type; 40 | this.nonce = Guid.NewGuid().ToString(); 41 | } 42 | 43 | /// 44 | /// Creates a new instance of the ChatPacketModel 45 | /// 46 | /// The type of packet 47 | /// The data of the packet 48 | public ChatPacketModel(string type, JObject data) 49 | : this(type) 50 | { 51 | this.data = data; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Trovo/Trovo.Base/Models/PageDataResponseModel.cs: -------------------------------------------------------------------------------- 1 | namespace Trovo.Base.Models 2 | { 3 | /// 4 | /// A paged response. 5 | /// 6 | public abstract class PageDataResponseModel 7 | { 8 | /// 9 | /// The page instance token. 10 | /// 11 | public string token { get; set; } 12 | /// 13 | /// The total number of pages. 14 | /// 15 | public int total_page { get; set; } 16 | /// 17 | /// The total number of pages. 18 | /// 19 | public int total { get; set; } 20 | /// 21 | /// The current page number. 22 | /// 23 | public int cursor { get; set; } 24 | 25 | /// 26 | /// Gets the count of items associated with the response. 27 | /// 28 | /// The count of items associated with the response 29 | public abstract int GetItemCount(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Trovo/Trovo.Base/Models/Users/PrivateUserModel.cs: -------------------------------------------------------------------------------- 1 | namespace Trovo.Base.Models.Users 2 | { 3 | /// 4 | /// Private information about a user. 5 | /// 6 | public class PrivateUserModel 7 | { 8 | /// 9 | /// The ID of the user. 10 | /// 11 | public string userId { get; set; } 12 | /// 13 | /// The name of the user. 14 | /// 15 | public string userName { get; set; } 16 | /// 17 | /// The display name of the user. 18 | /// 19 | public string nickName { get; set; } 20 | /// 21 | /// The email of the user. 22 | /// 23 | public string email { get; set; } 24 | /// 25 | /// The profile picture of the user. 26 | /// 27 | public string profilePic { get; set; } 28 | /// 29 | /// The display information for the user. 30 | /// 31 | public string info { get; set; } 32 | /// 33 | /// The ID of the channel for the user. 34 | /// 35 | public string channelId { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Trovo/Trovo.Base/Models/Users/UserModel.cs: -------------------------------------------------------------------------------- 1 | namespace Trovo.Base.Models.Users 2 | { 3 | /// 4 | /// Information about a user. 5 | /// 6 | public class UserModel 7 | { 8 | /// 9 | /// The ID of the user 10 | /// 11 | public string user_id { get; set; } 12 | /// 13 | /// The name of the user. 14 | /// 15 | public string username { get; set; } 16 | /// 17 | /// The display name of the user. 18 | /// 19 | public string nickname { get; set; } 20 | /// 21 | /// The ID of the channel for the user. 22 | /// 23 | public string channel_id { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Trovo/Trovo.Base/Services/CategoryService.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using StreamingClient.Base.Util; 3 | using StreamingClient.Base.Web; 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | using Trovo.Base.Models.Category; 7 | 8 | namespace Trovo.Base.Services 9 | { 10 | /// 11 | /// The APIs for category-based services. 12 | /// 13 | public class CategoryService : TrovoServiceBase 14 | { 15 | private class CategoryWrapperModel 16 | { 17 | public List category_info { get; set; } 18 | } 19 | 20 | /// 21 | /// Creates an instance of the CategoryService. 22 | /// 23 | /// The Trovo connection to use 24 | public CategoryService(TrovoConnection connection) : base(connection) { } 25 | 26 | /// 27 | /// Gets the top categories. 28 | /// 29 | /// The top categories 30 | public async Task> GetTopCategories() 31 | { 32 | CategoryWrapperModel categories = await this.GetAsync("categorys/top"); 33 | if (categories != null) 34 | { 35 | return categories.category_info; 36 | } 37 | return null; 38 | } 39 | 40 | /// 41 | /// Searches for categories matching the specified query. 42 | /// 43 | /// The query to search for 44 | /// The maximum number of results. Will be either that amount or slightly more 45 | /// The matching categories 46 | public async Task> SearchCategories(string query, int maxResults = 1) 47 | { 48 | Validator.ValidateString(query, "query"); 49 | 50 | JObject jobj = new JObject(); 51 | jobj["query"] = query; 52 | jobj["limit"] = maxResults; 53 | 54 | CategoryWrapperModel categories = await this.PostAsync("searchcategory", AdvancedHttpClient.CreateContentFromObject(jobj)); 55 | if (categories != null) 56 | { 57 | return categories.category_info; 58 | } 59 | return null; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Trovo/Trovo.Base/Trovo.Base.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | true 6 | StreamingClientLibrary.Trovo 7 | Matthew Olivo 8 | Matthew Olivo 9 | Trovo Streaming Client Library 10 | C# client library for the Trovo streaming service: https://trovo.live 11 | 12 | For more information, please see our project site: https://github.com/SaviorXTanren/StreamingClientLibrary 13 | Copyright © Matthew Olivo (SaviorXTanren) 2017-2021 14 | https://github.com/SaviorXTanren/StreamingClientLibrary 15 | https://github.com/SaviorXTanren/StreamingClientLibrary 16 | Trovo Streaming Bot Chat Interactive 17 | 1.0.0.24 18 | 1.0.0.24 19 | 1.0.0.24 20 | Adding scope list to OAuth Token 21 | 22 | 23 | 24 | obj\Debug\netstandard2.0\Trovo.Base.xml 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.ChatSample.Console/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.ChatSample.Console/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Twitch.ChatSample.Console")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Twitch.ChatSample.Console")] 13 | [assembly: AssemblyCopyright("Copyright © 2019")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("fc6d4634-d892-44ef-ba71-5bade3ab594d")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.ChatSample.Console/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.ExtensionSample.API/Controllers/SampleController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using Microsoft.Extensions.Primitives; 3 | using Newtonsoft.Json.Linq; 4 | using System.Threading.Tasks; 5 | using Twitch.Extensions.Base.Models; 6 | using Twitch.Extensions.Base.Services; 7 | 8 | namespace Twitch.ExtensionSample.API.Controllers 9 | { 10 | [Route("api/[controller]")] 11 | [ApiController] 12 | public class SampleController : ControllerBase 13 | { 14 | public string clientID = ""; 15 | public string clientSecret = ""; 16 | public string ownerID = ""; 17 | 18 | [HttpGet("test")] 19 | public async Task> Test() 20 | { 21 | if (!this.Request.Headers.TryGetValue("Authorization", out StringValues authHeader)) 22 | { 23 | return this.Unauthorized("Missing Authorization header"); 24 | } 25 | 26 | string bearerToken = authHeader.ToString(); 27 | if (!string.IsNullOrEmpty(bearerToken)) 28 | { 29 | bearerToken = bearerToken.Replace("Bearer ", ""); 30 | } 31 | 32 | string result = TwitchExtensionService.ValidateAuthenticationToken(bearerToken, clientSecret, out TwitchJWTTokenPayloadModel payload); 33 | if (!string.IsNullOrEmpty(result)) 34 | { 35 | return this.Unauthorized(result); 36 | } 37 | 38 | JObject data = new JObject(); 39 | data["hello"] = "world"; 40 | await TwitchExtensionService.SendBroadcast(clientID, clientSecret, ownerID, payload.channel_id, data); 41 | 42 | return this.Ok("Broadcast Sent"); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.ExtensionSample.API/Program.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Hosting; 2 | using Microsoft.Extensions.Hosting; 3 | 4 | namespace Twitch.ExtensionSample.API 5 | { 6 | public class Program 7 | { 8 | public static void Main(string[] args) 9 | { 10 | CreateHostBuilder(args).Build().Run(); 11 | } 12 | 13 | public static IHostBuilder CreateHostBuilder(string[] args) => 14 | Host.CreateDefaultBuilder(args) 15 | .ConfigureWebHostDefaults(webBuilder => 16 | { 17 | webBuilder.UseStartup(); 18 | }); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.ExtensionSample.API/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:13682", 8 | "sslPort": 44370 9 | } 10 | }, 11 | "profiles": { 12 | "IIS Express": { 13 | "commandName": "IISExpress", 14 | "launchBrowser": true, 15 | "launchUrl": "weatherforecast", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "Twitch.ExtensionSample.API": { 21 | "commandName": "Project", 22 | "launchBrowser": true, 23 | "launchUrl": "weatherforecast", 24 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 25 | "environmentVariables": { 26 | "ASPNETCORE_ENVIRONMENT": "Development" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.ExtensionSample.API/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Builder; 2 | using Microsoft.AspNetCore.Hosting; 3 | using Microsoft.Extensions.Configuration; 4 | using Microsoft.Extensions.DependencyInjection; 5 | using Microsoft.Extensions.Hosting; 6 | 7 | namespace Twitch.ExtensionSample.API 8 | { 9 | public class Startup 10 | { 11 | public Startup(IConfiguration configuration) 12 | { 13 | Configuration = configuration; 14 | } 15 | 16 | public IConfiguration Configuration { get; } 17 | 18 | // This method gets called by the runtime. Use this method to add services to the container. 19 | public void ConfigureServices(IServiceCollection services) 20 | { 21 | services.AddCors(options => 22 | { 23 | options.AddPolicy("AllowAllHeaders", 24 | builder => 25 | { 26 | builder.AllowAnyOrigin() 27 | .AllowAnyHeader() 28 | .AllowAnyMethod(); 29 | }); 30 | }); 31 | 32 | services.AddSingleton(this.Configuration); 33 | 34 | services.AddControllers(); 35 | } 36 | 37 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 38 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 39 | { 40 | if (env.IsDevelopment()) 41 | { 42 | app.UseDeveloperExceptionPage(); 43 | } 44 | 45 | app.UseHttpsRedirection(); 46 | 47 | app.UseRouting(); 48 | 49 | app.UseCors("AllowAllHeaders"); 50 | 51 | app.UseAuthorization(); 52 | 53 | app.UseEndpoints(endpoints => 54 | { 55 | endpoints.MapControllers(); 56 | }); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.ExtensionSample.API/Twitch.ExtensionSample.API.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.ExtensionSample.API/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.ExtensionSample.API/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.PubSubSample.Console/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.PubSubSample.Console/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Twitch.PubSubSample.Console")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Twitch.PubSubSample.Console")] 13 | [assembly: AssemblyCopyright("Copyright © 2019")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("ee516d81-b761-4ed9-80fb-0710b293e5f7")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.PubSubSample.Console/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.WebhooksSample.API/Controllers/SampleController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | using System; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Twitch.Base.Models.NewAPI.Users; 6 | using Twitch.Webhooks.Base.Models; 7 | using Twitch.Webhooks.Base.Services; 8 | 9 | namespace Twitch.WebHooksSample.API.Controllers 10 | { 11 | [Route("api/[controller]")] 12 | [ApiController] 13 | public class SampleController : ControllerBase 14 | { 15 | private const string secret = null; 16 | 17 | private static UserModel user; 18 | 19 | [HttpGet("userchanged")] 20 | public ActionResult GetUserChanged() 21 | { 22 | WebhookSubscriptionVerificationModel verification = TwitchWebhookService.VerifySubscriptionRequest(this.Request); 23 | if (verification.IsSubscribe) 24 | { 25 | if (verification.IsSuccessful) 26 | { 27 | return this.Ok(verification.challenge); 28 | } 29 | else 30 | { 31 | return this.BadRequest(); 32 | } 33 | } 34 | else 35 | { 36 | return this.Ok(); 37 | } 38 | } 39 | 40 | [HttpPost("userchanged")] 41 | public async Task PostUserChanged() 42 | { 43 | try 44 | { 45 | WebhookResultModel result = await TwitchWebhookService.GetWebhookResult(this.Request, secret); 46 | if (result.IsVerified) 47 | { 48 | user = result.Data.FirstOrDefault(); 49 | } 50 | return this.Ok(); 51 | } 52 | catch (Exception) 53 | { 54 | return this.BadRequest(); 55 | } 56 | } 57 | 58 | [HttpGet("user")] 59 | public ActionResult GetUser() 60 | { 61 | return this.Ok(user); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.WebhooksSample.API/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Microsoft.AspNetCore.Hosting; 6 | using Microsoft.Extensions.Configuration; 7 | using Microsoft.Extensions.Hosting; 8 | using Microsoft.Extensions.Logging; 9 | 10 | namespace Twitch.WebHooksSample.API 11 | { 12 | public class Program 13 | { 14 | public static void Main(string[] args) 15 | { 16 | CreateHostBuilder(args).Build().Run(); 17 | } 18 | 19 | public static IHostBuilder CreateHostBuilder(string[] args) => 20 | Host.CreateDefaultBuilder(args) 21 | .ConfigureWebHostDefaults(webBuilder => 22 | { 23 | webBuilder.UseStartup(); 24 | }); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.WebhooksSample.API/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:56203", 8 | "sslPort": 44390 9 | } 10 | }, 11 | "profiles": { 12 | "IIS Express": { 13 | "commandName": "IISExpress", 14 | "launchBrowser": true, 15 | "launchUrl": "weatherforecast", 16 | "environmentVariables": { 17 | "ASPNETCORE_ENVIRONMENT": "Development" 18 | } 19 | }, 20 | "Twitch.WebHooksSample.API": { 21 | "commandName": "Project", 22 | "launchBrowser": true, 23 | "launchUrl": "weatherforecast", 24 | "applicationUrl": "https://localhost:5001;http://localhost:5000", 25 | "environmentVariables": { 26 | "ASPNETCORE_ENVIRONMENT": "Development" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.WebhooksSample.API/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Builder; 2 | using Microsoft.AspNetCore.Hosting; 3 | using Microsoft.Extensions.Configuration; 4 | using Microsoft.Extensions.DependencyInjection; 5 | using Microsoft.Extensions.Hosting; 6 | 7 | namespace Twitch.WebHooksSample.API 8 | { 9 | public class Startup 10 | { 11 | public Startup(IConfiguration configuration) 12 | { 13 | Configuration = configuration; 14 | } 15 | 16 | public IConfiguration Configuration { get; } 17 | 18 | // This method gets called by the runtime. Use this method to add services to the container. 19 | public void ConfigureServices(IServiceCollection services) 20 | { 21 | services.AddCors(options => 22 | { 23 | options.AddPolicy("AllowAllHeaders", 24 | builder => 25 | { 26 | builder.AllowAnyOrigin() 27 | .AllowAnyHeader() 28 | .AllowAnyMethod(); 29 | }); 30 | }); 31 | 32 | services.AddSingleton(this.Configuration); 33 | 34 | services.AddControllers(); 35 | } 36 | 37 | // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. 38 | public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 39 | { 40 | if (env.IsDevelopment()) 41 | { 42 | app.UseDeveloperExceptionPage(); 43 | } 44 | 45 | app.UseHttpsRedirection(); 46 | 47 | app.UseRouting(); 48 | 49 | app.UseCors("AllowAllHeaders"); 50 | 51 | app.UseAuthorization(); 52 | 53 | app.UseEndpoints(endpoints => 54 | { 55 | endpoints.MapControllers(); 56 | }); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.WebhooksSample.API/Twitch.WebhooksSample.API.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp3.1 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.WebhooksSample.API/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Twitch/Samples/Twitch.WebhooksSample.API/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.1.48.0/.signature.p7s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.1.48.0/.signature.p7s -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.1.48.0/NuGetIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.1.48.0/NuGetIcon.png -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.1.48.0/lib/net45/Google.Apis.PlatformServices.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.1.48.0/lib/net45/Google.Apis.PlatformServices.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.1.48.0/lib/net45/Google.Apis.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.1.48.0/lib/net45/Google.Apis.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.1.48.0/lib/netstandard1.3/Google.Apis.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.1.48.0/lib/netstandard1.3/Google.Apis.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.1.48.0/lib/netstandard2.0/Google.Apis.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.1.48.0/lib/netstandard2.0/Google.Apis.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.Auth.1.48.0/.signature.p7s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.Auth.1.48.0/.signature.p7s -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.Auth.1.48.0/NuGetIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.Auth.1.48.0/NuGetIcon.png -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.Auth.1.48.0/lib/net45/Google.Apis.Auth.PlatformServices.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.Auth.1.48.0/lib/net45/Google.Apis.Auth.PlatformServices.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.Auth.1.48.0/lib/net45/Google.Apis.Auth.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.Auth.1.48.0/lib/net45/Google.Apis.Auth.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.Auth.1.48.0/lib/netstandard1.3/Google.Apis.Auth.PlatformServices.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.Auth.1.48.0/lib/netstandard1.3/Google.Apis.Auth.PlatformServices.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.Auth.1.48.0/lib/netstandard1.3/Google.Apis.Auth.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.Auth.1.48.0/lib/netstandard1.3/Google.Apis.Auth.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.Auth.1.48.0/lib/netstandard2.0/Google.Apis.Auth.PlatformServices.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.Auth.1.48.0/lib/netstandard2.0/Google.Apis.Auth.PlatformServices.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.Auth.1.48.0/lib/netstandard2.0/Google.Apis.Auth.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.Auth.1.48.0/lib/netstandard2.0/Google.Apis.Auth.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.Core.1.48.0/.signature.p7s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.Core.1.48.0/.signature.p7s -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.Core.1.48.0/NuGetIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.Core.1.48.0/NuGetIcon.png -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.Core.1.48.0/lib/net45/Google.Apis.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.Core.1.48.0/lib/net45/Google.Apis.Core.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.Core.1.48.0/lib/netstandard1.3/Google.Apis.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.Core.1.48.0/lib/netstandard1.3/Google.Apis.Core.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.Core.1.48.0/lib/netstandard2.0/Google.Apis.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.Core.1.48.0/lib/netstandard2.0/Google.Apis.Core.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.YouTube.v3.1.47.0.2008/.signature.p7s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.YouTube.v3.1.47.0.2008/.signature.p7s -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.YouTube.v3.1.47.0.2008/lib/net40/Google.Apis.YouTube.v3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.YouTube.v3.1.47.0.2008/lib/net40/Google.Apis.YouTube.v3.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.YouTube.v3.1.47.0.2008/lib/net45/Google.Apis.YouTube.v3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.YouTube.v3.1.47.0.2008/lib/net45/Google.Apis.YouTube.v3.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.YouTube.v3.1.47.0.2008/lib/netstandard1.0/Google.Apis.YouTube.v3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.YouTube.v3.1.47.0.2008/lib/netstandard1.0/Google.Apis.YouTube.v3.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.YouTube.v3.1.47.0.2008/lib/netstandard1.3/Google.Apis.YouTube.v3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.YouTube.v3.1.47.0.2008/lib/netstandard1.3/Google.Apis.YouTube.v3.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.YouTube.v3.1.47.0.2008/lib/netstandard2.0/Google.Apis.YouTube.v3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.YouTube.v3.1.47.0.2008/lib/netstandard2.0/Google.Apis.YouTube.v3.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.YouTubePartner.v1.1.35.1.1334/.signature.p7s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.YouTubePartner.v1.1.35.1.1334/.signature.p7s -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.YouTubePartner.v1.1.35.1.1334/lib/net40/Google.Apis.YouTubePartner.v1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.YouTubePartner.v1.1.35.1.1334/lib/net40/Google.Apis.YouTubePartner.v1.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.YouTubePartner.v1.1.35.1.1334/lib/net45/Google.Apis.YouTubePartner.v1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.YouTubePartner.v1.1.35.1.1334/lib/net45/Google.Apis.YouTubePartner.v1.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.YouTubePartner.v1.1.35.1.1334/lib/netstandard1.0/Google.Apis.YouTubePartner.v1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.YouTubePartner.v1.1.35.1.1334/lib/netstandard1.0/Google.Apis.YouTubePartner.v1.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.YouTubePartner.v1.1.35.1.1334/lib/netstandard1.3/Google.Apis.YouTubePartner.v1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.YouTubePartner.v1.1.35.1.1334/lib/netstandard1.3/Google.Apis.YouTubePartner.v1.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Google.Apis.YouTubePartner.v1.1.35.1.1334/lib/netstandard2.0/Google.Apis.YouTubePartner.v1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Google.Apis.YouTubePartner.v1.1.35.1.1334/lib/netstandard2.0/Google.Apis.YouTubePartner.v1.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Newtonsoft.Json.12.0.3/.signature.p7s: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Newtonsoft.Json.12.0.3/.signature.p7s -------------------------------------------------------------------------------- /Twitch/Samples/packages/Newtonsoft.Json.12.0.3/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2007 James Newton-King 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/net20/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/net20/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/net35/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/net35/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/net40/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/net40/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/net45/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/net45/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/netstandard1.0/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/netstandard1.0/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/netstandard1.3/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/netstandard1.3/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/netstandard2.0/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/netstandard2.0/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/portable-net40+sl5+win8+wp8+wpa81/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/portable-net40+sl5+win8+wp8+wpa81/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/portable-net45+win8+wp8+wpa81/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Newtonsoft.Json.12.0.3/lib/portable-net45+win8+wp8+wpa81/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /Twitch/Samples/packages/Newtonsoft.Json.12.0.3/packageIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/Twitch/Samples/packages/Newtonsoft.Json.12.0.3/packageIcon.png -------------------------------------------------------------------------------- /Twitch/Twitch.Base.UnitTests/NewAPI/AdsServiceUnitTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using Twitch.Base.Models.NewAPI.Ads; 3 | using Twitch.Base.Models.NewAPI.Users; 4 | 5 | namespace Twitch.Base.UnitTests.NewAPI 6 | { 7 | [TestClass] 8 | public class AdsServiceUnitTests : UnitTestBase 9 | { 10 | [TestMethod] 11 | public void RunAd() 12 | { 13 | TestWrapper(async (TwitchConnection connection) => 14 | { 15 | UserModel channel = await connection.NewAPI.Users.GetCurrentUser(); 16 | 17 | Assert.IsNotNull(channel); 18 | 19 | AdResponseModel result = await connection.NewAPI.Ads.RunAd(channel, 30); 20 | 21 | Assert.IsNotNull(result); 22 | Assert.IsTrue(string.IsNullOrEmpty(result.message)); 23 | }); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base.UnitTests/NewAPI/BitsServiceUnitTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using Twitch.Base.Models.NewAPI.Bits; 3 | 4 | namespace Twitch.Base.UnitTests.NewAPI 5 | { 6 | [TestClass] 7 | public class BitsServiceUnitTests : UnitTestBase 8 | { 9 | [TestMethod] 10 | public void GetBitsLeaderboard() 11 | { 12 | TestWrapper(async (TwitchConnection connection) => 13 | { 14 | BitsLeaderboardModel result = await connection.NewAPI.Bits.GetBitsLeaderboard(); 15 | 16 | Assert.IsNotNull(result); 17 | Assert.IsTrue(result.users.Count > 0); 18 | }); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base.UnitTests/NewAPI/ChatServiceUnitTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Twitch.Base.Models.NewAPI.Chat; 5 | using Twitch.Base.Models.NewAPI.Users; 6 | 7 | namespace Twitch.Base.UnitTests.NewAPI 8 | { 9 | [TestClass] 10 | public class ChatServiceUnitTests : UnitTestBase 11 | { 12 | [TestMethod] 13 | public void GetChannelChatBadges() 14 | { 15 | TestWrapper(async (TwitchConnection connection) => 16 | { 17 | UserModel user = await UsersServiceUnitTests.GetCurrentUser(connection); 18 | Assert.IsNotNull(user); 19 | 20 | IEnumerable badges = await connection.NewAPI.Chat.GetChannelChatBadges(user); 21 | Assert.IsNotNull(badges); 22 | Assert.IsTrue(badges.Count() > 0); 23 | }); 24 | } 25 | 26 | [TestMethod] 27 | public void GetGlobalChatBadges() 28 | { 29 | TestWrapper(async (TwitchConnection connection) => 30 | { 31 | IEnumerable badges = await connection.NewAPI.Chat.GetGlobalChatBadges(); 32 | Assert.IsNotNull(badges); 33 | Assert.IsTrue(badges.Count() > 0); 34 | }); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base.UnitTests/NewAPI/GamesServiceUnitTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Twitch.Base.Models.NewAPI.Games; 5 | 6 | namespace Twitch.Base.UnitTests.NewAPI 7 | { 8 | [TestClass] 9 | public class GamesServiceUnitTests : UnitTestBase 10 | { 11 | [TestMethod] 12 | public void GetTopGames() 13 | { 14 | TestWrapper(async (TwitchConnection connection) => 15 | { 16 | IEnumerable results = await connection.NewAPI.Games.GetTopGames(); 17 | 18 | Assert.IsNotNull(results); 19 | Assert.IsTrue(results.Count() > 0); 20 | }); 21 | } 22 | 23 | [TestMethod] 24 | public void GetGameByID() 25 | { 26 | TestWrapper(async (TwitchConnection connection) => 27 | { 28 | IEnumerable results = await connection.NewAPI.Games.GetGamesByName("Fortnite"); 29 | 30 | Assert.IsNotNull(results); 31 | Assert.IsTrue(results.Count() > 0); 32 | 33 | GameModel result = await connection.NewAPI.Games.GetGameByID(results.First().id); 34 | 35 | Assert.IsNotNull(result); 36 | Assert.IsNotNull(result.id); 37 | Assert.AreEqual(results.First().id, result.id); 38 | }); 39 | } 40 | 41 | [TestMethod] 42 | public void GetGamesByName() 43 | { 44 | TestWrapper(async (TwitchConnection connection) => 45 | { 46 | IEnumerable results = await connection.NewAPI.Games.GetGamesByName("Fortnite"); 47 | 48 | Assert.IsNotNull(results); 49 | Assert.IsTrue(results.Count() > 0); 50 | }); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base.UnitTests/NewAPI/ScheduleServiceUnitTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using Twitch.Base.Models.NewAPI.Schedule; 3 | using Twitch.Base.Models.NewAPI.Users; 4 | 5 | namespace Twitch.Base.UnitTests.NewAPI 6 | { 7 | [TestClass] 8 | public class ScheduleServiceUnitTests : UnitTestBase 9 | { 10 | [TestMethod] 11 | public void GetSchedule() 12 | { 13 | TestWrapper(async (TwitchConnection connection) => 14 | { 15 | UserModel broadcaster = await UsersServiceUnitTests.GetCurrentUser(connection); 16 | 17 | ScheduleModel schedule = await connection.NewAPI.Schedule.GetSchedule(broadcaster, 5); 18 | 19 | Assert.IsNotNull(schedule); 20 | Assert.IsNotNull(schedule.segments); 21 | Assert.IsTrue(schedule.segments.Count > 0); 22 | }); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base.UnitTests/NewAPI/SubscriptionsServiceUnitTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Twitch.Base.Models.NewAPI.Subscriptions; 5 | using Twitch.Base.Models.NewAPI.Users; 6 | 7 | namespace Twitch.Base.UnitTests.NewAPI 8 | { 9 | [TestClass] 10 | public class SubscriptionsServiceUnitTests : UnitTestBase 11 | { 12 | [TestMethod] 13 | public void GetBroadcasterSubscriptions() 14 | { 15 | TestWrapper(async (TwitchConnection connection) => 16 | { 17 | UserModel user = await UsersServiceUnitTests.GetCurrentUser(connection); 18 | 19 | IEnumerable results = await connection.NewAPI.Subscriptions.GetBroadcasterSubscriptions(user); 20 | 21 | Assert.IsNotNull(results); 22 | Assert.IsTrue(results.Count() > 0); 23 | }); 24 | } 25 | 26 | [TestMethod] 27 | public void GetSpecificBroadcasterSubscriptions() 28 | { 29 | TestWrapper(async (TwitchConnection connection) => 30 | { 31 | UserModel broadcaster = await UsersServiceUnitTests.GetCurrentUser(connection); 32 | UserModel user = await connection.NewAPI.Users.GetUserByLogin("Ninja"); 33 | 34 | IEnumerable results = await connection.NewAPI.Subscriptions.GetBroadcasterSubscriptions(broadcaster, new List() { user.id }); 35 | 36 | Assert.IsNotNull(results); 37 | Assert.IsTrue(results.Count() > 0); 38 | }); 39 | } 40 | 41 | [TestMethod] 42 | public void GetBroadcasterSubscriptionsCount() 43 | { 44 | TestWrapper(async (TwitchConnection connection) => 45 | { 46 | UserModel user = await UsersServiceUnitTests.GetCurrentUser(connection); 47 | 48 | long result = await connection.NewAPI.Subscriptions.GetBroadcasterSubscriptionsCount(user); 49 | 50 | Assert.IsTrue(result > 0); 51 | }); 52 | } 53 | 54 | [TestMethod] 55 | public void GetBroadcasterSubscriptionPoints() 56 | { 57 | TestWrapper(async (TwitchConnection connection) => 58 | { 59 | UserModel user = await UsersServiceUnitTests.GetCurrentUser(connection); 60 | 61 | long result = await connection.NewAPI.Subscriptions.GetBroadcasterSubscriptionPoints(user); 62 | 63 | Assert.IsTrue(result > 0); 64 | }); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base.UnitTests/NewAPI/TeamsServiceUnitTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using Twitch.Base.Models.NewAPI.Teams; 5 | using Twitch.Base.Models.NewAPI.Users; 6 | 7 | namespace Twitch.Base.UnitTests.NewAPI 8 | { 9 | [TestClass] 10 | public class TeamsServiceUnitTests : UnitTestBase 11 | { 12 | [TestMethod] 13 | public void GetChannelTeams() 14 | { 15 | TestWrapper(async (TwitchConnection connection) => 16 | { 17 | UserModel user = await UsersServiceUnitTests.GetCurrentUser(connection); 18 | 19 | IEnumerable results = await connection.NewAPI.Teams.GetChannelTeams(user); 20 | 21 | Assert.IsNotNull(results); 22 | Assert.IsTrue(results.Count() > 0); 23 | }); 24 | } 25 | 26 | [TestMethod] 27 | public void GetTeam() 28 | { 29 | TestWrapper(async (TwitchConnection connection) => 30 | { 31 | UserModel user = await UsersServiceUnitTests.GetCurrentUser(connection); 32 | 33 | IEnumerable results = await connection.NewAPI.Teams.GetChannelTeams(user); 34 | 35 | Assert.IsNotNull(results); 36 | Assert.IsTrue(results.Count() > 0); 37 | 38 | TeamDetailsModel team = await connection.NewAPI.Teams.GetTeam(results.First().id); 39 | 40 | Assert.IsNotNull(team); 41 | Assert.AreEqual(results.First().id, team.id); 42 | }); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base.UnitTests/Twitch.Base.UnitTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base.UnitTests/TwitchConnectionUnitTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using StreamingClient.Base.Model.OAuth; 3 | using System.Threading.Tasks; 4 | 5 | namespace Twitch.Base.UnitTests 6 | { 7 | [TestClass] 8 | public class TwitchConnectionUnitTests : UnitTestBase 9 | { 10 | [TestMethod] 11 | public void AuthorizeViaOAuthRedirect() 12 | { 13 | TestWrapper((TwitchConnection connection) => 14 | { 15 | return Task.FromResult(0); 16 | }); 17 | } 18 | 19 | [TestMethod] 20 | public void GetAuthorizationCodeURLForOAuth() 21 | { 22 | string url = TwitchConnection.GetAuthorizationCodeURLForOAuthBrowser(clientID, scopes, TwitchConnection.DEFAULT_OAUTH_LOCALHOST_URL).Result; 23 | Assert.IsNotNull(url); 24 | } 25 | 26 | [TestMethod] 27 | public void RefreshToken() 28 | { 29 | TestWrapper(async (TwitchConnection connection) => 30 | { 31 | OAuthTokenModel token = connection.GetOAuthTokenCopy(); 32 | Assert.IsNotNull(token); 33 | 34 | await connection.RefreshOAuthToken(); 35 | token = connection.GetOAuthTokenCopy(); 36 | Assert.IsNotNull(token); 37 | }); 38 | } 39 | 40 | [TestMethod] 41 | public void ConnectWithOldOAuthToken() 42 | { 43 | TestWrapper(async (TwitchConnection connection) => 44 | { 45 | TwitchConnection connection2 = await TwitchConnection.ConnectViaOAuthToken(connection.GetOAuthTokenCopy()); 46 | 47 | TwitchConnection connection3 = await TwitchConnection.ConnectViaOAuthToken(connection2.GetOAuthTokenCopy()); 48 | }); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Clients/FDGTChatClient.cs: -------------------------------------------------------------------------------- 1 | using StreamingClient.Base.Util; 2 | using System.Threading.Tasks; 3 | 4 | namespace Twitch.Base.Clients 5 | { 6 | /// 7 | /// IRC client for interacting with the mock FDGT Chat service. 8 | /// 9 | public class FDGTChatClient : ChatClient 10 | { 11 | /// 12 | /// The default Chat connection url. 13 | /// 14 | public const string FDGT_CHAT_CONNECTION_URL = "wss://irc.fdgt.dev"; 15 | 16 | /// 17 | /// Creates a new instance of the FDGTChatClient class. 18 | /// 19 | /// The current connection 20 | public FDGTChatClient(TwitchConnection connection) : base(connection) { } 21 | 22 | /// 23 | /// Connects to the default ChatClient connection. 24 | /// 25 | /// An awaitable Task 26 | public override async Task Connect() { await this.Connect(FDGTChatClient.FDGT_CHAT_CONNECTION_URL); } 27 | 28 | /// 29 | /// Sends a test message to trigger an event through FDGT. 30 | /// 31 | /// The message to send 32 | /// An awaitable Task 33 | public async Task SendTestMessage(string message) 34 | { 35 | Validator.ValidateString(message, "message"); 36 | await this.Send(string.Format("PRIVMSG #channel :{0}", message)); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/Chat/ChatClearChatPacketModel.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Twitch.Base.Models.Clients.Chat 4 | { 5 | /// 6 | /// Information about a chat clear packet. 7 | /// 8 | public class ChatClearChatPacketModel : ChatPacketModelBase 9 | { 10 | /// 11 | /// The ID of the command for a chat clear. 12 | /// 13 | public const string CommandID = "CLEARCHAT"; 14 | 15 | /// 16 | /// The user's ID who was purged, if any. 17 | /// 18 | public string UserID { get; set; } 19 | 20 | /// 21 | /// The user's login name who was purged, if any. 22 | /// 23 | public string UserLogin { get; set; } 24 | 25 | /// 26 | /// The time of the ban in seconds. A value of 0 is a permanent ban. 27 | /// 28 | public long BanDuration { get; set; } = 0; 29 | 30 | /// 31 | /// Creates a new instance of the ChatClearChatPacketModel class. 32 | /// 33 | /// The Chat packet 34 | public ChatClearChatPacketModel(ChatRawPacketModel packet) 35 | : base(packet) 36 | { 37 | if (packet.Parameters.Count > 1) 38 | { 39 | this.UserLogin = packet.Parameters.Last(); 40 | } 41 | this.UserID = packet.GetTagString("target-user-id"); 42 | this.BanDuration = packet.GetTagLong("ban-duration"); 43 | } 44 | 45 | /// 46 | /// Indicates if this was a regular chat clear and not directed at a specific user. 47 | /// 48 | public bool IsClear { get { return string.IsNullOrEmpty(this.UserID); } } 49 | 50 | /// 51 | /// Indicates if this is a timeout of a specific user. 52 | /// 53 | public bool IsTimeout { get { return !string.IsNullOrEmpty(this.UserID) && this.BanDuration > 0; } } 54 | 55 | /// 56 | /// Indicates if this is a ban of a specific user. 57 | /// 58 | public bool IsBan { get { return !string.IsNullOrEmpty(this.UserID) && this.BanDuration == 0; } } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/Chat/ChatClearMessagePacketModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.Clients.Chat 2 | { 3 | /// 4 | /// Information about a chat message clear packet. 5 | /// 6 | public class ChatClearMessagePacketModel : ChatPacketModelBase 7 | { 8 | /// 9 | /// The ID of the command for a chat message clear. 10 | /// 11 | public const string CommandID = "CLEARMSG"; 12 | 13 | /// 14 | /// The ID of the message. 15 | /// 16 | public string ID { get; set; } 17 | 18 | /// 19 | /// The user's login name. 20 | /// 21 | public string UserLogin { get; set; } 22 | 23 | /// 24 | /// The message text. 25 | /// 26 | public string Message { get; set; } 27 | 28 | /// 29 | /// Creates a new instance of the ChatClearMessagePacketModel class. 30 | /// 31 | /// The Chat packet 32 | public ChatClearMessagePacketModel(ChatRawPacketModel packet) 33 | : base(packet) 34 | { 35 | this.ID = packet.GetTagString("target-msg-id"); 36 | this.UserLogin = packet.GetTagString("login"); 37 | this.Message = packet.Get1SkippedParameterText; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/Chat/ChatGlobalUserStatePacketModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Twitch.Base.Models.Clients.Chat 4 | { 5 | /// 6 | /// Information about a chat global user state packet. 7 | /// 8 | public class ChatGlobalUserStatePacketModel : ChatUserStatePacketModel 9 | { 10 | /// 11 | /// The ID of the command for a chat global user state. 12 | /// 13 | public new const string CommandID = "GLOBALUSERSTATE"; 14 | 15 | /// 16 | /// The user’s ID. 17 | /// 18 | public long UserID { get; set; } 19 | 20 | /// 21 | /// Creates a new instance of the ChatUserStatePacketModel class. 22 | /// 23 | /// The Chat packet 24 | public ChatGlobalUserStatePacketModel(ChatRawPacketModel packet) 25 | : base(packet) 26 | { 27 | this.UserID = packet.GetTagLong("user-id"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/Chat/ChatNoticePacketModel.cs: -------------------------------------------------------------------------------- 1 | using StreamingClient.Base.Util; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Twitch.Base.Models.Clients.Chat 7 | { 8 | /// 9 | /// Information about a chat notice packet. 10 | /// 11 | public class ChatNoticePacketModel : ChatPacketModelBase 12 | { 13 | /// 14 | /// The ID of the command for a chat notice. 15 | /// 16 | public const string CommandID = "NOTICE"; 17 | 18 | /// 19 | /// The message ID associated with notice. 20 | /// 21 | public string MessageID { get; set; } 22 | 23 | /// 24 | /// The message of the notice 25 | /// 26 | public string Message { get; set; } 27 | 28 | /// 29 | /// Creates a new instance of the ChatNoticePacketModel class. 30 | /// 31 | /// The Chat packet 32 | public ChatNoticePacketModel(ChatRawPacketModel packet) 33 | : base(packet) 34 | { 35 | this.MessageID = packet.GetTagString("msg-id"); 36 | this.Message = packet.Get1SkippedParameterText; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/Chat/ChatPacketModelBase.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Twitch.Base.Models.Clients.Chat 4 | { 5 | /// 6 | /// Information about a base chat packet. 7 | /// 8 | public class ChatPacketModelBase 9 | { 10 | /// 11 | /// The raw packet information. 12 | /// 13 | public ChatRawPacketModel RawPacket { get; set; } 14 | 15 | /// 16 | /// Creates a new instance of the ChatPacketModelBase class. 17 | /// 18 | public ChatPacketModelBase() { } 19 | 20 | /// 21 | /// Creates a new instance of the ChatPacketModelBase class. 22 | /// 23 | /// The raw Chat packet 24 | public ChatPacketModelBase(ChatRawPacketModel rawPacket) 25 | { 26 | this.RawPacket = rawPacket; 27 | } 28 | 29 | /// 30 | /// Creates a dictionary for badge information from a text list. 31 | /// 32 | /// The text list of badge information 33 | /// The dictionary of badge information 34 | protected Dictionary ParseBadgeDictionary(string list) 35 | { 36 | Dictionary results = new Dictionary(); 37 | if (!string.IsNullOrEmpty(list)) 38 | { 39 | string[] splits = list.Split(new char[] { ',', '/' }); 40 | if (splits != null && splits.Length > 0 && splits.Length % 2 == 0) 41 | { 42 | for (int i = 0; i < splits.Length; i = i + 2) 43 | { 44 | if (int.TryParse(splits[i + 1], out int version)) 45 | { 46 | results[splits[i]] = version; 47 | } 48 | } 49 | } 50 | } 51 | return results; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/Chat/ChatRoomStatePacketModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.Clients.Chat 2 | { 3 | /// 4 | /// Information about a chat room state packet. 5 | /// 6 | public class ChatRoomStatePacketModel : ChatPacketModelBase 7 | { 8 | /// 9 | /// The ID of the command for a chat user join. 10 | /// 11 | public const string CommandID = "ROOMSTATE"; 12 | 13 | /// 14 | /// Indicates whether the chat is in emote-only mode. 15 | /// 16 | public bool EmoteOnly { get; set; } 17 | 18 | /// 19 | /// Indicates whether the chat is in followers-only mode. 20 | /// 21 | /// Any non-negative number indicates the chat is follower-only and any positive number indicates how many minutes a user must be following for to chat. 22 | /// 23 | public int FollowersOnly { get; set; } 24 | 25 | /// 26 | /// Indicates whether the chat is in r9k-only mode. 27 | /// 28 | public bool R9K { get; set; } 29 | 30 | /// 31 | /// he number of seconds chatters without moderator privileges must wait between sending messages. 32 | /// 33 | public int Slow { get; set; } 34 | 35 | /// 36 | /// Indicates whether the chat is in subs-only mode. 37 | /// 38 | public bool SubsOnly { get; set; } 39 | 40 | /// 41 | /// Creates a new instance of the ChatRoomStatePacketModel class. 42 | /// 43 | /// The Chat packet 44 | public ChatRoomStatePacketModel(ChatRawPacketModel packet) 45 | : base(packet) 46 | { 47 | this.EmoteOnly = packet.GetTagBool("emote-only"); 48 | this.FollowersOnly = packet.GetTagInt("followers-only"); 49 | this.R9K = packet.GetTagBool("r9k"); 50 | this.Slow = packet.GetTagInt("slow"); 51 | this.SubsOnly = packet.GetTagBool("subs-only"); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/Chat/ChatUserJoinPacketModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.Clients.Chat 2 | { 3 | /// 4 | /// Information about a chat user join packet. 5 | /// 6 | public class ChatUserJoinPacketModel : ChatPacketModelBase 7 | { 8 | /// 9 | /// The ID of the command for a chat user join. 10 | /// 11 | public const string CommandID = "JOIN"; 12 | 13 | /// 14 | /// The user's login name. 15 | /// 16 | public string UserLogin { get; set; } 17 | 18 | /// 19 | /// Creates a new instance of the ChatUserJoinPacketModel class. 20 | /// 21 | /// The Chat packet 22 | public ChatUserJoinPacketModel(ChatRawPacketModel packet) 23 | : base(packet) 24 | { 25 | this.UserLogin = packet.GetUserLogin; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/Chat/ChatUserLeavePacketModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.Clients.Chat 2 | { 3 | /// 4 | /// Information about a chat user leave packet. 5 | /// 6 | public class ChatUserLeavePacketModel : ChatPacketModelBase 7 | { 8 | /// 9 | /// The ID of the command for a chat user leave. 10 | /// 11 | public const string CommandID = "PART"; 12 | 13 | /// 14 | /// The user's login name. 15 | /// 16 | public string UserLogin { get; set; } 17 | 18 | /// 19 | /// Creates a new instance of the ChatUserLeavePacketModel class. 20 | /// 21 | /// The Chat packet 22 | public ChatUserLeavePacketModel(ChatRawPacketModel packet) 23 | : base(packet) 24 | { 25 | this.UserLogin = packet.GetUserLogin; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/Chat/ChatUserPacketModelBase.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Twitch.Base.Models.Clients.Chat 4 | { 5 | /// 6 | /// Base class for user-based chat packets. 7 | /// 8 | public class ChatUserPacketModelBase : ChatPacketModelBase 9 | { 10 | /// 11 | /// The user's display name. 12 | /// 13 | public string UserDisplayName { get; set; } 14 | 15 | /// 16 | /// The user's badge information. 17 | /// 18 | public string UserBadgeInfo { get; set; } 19 | 20 | /// 21 | /// The user's badges. 22 | /// 23 | public string UserBadges { get; set; } 24 | 25 | /// 26 | /// Hexadecimal RGB color code of the message, if any. 27 | /// 28 | public string Color { get; set; } 29 | 30 | /// 31 | /// Creates a new instance of the ChatUserStatePacketModel class. 32 | /// 33 | /// The Chat packet 34 | public ChatUserPacketModelBase(ChatRawPacketModel packet) 35 | : base(packet) 36 | { 37 | this.UserDisplayName = packet.GetTagString("display-name"); 38 | this.UserBadgeInfo = packet.GetTagString("badge-info"); 39 | this.UserBadges = packet.GetTagString("badges"); 40 | this.Color = packet.GetTagString("color"); 41 | } 42 | 43 | /// 44 | /// A dictionary containing the user's badges and associated versions. 45 | /// 46 | public Dictionary BadgeDictionary { get { return this.ParseBadgeDictionary(this.UserBadges); } } 47 | 48 | /// 49 | /// A dictionary containing the user's badges and associated versions. 50 | /// 51 | public Dictionary BadgeInfoDictionary { get { return this.ParseBadgeDictionary(this.UserBadgeInfo); } } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/Chat/ChatUserStatePacketModel.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System.Collections.Generic; 3 | 4 | namespace Twitch.Base.Models.Clients.Chat 5 | { 6 | /// 7 | /// Information about a chat user state packet. 8 | /// 9 | public class ChatUserStatePacketModel : ChatUserPacketModelBase 10 | { 11 | /// 12 | /// The ID of the command for a chat user state. 13 | /// 14 | public const string CommandID = "USERSTATE"; 15 | 16 | /// 17 | /// Indicates whether the user is a moderator. 18 | /// 19 | public bool Moderator { get; set; } 20 | 21 | /// 22 | /// Information to the user's emote sets. 23 | /// 24 | public string EmoteSets { get; set; } 25 | 26 | /// 27 | /// Creates a new instance of the ChatUserStatePacketModel class. 28 | /// 29 | /// The Chat packet 30 | public ChatUserStatePacketModel(ChatRawPacketModel packet) 31 | : base(packet) 32 | { 33 | this.Moderator = packet.GetTagBool("mod"); 34 | this.EmoteSets = packet.GetTagString("emote-sets"); 35 | } 36 | 37 | /// 38 | /// A list containing the user's available emote set IDs. 39 | /// 40 | public IEnumerable EmoteSetsDictionary 41 | { 42 | get 43 | { 44 | HashSet results = new HashSet(); 45 | if (!string.IsNullOrEmpty(this.EmoteSets)) 46 | { 47 | string[] splits = this.EmoteSets.Split(new char[] { ',' }); 48 | if (splits != null) 49 | { 50 | results = new HashSet(splits); 51 | results.Remove("0"); 52 | } 53 | } 54 | return results; 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/Chat/ChatUsersListPacketModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | namespace Twitch.Base.Models.Clients.Chat 6 | { 7 | /// 8 | /// Information about a user list in chat. 9 | /// 10 | public class ChatUsersListPacketModel : ChatPacketModelBase 11 | { 12 | /// 13 | /// The command ID of the reply to the NAMES command. 14 | /// 15 | public const string CommandID = "353"; 16 | 17 | /// 18 | /// The list of user logins. 19 | /// 20 | public List UserLogins { get; set; } 21 | 22 | /// 23 | /// Creates a new instance of the ChatUsersListPacketModel class. 24 | /// 25 | /// The Chat packet 26 | public ChatUsersListPacketModel(ChatRawPacketModel packet) 27 | : base(packet) 28 | { 29 | this.UserLogins = packet.Parameters.Last().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries).ToList(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/Chat/ChatWhisperMessagePacketModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Twitch.Base.Models.Clients.Chat 4 | { 5 | /// 6 | /// Information about a Chat whisper message packet. 7 | /// 8 | public class ChatWhisperMessagePacketModel : ChatMessagePacketModel 9 | { 10 | /// 11 | /// The ID of the command for a chat message. 12 | /// 13 | new public const string CommandID = "WHISPER"; 14 | 15 | /// 16 | /// Creates a new instance of the ChatWhisperMessagePacketModel 17 | /// 18 | /// 19 | public ChatWhisperMessagePacketModel(ChatRawPacketModel packet) : base(packet) 20 | { 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/EventSub/EventSubMessageBase.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.Clients.EventSub 2 | { 3 | /// 4 | /// A base class with no payload for the EventSub messages. 5 | /// 6 | public abstract class EventSubMessageBase 7 | { 8 | /// 9 | /// The message metadata including information about the message type. 10 | /// 11 | public MessageMetadata Metadata { get; set; } 12 | } 13 | 14 | /// 15 | /// A base class with a typed payload for the EventSub messages. 16 | /// 17 | public abstract class EventSubMessageBase : EventSubMessageBase 18 | { 19 | /// 20 | /// The payload which is different depending on the message type. 21 | /// 22 | public T Payload { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/EventSub/KeepAliveMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.Clients.EventSub 2 | { 3 | /// 4 | /// The KeepAlive message just indicates that the service is still connected. 5 | /// 6 | public class KeepAliveMessage : EventSubMessageBase 7 | { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/EventSub/MessageMetadata.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | 4 | namespace Twitch.Base.Models.Clients.EventSub 5 | { 6 | /// 7 | /// An object that identifies the message. 8 | /// 9 | public class MessageMetadata 10 | { 11 | /// 12 | /// An ID that uniquely identifies the message. Twitch sends messages at least once, 13 | /// but if Twitch is unsure of whether you received a notification, it’ll resend the 14 | /// message. This means you may receive a notification twice. If Twitch resends the message, 15 | /// the message ID will be the same. 16 | /// 17 | [JsonProperty("message_id")] 18 | public string MessageId { get; set; } 19 | 20 | /// 21 | /// The type of message. 22 | /// 23 | [JsonProperty("message_type")] 24 | public MessageType MessageType { get; set; } 25 | 26 | /// 27 | /// The UTC date and time that the message was sent. 28 | /// 29 | [JsonProperty("message_timestamp")] 30 | public DateTimeOffset MessageTimeStamp { get; set; } 31 | 32 | /// 33 | /// The type of event sent in the message. 34 | /// 35 | [JsonProperty("subscription_type")] 36 | public string SubscriptionType { get; set; } 37 | 38 | /// 39 | /// The version number of the subscription type’s definition. 40 | /// This is the same value specified in the subscription request. 41 | /// 42 | [JsonProperty("subscription_version")] 43 | public string SubscriptionVersion { get; set; } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/EventSub/MessageType.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.Clients.EventSub 2 | { 3 | /// 4 | /// The type of message. 5 | /// 6 | public enum MessageType 7 | { 8 | /// 9 | /// Used to indicate a welcome message. 10 | /// 11 | /// 12 | session_welcome, 13 | 14 | /// 15 | /// Used to indicate a keepalive message. 16 | /// 17 | /// 18 | session_keepalive, 19 | 20 | /// 21 | /// Used to indicate a reconnect message. 22 | /// 23 | /// 24 | session_reconnect, 25 | 26 | /// 27 | /// Used to indicate a notification message. 28 | /// 29 | /// 30 | notification, 31 | 32 | /// 33 | /// Used to indicate a revokation message. 34 | /// 35 | /// 36 | revocation, 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/EventSub/NotificationMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.Clients.EventSub 2 | { 3 | /// 4 | /// Contains information about a notification for a subscription. 5 | /// 6 | /// 7 | public class NotificationMessage : EventSubMessageBase 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/EventSub/NotificationMessagePayload.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | 3 | namespace Twitch.Base.Models.Clients.EventSub 4 | { 5 | /// 6 | /// The notification information such as the subscription and event details. 7 | /// 8 | /// 9 | public class NotificationMessagePayload 10 | { 11 | /// 12 | /// The subscription details. 13 | /// 14 | public Subscription Subscription { get; set; } 15 | 16 | /// 17 | /// The event details which can parsed using this documentation: 18 | /// https://dev.twitch.tv/docs/eventsub/eventsub-reference#events 19 | /// 20 | public JObject Event { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/EventSub/ReconnectMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.Clients.EventSub 2 | { 3 | /// 4 | /// The reconnect message indicates the server is going to disconnect you and requests 5 | /// that you reconnect on the supplied URL. 6 | /// 7 | /// 8 | public class ReconnectMessage : EventSubMessageBase 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/EventSub/ReconnectMessagePayload.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.Clients.EventSub 2 | { 3 | /// 4 | /// Contains information about the session. 5 | /// 6 | /// 7 | public class ReconnectMessagePayload 8 | { 9 | /// 10 | /// The session information. 11 | /// 12 | public Session Session { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/EventSub/RevocationMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.Clients.EventSub 2 | { 3 | /// 4 | /// The server has been told to revoke a subscription. 5 | /// 6 | /// 7 | public class RevocationMessage : EventSubMessageBase 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/EventSub/RevocationMessagePayload.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.Clients.EventSub 2 | { 3 | /// 4 | /// The payload containing the revoked subscription. 5 | /// 6 | public class RevocationMessagePayload 7 | { 8 | /// 9 | /// The subscription being revoked. 10 | /// 11 | public Subscription Subscription { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/EventSub/Session.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using System; 3 | 4 | namespace Twitch.Base.Models.Clients.EventSub 5 | { 6 | /// 7 | /// An object that contains information about the connection. 8 | /// 9 | public class Session 10 | { 11 | /// 12 | /// An ID that uniquely identifies this WebSocket connection. 13 | /// 14 | public string Id { get; set; } 15 | 16 | /// 17 | /// The connection’s status. 18 | /// 19 | public string Status { get; set; } 20 | 21 | /// 22 | /// The maximum number of seconds that you should expect silence before receiving a keepalive message. 23 | /// 24 | [JsonProperty("keepalive_timeout_seconds")] 25 | public int? KeepaliveTimeoutSeconds { get; set; } 26 | 27 | /// 28 | /// The URL to reconnect to. The connection automatically includes the subscriptions from the old connection. 29 | /// 30 | [JsonProperty("reconnect_url")] 31 | public string ReconnectUrl { get; set; } 32 | 33 | /// 34 | /// The UTC date and time when the connection was created. 35 | /// 36 | [JsonProperty("connected_at")] 37 | public DateTimeOffset ConnectedAt { get; set; } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/EventSub/Subscription.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using System; 3 | 4 | namespace Twitch.Base.Models.Clients.EventSub 5 | { 6 | /// 7 | /// An object that contains information about your subscription. 8 | /// 9 | public class Subscription 10 | { 11 | /// 12 | /// An ID that uniquely identifies this subscription. 13 | /// 14 | public string Id { get; set; } 15 | 16 | /// 17 | /// The subscription’s status, which is set to enabled. 18 | /// 19 | public string Status { get; set; } 20 | 21 | /// 22 | /// The type of event sent in the message. 23 | /// 24 | public string Type { get; set; } 25 | 26 | /// 27 | /// The version number of the subscription type’s definition. 28 | /// 29 | public string Version { get; set; } 30 | 31 | /// 32 | /// The event’s cost. 33 | /// 34 | public string Cost { get; set; } 35 | 36 | /// 37 | /// The conditions under which the event fires. For example, if you requested 38 | /// notifications when a broadcaster gets a new follower, this object contains the broadcaster’s ID. 39 | /// 40 | public JObject Condition { get; set; } 41 | 42 | /// 43 | /// An object that contains information about the transport used for notifications. 44 | /// 45 | public Transport Transport { get; set; } 46 | 47 | /// 48 | /// The UTC date and time that the subscription was created. 49 | /// 50 | public DateTimeOffset CreatedAt { get; set; } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/EventSub/Transport.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Twitch.Base.Models.Clients.EventSub 4 | { 5 | /// 6 | /// An object that contains information about the transport used for notifications. 7 | /// 8 | public class Transport 9 | { 10 | /// 11 | /// The transport method. 12 | /// 13 | public string Method { get; set; } 14 | 15 | /// 16 | /// An ID that uniquely identifies the WebSocket. 17 | /// 18 | [JsonProperty("session_id")] 19 | public string SessionId { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/EventSub/WelcomeMessage.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.Clients.EventSub 2 | { 3 | /// 4 | /// Contains information about the connected session. 5 | /// 6 | /// 7 | public class WelcomeMessage : EventSubMessageBase 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/EventSub/WelcomeMessagePayload.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.Clients.EventSub 2 | { 3 | /// 4 | /// Contains information about the session. 5 | /// 6 | /// 7 | public class WelcomeMessagePayload 8 | { 9 | /// 10 | /// The session information. 11 | /// 12 | public Session Session { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/PubSub/Messages/PubSubBitBadgeEventModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.Clients.PubSub.Messages 2 | { 3 | /// 4 | /// Information about a Bits Badge. 5 | /// 6 | public class PubSubBitBadgeEventModel 7 | { 8 | /// 9 | /// ID of user who earned the new Bits badge 10 | /// 11 | public string user_id { get; set; } 12 | /// 13 | /// Login of user who earned the new Bits badge 14 | /// 15 | public string user_name { get; set; } 16 | /// 17 | /// ID of channel where user earned the new Bits badge 18 | /// 19 | public string channel_id { get; set; } 20 | /// 21 | /// Login of channel where user earned the new Bits badge 22 | /// 23 | public string channel_name { get; set; } 24 | /// 25 | /// alue of Bits badge tier that was earned (1000, 10000, etc.) 26 | /// 27 | public long badge_tier { get; set; } 28 | /// 29 | /// [Optional] Custom message included with share 30 | /// 31 | public string chat_message { get; set; } 32 | /// 33 | /// Time when the new Bits badge was earned. RFC 3339 format. 34 | /// 35 | public string time { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/PubSub/Messages/PubSubBitsEventV1Model.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | 3 | namespace Twitch.Base.Models.Clients.PubSub.Messages 4 | { 5 | /// 6 | /// Information about a Bits Event V2. 7 | /// 8 | public class PubSubBitsEventV1Model 9 | { 10 | /// 11 | /// Information about the user’s new badge level, if the user reached a new badge level with this cheer; otherwise. null. 12 | /// 13 | public JObject badge_entitlement { get; set; } 14 | /// 15 | /// Number of Bits used. 16 | /// 17 | public int bits_used { get; set; } 18 | /// 19 | /// User ID of the channel on which Bits were used. 20 | /// 21 | public string channel_id { get; set; } 22 | /// 23 | /// Name of the channel on which Bits were used. 24 | /// 25 | public string channel_name { get; set; } 26 | /// 27 | /// Chat message sent with the cheer. 28 | /// 29 | public string chat_message { get; set; } 30 | /// 31 | /// Event type associated with this use of Bits (for example, cheer). 32 | /// 33 | public string context { get; set; } 34 | /// 35 | /// Message ID 36 | /// 37 | public string message_id { get; set; } 38 | /// 39 | /// essage type (that is, the type of object contained in the data field) 40 | /// 41 | public string message_type { get; set; } 42 | /// 43 | /// Time when the Bits were used. RFC 3339 format. 44 | /// 45 | public string time { get; set; } 46 | /// 47 | /// All-time total number of Bits used on this channel by the specified user. 48 | /// 49 | public long total_bits_used { get; set; } 50 | /// 51 | /// User ID of the person who used the Bits. 52 | /// 53 | public string user_id { get; set; } 54 | /// 55 | /// Login name of the person who used the Bits. 56 | /// 57 | public string user_name { get; set; } 58 | /// 59 | /// Message version. 60 | /// 61 | public string version { get; set; } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/PubSub/Messages/PubSubBitsEventV2Model.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | 3 | namespace Twitch.Base.Models.Clients.PubSub.Messages 4 | { 5 | /// 6 | /// Information about a Bits Event V2. 7 | /// 8 | public class PubSubBitsEventV2Model 9 | { 10 | /// 11 | /// Information about a user’s new badge level, if the cheer was not anonymous and the user reached a new badge level with this cheer. Otherwise, null. 12 | /// 13 | public JObject badge_entitlement { get; set; } 14 | /// 15 | /// Number of bits used. 16 | /// 17 | public int bits_used { get; set; } 18 | /// 19 | /// ID of the channel in which Bits were used. 20 | /// 21 | public string channel_id { get; set; } 22 | /// 23 | /// Chat message sent with the cheer. 24 | /// 25 | public string chat_message { get; set; } 26 | /// 27 | /// Event type associated with this use of Bits. 28 | /// 29 | public string context { get; set; } 30 | /// 31 | /// Whether or not the event was anonymous. 32 | /// 33 | public bool is_anonymous { get; set; } 34 | /// 35 | /// Message ID. 36 | /// 37 | public string message_id { get; set; } 38 | /// 39 | /// The type of object contained in the data field. 40 | /// 41 | public string message_type { get; set; } 42 | /// 43 | /// Time when the Bits were used. RFC 3339 format. 44 | /// 45 | public string time { get; set; } 46 | /// 47 | /// All time total number of Bits used in the channel by a specified user. 48 | /// 49 | public long total_bits_used { get; set; } 50 | /// 51 | /// User ID of the person who used the Bits - if the cheer was not anonymous. Null if anonymous. 52 | /// 53 | public string user_id { get; set; } 54 | /// 55 | /// Login name of the person who used the Bits - if the cheer was not anonymous. Null if anonymous 56 | /// 57 | public string user_name { get; set; } 58 | /// 59 | /// Message version 60 | /// 61 | public string version { get; set; } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/PubSub/Messages/PubSubSubscriptionsGiftEventModel.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | 3 | namespace Twitch.Base.Models.Clients.PubSub.Messages 4 | { 5 | /// 6 | /// Information about a Subscription Gift. 7 | /// 8 | public class PubSubSubscriptionsGiftEventModel : PubSubSubscriptionsEventModel 9 | { 10 | /// 11 | /// The recipient ID of the gift. 12 | /// 13 | public string recipient_id { get; set; } 14 | /// 15 | /// The recipient name of the gift. 16 | /// 17 | public string recipient_user_name { get; set; } 18 | /// 19 | /// The recipient display name of the gift. 20 | /// 21 | public string recipient_display_name { get; set; } 22 | /// 23 | /// The amount of months gifted to the recipient if it was more than 1 month. 24 | /// 25 | public int multi_month_duration { get; set; } 26 | 27 | /// 28 | /// Indicates whether the event is a multi-month subscription gift. 29 | /// 30 | [JsonIgnore] 31 | public bool IsMultiMonth { get { return this.multi_month_duration > 1; } } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/PubSub/PubSubPacketModel.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using System; 3 | 4 | namespace Twitch.Base.Models.Clients.PubSub 5 | { 6 | /// 7 | /// A PubSub web socket packet. 8 | /// 9 | public class PubSubPacketModel 10 | { 11 | /// 12 | /// The type of packet. 13 | /// 14 | public string type { get; set; } 15 | /// 16 | /// The data of the packet. 17 | /// 18 | public JObject data { get; set; } 19 | /// 20 | /// Optional string used to identify the response for a request. 21 | /// 22 | public string nonce { get; set; } 23 | 24 | /// 25 | /// Creates a new instance of the PubSubPacketModel class. 26 | /// 27 | public PubSubPacketModel() 28 | { 29 | this.nonce = Guid.NewGuid().ToString().Replace("-", ""); 30 | } 31 | 32 | /// 33 | /// Creates a new instance of the PubSubPacketModel class. 34 | /// 35 | /// The type of packet 36 | public PubSubPacketModel(string type) 37 | : this() 38 | { 39 | this.type = type; 40 | } 41 | 42 | /// 43 | /// Creates a new instance of the PubSubPacketModel class. 44 | /// 45 | /// The type of packet 46 | /// The data of the packet 47 | public PubSubPacketModel(string type, object data) 48 | : this(type) 49 | { 50 | this.data = JObject.FromObject(data); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/Clients/PubSub/PubSubResponsePacketModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.Clients.PubSub 2 | { 3 | /// 4 | /// A PubSub web socket response packet. 5 | /// 6 | public class PubSubResponsePacketModel : PubSubPacketModel 7 | { 8 | /// 9 | /// Error information related to the request. 10 | /// 11 | public string error { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Ads/AdResponseModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Ads 2 | { 3 | /// 4 | /// Information about the response of running an ad. 5 | /// 6 | public class AdResponseModel 7 | { 8 | /// 9 | /// Length of the triggered commercial. 10 | /// 11 | public int length { get; set; } 12 | /// 13 | /// Provides contextual information on why the request failed 14 | /// 15 | public string message { get; set; } 16 | /// 17 | /// Seconds until the next commercial can be served on this channel 18 | /// 19 | public int retryAfter { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Ads/AdScheduleModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Ads 2 | { 3 | /// 4 | /// Information about a channel's ad schedule. 5 | /// 6 | public class AdScheduleModel 7 | { 8 | /// 9 | /// The number of snoozes available for the broadcaster. 10 | /// 11 | public int snooze_count { get; set; } 12 | /// 13 | /// The UTC timestamp when the broadcaster will gain an additional snooze, in Unix seconds timestamp format. Empty / 0 if the channel has the maximum number of snoozes. 14 | /// 15 | public string snooze_refresh_at { get; set; } 16 | /// 17 | /// The UTC timestamp of the broadcaster’s next scheduled ad, in Unix seconds timestamp format. Empty if the channel has no ad scheduled or is not live. 18 | /// 19 | public string next_ad_at { get; set; } 20 | /// 21 | /// The length in seconds of the scheduled upcoming ad break. 22 | /// 23 | public int duration { get; set; } 24 | /// 25 | /// The UTC timestamp of the broadcaster’s last ad-break, in Unix seconds timestamp format. Empty / 0 if the channel has not run an ad or is not live. 26 | /// 27 | public string last_ad_at { get; set; } 28 | /// 29 | /// The amount of pre-roll free time remaining for the channel in seconds. Returns 0 if they are currently not pre-roll free. 30 | /// 31 | public int preroll_free_time { get; set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Ads/AdSnoozeResponseModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Ads 2 | { 3 | /// 4 | /// Information about the channel’s snoozes and next upcoming ad after successfully snoozing. 5 | /// 6 | public class AdSnoozeResponseModel 7 | { 8 | /// 9 | /// The number of snoozes available for the broadcaster. 10 | /// 11 | public int snooze_count { get; set; } 12 | /// 13 | /// The UTC timestamp when the broadcaster will gain an additional snooze, in Unix seconds timestamp format. 14 | /// 15 | public string snooze_refresh_at { get; set; } 16 | /// 17 | /// The UTC timestamp of the broadcaster’s next scheduled ad, in Unix seconds timestamp format. 18 | /// 19 | public string next_ad_at { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Bits/BitsLeaderboardModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Twitch.Base.Models.NewAPI.Bits 4 | { 5 | /// 6 | /// Information about a specific user on a channel's Bits leaderboard. 7 | /// 8 | public class BitsLeaderboardUserModel 9 | { 10 | /// 11 | /// The ID of the user. 12 | /// 13 | public string user_id { get; set; } 14 | /// 15 | /// The name of the user. 16 | /// 17 | public string user_name { get; set; } 18 | /// 19 | /// The rank of the user. 20 | /// 21 | public int rank { get; set; } 22 | /// 23 | /// The total bits score of the user. 24 | /// 25 | public long score { get; set; } 26 | } 27 | 28 | /// 29 | /// Information about a channel's Bits leaderboard. 30 | /// 31 | public class BitsLeaderboardModel 32 | { 33 | /// 34 | /// The date when the leaderboard started. 35 | /// 36 | public string started_at { get; set; } 37 | /// 38 | /// The date when the leaderboard ended. 39 | /// 40 | public string ended_at { get; set; } 41 | /// 42 | /// The users on the leaderboard. 43 | /// 44 | public List users { get; set; } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Channels/ChannelBannedUserModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Twitch.Base.Models.NewAPI.Channels 4 | { 5 | /// 6 | /// Information about a channel user ban. 7 | /// 8 | public class ChannelBannedUserModel 9 | { 10 | /// 11 | /// User ID of a user who has been banned. 12 | /// 13 | public string user_id { get; set; } 14 | /// 15 | /// Display name of a user who has been banned. 16 | /// 17 | public string user_name { get; set; } 18 | /// 19 | /// RFC3339 formatted timestamp for timeouts; empty string for bans. 20 | /// 21 | public string expires_at { get; set; } 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Channels/ChannelContentClassificationLabelModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Channels 2 | { 3 | /// 4 | /// Information about a channel content classification label. 5 | /// 6 | public class ChannelContentClassificationLabelModel 7 | { 8 | /// 9 | /// Unique identifier for the CCL. 10 | /// 11 | public string id { get; set; } 12 | /// 13 | /// Localized name of the CCL. 14 | /// 15 | public string name { get; set; } 16 | /// 17 | /// Localized description of the CCL. 18 | /// 19 | public string description { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Channels/ChannelEditorUserModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Channels 2 | { 3 | /// 4 | /// Information about a channel editor. 5 | /// 6 | public class ChannelEditorUserModel 7 | { 8 | /// 9 | /// User ID of the editor. 10 | /// 11 | public string user_id { get; set; } 12 | /// 13 | /// Display name of the editor. 14 | /// 15 | public string user_name { get; set; } 16 | /// 17 | /// Date and time the editor was given editor permissions. 18 | /// 19 | public string created_at { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Channels/ChannelFollowedModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Channels 2 | { 3 | /// 4 | /// Information about a followed channel. 5 | /// 6 | public class ChannelFollowedModel 7 | { 8 | /// 9 | /// An ID that uniquely identifies the broadcaster that this user is following. 10 | /// 11 | public string broadcaster_id { get; set; } 12 | /// 13 | /// The broadcaster’s login name. 14 | /// 15 | public string broadcaster_login { get; set; } 16 | /// 17 | /// The broadcaster’s display name. 18 | /// 19 | public string broadcaster_name { get; set; } 20 | /// 21 | /// The UTC timestamp when the user started following the broadcaster. 22 | /// 23 | public string followed_at { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Channels/ChannelFollowerModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Channels 2 | { 3 | /// 4 | /// Information about a channel follow 5 | /// 6 | public class ChannelFollowerModel 7 | { 8 | /// 9 | /// An ID that uniquely identifies the user that’s following the broadcaster. 10 | /// 11 | public string user_id { get; set; } 12 | /// 13 | /// The user’s login name. 14 | /// 15 | public string user_login { get; set; } 16 | /// 17 | /// The user’s display name. 18 | /// 19 | public string user_name { get; set; } 20 | /// 21 | /// The UTC timestamp when the user started following the broadcaster. 22 | /// 23 | public string followed_at { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Channels/ChannelInformationModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Twitch.Base.Models.NewAPI.Channels 4 | { 5 | /// 6 | /// Information about a channel. 7 | /// 8 | public class ChannelInformationModel 9 | { 10 | /// 11 | /// Twitch User ID of this channel owner 12 | /// 13 | public string broadcaster_id { get; set; } 14 | /// 15 | /// Twitch User name of this channel owner 16 | /// 17 | public string broadcaster_name { get; set; } 18 | /// 19 | /// Language of the channel 20 | /// 21 | public string broadcaster_language { get; set; } 22 | /// 23 | /// Current game ID being played on the channel 24 | /// 25 | public string game_id { get; set; } 26 | /// 27 | /// Current game name being played on the channel 28 | /// 29 | public string game_name { get; set; } 30 | /// 31 | /// Title of the stream 32 | /// 33 | public string title { get; set; } 34 | /// 35 | /// The value of the broadcaster’s stream delay setting, in seconds. This field’s value defaults to zero unless 36 | /// 37 | /// 1) the request specifies a user access token, 38 | /// 2) the ID in the broadcaster_id query parameter matches the user ID in the access token, and 39 | /// 3) the broadcaster has partner status and they set a non-zero stream delay value. 40 | /// 41 | public uint delay { get; set; } 42 | /// 43 | /// The tags applied to the channel. 44 | /// 45 | public List tags { get; set; } 46 | /// 47 | /// The CCLs applied to the channel. 48 | /// 49 | public List content_classification_labels { get; set; } 50 | /// 51 | /// Boolean flag indicating if the channel has branded content. 52 | /// 53 | public bool is_branded_content { get; set; } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Channels/ChannelModeratorUserModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Channels 2 | { 3 | /// 4 | /// Information about a channel user moderator. 5 | /// 6 | public class ChannelModeratorUserModel 7 | { 8 | /// 9 | /// User ID of a moderator in the channel. 10 | /// 11 | public string user_id { get; set; } 12 | /// 13 | /// Login of a moderator in the channel. 14 | /// 15 | public string user_login { get; set; } 16 | /// 17 | /// Display name of a moderator in the channel. 18 | /// 19 | public string user_name { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Charity/CharityCampaignAmountModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Charity 2 | { 3 | /// 4 | /// Information about a charity campaign amount 5 | /// 6 | public class CharityCampaignAmountModel 7 | { 8 | /// 9 | /// The monetary amount. The amount is specified in the currency’s minor unit. For example, the minor units for USD is cents, so if the amount is $5.50 USD, value is set to 550. 10 | /// 11 | public int current_amount { get; set; } 12 | /// 13 | /// The number of decimal places used by the currency. For example, USD uses two decimal places. Use this number to translate value from minor units to major units by using the formula: 14 | /// 15 | /// value / 10^decimal_places 16 | /// 17 | public int decimal_places { get; set; } 18 | /// 19 | /// The ISO-4217 three-letter currency code that identifies the type of currency in value. 20 | /// 21 | public string currency { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Charity/CharityCampaignDonationModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Charity 2 | { 3 | /// 4 | /// Information about a campaign charity donation. 5 | /// 6 | public class CharityCampaignDonationModel 7 | { 8 | /// 9 | /// An ID that identifies the charity campaign that the donation applies to. 10 | /// 11 | public string campaign_id { get; set; } 12 | /// 13 | /// An ID that identifies a user that donated money to the campaign. 14 | /// 15 | public string user_id { get; set; } 16 | /// 17 | /// The user’s login name. 18 | /// 19 | public string user_login { get; set; } 20 | /// 21 | /// The user’s display name. 22 | /// 23 | public string user_name { get; set; } 24 | /// 25 | /// An object that contains the amount of money that the user donated. 26 | /// 27 | public CharityCampaignAmountModel amount { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Charity/CharityCampaignModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Charity 2 | { 3 | /// 4 | /// Information about a charity campaign. 5 | /// 6 | public class CharityCampaignModel 7 | { 8 | /// 9 | /// An ID that uniquely identifies the charity campaign. 10 | /// 11 | public string id { get; set; } 12 | /// 13 | /// An ID that uniquely identifies the broadcaster that’s running the campaign. 14 | /// 15 | public string broadcaster_id { get; set; } 16 | /// 17 | /// The broadcaster’s login name. 18 | /// 19 | public string broadcaster_login { get; set; } 20 | /// 21 | /// The broadcaster’s display name. 22 | /// 23 | public string broadcaster_name { get; set; } 24 | /// 25 | /// The charity’s name. 26 | /// 27 | public string charity_name { get; set; } 28 | /// 29 | /// A description of the charity. 30 | /// 31 | public string charity_description { get; set; } 32 | /// 33 | /// A URL to an image of the charity’s logo. The image’s type is PNG and its size is 100px X 100px. 34 | /// 35 | public string charity_logo { get; set; } 36 | /// 37 | /// A URL to the charity’s website. 38 | /// 39 | public string charity_website { get; set; } 40 | /// 41 | /// The current amount of donations that the campaign has received. 42 | /// 43 | public CharityCampaignAmountModel current_amount { get; set; } 44 | /// 45 | /// The campaign’s fundraising goal. This field is null if the broadcaster has not defined a fundraising goal. 46 | /// 47 | public CharityCampaignAmountModel target_amount { get; set; } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Chat/AnnouncementModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Twitch.Base.Models.NewAPI.Chat 4 | { 5 | /// 6 | /// Information about creating an announcement. 7 | /// 8 | public class AnnouncementModel 9 | { 10 | /// 11 | /// The announcement to make in the broadcaster’s chat room. Announcements are limited to a maximum of 500 characters; announcements longer than 500 characters are truncated. 12 | /// 13 | public string message { get; set; } 14 | /// 15 | /// The color used to highlight the announcement. Possible case-sensitive values are: 16 | /// blue 17 | /// green 18 | /// orange 19 | /// purple 20 | /// primary (default) 21 | /// If color is set to primary or is not set, the channel’s accent color is used to highlight the announcement (see Profile Accent Color under profile settings, Channel and Videos, and Brand). 22 | /// 23 | public string color { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Chat/ChatBadgeModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Twitch.Base.Models.NewAPI.Chat 4 | { 5 | /// 6 | /// Information about a set of chat badges. 7 | /// 8 | public class ChatBadgeSetModel 9 | { 10 | /// 11 | /// The id of the set of chat badges. 12 | /// 13 | public string set_id { get; set; } 14 | 15 | /// 16 | /// The versions of the chat badges. 17 | /// 18 | public List versions { get; set; } = new List(); 19 | } 20 | 21 | /// 22 | /// Information about a chat badge. 23 | /// 24 | public class ChatBadgeModel 25 | { 26 | /// 27 | /// The ID of the chat badge. 28 | /// 29 | public string id { get; set; } 30 | 31 | /// 32 | /// The title of the chat badge. 33 | /// 34 | public string title { get; set; } 35 | 36 | /// 37 | /// The description of the chat badge. 38 | /// 39 | public string description { get; set; } 40 | 41 | /// 42 | /// The action to take when clicking on the badge. Set to null if no action is specified. 43 | /// 44 | public string click_action { get; set; } 45 | 46 | /// 47 | /// The URL to navigate to when clicking on the badge. Set to null if no URL is specified. 48 | /// 49 | public string click_url { get; set; } 50 | 51 | /// 52 | /// The 1x size image of the chat badge. 53 | /// 54 | public string image_url_1x { get; set; } 55 | 56 | /// 57 | /// The 2x size image of the chat badge. 58 | /// 59 | public string image_url_2x { get; set; } 60 | 61 | /// 62 | /// The 4x size image of the chat badge. 63 | /// 64 | public string image_url_4x { get; set; } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Chat/ChatterModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Chat 2 | { 3 | /// 4 | /// Information about a chatter. 5 | /// 6 | public class ChatterModel 7 | { 8 | /// 9 | /// The login name of a user that’s connected to the broadcaster’s chat room. 10 | /// 11 | public string user_login { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Clips/ClipCreationModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Clips 2 | { 3 | /// 4 | /// Information about a created clip. 5 | /// 6 | public class ClipCreationModel 7 | { 8 | /// 9 | /// The ID of the clip. 10 | /// 11 | public string id { get; set; } 12 | /// 13 | /// The url to the clip. 14 | /// 15 | public string edit_url { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/EventSub/EventSubSubscriptionChallengeModel.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using StreamingClient.Base.Util; 3 | using System.Collections.Generic; 4 | 5 | namespace Twitch.Base.Models.NewAPI.EventSub 6 | { 7 | /// 8 | /// The challenge sent by Twitch to the registered callback 9 | /// 10 | public class EventSubSubscriptionChallengeModel 11 | { 12 | /// 13 | /// Your response must be a raw string. If your server is using a web framework, 14 | /// be careful that your web framework isn’t modifying the response in an incompatible 15 | /// way. For example, some web frameworks default to converting responses into JSON objects. 16 | /// 17 | public string challenge { get; set; } 18 | 19 | /// 20 | /// The subscription that must be approved. 21 | /// 22 | public EventSubSubscriptionModel subscription { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/EventSub/EventSubSubscriptionModel.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using StreamingClient.Base.Util; 3 | using System.Collections.Generic; 4 | 5 | namespace Twitch.Base.Models.NewAPI.EventSub 6 | { 7 | /// 8 | /// Information about a subscription. 9 | /// 10 | public class EventSubSubscriptionModel 11 | { 12 | /// 13 | /// The ID of the subscription. 14 | /// 15 | public string id { get; set; } 16 | 17 | /// 18 | /// The notification’s subscription type. 19 | /// 20 | public string type { get; set; } 21 | 22 | /// 23 | /// The version of the subscription. 24 | /// 25 | public string version { get; set; } 26 | 27 | /// 28 | /// The status of the subscription. 29 | /// 30 | public string status { get; set; } 31 | 32 | /// 33 | /// How much the subscription counts against your limit. See Subscription Limits for more information. 34 | /// 35 | public int cost { get; set; } 36 | 37 | /// 38 | /// Subscription-specific parameters. 39 | /// 40 | public Dictionary condition { get; set; } 41 | 42 | /// 43 | /// The subscription transport details. 44 | /// 45 | public EventSubTransportModel transport { get; set; } 46 | 47 | /// 48 | /// The time the subscription was created. 49 | /// 50 | public string created_at { get; set; } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/EventSub/EventSubSubscriptionNotificationModel.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Linq; 3 | using StreamingClient.Base.Util; 4 | using System.Collections.Generic; 5 | 6 | namespace Twitch.Base.Models.NewAPI.EventSub 7 | { 8 | /// 9 | /// The challenge sent by Twitch to the registered callback 10 | /// 11 | public class EventSubSubscriptionNotificationModel 12 | { 13 | /// 14 | /// The subscription that must be approved. 15 | /// 16 | public EventSubSubscriptionModel subscription { get; set; } 17 | 18 | /// 19 | /// The event being notified. 20 | /// 21 | public JObject @event { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/EventSub/EventSubTransportModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.EventSub 2 | { 3 | /// 4 | /// Information about the transport for a subscription 5 | /// 6 | public class EventSubTransportModel 7 | { 8 | /// 9 | /// The transport method. Supported values: webhook. 10 | /// 11 | public string method { get; set; } 12 | 13 | /// 14 | /// The callback URL where the notification should be sent. 15 | /// 16 | public string callback { get; set; } 17 | 18 | /// 19 | /// The secret used for verifying a signature. 20 | /// 21 | public string secret { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Games/GameModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Games 2 | { 3 | /// 4 | /// Information about a game. 5 | /// 6 | public class GameModel 7 | { 8 | /// 9 | /// The ID of the game. 10 | /// 11 | public string id { get; set; } 12 | /// 13 | /// The name of the game. 14 | /// 15 | public string name { get; set; } 16 | /// 17 | /// The url to the game's box art. 18 | /// 19 | public string box_art_url { get; set; } 20 | /// 21 | /// The ID that IGDB uses to identify this game. If the IGDB ID is not available to Twitch, this field is set to an empty string. 22 | /// 23 | public string igdb_id { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/NewTwitchAPIDataRestResult.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using System.Collections.Generic; 3 | 4 | namespace Twitch.Base.Models.NewAPI 5 | { 6 | /// 7 | /// A wrapper result used for the New Twitch APIs 8 | /// 9 | /// The type that the result contains 10 | public class NewTwitchAPIDataRestResult 11 | { 12 | /// 13 | /// The data of the result. 14 | /// 15 | public List data { get; set; } = new List(); 16 | 17 | /// 18 | /// The total number of results. 19 | /// 20 | public long total { get; set; } 21 | 22 | /// 23 | /// Pagination information. 24 | /// 25 | public JObject pagination { get; set; } 26 | 27 | /// 28 | /// The pagination cursor. 29 | /// 30 | public string Cursor { get { return (this.pagination!=null && this.pagination.ContainsKey("cursor")) ? this.pagination["cursor"].ToString() : null; } } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/NewTwitchAPISingleDataRestResult.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace Twitch.Base.Models.NewAPI 7 | { 8 | /// 9 | /// A wrapper result used for the New Twitch APIs where results is a single object for the data node 10 | /// Used for APIs such as schedule 11 | /// 12 | public class NewTwitchAPISingleDataRestResult 13 | { 14 | /// 15 | /// The data of the result. 16 | /// 17 | public T data { get; set; } 18 | 19 | /// 20 | /// Pagination information. 21 | /// 22 | public JObject pagination { get; set; } 23 | 24 | /// 25 | /// The pagination cursor. 26 | /// 27 | public string Cursor { get { return (this.pagination != null && this.pagination.ContainsKey("cursor")) ? this.pagination["cursor"].ToString() : null; } } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Polls/PollChoiceModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Polls 2 | { 3 | /// 4 | /// Information about creating a poll choice. 5 | /// 6 | public class CreatePollChoiceModel 7 | { 8 | /// 9 | /// The title of the choice. 10 | /// 11 | public string title { get; set; } 12 | } 13 | 14 | /// 15 | /// Information about a poll choice. 16 | /// 17 | public class PollChoiceModel : CreatePollChoiceModel 18 | { 19 | /// 20 | /// The ID of the choice. 21 | /// 22 | public string id { get; set; } 23 | /// 24 | /// The total number of votes for the choice. 25 | /// 26 | public int votes { get; set; } 27 | /// 28 | /// The total number of votes via channel points for the choice. 29 | /// 30 | public int channel_points_votes { get; set; } 31 | /// 32 | /// The total number of votes via bits for the choice. 33 | /// 34 | public int bits_votes { get; set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Predictions/PredictionOutcomeModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Twitch.Base.Models.NewAPI.Predictions 4 | { 5 | /// 6 | /// Information about creating a prediction outcome. 7 | /// 8 | public class CreatePredictionOutcomeModel 9 | { 10 | /// 11 | /// The title of the choice. 12 | /// 13 | public string title { get; set; } 14 | } 15 | 16 | /// 17 | /// Information about a prediction outcome. 18 | /// 19 | public class PredictionOutcomeModel : CreatePredictionOutcomeModel 20 | { 21 | /// 22 | /// The ID of the choice. 23 | /// 24 | public string id { get; set; } 25 | /// 26 | /// The unique number of users who voted for the choice. 27 | /// 28 | public int users { get; set; } 29 | /// 30 | /// The total number of channel points used for the outcome. 31 | /// 32 | public int channel_points { get; set; } 33 | /// 34 | /// The color of the outcome 35 | /// 36 | public string color { get; set; } 37 | /// 38 | /// The top predictors of the outcome. 39 | /// 40 | public List top_predictors { get; set; } = new List(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Predictions/PredictionOutcomeTopPredictorModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Predictions 2 | { 3 | /// 4 | /// Information about a top predictor for a prediction outcome. 5 | /// 6 | public class PredictionOutcomeTopPredictorModel 7 | { 8 | /// 9 | /// The ID of the user 10 | /// 11 | public string user_id { get; set; } 12 | /// 13 | /// The display name of the user. 14 | /// 15 | public string user_login { get; set; } 16 | /// 17 | /// The login of the user. 18 | /// 19 | public string user_name { get; set; } 20 | /// 21 | /// The number of channel points bet. 22 | /// 23 | public int channel_points_used { get; set; } 24 | /// 25 | /// The number of channel points won. 26 | /// 27 | public int channel_points_won { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Schedule/ScheduleModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Twitch.Base.Models.NewAPI.Schedule 4 | { 5 | /// 6 | /// Information about a broadcaster's schedule 7 | /// 8 | public class ScheduleModel 9 | { 10 | /// 11 | /// The ID of the broadcaster. 12 | /// 13 | public string broadcaster_id { get; set; } 14 | /// 15 | /// The name of the broadcaster. 16 | /// 17 | public string broadcaster_name { get; set; } 18 | /// 19 | /// Login of the broadcaster. 20 | /// 21 | public string broadcaster_login { get; set; } 22 | /// 23 | /// If Vacation Mode is enabled, this includes start and end dates for the vacation.If Vacation Mode is disabled, value is set to null. 24 | /// 25 | public ScheduleVacationModel vacation { get; set; } 26 | /// 27 | /// Scheduled broadcasts for this stream schedule. 28 | /// 29 | public List segments { get; set; } = new List(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Schedule/ScheduleSegmentCategoryModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Twitch.Base.Models.NewAPI.Schedule 6 | { 7 | /// 8 | /// The game/category for a broadcaster's schedule segment 9 | /// 10 | public class ScheduleSegmentCategoryModel 11 | { 12 | /// 13 | /// Game/category ID. 14 | /// 15 | public string id { get; set; } 16 | /// 17 | /// Game/category name. 18 | /// 19 | public string name { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Schedule/ScheduleSegmentModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Twitch.Base.Models.NewAPI.Schedule 6 | { 7 | /// 8 | /// Information for a segment of a broadcaster's schedule 9 | /// 10 | public class ScheduleSegmentModel 11 | { 12 | /// 13 | /// The ID for the scheduled broadcast. 14 | /// 15 | public string id { get; set; } 16 | /// 17 | /// Scheduled start time for the scheduled broadcast in RFC3339 format. 18 | /// 19 | public string start_time { get; set; } 20 | /// 21 | /// Scheduled end time for the scheduled broadcast in RFC3339 format. 22 | /// 23 | public string end_time { get; set; } 24 | /// 25 | /// Title for the scheduled broadcast 26 | /// 27 | public string title { get; set; } 28 | /// 29 | /// Used with recurring scheduled broadcasts. Specifies the date of the next recurring broadcast in RFC3339 format if one or more specific broadcasts have been deleted in the series. Set to null otherwise. 30 | /// 31 | public string canceled_until { get; set; } 32 | /// 33 | /// The category for the scheduled broadcast. Set to null if no category has been specified. 34 | /// 35 | public ScheduleSegmentCategoryModel category { get; set; } 36 | /// 37 | /// Indicates if the scheduled broadcast is recurring weekly. 38 | /// 39 | public bool is_recurring { get; set; } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Schedule/ScheduleVacationModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Twitch.Base.Models.NewAPI.Schedule 6 | { 7 | /// 8 | /// Infomration for a broadcater's scheduled vacation 9 | /// 10 | public class ScheduleVacationModel 11 | { 12 | /// 13 | /// Start time for vacation specified in RFC3339 format. 14 | /// 15 | public string start_time { get; set; } 16 | /// 17 | /// End time for vacation specified in RFC3339 format. 18 | /// 19 | public string end_time { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Streams/StreamMarkerModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Streams 2 | { 3 | /// 4 | /// Information about a created stream marker. 5 | /// 6 | public class CreatedStreamMarkerModel 7 | { 8 | /// 9 | /// The ID of the stream marker. 10 | /// 11 | public long id { get; set; } 12 | /// 13 | /// The date the stream marker was created at. 14 | /// 15 | public string created_at { get; set; } 16 | /// 17 | /// The description of the stream marker. 18 | /// 19 | public string description { get; set; } 20 | /// 21 | /// The number of seconds into the stream. 22 | /// 23 | public long position_seconds { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Streams/StreamModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Twitch.Base.Models.NewAPI.Streams 4 | { 5 | /// 6 | /// Information about a stream. 7 | /// 8 | public class StreamModel 9 | { 10 | /// 11 | /// The ID of the stream. 12 | /// 13 | public string id { get; set; } 14 | /// 15 | /// The ID of the channel. 16 | /// 17 | public string user_id { get; set; } 18 | /// 19 | /// The name of the channel. 20 | /// 21 | public string user_name { get; set; } 22 | /// 23 | /// Login of the user who is streaming. 24 | /// 25 | public string user_login { get; set; } 26 | /// 27 | /// The ID of the game. 28 | /// 29 | public string game_id { get; set; } 30 | /// 31 | /// Name of the game being played. 32 | /// 33 | public string game_name { get; set; } 34 | /// 35 | /// The list of community IDs. 36 | /// 37 | public List community_ids { get; set; } 38 | /// 39 | /// The type of stream. 40 | /// 41 | public string type { get; set; } 42 | /// 43 | /// The title of the stream. 44 | /// 45 | public string title { get; set; } 46 | /// 47 | /// The viewer count of the stream. 48 | /// 49 | public long viewer_count { get; set; } 50 | /// 51 | /// The date the stream started at. 52 | /// 53 | public string started_at { get; set; } 54 | /// 55 | /// The language of the stream. 56 | /// 57 | public string language { get; set; } 58 | /// 59 | /// The url for the thumbnail image of the stream. 60 | /// 61 | public string thumbnail_url { get; set; } 62 | /// 63 | /// The list of tag IDs. 64 | /// 65 | public List tag_ids { get; set; } 66 | /// 67 | /// Indicates if the broadcaster has specified their channel contains mature content that may be inappropriate for younger audiences. 68 | /// 69 | public bool is_mature { get; set; } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Subscriptions/SubscriptionModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Subscriptions 2 | { 3 | /// 4 | /// Information about a subscription. 5 | /// 6 | public class SubscriptionModel 7 | { 8 | /// 9 | /// The ID of the broadcaster. 10 | /// 11 | public string broadcaster_id { get; set; } 12 | /// 13 | /// The name of the broadcaster. 14 | /// 15 | public string broadcaster_name { get; set; } 16 | /// 17 | /// Whether the subscription was a gift. 18 | /// 19 | public bool is_gift { get; set; } 20 | /// 21 | /// The login of the gifter if it was a gifted subscription 22 | /// 23 | public string gifter_login { get; set; } 24 | /// 25 | /// The display name of the gifter if it was a gifted subscription 26 | /// 27 | public string gifter_name { get; set; } 28 | /// 29 | /// The tier of the subscription. 30 | /// 31 | public string tier { get; set; } 32 | /// 33 | /// The plan name of the subscription. 34 | /// 35 | public string plan_name { get; set; } 36 | /// 37 | /// The subscriber user ID. 38 | /// 39 | public string user_id { get; set; } 40 | /// 41 | /// The subscriber user name. 42 | /// 43 | public string user_name { get; set; } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Teams/TeamMemberModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Teams 2 | { 3 | /// 4 | /// Information about a team member. 5 | /// 6 | public class TeamMemberModel 7 | { 8 | /// 9 | /// User ID of a Team member. 10 | /// 11 | public string user_id { get; set; } 12 | /// 13 | /// Login of a Team member. 14 | /// 15 | public string user_login { get; set; } 16 | /// 17 | /// Display name of a Team member. 18 | /// 19 | public string user_name { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Teams/TeamModel.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Twitch.Base.Models.NewAPI.Teams 4 | { 5 | /// 6 | /// Information about a team. 7 | /// 8 | public class TeamModel 9 | { 10 | /// 11 | /// Team ID. 12 | /// 13 | public string id { get; set; } 14 | /// 15 | /// Team name. 16 | /// 17 | public string team_name { get; set; } 18 | /// 19 | /// Team display name. 20 | /// 21 | public string team_display_name { get; set; } 22 | /// 23 | /// Team description. 24 | /// 25 | public string info { get; set; } 26 | /// 27 | /// Image URL for the Team logo. 28 | /// 29 | public string thumbnail_url { get; set; } 30 | /// 31 | /// URL of the Team background image. 32 | /// 33 | public string background_image_url { get; set; } 34 | /// 35 | /// URL for the Team banner. 36 | /// 37 | public string banner { get; set; } 38 | /// 39 | /// Date and time the Team was created. 40 | /// 41 | public string created_at { get; set; } 42 | /// 43 | /// Date and time the Team was last updated. 44 | /// 45 | public string updated_at { get; set; } 46 | } 47 | 48 | /// 49 | /// Information about a team's details. 50 | /// 51 | public class TeamDetailsModel : TeamModel 52 | { 53 | /// 54 | /// Users in the specified Team. 55 | /// 56 | public List users { get; set; } = new List(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Users/UserModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Users 2 | { 3 | /// 4 | /// Information about a user. 5 | /// 6 | public class UserModel 7 | { 8 | private const string ThumbnailPreviewURLFormat = "https://static-cdn.jtvnw.net/previews-ttv/live_user_{0}{1}.jpg"; 9 | 10 | /// 11 | /// The user ID. 12 | /// 13 | public string id { get; set; } 14 | /// 15 | /// The user's account name. 16 | /// 17 | public string login { get; set; } 18 | /// 19 | /// The user's display name. 20 | /// 21 | public string display_name { get; set; } 22 | /// 23 | /// The type of the user. 24 | /// 25 | public string type { get; set; } 26 | /// 27 | /// The broadcast type of the user. 28 | /// 29 | public string broadcaster_type { get; set; } 30 | /// 31 | /// The user's description. 32 | /// 33 | public string description { get; set; } 34 | /// 35 | /// The user's profile image URL. 36 | /// 37 | public string profile_image_url { get; set; } 38 | /// 39 | /// The user's offline image URL. 40 | /// 41 | public string offline_image_url { get; set; } 42 | /// 43 | /// The user's total view count. 44 | /// 45 | public long view_count { get; set; } 46 | /// 47 | /// The user's email account. 48 | /// 49 | public string email { get; set; } 50 | /// 51 | /// Date when the user was created. 52 | /// 53 | public string created_at { get; set; } 54 | 55 | /// 56 | /// Gets the current thumbnail preview image for the user's channel in a large size. 57 | /// 58 | public string ThumbnailPreviewLarge { get { return string.Format(ThumbnailPreviewURLFormat, this.login, ""); } } 59 | /// 60 | /// Gets the current thumbnail preview image for the user's channel in a small size. 61 | /// 62 | public string ThumbnailPreviewSmall { get { return string.Format(ThumbnailPreviewURLFormat, this.login, "-640x360"); } } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Models/NewAPI/Webhook/WebhookSubscriptionModel.cs: -------------------------------------------------------------------------------- 1 | namespace Twitch.Base.Models.NewAPI.Webhooks 2 | { 3 | /// 4 | /// Information about Webhook Subscription 5 | /// 6 | public class WebhookSubscriptionModel 7 | { 8 | /// 9 | /// The topic used in the initial subscription. 10 | /// 11 | public string topic { get; set; } 12 | 13 | /// 14 | /// The callback provided for this subscription. 15 | /// 16 | public string callback { get; set; } 17 | 18 | /// 19 | /// Date and time when this subscription expires. Encoded as RFC3339. The timezone is always UTC (“Z”). 20 | /// 21 | public string expires_at { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Services/NewAPI/ScheduleService.cs: -------------------------------------------------------------------------------- 1 | using StreamingClient.Base.Util; 2 | using System.Threading.Tasks; 3 | using Twitch.Base.Models.NewAPI; 4 | using Twitch.Base.Models.NewAPI.Schedule; 5 | using Twitch.Base.Models.NewAPI.Users; 6 | 7 | namespace Twitch.Base.Services.NewAPI 8 | { 9 | /// 10 | /// APIs for schedule-based services 11 | /// 12 | public class ScheduleService : NewTwitchAPIServiceBase 13 | { 14 | /// 15 | /// Creates an instance of the ScheduleService. 16 | /// 17 | /// The Twitch connection to use 18 | public ScheduleService(TwitchConnection connection) : base(connection) { } 19 | 20 | /// 21 | /// Get stream schedule for broadcaster 22 | /// 23 | /// broadcaster 24 | /// Maximum schedule segment results to return. Will be either that amount or slightly more. 25 | /// Broadcaster's schedule details 26 | public async Task GetSchedule(UserModel broadcaster, int maxResults) 27 | { 28 | Validator.ValidateVariable(broadcaster, "broadcaster"); 29 | 30 | ScheduleModel scheduleModel = null; 31 | string cursor = null; 32 | 33 | do 34 | { 35 | int totalSegmentCount = (scheduleModel?.segments?.Count ?? 0); 36 | int itemsToRetrieve = maxResults - totalSegmentCount > 25 ? 25 : maxResults - totalSegmentCount; 37 | 38 | NewTwitchAPISingleDataRestResult results = await this.GetPagedSingleDataResultAsync("schedule?broadcaster_id=" + broadcaster.id, itemsToRetrieve, cursor); 39 | cursor = results.Cursor; 40 | 41 | if (results.data != null) 42 | { 43 | if (scheduleModel == null) 44 | { 45 | scheduleModel = results.data; 46 | } 47 | else 48 | { 49 | scheduleModel.segments.AddRange(results.data.segments); 50 | } 51 | } 52 | } 53 | while (scheduleModel != null && scheduleModel.segments.Count < maxResults && cursor != null); 54 | 55 | return scheduleModel; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Services/NewAPI/TeamsService.cs: -------------------------------------------------------------------------------- 1 | using StreamingClient.Base.Util; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using Twitch.Base.Models.NewAPI.Teams; 6 | using Twitch.Base.Models.NewAPI.Users; 7 | 8 | namespace Twitch.Base.Services.NewAPI 9 | { 10 | /// 11 | /// The APIs for Teams-based services. 12 | /// 13 | public class TeamsService : NewTwitchAPIServiceBase 14 | { 15 | /// 16 | /// Creates an instance of the TeamsService. 17 | /// 18 | /// The Twitch connection to use 19 | public TeamsService(TwitchConnection connection) : base(connection) { } 20 | 21 | /// 22 | /// Gets all the teams that the specified broadcaster is a part of. 23 | /// 24 | /// The broadcaster to get teams for 25 | /// A list of teams 26 | public async Task> GetChannelTeams(UserModel broadcaster) 27 | { 28 | Validator.ValidateVariable(broadcaster, "broadcaster"); 29 | return await this.GetDataResultAsync("teams/channel?broadcaster_id=" + broadcaster.id); 30 | } 31 | 32 | /// 33 | /// Gets the details for a specific Team. 34 | /// 35 | /// The ID of the team 36 | /// A list of teams 37 | public async Task GetTeam(string id) 38 | { 39 | Validator.ValidateString(id, "id"); 40 | IEnumerable results = await this.GetDataResultAsync("teams?id=" + id); 41 | return results.FirstOrDefault(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Twitch - Backup.Base.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | Twitch.Base 6 | Twitch.Base 7 | Copyright © Matthew Olivo (SaviorXTanren) 2017-2022 8 | Matthew Olivo 9 | Matthew Olivo 10 | true 11 | 1.0.0.78 12 | C# client library for the Twitch streaming service: https://twitch.tv 13 | 14 | For more information, please see our project site: https://github.com/SaviorXTanren/StreamingClientLibrary 15 | Twitch Streaming Bot Chat Interactive 16 | StreamingClientLibrary.Twitch 17 | Twitch Streaming Client Library 18 | https://github.com/SaviorXTanren/StreamingClientLibrary 19 | https://github.com/SaviorXTanren/StreamingClientLibrary 20 | false 21 | true 22 | 23 | 24 | 25 | obj\Debug\netstandard2.0\Twitch.Base.xml 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage 38 | 1.0.0.78 39 | 1.0.0.77 40 | StreamingClientLibrary.Twitch 41 | https://github.com/SaviorXTanren/StreamingClientLibrary/blob/master/LICENSE.txt 42 | Adding featured parameter for Twitch Clips API 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Twitch/Twitch.Base/Twitch.Base.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | Twitch.Base 6 | Twitch.Base 7 | Copyright © Matthew Olivo (SaviorXTanren) 2017-2022 8 | Matthew Olivo 9 | Matthew Olivo 10 | true 11 | 1.0.0.79 12 | C# client library for the Twitch streaming service: https://twitch.tv 13 | 14 | For more information, please see our project site: https://github.com/SaviorXTanren/StreamingClientLibrary 15 | Twitch Streaming Bot Chat Interactive 16 | StreamingClientLibrary.Twitch 17 | Twitch Streaming Client Library 18 | https://github.com/SaviorXTanren/StreamingClientLibrary 19 | https://github.com/SaviorXTanren/StreamingClientLibrary 20 | false 21 | true 22 | 23 | 24 | 25 | obj\Debug\netstandard2.0\Twitch.Base.xml 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | $(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage 38 | 1.0.0.79 39 | 1.0.0.79 40 | StreamingClientLibrary.Twitch 41 | https://github.com/SaviorXTanren/StreamingClientLibrary/blob/master/LICENSE.txt 42 | Updating API calls for Clips data 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /Twitch/Twitch.Extensions.Base/Models/BroadcastBodyModel.cs: -------------------------------------------------------------------------------- 1 | using StreamingClient.Base.Util; 2 | using System.Runtime.Serialization; 3 | 4 | namespace Twitch.Extensions.Base.Models 5 | { 6 | /// 7 | /// The body of a request to be broadcasted out 8 | /// 9 | [DataContract] 10 | public class BroadcastBodyModel 11 | { 12 | /// 13 | /// The content type of the body 14 | /// 15 | [DataMember] 16 | public string content_type { get; set; } = "application/json"; 17 | /// 18 | /// The target of the message. 19 | /// 20 | [DataMember] 21 | public string[] targets { get; set; } = new string[] { "broadcast" }; 22 | /// 23 | /// The serialized message. 24 | /// 25 | [DataMember] 26 | public string message { get; set; } 27 | 28 | /// 29 | /// Creates a new instance of the BroadcastBodyModel class. 30 | /// 31 | /// The data to include in the broadcast 32 | public BroadcastBodyModel(object data) 33 | { 34 | this.message = JSONSerializerHelper.SerializeToString(data); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Twitch/Twitch.Extensions.Base/Models/ExtensionChatMessageModel.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace Twitch.Extensions.Base.Models 4 | { 5 | /// 6 | /// The text of the chat message sent by an extension. 7 | /// 8 | [DataContract] 9 | public class ExtensionChatMessageModel 10 | { 11 | /// 12 | /// The text of the chat message. 13 | /// 14 | [DataMember] 15 | public string text { get; set; } 16 | 17 | /// 18 | /// Creates a new instance of the ExtensionChatMessageModel class. 19 | /// 20 | /// The text of the chat message 21 | public ExtensionChatMessageModel(string text) { this.text = text; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Twitch/Twitch.Extensions.Base/Twitch.Extensions.Base.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Twitch/Twitch.Webhooks.Base/Twitch.Webhooks.Base.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /YouTube/Samples/YouTube.ChatSample.Console/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /YouTube/Samples/YouTube.ChatSample.Console/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("YouTube.ChatSample.Console")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("YouTube.ChatSample.Console")] 12 | [assembly: AssemblyCopyright("Copyright © 2019")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("c88df63d-227a-458e-9270-ab6a777a7a09")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /YouTube/Samples/YouTube.ChatSample.Console/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /YouTube/Samples/YouTube.VideoUploadSample.Console/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /YouTube/Samples/YouTube.VideoUploadSample.Console/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | [assembly: AssemblyTitle("YouTube.VideoUploadSample.Console")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("YouTube.VideoUploadSample.Console")] 12 | [assembly: AssemblyCopyright("Copyright © 2019")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // Setting ComVisible to false makes the types in this assembly not visible 17 | // to COM components. If you need to access a type in this assembly from 18 | // COM, set the ComVisible attribute to true on that type. 19 | [assembly: ComVisible(false)] 20 | 21 | // The following GUID is for the ID of the typelib if this project is exposed to COM 22 | [assembly: Guid("7bd692e5-6886-4b5c-83c1-533be2f90e67")] 23 | 24 | // Version information for an assembly consists of the following four values: 25 | // 26 | // Major Version 27 | // Minor Version 28 | // Build Number 29 | // Revision 30 | // 31 | // You can specify all the values or you can default the Build and Revision Numbers 32 | // by using the '*' as shown below: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /YouTube/Samples/YouTube.VideoUploadSample.Console/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /YouTube/Samples/YouTube.VideoUploadSample.Console/thumbnail.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/YouTube/Samples/YouTube.VideoUploadSample.Console/thumbnail.jpg -------------------------------------------------------------------------------- /YouTube/Samples/YouTube.VideoUploadSample.Console/video.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaviorXTanren/StreamingClientLibrary/2e09b9c2f301c179b8c194757a82fa70abb6fe35/YouTube/Samples/YouTube.VideoUploadSample.Console/video.mp4 -------------------------------------------------------------------------------- /YouTube/YouTube.Base.UnitTests/ChannelsServiceUnitTests.cs: -------------------------------------------------------------------------------- 1 | using Google.Apis.YouTube.v3.Data; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using System.Threading.Tasks; 4 | 5 | namespace YouTube.Base.UnitTests 6 | { 7 | [TestClass] 8 | public class ChannelsServiceUnitTests : UnitTestBase 9 | { 10 | public static async Task GetMyChannel(YouTubeConnection connection) 11 | { 12 | Channel channel = await connection.Channels.GetMyChannel(); 13 | 14 | Assert.IsNotNull(channel); 15 | Assert.IsNotNull(channel.Id); 16 | 17 | return channel; 18 | } 19 | 20 | [TestMethod] 21 | public void GetMyChannel() 22 | { 23 | TestWrapper(async (YouTubeConnection connection) => 24 | { 25 | Channel channel = await ChannelsServiceUnitTests.GetMyChannel(connection); 26 | }); 27 | } 28 | 29 | [TestMethod] 30 | public void GetChannelByUsername() 31 | { 32 | TestWrapper(async (YouTubeConnection connection) => 33 | { 34 | Channel channel = await connection.Channels.GetChannelByUsername("GoogleDevelopers"); 35 | 36 | Assert.IsNotNull(channel); 37 | Assert.IsNotNull(channel.Id); 38 | }); 39 | } 40 | 41 | [TestMethod] 42 | public void GetChannelByID() 43 | { 44 | TestWrapper(async (YouTubeConnection connection) => 45 | { 46 | Channel channel = await connection.Channels.GetChannelByID("UCHRSNim0jPoFPJS_PX2v8sg"); 47 | 48 | Assert.IsNotNull(channel); 49 | Assert.IsNotNull(channel.Id); 50 | }); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /YouTube/YouTube.Base.UnitTests/LiveBroadcastsServiceUnitTests.cs: -------------------------------------------------------------------------------- 1 | using Google.Apis.YouTube.v3.Data; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace YouTube.Base.UnitTests 7 | { 8 | [TestClass] 9 | public class LiveBroadcastsServiceUnitTests : UnitTestBase 10 | { 11 | [TestMethod] 12 | public void GetCommentThreadsForChannel() 13 | { 14 | TestWrapper(async (YouTubeConnection connection) => 15 | { 16 | IEnumerable results = await connection.LiveBroadcasts.GetMyBroadcasts(); 17 | 18 | Assert.IsNotNull(results); 19 | Assert.IsTrue(results.Count() > 0); 20 | }); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /YouTube/YouTube.Base.UnitTests/SubscriptionsServiceUnitTests.cs: -------------------------------------------------------------------------------- 1 | using Google.Apis.YouTube.v3.Data; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace YouTube.Base.UnitTests 7 | { 8 | [TestClass] 9 | public class SubscriptionsServiceUnitTests : UnitTestBase 10 | { 11 | [TestMethod] 12 | public void GetMySubscriptions() 13 | { 14 | TestWrapper(async (YouTubeConnection connection) => 15 | { 16 | IEnumerable results = await connection.Subscriptions.GetMySubscriptions(maxResults: 10); 17 | 18 | Assert.IsNotNull(results); 19 | Assert.IsTrue(results.Count() > 0); 20 | }); 21 | } 22 | 23 | [TestMethod] 24 | public void GetMySubscribers() 25 | { 26 | TestWrapper(async (YouTubeConnection connection) => 27 | { 28 | IEnumerable results = await connection.Subscriptions.GetMySubscribers(maxResults: 10); 29 | 30 | Assert.IsNotNull(results); 31 | Assert.IsTrue(results.Count() > 0); 32 | }); 33 | } 34 | 35 | [TestMethod] 36 | public void GetMyRecentSubscribers() 37 | { 38 | TestWrapper(async (YouTubeConnection connection) => 39 | { 40 | IEnumerable results = await connection.Subscriptions.GetMyRecentSubscribers(maxResults: 10); 41 | 42 | Assert.IsNotNull(results); 43 | Assert.IsTrue(results.Count() > 0); 44 | }); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /YouTube/YouTube.Base.UnitTests/UnitTestBase.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using StreamingClient.Base.Util; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | 7 | namespace YouTube.Base.UnitTests 8 | { 9 | public class UnitTestBase 10 | { 11 | public static string clientID = "884596410562-pcrl1fn8ov0npj7fhjl086ffmud7r5j6.apps.googleusercontent.com"; 12 | public static string clientSecret = "QBkxNmPNIvWatRvOIfRYrXlc"; 13 | 14 | public static readonly List scopes = new List() 15 | { 16 | OAuthClientScopeEnum.ManageAccount, 17 | OAuthClientScopeEnum.ManageData, 18 | OAuthClientScopeEnum.ManagePartner, 19 | OAuthClientScopeEnum.ManagePartnerAudit, 20 | OAuthClientScopeEnum.ManageVideos, 21 | OAuthClientScopeEnum.ReadOnlyAccount, 22 | OAuthClientScopeEnum.ViewAnalytics, 23 | OAuthClientScopeEnum.ViewMonetaryAnalytics 24 | }; 25 | 26 | private static YouTubeConnection connection; 27 | 28 | [AssemblyInitialize] 29 | public void Initialize() 30 | { 31 | Logger.LogOccurred += Logger_LogOccurred; 32 | } 33 | 34 | public static YouTubeConnection GetYouTubeLiveClient() 35 | { 36 | if (UnitTestBase.connection == null) 37 | { 38 | UnitTestBase.connection = YouTubeConnection.ConnectViaLocalhostOAuthBrowser(clientID, clientSecret, scopes).Result; 39 | } 40 | 41 | Assert.IsNotNull(UnitTestBase.connection); 42 | return UnitTestBase.connection; 43 | } 44 | 45 | protected static void TestWrapper(Func function) 46 | { 47 | if (string.IsNullOrEmpty(clientID) || string.IsNullOrEmpty(clientSecret)) 48 | { 49 | throw new InvalidOperationException("Client ID and/or Client Secret are not set in the UnitTestBase class"); 50 | } 51 | 52 | try 53 | { 54 | YouTubeConnection connection = UnitTestBase.GetYouTubeLiveClient(); 55 | function(connection).Wait(); 56 | } 57 | catch (Exception ex) 58 | { 59 | Assert.Fail(ex.ToString()); 60 | } 61 | } 62 | 63 | private void Logger_LogOccurred(object sender, Log log) 64 | { 65 | if (log.Level >= LogLevel.Error) 66 | { 67 | Assert.Fail(log.Message); 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /YouTube/YouTube.Base.UnitTests/VideosServiceUnitTests.cs: -------------------------------------------------------------------------------- 1 | using Google.Apis.YouTube.v3.Data; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace YouTube.Base.UnitTests 7 | { 8 | [TestClass] 9 | public class VideosServiceUnitTests : UnitTestBase 10 | { 11 | [TestMethod] 12 | public void GetMyVideos() 13 | { 14 | TestWrapper(async (YouTubeConnection connection) => 15 | { 16 | IEnumerable