本文整理汇总了Java中com.aspose.storage.client.ApiException.getCode方法的典型用法代码示例。如果您正苦于以下问题:Java ApiException.getCode方法的具体用法?Java ApiException.getCode怎么用?Java ApiException.getCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.aspose.storage.client.ApiException
的用法示例。
在下文中一共展示了ApiException.getCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GetDocument
import com.aspose.storage.client.ApiException; //导入方法依赖的package包/类
/**
* GetDocument
* Read common document info.
* @param name String The document name.
* @param storage String The document storage.
* @param folder String The document folder.
* @return ResponseMessage
*/
public ResponseMessage GetDocument (String name, String storage, String folder) {
Object postBody = null;
// verify required params are set
if(name == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/pdf/{name}/?appSid={appSid}&storage={storage}&folder={folder}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(name!=null)
resourcePath = resourcePath.replace("{" + "name" + "}" , apiInvoker.toPathValue(name));
else
resourcePath = resourcePath.replaceAll("[&?]name.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
if(folder!=null)
resourcePath = resourcePath.replace("{" + "folder" + "}" , apiInvoker.toPathValue(folder));
else
resourcePath = resourcePath.replaceAll("[&?]folder.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "GET", queryParams, postBody, headerParams, formParams, contentType);
return (ResponseMessage) ApiInvoker.deserialize(response, "", ResponseMessage.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例2: GetSegment
import com.aspose.storage.client.ApiException; //导入方法依赖的package包/类
/**
* GetSegment
* Read segment.
* @param name String
* @param pageNumber Integer
* @param fragmentNumber Integer
* @param segmentNumber Integer
* @param storage String
* @param folder String
* @return TextItemResponse
*/
public TextItemResponse GetSegment (String name, Integer pageNumber, Integer fragmentNumber, Integer segmentNumber, String storage, String folder) {
Object postBody = null;
// verify required params are set
if(name == null || pageNumber == null || fragmentNumber == null || segmentNumber == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/pdf/{name}/pages/{pageNumber}/fragments/{fragmentNumber}/segments/{segmentNumber}/?appSid={appSid}&storage={storage}&folder={folder}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(name!=null)
resourcePath = resourcePath.replace("{" + "name" + "}" , apiInvoker.toPathValue(name));
else
resourcePath = resourcePath.replaceAll("[&?]name.*?(?=&|\\?|$)", "");
if(pageNumber!=null)
resourcePath = resourcePath.replace("{" + "pageNumber" + "}" , apiInvoker.toPathValue(pageNumber));
else
resourcePath = resourcePath.replaceAll("[&?]pageNumber.*?(?=&|\\?|$)", "");
if(fragmentNumber!=null)
resourcePath = resourcePath.replace("{" + "fragmentNumber" + "}" , apiInvoker.toPathValue(fragmentNumber));
else
resourcePath = resourcePath.replaceAll("[&?]fragmentNumber.*?(?=&|\\?|$)", "");
if(segmentNumber!=null)
resourcePath = resourcePath.replace("{" + "segmentNumber" + "}" , apiInvoker.toPathValue(segmentNumber));
else
resourcePath = resourcePath.replaceAll("[&?]segmentNumber.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
if(folder!=null)
resourcePath = resourcePath.replace("{" + "folder" + "}" , apiInvoker.toPathValue(folder));
else
resourcePath = resourcePath.replaceAll("[&?]folder.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "GET", queryParams, postBody, headerParams, formParams, contentType);
return (TextItemResponse) ApiInvoker.deserialize(response, "", TextItemResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例3: GetFragments
import com.aspose.storage.client.ApiException; //导入方法依赖的package包/类
/**
* GetFragments
* Read page fragments.
* @param name String
* @param pageNumber Integer
* @param withEmpty String
* @param storage String
* @param folder String
* @return TextItemsResponse
*/
public TextItemsResponse GetFragments (String name, Integer pageNumber, String withEmpty, String storage, String folder) {
Object postBody = null;
// verify required params are set
if(name == null || pageNumber == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/pdf/{name}/pages/{pageNumber}/fragments/?appSid={appSid}&withEmpty={withEmpty}&storage={storage}&folder={folder}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(name!=null)
resourcePath = resourcePath.replace("{" + "name" + "}" , apiInvoker.toPathValue(name));
else
resourcePath = resourcePath.replaceAll("[&?]name.*?(?=&|\\?|$)", "");
if(pageNumber!=null)
resourcePath = resourcePath.replace("{" + "pageNumber" + "}" , apiInvoker.toPathValue(pageNumber));
else
resourcePath = resourcePath.replaceAll("[&?]pageNumber.*?(?=&|\\?|$)", "");
if(withEmpty!=null)
resourcePath = resourcePath.replace("{" + "withEmpty" + "}" , apiInvoker.toPathValue(withEmpty));
else
resourcePath = resourcePath.replaceAll("[&?]withEmpty.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
if(folder!=null)
resourcePath = resourcePath.replace("{" + "folder" + "}" , apiInvoker.toPathValue(folder));
else
resourcePath = resourcePath.replaceAll("[&?]folder.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "GET", queryParams, postBody, headerParams, formParams, contentType);
return (TextItemsResponse) ApiInvoker.deserialize(response, "", TextItemsResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例4: PutCreate
import com.aspose.storage.client.ApiException; //导入方法依赖的package包/类
/**
* PutCreate
* Upload a specific file. Parameters: path - source file path e.g. /file.ext, versionID - source file's version, storage - user's source storage name, newdest - destination file path, destStorage - user's destination storage name.
* @param Path String
* @param versionId String
* @param storage String
* @param file File
* @return ResponseMessage
*/
public ResponseMessage PutCreate (String Path, String versionId, String storage, File file) {
Object postBody = null;
// verify required params are set
if(Path == null || file == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/storage/file/{Path}/?appSid={appSid}&versionId={versionId}&storage={storage}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(Path!=null)
resourcePath = resourcePath.replace("{" + "Path" + "}" , apiInvoker.toPathValue(Path));
else
resourcePath = resourcePath.replaceAll("[&?]Path.*?(?=&|\\?|$)", "");
if(versionId!=null)
resourcePath = resourcePath.replace("{" + "versionId" + "}" , apiInvoker.toPathValue(versionId));
else
resourcePath = resourcePath.replaceAll("[&?]versionId.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"multipart/form-data"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if(contentType.startsWith("multipart/form-data")) {
FormDataMultiPart mp = new FormDataMultiPart();
mp.field("file", file, MediaType.MULTIPART_FORM_DATA_TYPE);
postBody = mp;
}
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "PUT", queryParams, postBody, headerParams, formParams, contentType);
return (ResponseMessage) ApiInvoker.deserialize(response, "", ResponseMessage.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例5: GetListFileVersions
import com.aspose.storage.client.ApiException; //导入方法依赖的package包/类
/**
* GetListFileVersions
* Get the file's versions list. Parameters: path - file path e.g. /file.ext or /Folder1/file.ext, storage - user's storage name.
* @param Path String
* @param storage String
* @return FileVersionsResponse
*/
public FileVersionsResponse GetListFileVersions (String Path, String storage) {
Object postBody = null;
// verify required params are set
if(Path == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/storage/version/{Path}/?appSid={appSid}&storage={storage}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(Path!=null)
resourcePath = resourcePath.replace("{" + "Path" + "}" , apiInvoker.toPathValue(Path));
else
resourcePath = resourcePath.replaceAll("[&?]Path.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "GET", queryParams, postBody, headerParams, formParams, contentType);
return (FileVersionsResponse) ApiInvoker.deserialize(response, "", FileVersionsResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例6: GetSegments
import com.aspose.storage.client.ApiException; //导入方法依赖的package包/类
/**
* GetSegments
* Read fragment segments.
* @param name String
* @param pageNumber Integer
* @param fragmentNumber Integer
* @param withEmpty String
* @param storage String
* @param folder String
* @return TextItemsResponse
*/
public TextItemsResponse GetSegments (String name, Integer pageNumber, Integer fragmentNumber, String withEmpty, String storage, String folder) {
Object postBody = null;
// verify required params are set
if(name == null || pageNumber == null || fragmentNumber == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/pdf/{name}/pages/{pageNumber}/fragments/{fragmentNumber}/segments/?appSid={appSid}&withEmpty={withEmpty}&storage={storage}&folder={folder}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(name!=null)
resourcePath = resourcePath.replace("{" + "name" + "}" , apiInvoker.toPathValue(name));
else
resourcePath = resourcePath.replaceAll("[&?]name.*?(?=&|\\?|$)", "");
if(pageNumber!=null)
resourcePath = resourcePath.replace("{" + "pageNumber" + "}" , apiInvoker.toPathValue(pageNumber));
else
resourcePath = resourcePath.replaceAll("[&?]pageNumber.*?(?=&|\\?|$)", "");
if(fragmentNumber!=null)
resourcePath = resourcePath.replace("{" + "fragmentNumber" + "}" , apiInvoker.toPathValue(fragmentNumber));
else
resourcePath = resourcePath.replaceAll("[&?]fragmentNumber.*?(?=&|\\?|$)", "");
if(withEmpty!=null)
resourcePath = resourcePath.replace("{" + "withEmpty" + "}" , apiInvoker.toPathValue(withEmpty));
else
resourcePath = resourcePath.replaceAll("[&?]withEmpty.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
if(folder!=null)
resourcePath = resourcePath.replace("{" + "folder" + "}" , apiInvoker.toPathValue(folder));
else
resourcePath = resourcePath.replaceAll("[&?]folder.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "GET", queryParams, postBody, headerParams, formParams, contentType);
return (TextItemsResponse) ApiInvoker.deserialize(response, "", TextItemsResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例7: PutUpdateField
import com.aspose.storage.client.ApiException; //导入方法依赖的package包/类
/**
* PutUpdateField
* Update field.
* @param name String The document name.
* @param storage String The document storage.
* @param folder String The document folder.
* @param fieldName String
* @param body Field with the field data.
* @return FieldResponse
*/
public FieldResponse PutUpdateField (String name, String storage, String folder, String fieldName, Field body) {
Object postBody = body;
// verify required params are set
if(name == null || fieldName == null || body == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/pdf/{name}/fields/{fieldName}/?appSid={appSid}&storage={storage}&folder={folder}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(name!=null)
resourcePath = resourcePath.replace("{" + "name" + "}" , apiInvoker.toPathValue(name));
else
resourcePath = resourcePath.replaceAll("[&?]name.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
if(folder!=null)
resourcePath = resourcePath.replace("{" + "folder" + "}" , apiInvoker.toPathValue(folder));
else
resourcePath = resourcePath.replaceAll("[&?]folder.*?(?=&|\\?|$)", "");
if(fieldName!=null)
resourcePath = resourcePath.replace("{" + "fieldName" + "}" , apiInvoker.toPathValue(fieldName));
else
resourcePath = resourcePath.replaceAll("[&?]fieldName.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "PUT", queryParams, postBody, headerParams, formParams, contentType);
return (FieldResponse) ApiInvoker.deserialize(response, "", FieldResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例8: PostSplitDocument
import com.aspose.storage.client.ApiException; //导入方法依赖的package包/类
/**
* PostSplitDocument
* Split document to parts.
* @param name String Document name.
* @param format String Resulting documents format.
* @param from Integer Start page if defined.
* @param to Integer End page if defined.
* @param storage String The document storage.
* @param folder String The document folder.
* @return SplitResultResponse
*/
public SplitResultResponse PostSplitDocument (String name, String format, Integer from, Integer to, String storage, String folder) {
Object postBody = null;
// verify required params are set
if(name == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/pdf/{name}/split/?appSid={appSid}&toFormat={toFormat}&from={from}&to={to}&storage={storage}&folder={folder}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(name!=null)
resourcePath = resourcePath.replace("{" + "name" + "}" , apiInvoker.toPathValue(name));
else
resourcePath = resourcePath.replaceAll("[&?]name.*?(?=&|\\?|$)", "");
if(format!=null)
resourcePath = resourcePath.replace("{" + "format" + "}" , apiInvoker.toPathValue(format));
else
resourcePath = resourcePath.replaceAll("[&?]format.*?(?=&|\\?|$)", "");
if(from!=null)
resourcePath = resourcePath.replace("{" + "from" + "}" , apiInvoker.toPathValue(from));
else
resourcePath = resourcePath.replaceAll("[&?]from.*?(?=&|\\?|$)", "");
if(to!=null)
resourcePath = resourcePath.replace("{" + "to" + "}" , apiInvoker.toPathValue(to));
else
resourcePath = resourcePath.replaceAll("[&?]to.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
if(folder!=null)
resourcePath = resourcePath.replace("{" + "folder" + "}" , apiInvoker.toPathValue(folder));
else
resourcePath = resourcePath.replaceAll("[&?]folder.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "POST", queryParams, postBody, headerParams, formParams, contentType);
return (SplitResultResponse) ApiInvoker.deserialize(response, "", SplitResultResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例9: DeleteFile
import com.aspose.storage.client.ApiException; //导入方法依赖的package包/类
/**
* DeleteFile
* Remove a specific file. Parameters: path - file path e.g. /file.ext, versionID - file's version, storage - user's storage name.
* @param Path String
* @param versionId String
* @param storage String
* @return RemoveFileResponse
*/
public RemoveFileResponse DeleteFile (String Path, String versionId, String storage) {
Object postBody = null;
// verify required params are set
if(Path == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/storage/file/{Path}/?appSid={appSid}&versionId={versionId}&storage={storage}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(Path!=null)
resourcePath = resourcePath.replace("{" + "Path" + "}" , apiInvoker.toPathValue(Path));
else
resourcePath = resourcePath.replaceAll("[&?]Path.*?(?=&|\\?|$)", "");
if(versionId!=null)
resourcePath = resourcePath.replace("{" + "versionId" + "}" , apiInvoker.toPathValue(versionId));
else
resourcePath = resourcePath.replaceAll("[&?]versionId.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "DELETE", queryParams, postBody, headerParams, formParams, contentType);
return (RemoveFileResponse) ApiInvoker.deserialize(response, "", RemoveFileResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例10: DeleteProperties
import com.aspose.storage.client.ApiException; //导入方法依赖的package包/类
/**
* DeleteProperties
* Delete document properties.
* @param name String
* @param storage String
* @param folder String
* @return SaaSposeResponse
*/
public SaaSposeResponse DeleteProperties (String name, String storage, String folder) {
Object postBody = null;
// verify required params are set
if(name == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/pdf/{name}/documentproperties/?appSid={appSid}&storage={storage}&folder={folder}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(name!=null)
resourcePath = resourcePath.replace("{" + "name" + "}" , apiInvoker.toPathValue(name));
else
resourcePath = resourcePath.replaceAll("[&?]name.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
if(folder!=null)
resourcePath = resourcePath.replace("{" + "folder" + "}" , apiInvoker.toPathValue(folder));
else
resourcePath = resourcePath.replaceAll("[&?]folder.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "DELETE", queryParams, postBody, headerParams, formParams, contentType);
return (SaaSposeResponse) ApiInvoker.deserialize(response, "", SaaSposeResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例11: PutConvertDocument
import com.aspose.storage.client.ApiException; //导入方法依赖的package包/类
/**
* PutConvertDocument
* Convert document from request content to format specified.
* @param format String The format to convert.
* @param url String
* @param outPath String Path to save result
* @param file File
* @return ResponseMessage
*/
public ResponseMessage PutConvertDocument (String format, String url, String outPath, File file) {
Object postBody = null;
// create path and map variables
String resourcePath = "/pdf/convert/?appSid={appSid}&toFormat={toFormat}&url={url}&outPath={outPath}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(format!=null)
resourcePath = resourcePath.replace("{" + "format" + "}" , apiInvoker.toPathValue(format));
else
resourcePath = resourcePath.replaceAll("[&?]format.*?(?=&|\\?|$)", "");
if(url!=null)
resourcePath = resourcePath.replace("{" + "url" + "}" , apiInvoker.toPathValue(url));
else
resourcePath = resourcePath.replaceAll("[&?]url.*?(?=&|\\?|$)", "");
if(outPath!=null)
resourcePath = resourcePath.replace("{" + "outPath" + "}" , apiInvoker.toPathValue(outPath));
else
resourcePath = resourcePath.replaceAll("[&?]outPath.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"multipart/form-data"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if(file!=null){
contentType = "multipart/form-data";
FormDataMultiPart mp = new FormDataMultiPart();
mp.field("file", file, MediaType.MULTIPART_FORM_DATA_TYPE);
postBody = mp;
}else{
contentType = "application/json";
}
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "PUT", queryParams, postBody, headerParams, formParams, contentType);
return (ResponseMessage) ApiInvoker.deserialize(response, "", ResponseMessage.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例12: GetPageLinkAnnotationByIndex
import com.aspose.storage.client.ApiException; //导入方法依赖的package包/类
/**
* GetPageLinkAnnotationByIndex
* Read document page link annotation by its index.
* @param name String The document name.
* @param pageNumber Integer The page number.
* @param linkIndex Integer The link index.
* @param storage String The document storage.
* @param folder String The document folder.
* @return LinkAnnotationResponse
*/
public LinkAnnotationResponse GetPageLinkAnnotationByIndex (String name, Integer pageNumber, Integer linkIndex, String storage, String folder) {
Object postBody = null;
// verify required params are set
if(name == null || pageNumber == null || linkIndex == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/pdf/{name}/pages/{pageNumber}/links/{linkIndex}/?appSid={appSid}&storage={storage}&folder={folder}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(name!=null)
resourcePath = resourcePath.replace("{" + "name" + "}" , apiInvoker.toPathValue(name));
else
resourcePath = resourcePath.replaceAll("[&?]name.*?(?=&|\\?|$)", "");
if(pageNumber!=null)
resourcePath = resourcePath.replace("{" + "pageNumber" + "}" , apiInvoker.toPathValue(pageNumber));
else
resourcePath = resourcePath.replaceAll("[&?]pageNumber.*?(?=&|\\?|$)", "");
if(linkIndex!=null)
resourcePath = resourcePath.replace("{" + "linkIndex" + "}" , apiInvoker.toPathValue(linkIndex));
else
resourcePath = resourcePath.replaceAll("[&?]linkIndex.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
if(folder!=null)
resourcePath = resourcePath.replace("{" + "folder" + "}" , apiInvoker.toPathValue(folder));
else
resourcePath = resourcePath.replaceAll("[&?]folder.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "GET", queryParams, postBody, headerParams, formParams, contentType);
return (LinkAnnotationResponse) ApiInvoker.deserialize(response, "", LinkAnnotationResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例13: GetSegmentTextFormat
import com.aspose.storage.client.ApiException; //导入方法依赖的package包/类
/**
* GetSegmentTextFormat
* Read segment text format.
* @param name String
* @param pageNumber Integer
* @param fragmentNumber Integer
* @param segmentNumber Integer
* @param storage String
* @param folder String
* @return TextFormatResponse
*/
public TextFormatResponse GetSegmentTextFormat (String name, Integer pageNumber, Integer fragmentNumber, Integer segmentNumber, String storage, String folder) {
Object postBody = null;
// verify required params are set
if(name == null || pageNumber == null || fragmentNumber == null || segmentNumber == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/pdf/{name}/pages/{pageNumber}/fragments/{fragmentNumber}/segments/{segmentNumber}/textformat/?appSid={appSid}&storage={storage}&folder={folder}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(name!=null)
resourcePath = resourcePath.replace("{" + "name" + "}" , apiInvoker.toPathValue(name));
else
resourcePath = resourcePath.replaceAll("[&?]name.*?(?=&|\\?|$)", "");
if(pageNumber!=null)
resourcePath = resourcePath.replace("{" + "pageNumber" + "}" , apiInvoker.toPathValue(pageNumber));
else
resourcePath = resourcePath.replaceAll("[&?]pageNumber.*?(?=&|\\?|$)", "");
if(fragmentNumber!=null)
resourcePath = resourcePath.replace("{" + "fragmentNumber" + "}" , apiInvoker.toPathValue(fragmentNumber));
else
resourcePath = resourcePath.replaceAll("[&?]fragmentNumber.*?(?=&|\\?|$)", "");
if(segmentNumber!=null)
resourcePath = resourcePath.replace("{" + "segmentNumber" + "}" , apiInvoker.toPathValue(segmentNumber));
else
resourcePath = resourcePath.replaceAll("[&?]segmentNumber.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
if(folder!=null)
resourcePath = resourcePath.replace("{" + "folder" + "}" , apiInvoker.toPathValue(folder));
else
resourcePath = resourcePath.replaceAll("[&?]folder.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "GET", queryParams, postBody, headerParams, formParams, contentType);
return (TextFormatResponse) ApiInvoker.deserialize(response, "", TextFormatResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例14: GetPage
import com.aspose.storage.client.ApiException; //导入方法依赖的package包/类
/**
* GetPage
* Read document page info.
* @param name String The document name.
* @param pageNumber Integer The page number.
* @param storage String The document storage.
* @param folder String The document folder.
* @return ResponseMessage
*/
public ResponseMessage GetPage (String name, Integer pageNumber, String storage, String folder) {
Object postBody = null;
// verify required params are set
if(name == null || pageNumber == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/pdf/{name}/pages/{pageNumber}/?appSid={appSid}&storage={storage}&folder={folder}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(name!=null)
resourcePath = resourcePath.replace("{" + "name" + "}" , apiInvoker.toPathValue(name));
else
resourcePath = resourcePath.replaceAll("[&?]name.*?(?=&|\\?|$)", "");
if(pageNumber!=null)
resourcePath = resourcePath.replace("{" + "pageNumber" + "}" , apiInvoker.toPathValue(pageNumber));
else
resourcePath = resourcePath.replaceAll("[&?]pageNumber.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
if(folder!=null)
resourcePath = resourcePath.replace("{" + "folder" + "}" , apiInvoker.toPathValue(folder));
else
resourcePath = resourcePath.replaceAll("[&?]folder.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "GET", queryParams, postBody, headerParams, formParams, contentType);
return (ResponseMessage) ApiInvoker.deserialize(response, "", ResponseMessage.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例15: GetDocumentBookmarksChildren
import com.aspose.storage.client.ApiException; //导入方法依赖的package包/类
/**
* GetDocumentBookmarksChildren
* Read document bookmark/bookmarks (including children).
* @param name String The document name.
* @param bookmarkPath String The bookmark path.
* @param storage String The document storage.
* @param folder String The document folder.
* @return BookmarkResponse
*/
public BookmarkResponse GetDocumentBookmarksChildren (String name, String bookmarkPath, String storage, String folder) {
Object postBody = null;
// verify required params are set
if(name == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/pdf/{name}/bookmarks/{bookmarkPath}/?appSid={appSid}&storage={storage}&folder={folder}";
resourcePath = resourcePath.replaceAll("\\*", "").replace("&", "&").replace("/?", "?").replace("toFormat={toFormat}", "format={format}");
// query params
Map<String, String> queryParams = new HashMap<String, String>();
Map<String, String> headerParams = new HashMap<String, String>();
Map<String, String> formParams = new HashMap<String, String>();
if(name!=null)
resourcePath = resourcePath.replace("{" + "name" + "}" , apiInvoker.toPathValue(name));
else
resourcePath = resourcePath.replaceAll("[&?]name.*?(?=&|\\?|$)", "");
if(bookmarkPath!=null)
resourcePath = resourcePath.replace("{" + "bookmarkPath" + "}" , apiInvoker.toPathValue(bookmarkPath));
else
resourcePath = resourcePath.replaceAll("[&?]bookmarkPath.*?(?=&|\\?|$)", "");
if(storage!=null)
resourcePath = resourcePath.replace("{" + "storage" + "}" , apiInvoker.toPathValue(storage));
else
resourcePath = resourcePath.replaceAll("[&?]storage.*?(?=&|\\?|$)", "");
if(folder!=null)
resourcePath = resourcePath.replace("{" + "folder" + "}" , apiInvoker.toPathValue(folder));
else
resourcePath = resourcePath.replaceAll("[&?]folder.*?(?=&|\\?|$)", "");
String[] contentTypes = {
"application/json"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
try {
response = apiInvoker.invokeAPI(basePath, resourcePath, "GET", queryParams, postBody, headerParams, formParams, contentType);
return (BookmarkResponse) ApiInvoker.deserialize(response, "", BookmarkResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}