internal static RestSimpleTeam Create(BaseTwitchClient client, Model model) { var entity = new RestSimpleTeam(client, model.Id); entity.Update(model); return(entity); }
// 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); }
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()); }
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()); }
public int GetHashCode(RestSimpleTeam obj) => obj.GetHashCode();
public bool Equals(RestSimpleTeam x, RestSimpleTeam y) => x.Id == y.Id;
// 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()); }