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

            entity.Update(model);
            return(entity);
        }
Esempio n. 2
0
        // Teams
        public static async Task <IReadOnlyCollection <RestSimpleTeam> > GetTeamsAsync(BaseTwitchClient client, PageOptions paging = null, RequestOptions options = null)
        {
            var model = await client.ApiClient.GetTeamsAsync(paging, options).ConfigureAwait(false);

            if (model.Teams != null)
            {
                return(model.Teams.Select(x => RestSimpleTeam.Create(client, x)).ToArray());
            }
            return(null);
        }
Esempio n. 3
0
        internal static async Task <IReadOnlyCollection <RestSimpleTeam> > GetTeamsAsync(BaseRestClient client, ulong channelId)
        {
            TokenHelper.TryGetToken(client, channelId, out RestTokenInfo info);
            var model = await client.RestClient.GetChannelTeamsInternalAsync(info?.Token, channelId);

            var entity = model.Teams.Select(x =>
            {
                var team = new RestSimpleTeam(client, x.Id);
                team.Update(x);
                return(team);
            });

            return(entity.ToArray());
        }
Esempio n. 4
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());
        }
Esempio n. 5
0
 public int GetHashCode(RestSimpleTeam obj)
 => obj.GetHashCode();
Esempio n. 6
0
 public bool Equals(RestSimpleTeam x, RestSimpleTeam y)
 => x.Id == y.Id;
Esempio n. 7
0
        // Teams
        public static async Task <IReadOnlyCollection <RestSimpleTeam> > GetTeamsAsync(BaseTwitchClient client, ulong channelId, RequestOptions options = null)
        {
            var model = await client.ApiClient.GetChannelTeamsAsync(channelId, options).ConfigureAwait(false);

            return(model.Teams.Select(x => RestSimpleTeam.Create(client, x)).ToArray());
        }