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

            entity.Update(model);
            return(entity);
        }
Ejemplo n.º 2
0
        // Chat
        public static async Task <IReadOnlyDictionary <string, IReadOnlyCollection <RestEmote> > > GetEmotesAsync(BaseTwitchClient client, ulong userId, RequestOptions options = null)
        {
            var model = await client.ApiClient.GetEmotesAsync(userId, options).ConfigureAwait(false);

            var entity = model.Emotes.Select(x =>
            {
                var values = x.Value.Select(y => RestEmote.Create(client, y));
                return(new KeyValuePair <string, IReadOnlyCollection <RestEmote> >(x.Key, values.ToArray()));
            });

            return(entity.ToDictionary(x => x.Key, x => x.Value));
        }
Ejemplo n.º 3
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));
        }