Ejemplo n.º 1
0
        internal new static RestChannelSubscription Create(BaseTwitchClient client, Model model)
        {
            var entity = new RestChannelSubscription(client, model.Id);

            entity.Update(model);
            return(entity);
        }
Ejemplo n.º 2
0
        internal static RestSimpleTeam Create(BaseTwitchClient client, Model model)
        {
            var entity = new RestSimpleTeam(client, model.Id);

            entity.Update(model);
            return(entity);
        }
Ejemplo n.º 3
0
        internal new static RestCommunity Create(BaseTwitchClient client, Model model)
        {
            var entity = new RestCommunity(client, model.Id);

            entity.Update(model);
            return(entity);
        }
Ejemplo n.º 4
0
        internal static RestBlockedUser Create(BaseTwitchClient client, Model model)
        {
            var entity = new RestBlockedUser(client, model.Id);

            entity.Update(model);
            return(entity);
        }
Ejemplo n.º 5
0
        internal static RestFeaturedStream Create(BaseTwitchClient client, Model model)
        {
            var entity = new RestFeaturedStream();

            entity.Update(client, model);
            return(entity);
        }
Ejemplo n.º 6
0
        internal new static RestChannelFollow Create(BaseTwitchClient client, Model model)
        {
            var entity = new RestChannelFollow(client);

            entity.Update(model);
            return(entity);
        }
Ejemplo n.º 7
0
        internal new static RestSelfChannel Create(BaseTwitchClient client, Model model)
        {
            var entity = new RestSelfChannel(client, model.Id);

            entity.Update(model);
            return(entity);
        }
Ejemplo n.º 8
0
        public static async Task <IReadOnlyCollection <RestStream> > GetStreamsAsync(BaseTwitchClient client, ulong[] channelIds, PageOptions paging = null, RequestOptions options = null)
        {
            var parameters = new GetStreamsParams()
            {
                ChannelIds = channelIds
            };

            return(await GetStreamsAsync(client, x => { x = parameters; }, paging, options));
        }
Ejemplo n.º 9
0
        // Videos
        public static async Task <RestVideo> GetVideoAsync(BaseTwitchClient client, string videoId, RequestOptions options = null)
        {
            var model = await client.ApiClient.GetVideoAsync(videoId, options).ConfigureAwait(false);

            if (model != null)
            {
                return(RestVideo.Create(client, model));
            }
            return(null);
        }
Ejemplo n.º 10
0
        // Streams
        public static async Task <RestStream> GetStreamAsync(BaseTwitchClient client, ulong channelId, StreamType type, RequestOptions options = null)
        {
            var model = await client.ApiClient.GetStreamAsync(channelId, type, options).ConfigureAwait(false);

            if (model.Stream != null)
            {
                return(RestStream.Create(client, model.Stream));
            }
            return(null);
        }
Ejemplo n.º 11
0
        // Ingests
        public static async Task <IReadOnlyCollection <RestIngest> > GetIngestsAsync(BaseTwitchClient client, RequestOptions options = null)
        {
            var model = await client.ApiClient.GetIngestsAsync(options).ConfigureAwait(false);

            if (model.Ingests != null)
            {
                return(model.Ingests.Select(x => RestIngest.Create(client, x)).ToArray());
            }
            return(null);
        }
Ejemplo n.º 12
0
        // Communities
        public static async Task <RestCommunity> GetCommunityAsync(BaseTwitchClient client, string communityId, bool isname, RequestOptions options = null)
        {
            var model = await client.ApiClient.GetCommunityAsync(communityId, isname, options).ConfigureAwait(false);

            if (model != null)
            {
                return(RestCommunity.Create(client, model));
            }
            return(null);
        }
Ejemplo n.º 13
0
        public static async Task <RestChannel> GetChannelAsync(BaseTwitchClient client, ulong channelId, RequestOptions options = null)
        {
            var model = await client.ApiClient.GetChannelAsync(channelId, options).ConfigureAwait(false);

            if (model != null)
            {
                return(RestChannel.Create(client, model));
            }
            return(null);
        }
Ejemplo n.º 14
0
        public static async Task <IReadOnlyCollection <RestUser> > GetUsersAsync(BaseTwitchClient client, string[] usernames, RequestOptions options = null)
        {
            var model = await client.ApiClient.GetUsersAsync(usernames, options).ConfigureAwait(false);

            if (model.Users != null)
            {
                return(model.Users.Select(x => RestUser.Create(client, x)).ToArray());
            }
            return(null);
        }
Ejemplo n.º 15
0
        // Users
        public static async Task <RestSelfUser> GetCurrentUserAsync(BaseTwitchClient client, RequestOptions options = null)
        {
            var model = await client.ApiClient.GetMyUserAsync(options).ConfigureAwait(false);

            if (model != null)
            {
                return(RestSelfUser.Create(client, model));
            }
            return(null);
        }
Ejemplo n.º 16
0
        public static async Task <RestTeam> GetTeamAsync(BaseTwitchClient client, string name, RequestOptions options = null)
        {
            var model = await client.ApiClient.GetTeamAsync(name, options).ConfigureAwait(false);

            if (model != null)
            {
                return(RestTeam.Create(client, model));
            }
            return(null);
        }
