Exemple #1
0
        internal static async Task <IReadOnlyDictionary <string, IEnumerable <RestEmote> > > GetEmotesAsync(BaseRestClient client, ulong userId)
        {
            var token = TokenHelper.GetSingleToken(client);
            var model = await client.RestClient.GetEmotesInternalAsync(token, userId);

            var entity = model.Emotes.Select(x =>
            {
                var values = x.Value.Select(y =>
                {
                    var emote = new RestEmote(client, y.Id);
                    emote.Update(y);
                    return(emote);
                });
                return(new KeyValuePair <string, IEnumerable <RestEmote> >(x.Key, values));
            });

            return(entity.ToDictionary(x => x.Key, x => x.Value));
        }
Exemple #2
0
 internal RestChannelFollow(BaseRestClient client)
     : base(client)
 {
 }
Exemple #3
0
 internal RestSubscription(BaseRestClient client)
 {
     Client = client;
 }
Exemple #4
0
        internal static async Task <IReadOnlyCollection <RestChannelFollow> > GetFollowsAsync(BaseRestClient client, ulong userId, SortMode sort, bool ascending, uint limit, uint offset)
        {
            var token = TokenHelper.GetSingleToken(client);
            var model = await client.RestClient.GetFollowsInternalAsync(token, userId, sort, ascending, limit, offset);

            var entity = model.Follows.Select(x =>
            {
                var follow = new RestChannelFollow(client);
                follow.Update(x);
                return(follow);
            });

            return(entity.ToArray());
        }
 internal RestSimpleChannel(BaseRestClient client, ulong id)
     : base(client, id)
 {
 }
Exemple #6
0
 internal RestBannedUser(BaseRestClient client, ulong id)
     : base(client, id)
 {
 }
Exemple #7
0
        internal static async Task <IReadOnlyCollection <RestStream> > GetStreamsAsync(BaseRestClient client, Action <GetStreamsParams> options)
        {
            var token = TokenHelper.GetSingleToken(client);

            var changes = new GetStreamsParams();

            options.Invoke(changes);

            var model = await client.RestClient.GetStreamsInternalAsync(token, changes);

            if (model == null)
            {
                return(new List <RestStream>());
            }

            var entity = model.Streams.Select(x => RestStream.Create(client, x));

            return(entity.ToArray());
        }
Exemple #8
0
 public RestEntity(BaseRestClient client, T id)
 {
     Client = client;
     Id = id;
 }
Exemple #9
0
        public static async Task <IReadOnlyCollection <RestClip> > GetFollowedClipsAsync(BaseRestClient client, ulong userId, bool istrending, uint limit)
        {
            if (!TokenHelper.TryGetToken(client, userId, out RestTokenInfo info))
            {
                throw new MissingScopeException("user_read");
            }
            if (!info.Authorization.Scopes.Contains("user_read"))
            {
                throw new MissingScopeException("user_read");
            }

            var model = await client.RestClient.GetFollowedClipsInternalAsync(info.Token, istrending, limit);

            var entity = model.Clips.Select(x => RestClip.Create(client, x));

            return(entity.ToArray());
        }
Exemple #10
0
        internal static async Task <IReadOnlyCollection <RestStream> > GetFollowedStreamsAsync(BaseRestClient client, ulong userId, StreamType type, uint limit, uint offset)
        {
            if (!TokenHelper.TryGetToken(client, userId, out RestTokenInfo info))
            {
                throw new MissingScopeException("user_read");
            }
            if (!info.Authorization.Scopes.Contains("user_read"))
            {
                throw new MissingScopeException("user_read");
            }

            var model = await client.RestClient.GetFollowedStreamsInternalAsync(info?.Token, type, limit, offset);

            if (model == null)
            {
                return(new List <RestStream>());
            }

            var entity = model.Streams.Select(x => RestStream.Create(client, x));

            return(entity.ToArray());
        }
Exemple #11
0
        public static async Task <IReadOnlyCollection <RestCheerInfo> > GetCheersAsync(BaseRestClient client, ulong?channelId)
        {
            var token = TokenHelper.GetSingleToken(client);
            var model = await client.RestClient.GetCheersInternalAsync(token, channelId);

            var entity = model.Actions.Select(x => new RestCheerInfo(client, x));

            return(entity.ToArray());
        }
Exemple #12
0
 internal RestEmote(BaseRestClient client, uint id)
     : base(client, id)
 {
 }
Exemple #13
0
 internal RestCheerScale(BaseRestClient client, Model model)
 {
     Client = client;
     Update(model);
 }
Exemple #14
0
 internal RestChannelSubscription(BaseRestClient client)
     : base(client)
 {
 }
Exemple #15
0
        public static async Task <IReadOnlyCollection <RestTopCommunity> > GetTopCommunitiesAsync(BaseRestClient client, uint limit)
        {
            var token = TokenHelper.GetSingleToken(client);
            var model = await client.RestClient.GetTopCommunitiesInternalAsync(token, limit);

            var entity = model.Communities.Select(x => RestTopCommunity.Create(client, x));

            return(entity.ToArray());
        }
Exemple #16
0
 internal RestCheerImage(BaseRestClient client, Model model)
 {
     Client = client;
 }
Exemple #17
0
        public static async Task <IReadOnlyCollection <RestSimpleTeam> > GetTeamsAsync(BaseRestClient client, uint limit, uint offset)
        {
            var token = TokenHelper.GetSingleToken(client);
            var model = await client.RestClient.GetTeamsInternalAsync(token, limit, offset);

            if (model == null)
            {
                return(new List <RestSimpleTeam>());
            }

            var entity = model.Teams.Select(x => RestSimpleTeam.Create(client, x));

            return(entity.ToArray());
        }
Exemple #18
0
 internal RestIngest(BaseRestClient client, ulong id)
     : base(client, id)
 {
 }
Exemple #19
0
        internal static async Task <IReadOnlyCollection <RestGame> > SearchGamesAsync(BaseRestClient client, string query, bool islive)
        {
            var token = TokenHelper.GetSingleToken(client);
            var model = await client.RestClient.SearchGamesInternalAsync(token, query, islive);

            if (model == null)
            {
                return(new List <RestGame>());
            }

            var entity = model.Games.Select(x => RestGame.Create(client, x));

            return(entity.ToArray());
        }
 internal RestTopCommunity(BaseRestClient client, string id)
     : base(client, id)
 {
 }
Exemple #21
0
        internal static async Task <IReadOnlyCollection <RestChannel> > SearchChannelsAsync(BaseRestClient client, string query, uint limit, uint offset)
        {
            var token = TokenHelper.GetSingleToken(client);
            var model = await client.RestClient.SearchChannelsInternalAsync(token, query, limit, offset);

            if (model == null)
            {
                return(new List <RestChannel>());
            }

            var entity = model.Channels.Select(x => RestChannel.Create(client, x));

            return(entity.ToArray());
        }
Exemple #22
0
 internal RestVideo(BaseRestClient client, string id)
     : base(client, id)
 {
 }
Exemple #23
0
 public RestClip(BaseRestClient client, string id)
     : base(client, id)
 {
 }