Ejemplo n.º 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));
        }
Ejemplo n.º 2
0
 internal RestChannelFollow(BaseRestClient client)
     : base(client)
 {
 }
Ejemplo n.º 3
0
 internal RestSubscription(BaseRestClient client)
 {
     Client = client;
 }
Ejemplo n.º 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());
        }
Ejemplo n.º 5
0
 internal RestSimpleChannel(BaseRestClient client, ulong id)
     : base(client, id)
 {
 }
Ejemplo n.º 6
0
 internal RestBannedUser(BaseRestClient client, ulong id)
     : base(client, id)
 {
 }
Ejemplo n.º 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());
        }
Ejemplo n.º 8
0
 public RestEntity(BaseRestClient client, T id)
 {
     Client = client;
     Id = id;
 }
Ejemplo n.º 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());
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 12
0
 internal RestEmote(BaseRestClient client, uint id)
     : base(client, id)
 {
 }
Ejemplo n.º 13
0
 internal RestCheerScale(BaseRestClient client, Model model)
 {
     Client = client;
     Update(model);
 }
Ejemplo n.º 14
0
 internal RestChannelSubscription(BaseRestClient client)
     : base(client)
 {
 }
Ejemplo n.º 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());
        }
Ejemplo n.º 16
0
 internal RestCheerImage(BaseRestClient client, Model model)
 {
     Client = client;
 }
Ejemplo n.º 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());
        }
Ejemplo n.º 18
0
 internal RestIngest(BaseRestClient client, ulong id)
     : base(client, id)
 {
 }
Ejemplo n.º 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());
        }
Ejemplo n.º 20
0
 internal RestTopCommunity(BaseRestClient client, string id)
     : base(client, id)
 {
 }
Ejemplo n.º 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());
        }
Ejemplo n.º 22
0
 internal RestVideo(BaseRestClient client, string id)
     : base(client, id)
 {
 }
Ejemplo n.º 23
0
 public RestClip(BaseRestClient client, string id)
     : base(client, id)
 {
 }