private IApiRequest GenerateVideoPatchRequest(long clipId, VideoUpdateMetadata metaData) { ThrowIfUnauthorized(); IApiRequest request = _apiRequestFactory.GetApiRequest(AccessToken); request.Method = Method.PATCH; request.Path = Endpoints.Video; request.UrlSegments.Add("clipId", clipId.ToString()); if (metaData.Name != null) { request.Query.Add("name", metaData.Name.Trim()); } if (metaData.Description != null) { request.Query.Add("description", metaData.Description.Trim()); } if (metaData.Privacy != VideoPrivacyEnum.Unknown) { request.Query.Add("privacy.view", metaData.Privacy.ToString().ToLower()); } if (metaData.EmbedPrivacy != VideoEmbedPrivacyEnum.Unknown) { request.Query.Add("privacy.embed", metaData.EmbedPrivacy.ToString().ToLower()); } request.Query.Add("review_link", metaData.ReviewLinkEnabled.ToString().ToLower()); return(request); }
public void UpdateVideoMetadata(long clipId, VideoUpdateMetadata metaData) { try { UpdateVideoMetadataAsync(clipId, metaData).RunSynchronouslyWithCurrentCulture(); } catch (AggregateException ex) { ExceptionDispatchInfo.Capture(ex.InnerException).Throw(); } }
public void UpdateVideoMetadata(long clipId, VideoUpdateMetadata metaData) { try { Task.Run(async() => await UpdateVideoMetadataAsync(clipId, metaData)).Wait(); } catch (AggregateException ex) { ExceptionDispatchInfo.Capture(ex.InnerException).Throw(); } }
public async Task VideoMetadataGuncelle(long videoId, VideoUpdateMetadata metadata) { VimeoDotNet.VimeoClient client1 = new VimeoDotNet.VimeoClient(TokenKey.Token); try { await client1.UpdateVideoMetadataAsync(videoId, metadata); } catch (Exception ex) { throw new Exception(ex.Message); } }
public async Task UpdateVideoMetadataAsync(long clipId, VideoUpdateMetadata metaData) { try { IApiRequest request = GenerateVideoPatchRequest(clipId, metaData); IRestResponse response = await request.ExecuteRequestAsync(); CheckStatusCodeError(response, "Error updating user video metadata."); } catch (Exception ex) { if (ex is VimeoApiException) { throw; } throw new VimeoApiException("Error updating user video metadata.", ex); } }
private IApiRequest GenerateVideoPatchRequest(long clipId, VideoUpdateMetadata metaData) { ThrowIfUnauthorized(); var request = ApiRequestFactory.GetApiRequest(AccessToken); request.Method = new HttpMethod("PATCH"); request.Path = Endpoints.Video; request.UrlSegments.Add("clipId", clipId.ToString()); var parameters = new Dictionary <string, string>(); if (metaData.Name != null) { parameters["name"] = metaData.Name.Trim(); } if (metaData.Description != null) { parameters["description"] = metaData.Description.Trim(); } if (metaData.Privacy != VideoPrivacyEnum.Unknown) { parameters["privacy.view"] = metaData.Privacy.ToString().ToLower(); } if (metaData.Privacy == VideoPrivacyEnum.Password) { parameters["password"] = metaData.Password; } if (metaData.EmbedPrivacy != VideoEmbedPrivacyEnum.Unknown) { parameters["privacy.embed"] = metaData.EmbedPrivacy.ToString().ToLower(); } if (metaData.Comments != VideoCommentsEnum.Unknown) { parameters["privacy.comments"] = metaData.Comments.ToString().ToLower(); } parameters["review_link"] = metaData.ReviewLinkEnabled.ToString().ToLower(); parameters["privacy.download"] = metaData.AllowDownloadVideo ? "true" : "false"; parameters["privacy.add"] = metaData.AllowAddToAlbumChannelGroup ? "true" : "false"; request.Body = new FormUrlEncodedContent(parameters); return(request); }
private IApiRequest GenerateVideoPatchRequest(long clipId, VideoUpdateMetadata metaData) { ThrowIfUnauthorized(); IApiRequest request = _apiRequestFactory.GetApiRequest(AccessToken); request.Method = Method.PATCH; request.Path = Endpoints.Video; request.UrlSegments.Add("clipId", clipId.ToString()); if (metaData.Name != null) { request.Query.Add("name", metaData.Name.Trim()); } if (metaData.Description != null) { request.Query.Add("description", metaData.Description.Trim()); } if (metaData.Privacy != VideoPrivacyEnum.Unknown) { request.Query.Add("privacy.view", metaData.Privacy.ToString().ToLower()); } if (metaData.Privacy == VideoPrivacyEnum.Password) { request.Query.Add("password", metaData.Password); } if (metaData.EmbedPrivacy != VideoEmbedPrivacyEnum.Unknown) { request.Query.Add("privacy.embed", metaData.EmbedPrivacy.ToString().ToLower()); } if (metaData.Comments != VideoCommentsEnum.Unknown) { request.Query.Add("privacy.comments", metaData.Comments.ToString().ToLower()); } request.Query.Add("review_link", metaData.ReviewLinkEnabled.ToString().ToLower()); request.Query.Add("privacy.download", metaData.AllowDownloadVideo ? "true" : "false"); request.Query.Add("privacy.add", metaData.AllowAddToAlbumChannelGroup ? "true" : "false"); return(request); }