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)); }
internal RestChannelFollow(BaseRestClient client) : base(client) { }
internal RestSubscription(BaseRestClient client) { Client = client; }
internal static async Task <IReadOnlyCollection <RestChannelFollow> > GetFollowsAsync(BaseRestClient client, ulong userId, SortMode sort, bool ascending, uint limit, uint offset) { var token = TokenHelper.GetSingleToken(client); var model = await client.RestClient.GetFollowsInternalAsync(token, userId, sort, ascending, limit, offset); var entity = model.Follows.Select(x => { var follow = new RestChannelFollow(client); follow.Update(x); return(follow); }); return(entity.ToArray()); }
internal RestSimpleChannel(BaseRestClient client, ulong id) : base(client, id) { }
internal RestBannedUser(BaseRestClient client, ulong id) : base(client, id) { }
internal static async Task <IReadOnlyCollection <RestStream> > GetStreamsAsync(BaseRestClient client, Action <GetStreamsParams> options) { var token = TokenHelper.GetSingleToken(client); var changes = new GetStreamsParams(); options.Invoke(changes); var model = await client.RestClient.GetStreamsInternalAsync(token, changes); if (model == null) { return(new List <RestStream>()); } var entity = model.Streams.Select(x => RestStream.Create(client, x)); return(entity.ToArray()); }
public RestEntity(BaseRestClient client, T id) { Client = client; Id = id; }
public static async Task <IReadOnlyCollection <RestClip> > GetFollowedClipsAsync(BaseRestClient client, ulong userId, bool istrending, uint limit) { if (!TokenHelper.TryGetToken(client, userId, out RestTokenInfo info)) { throw new MissingScopeException("user_read"); } if (!info.Authorization.Scopes.Contains("user_read")) { throw new MissingScopeException("user_read"); } var model = await client.RestClient.GetFollowedClipsInternalAsync(info.Token, istrending, limit); var entity = model.Clips.Select(x => RestClip.Create(client, x)); return(entity.ToArray()); }
internal static async Task <IReadOnlyCollection <RestStream> > GetFollowedStreamsAsync(BaseRestClient client, ulong userId, StreamType type, uint limit, uint offset) { if (!TokenHelper.TryGetToken(client, userId, out RestTokenInfo info)) { throw new MissingScopeException("user_read"); } if (!info.Authorization.Scopes.Contains("user_read")) { throw new MissingScopeException("user_read"); } var model = await client.RestClient.GetFollowedStreamsInternalAsync(info?.Token, type, limit, offset); if (model == null) { return(new List <RestStream>()); } var entity = model.Streams.Select(x => RestStream.Create(client, x)); return(entity.ToArray()); }
public static async Task <IReadOnlyCollection <RestCheerInfo> > GetCheersAsync(BaseRestClient client, ulong?channelId) { var token = TokenHelper.GetSingleToken(client); var model = await client.RestClient.GetCheersInternalAsync(token, channelId); var entity = model.Actions.Select(x => new RestCheerInfo(client, x)); return(entity.ToArray()); }
internal RestEmote(BaseRestClient client, uint id) : base(client, id) { }
internal RestCheerScale(BaseRestClient client, Model model) { Client = client; Update(model); }
internal RestChannelSubscription(BaseRestClient client) : base(client) { }
public static async Task <IReadOnlyCollection <RestTopCommunity> > GetTopCommunitiesAsync(BaseRestClient client, uint limit) { var token = TokenHelper.GetSingleToken(client); var model = await client.RestClient.GetTopCommunitiesInternalAsync(token, limit); var entity = model.Communities.Select(x => RestTopCommunity.Create(client, x)); return(entity.ToArray()); }
internal RestCheerImage(BaseRestClient client, Model model) { Client = client; }
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()); }
internal RestIngest(BaseRestClient client, ulong id) : base(client, id) { }
internal static async Task <IReadOnlyCollection <RestGame> > SearchGamesAsync(BaseRestClient client, string query, bool islive) { var token = TokenHelper.GetSingleToken(client); var model = await client.RestClient.SearchGamesInternalAsync(token, query, islive); if (model == null) { return(new List <RestGame>()); } var entity = model.Games.Select(x => RestGame.Create(client, x)); return(entity.ToArray()); }
internal RestTopCommunity(BaseRestClient client, string id) : base(client, id) { }
internal static async Task <IReadOnlyCollection <RestChannel> > SearchChannelsAsync(BaseRestClient client, string query, uint limit, uint offset) { var token = TokenHelper.GetSingleToken(client); var model = await client.RestClient.SearchChannelsInternalAsync(token, query, limit, offset); if (model == null) { return(new List <RestChannel>()); } var entity = model.Channels.Select(x => RestChannel.Create(client, x)); return(entity.ToArray()); }
internal RestVideo(BaseRestClient client, string id) : base(client, id) { }
public RestClip(BaseRestClient client, string id) : base(client, id) { }