コード例 #1
0
ファイル: RestEmote.cs プロジェクト: kouweizhong/NTwitch
        internal static RestEmote Create(BaseTwitchClient client, Model model)
        {
            var entity = new RestEmote(client, model.Id);

            entity.Update(model);
            return(entity);
        }
コード例 #2
0
ファイル: UserHelper.cs プロジェクト: kouweizhong/NTwitch
        // 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));
        }
コード例 #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));
        }