Beispiel #1
0
 public async Task UpdateVideoMetadata(long VideoId, string NewVideoName)
 {
     try
     {
         vimeoManager = new VimeoManager();
         VimeoDotNet.Models.VideoUpdateMetadata metadata = new VimeoDotNet.Models.VideoUpdateMetadata();
         metadata.Name = NewVideoName;
         await vimeoManager.VideoMetadataGuncelle(VideoId, metadata);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public void UpdateVideoMetadata(long clipId, VideoUpdateMetadata metaData)
 {
     try
     {
         UpdateVideoMetadataAsync(clipId, metaData).RunSynchronouslyWithCurrentCulture();
     }
     catch (AggregateException ex)
     {
         ExceptionDispatchInfo.Capture(ex.InnerException).Throw();
     }
 }
        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;
        }
 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);
     }
 }
 public void UpdateVideoMetadata(long clipId, VideoUpdateMetadata metaData)
 {
     try
     {
         Task.Run(async () => await UpdateVideoMetadataAsync(clipId, metaData)).Wait();
     }
     catch (AggregateException ex)
     {
         ExceptionDispatchInfo.Capture(ex.InnerException).Throw();
     }
 }
        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());
            }
            request.Query.Add("review_link", metaData.ReviewLinkEnabled.ToString().ToLower());

            return request;
        }