Example #1
0
        internal new static RestBannedUser Create(BaseTwitchClient client, Model model)
        {
            var entity = new RestBannedUser(client, model.Id);

            entity.Update(model);
            return(entity);
        }
Example #2
0
        internal static async Task <IReadOnlyCollection <RestBannedUser> > GetTimeoutsAsync(RestSimpleCommunity community, ulong userId, uint limit)
        {
            if (!TokenHelper.TryGetToken(community.Client, userId, out RestTokenInfo info))
            {
                throw new MissingScopeException("communities_moderate");
            }
            if (!info.Authorization.Scopes.Contains("communities_moderate"))
            {
                throw new MissingScopeException("communities_moderate");
            }

            var model = await community.Client.RestClient.GetCommunityTimeoutsInternalAsync(info.Token, community.Id, limit);

            var entity = model.Timeouts.Select(x =>
            {
                var user = new RestBannedUser(community.Client, x.Id);
                user.Update(x);
                return(user);
            });

            return(entity.ToArray());
        }