Ejemplo n.º 17
0
        public static async Task <IReadOnlyCollection <RestGame> > FindGamesAsync(BaseTwitchClient client, string query, bool islive, RequestOptions options = null)
        {
            var model = await client.ApiClient.FindGamesAsync(query, islive, options).ConfigureAwait(false);

            if (model.Games != null)
            {
                return(model.Games.Select(x => RestGame.Create(client, x)).ToArray());
            }
            return(null);
        }
Ejemplo n.º 18
0
        public static async Task <RestGameSummary> GetGameSummaryAsync(BaseTwitchClient client, string game, RequestOptions options = null)
        {
            var model = await client.ApiClient.GetStreamSummaryAsync(game, options).ConfigureAwait(false);

            if (model != null)
            {
                return(RestGameSummary.Create(model));
            }
            return(null);
        }
Ejemplo n.º 19
0
        // Tokens
        public static async Task <RestTokenInfo> GetTokenInfoAsync(BaseTwitchClient client, RequestOptions options = null)
        {
            var model = await client.ApiClient.ValidateTokenAsync(options).ConfigureAwait(false);

            if (model.Token != null)
            {
                return(RestTokenInfo.Create(client.ApiClient.AuthToken, model.Token));
            }
            return(null);
        }
Ejemplo n.º 20
0
        internal virtual void Update(BaseTwitchClient client, Model model)
        {
            Stream = new RestStream(client, model.Stream.Id);
            Stream.Update(model.Stream);

            Image     = model.Image;
            Priority  = model.Priority;
            Scheduled = model.Scheduled;
            Sponsored = model.Sponsored;
            Text      = model.Text;
            Title     = model.Title;
        }
Ejemplo n.º 21
0
        public static async Task <IReadOnlyCollection <RestClip> > GetTopClipsAsync(BaseTwitchClient client, Action <TopClipsParams> parameters, RequestOptions options = null)
        {
            var filledParams = new TopClipsParams();

            parameters.Invoke(filledParams);

            var model = await client.ApiClient.GetTopClipsAsync(filledParams, options).ConfigureAwait(false);

            if (model.Clips != null)
            {
                return(model.Clips.Select(x => RestClip.Create(client, x)).ToArray());
            }
            return(null);
        }
Ejemplo n.º 22
0
        public static async Task <IReadOnlyCollection <RestStream> > GetStreamsAsync(BaseTwitchClient client, Action <GetStreamsParams> parameters, PageOptions paging = null, RequestOptions options = null)
        {
            var filledParams = new GetStreamsParams();

            parameters.Invoke(filledParams);

            var model = await client.ApiClient.GetStreamsAsync(filledParams, paging, options).ConfigureAwait(false);

            if (model.Streams != null)
            {
                return(model.Streams.Select(x => RestStream.Create(client, x)).ToArray());
            }
            return(null);
        }
Ejemplo n.º 23
0
 internal RestSimpleTeam(BaseTwitchClient client, ulong id)
     : base(client, id)
 {
 }
Ejemplo n.º 24
0
 internal RestSelfChannel(BaseTwitchClient client, ulong id)
     : base(client, id)
 {
 }
Ejemplo n.º 25
0
 internal RestChannelFollow(BaseTwitchClient client)
     : base(client)
 {
 }
Ejemplo n.º 26
0
 internal RestClip(BaseTwitchClient client, string id)
     : base(client, id)
 {
 }
Ejemplo n.º 27
0
        // Videos
        public static async Task <IReadOnlyCollection <RestVideo> > GetVideosAsync(BaseTwitchClient client, ulong channelId, PageOptions paging = null, RequestOptions options = null)
        {
            var model = await client.ApiClient.GetChannelVideosAsync(channelId, paging, options).ConfigureAwait(false);

            return(model.Videos.Select(x => RestVideo.Create(client, x)).ToArray());
        }
Ejemplo n.º 28
0
        public static async Task <RestUserSubscription> GetSubscriberAsync(BaseTwitchClient client, ulong channelId, ulong userId, RequestOptions options = null)
        {
            var model = await client.ApiClient.GetChannelSubscriberAsync(channelId, userId, options).ConfigureAwait(false);

            return(RestUserSubscription.Create(client, model));
        }
Ejemplo n.º 29
0
        public static async Task <IReadOnlyCollection <RestUserSubscription> > GetSubscribersAsync(BaseTwitchClient client, ulong channelId, bool ascending, PageOptions paging = null, RequestOptions options = null)
        {
            var model = await client.ApiClient.GetChannelSubscribersAsync(channelId, ascending, paging, options).ConfigureAwait(false);

            return(model.Subscriptions.Select(x => RestUserSubscription.Create(client, x)).ToArray());
        }
Ejemplo n.º 30
0
        public static async Task <IReadOnlyCollection <RestUser> > GetEditorsAsync(BaseTwitchClient client, ulong channelId, RequestOptions options = null)
        {
            var model = await client.ApiClient.GetChannelEditorsAsync(channelId, options).ConfigureAwait(false);

            return(model.Users.Select(x => RestUser.Create(client, x)).ToArray());
        }