internal static RestVideo Create(BaseTwitchClient client, Model model) { var entity = new RestVideo(client, model.Id); entity.Update(model); return(entity); }
public static async Task <RestVideo> GetVideoAsync(BaseRestClient client, string id) { var token = TokenHelper.GetSingleToken(client); var model = await client.RestClient.GetVideoInternalAsync(token, id); return(RestVideo.Create(client, model)); }
public static async Task ModifyAsync(RestVideo video, Action <ModifyVideoParams> changes, RequestOptions options) { var modify = new ModifyVideoParams(); changes.Invoke(modify); var model = await video.Client.ApiClient.ModifyVideoAsync(video.Id, modify, options); video.Update(model); }
public static async Task <IReadOnlyCollection <RestVideo> > GetFollowedVideosAsync(BaseTwitchClient client, string broadcastType, string language, string sort, PageOptions paging, RequestOptions options) { var model = await client.ApiClient.GetFollowedVideosAsync(broadcastType, language, sort, paging, options).ConfigureAwait(false); if (model.Videos != null) { return(model.Videos.Select(x => RestVideo.Create(client, x)).ToArray()); } return(null); }
// Videos public static async Task <RestVideo> GetVideoAsync(BaseTwitchClient client, string videoId, RequestOptions options = null) { var model = await client.ApiClient.GetVideoAsync(videoId, options).ConfigureAwait(false); if (model != null) { return(RestVideo.Create(client, model)); } return(null); }
// Videos public static async Task <IReadOnlyCollection <RestVideo> > GetVideosAsync(BaseTwitchClient client, ulong channelId, PageOptions paging = null, RequestOptions options = null) { var model = await client.ApiClient.GetChannelVideosAsync(channelId, paging, options).ConfigureAwait(false); return(model.Videos.Select(x => RestVideo.Create(client, x)).ToArray()); }
public static Task CompleteUploadAsync(RestVideo video, RequestOptions options) { throw new NotImplementedException(); }
public static async Task DeleteAsync(RestVideo video, RequestOptions options) { await video.Client.ApiClient.DeleteVideoAsync(video.Id, options).ConfigureAwait(false); }