/// <summary> /// Upload file /// </summary> /// <param name="request">Request. <see cref="UploadFileRequest" /></param> /// <returns><see cref="FilesUploadResult"/></returns> public FilesUploadResult UploadFile(UploadFileRequest request) { // verify the required parameter 'path' is set if (request.path == null) { throw new ApiException(400, "Missing required parameter 'path' when calling UploadFile"); } // verify the required parameter 'file' is set if (request.File == null) { throw new ApiException(400, "Missing required parameter 'file' when calling UploadFile"); } // create path and map variables var resourcePath = this.configuration.GetApiRootUrl() + "/ocr/storage/file/{path}"; resourcePath = Regex .Replace(resourcePath, "\\*", string.Empty) .Replace("&", "&") .Replace("/?", "?"); var formParams = new Dictionary <string, object>(); resourcePath = UrlHelper.AddPathParameter(resourcePath, "path", request.path); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "storageName", request.storageName); if (request.File != null) { formParams.Add("file", this.apiInvoker.ToFileInfo(request.File, "File")); } try { var response = this.apiInvoker.InvokeApi <string>( resourcePath, "PUT", null, null, formParams); if (response != null) { return((FilesUploadResult)JsonSerializationHelper.Deserialize(response, typeof(FilesUploadResult))); } return(null); } catch (ApiException ex) { if (ex.ErrorCode == 404) { return(null); } throw; } }
/// <summary> /// Get all files and folders within a folder /// </summary> /// <param name="request">Request. <see cref="GetFilesListRequest" /></param> /// <returns><see cref="FilesList"/></returns> public FilesList GetFilesList(GetFilesListRequest request) { // verify the required parameter 'path' is set if (request.path == null) { throw new ApiException(400, "Missing required parameter 'path' when calling GetFilesList"); } // create path and map variables var resourcePath = this.configuration.GetApiRootUrl() + "/ocr/storage/folder/{path}"; resourcePath = Regex .Replace(resourcePath, "\\*", string.Empty) .Replace("&", "&") .Replace("/?", "?"); resourcePath = UrlHelper.AddPathParameter(resourcePath, "path", request.path); resourcePath = UrlHelper.AddQueryParameterToUrl(resourcePath, "storageName", request.storageName); try { var response = this.apiInvoker.InvokeApi <string>( resourcePath, "GET", null, null, null); if (response != null) { return((FilesList)JsonSerializationHelper.Deserialize(response, typeof(FilesList))); } return(null); } catch (ApiException ex) { if (ex.ErrorCode == 404) { return(null); } throw; } }