/// <summary> /// Move a specific file /// </summary> /// <param name="request">Request. <see cref="PostMoveFileRequest" /></param> /// <returns><see cref="MoveFileResponse"/></returns> public MoveFileResponse PostMoveFile(PostMoveFileRequest request) { // verify the required parameter 'src' is set if (request.Src == null) { throw new ApiException(400, "Missing required parameter 'src' when calling PostMoveFile"); } // verify the required parameter 'dest' is set if (request.Dest == null) { throw new ApiException(400, "Missing required parameter 'dest' when calling PostMoveFile"); } // create path and map variables var resourcePath = this.configuration.GetApiRootUrl() + "/storage/file"; resourcePath = Regex .Replace(resourcePath, "\\*", string.Empty) .Replace("&", "&") .Replace("/?", "?"); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "src", request.Src); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "dest", request.Dest); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "versionId", request.VersionId); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "storage", request.Storage); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "destStorage", request.DestStorage); try { var response = this.apiInvoker.InvokeApi( resourcePath, "POST", null, null, null); if (response != null) { return((MoveFileResponse)SerializationHelper.Deserialize(response, typeof(MoveFileResponse))); } return(null); } catch (ApiException ex) { if (ex.ErrorCode == 404) { return(null); } throw; } }
private void MoveFile(string storageName, string srcPath, string destStorageName, string destPath, string versionId = null) { var request = new PostMoveFileRequest(); request.Src = srcPath; request.Storage = storageName; request.Dest = destPath; request.DestStorage = destStorageName; request.VersionId = versionId; var response = StorageApi.PostMoveFile(request); Assert.AreEqual(200, response.Code); }
public void FilePostMoveFileTest() { PostMoveFileRequest request = new PostMoveFileRequest(); request.src = Path.Combine(dataFolder, "TestFile1.pdf"); request.storage = storageName; request.dest = Path.Combine(dataFolder, "TestFile2.pdf"); request.destStorage = destStorageName; request.versionId = null; var response = FileApi.PostMoveFile(request); Assert.AreEqual(200, response.Code); }
public void MoveFile(string FileName, string FilePath) { try { PostMoveFileRequest request = new PostMoveFileRequest(); request.Dest = Constants.StorageDestinationFolder + "//" + FileName; request.Src = Constants.StorageConversionFolder + FilePath; var response = ObjStorageApi.PostMoveFile(request); if (response.Code != Constants.ResponseOkCode) { } } catch (Exception e) { } }