本文整理汇总了Java中com.aspose.storage.client.ApiException类的典型用法代码示例。如果您正苦于以下问题:Java ApiException类的具体用法?Java ApiException怎么用?Java ApiException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ApiException类属于com.aspose.storage.client包,在下文中一共展示了ApiException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GetDiscUsage
import com.aspose.storage.client.ApiException; //导入依赖的package包/类
/**
* GetDiscUsage
* Check the disk usage of the current account. Parameters: storage - user's storage name.
* @param storage String
* @return DiscUsageResponse
*/
public DiscUsageResponse GetDiscUsage (String storage) {
Object postBody = null;
// create path and map variables
String resourcePath = "/storage/disc/?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(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 (DiscUsageResponse) ApiInvoker.deserialize(response, "", DiscUsageResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例2: DeleteFile
import com.aspose.storage.client.ApiException; //导入依赖的package包/类
@Test
public void DeleteFile() throws ApiException {
RemoveFileResponse response = null;
try {
response = storageApi.DeleteFile("AndroidTestFolder/MovedSampleWordDocument.docx", "","");
assertEquals("200", response.getCode());
} catch (ApiException ex) {
ex.printStackTrace();
}
}
示例3: GetIsStorageExist
import com.aspose.storage.client.ApiException; //导入依赖的package包/类
@Test
public void GetIsStorageExist() throws ApiException {
StorageExistResponse response = null;
try {
response = storageApi.GetIsStorageExist("Aspose123");
assertEquals("200", response.getCode());
} catch (ApiException ex) {
ex.printStackTrace();
}
}
示例4: GetListFiles
import com.aspose.storage.client.ApiException; //导入依赖的package包/类
/**
* GetListFiles
* Get the file listing of a specific folder. Parametres: path - start with name of storage e.g. root folder '/'or some folder '/folder1/..', storage - user's storage name.
* @param Path String
* @param storage String
* @return ResponseMessage
*/
public ResponseMessage GetListFiles (String Path, String storage) {
Object postBody = null;
// create path and map variables
String resourcePath = "/storage/folder/{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 (ResponseMessage) ApiInvoker.deserialize(response, "", ResponseMessage.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例5: GetIsExist
import com.aspose.storage.client.ApiException; //导入依赖的package包/类
@Test
public void GetIsExist() throws ApiException {
FileExistResponse response = null;
try {
response = storageApi.GetIsExist("AndroidTestFolder/SampleWordDocument.docx", "", "");
assertEquals("200", response.getCode());
} catch (ApiException ex) {
ex.printStackTrace();
}
}
示例6: PutCreateFolder
import com.aspose.storage.client.ApiException; //导入依赖的package包/类
@Test
public void PutCreateFolder() throws ApiException {
ResponseMessage response = null;
try {
response = storageApi.PutCreateFolder("AndroidTestFolder",null,null);
assertEquals(200, response.getCode().intValue());
} catch (ApiException ex) {
ex.printStackTrace();
}
}
示例7: GetDownload
import com.aspose.storage.client.ApiException; //导入依赖的package包/类
@Test
public void GetDownload() throws ApiException {
ResponseMessage response = null;
try {
response = storageApi.GetDownload("AndroidTestFolder/SampleWordDocument.docx", "", "");
assertEquals(200, response.getCode().intValue());
} catch (ApiException ex) {
ex.printStackTrace();
}
}
示例8: GetListFiles
import com.aspose.storage.client.ApiException; //导入依赖的package包/类
@Test
public void GetListFiles() throws ApiException {
ResponseMessage response = null;
try {
response = storageApi.GetListFiles("AndroidTestFolder", null);
assertEquals(200, response.getCode().intValue());
} catch (ApiException ex) {
ex.printStackTrace();
}
}
示例9: GetDiscUsage
import com.aspose.storage.client.ApiException; //导入依赖的package包/类
@Test
public void GetDiscUsage() throws ApiException {
DiscUsageResponse response = null;
try {
response = storageApi.GetDiscUsage(null);
assertEquals("200",response.getCode());
assertEquals(DiscUsage.class,response.getDiscUsage().getClass());
} catch (ApiException ex) {
ex.printStackTrace();
}
}
示例10: DeleteFolder
import com.aspose.storage.client.ApiException; //导入依赖的package包/类
@Test
public void DeleteFolder() throws ApiException {
RemoveFolderResponse response = null;
try {
response = storageApi.DeleteFolder("AndroidTestFolder/AnotherAndroidTest", "", false);
assertEquals("200", response.getCode());
} catch (ApiException ex) {
ex.printStackTrace();
}
}
示例11: GetIsStorageExist
import com.aspose.storage.client.ApiException; //导入依赖的package包/类
/**
* GetIsStorageExist
* Check if a specific storage exists.
* @param name String Storage name
* @return StorageExistResponse
*/
public StorageExistResponse GetIsStorageExist (String name) {
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 = "/storage/{name}/exist/?appSid={appSid}";
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.*?(?=&|\\?|$)", "");
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 (StorageExistResponse) ApiInvoker.deserialize(response, "", StorageExistResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例12: PutCreateFolder
import com.aspose.storage.client.ApiException; //导入依赖的package包/类
/**
* PutCreateFolder
* Create the folder. Parameters: path - source folder path e.g. /Folder1, storage - user's source storage name, newdest - destination folder path e.g. /Folder2, destStorage - user's destination storage name.
* @param Path String
* @param storage String
* @param destStorage String
* @return ResponseMessage
*/
public ResponseMessage PutCreateFolder (String Path, String storage, String destStorage) {
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/folder/{Path}/?appSid={appSid}&storage={storage}&destStorage={destStorage}";
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.*?(?=&|\\?|$)", "");
if(destStorage!=null)
resourcePath = resourcePath.replace("{" + "destStorage" + "}" , apiInvoker.toPathValue(destStorage));
else
resourcePath = resourcePath.replaceAll("[&?]destStorage.*?(?=&|\\?|$)", "");
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 (ResponseMessage) ApiInvoker.deserialize(response, "", ResponseMessage.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例13: PostPageReplaceTextList
import com.aspose.storage.client.ApiException; //导入依赖的package包/类
/**
* PostPageReplaceTextList
* Page's replace text method.
* @param name String
* @param pageNumber Integer
* @param storage String
* @param folder String
* @param body TextReplaceListRequest
* @return PageTextReplaceResponse
*/
public PageTextReplaceResponse PostPageReplaceTextList (String name, Integer pageNumber, String storage, String folder, TextReplaceListRequest body) {
Object postBody = body;
// verify required params are set
if(name == null || pageNumber == null || body == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/pdf/{name}/pages/{pageNumber}/replaceTextList/?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, "POST", queryParams, postBody, headerParams, formParams, contentType);
return (PageTextReplaceResponse) ApiInvoker.deserialize(response, "", PageTextReplaceResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}
示例14: DeleteProperty
import com.aspose.storage.client.ApiException; //导入依赖的package包/类
/**
* DeleteProperty
* Delete document property.
* @param name String
* @param propertyName String
* @param storage String
* @param folder String
* @return SaaSposeResponse
*/
public SaaSposeResponse DeleteProperty (String name, String propertyName, String storage, String folder) {
Object postBody = null;
// verify required params are set
if(name == null || propertyName == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/pdf/{name}/documentproperties/{propertyName}/?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(propertyName!=null)
resourcePath = resourcePath.replace("{" + "propertyName" + "}" , apiInvoker.toPathValue(propertyName));
else
resourcePath = resourcePath.replaceAll("[&?]propertyName.*?(?=&|\\?|$)", "");
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;
}
}
}
示例15: PostMoveFile
import com.aspose.storage.client.ApiException; //导入依赖的package包/类
/**
* PostMoveFile
* Move a specific file.
* @param src String source file path e.g. /file.ext
* @param dest String
* @param versionId String source file's version,
* @param storage String user's source storage name
* @param destStorage String user's destination storage name
* @return MoveFileResponse
*/
public MoveFileResponse PostMoveFile (String src, String dest, String versionId, String storage, String destStorage) {
Object postBody = null;
// verify required params are set
if(src == null || dest == null ) {
throw new ApiException(400, "missing required params");
}
// create path and map variables
String resourcePath = "/storage/file/{src}/?dest={dest}&appSid={appSid}&versionId={versionId}&storage={storage}&destStorage={destStorage}";
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(src!=null)
resourcePath = resourcePath.replace("{" + "src" + "}" , apiInvoker.toPathValue(src));
else
resourcePath = resourcePath.replaceAll("[&?]src.*?(?=&|\\?|$)", "");
if(dest!=null)
resourcePath = resourcePath.replace("{" + "dest" + "}" , apiInvoker.toPathValue(dest));
else
resourcePath = resourcePath.replaceAll("[&?]dest.*?(?=&|\\?|$)", "");
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.*?(?=&|\\?|$)", "");
if(destStorage!=null)
resourcePath = resourcePath.replace("{" + "destStorage" + "}" , apiInvoker.toPathValue(destStorage));
else
resourcePath = resourcePath.replaceAll("[&?]destStorage.*?(?=&|\\?|$)", "");
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 (MoveFileResponse) ApiInvoker.deserialize(response, "", MoveFileResponse.class);
} catch (ApiException ex) {
if(ex.getCode() == 404) {
throw new ApiException(404, "");
}
else {
throw ex;
}
}
}