public static async Task <IReadOnlyCollection <RestStream> > FindStreamsAsync(BaseTwitchClient client, string query, bool?hls, PageOptions paging = null, RequestOptions options = null) { var model = await client.ApiClient.FindStreamsAsync(query, hls, paging, options).ConfigureAwait(false); if (model.Streams != null) { return(model.Streams.Select(x => RestStream.Create(client, x)).ToArray()); } return(null); }
// Streams public static async Task <RestStream> GetStreamAsync(BaseTwitchClient client, ulong channelId, StreamType type, RequestOptions options = null) { var model = await client.ApiClient.GetStreamAsync(channelId, type, options).ConfigureAwait(false); if (model.Stream != null) { return(RestStream.Create(client, model.Stream)); } return(null); }
public static async Task <IReadOnlyCollection <RestStream> > GetFollowedStreamsAsync(BaseTwitchClient client, StreamType type, PageOptions paging, RequestOptions options = null) { var model = await client.ApiClient.GetFollowedStreamsAsync(type, paging, options).ConfigureAwait(false); if (model.Streams != null) { return(model.Streams.Select(x => RestStream.Create(client, x)).ToArray()); } return(null); }
public static async Task <RestStream> GetStreamAsync(BaseRestClient client, ulong channelId, StreamType type) { var token = TokenHelper.GetSingleToken(client); var model = await client.RestClient.GetStreamInternalAsync(token, channelId, type); if (model.Stream == null) { return(null); } return(RestStream.Create(client, model.Stream)); }
public static async Task <IReadOnlyCollection <RestStream> > GetStreamsAsync(BaseTwitchClient client, Action <GetStreamsParams> parameters, PageOptions paging = null, RequestOptions options = null) { var filledParams = new GetStreamsParams(); parameters.Invoke(filledParams); var model = await client.ApiClient.GetStreamsAsync(filledParams, paging, options).ConfigureAwait(false); if (model.Streams != null) { return(model.Streams.Select(x => RestStream.Create(client, x)).ToArray()); } return(null); }
internal static async Task <IReadOnlyCollection <RestStream> > SearchStreamsAsync(BaseRestClient client, string query, bool?hls, uint limit, uint offset) { var token = TokenHelper.GetSingleToken(client); var model = await client.RestClient.SearchStreamsInternalAsync(token, query, hls, limit, offset); if (model == null) { return(new List <RestStream>()); } var entity = model.Streams.Select(x => RestStream.Create(client, x)); return(entity.ToArray()); }
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()); }
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()); }