groupdocs-conversion-cloud
Version:
GroupDocs.Conversion Cloud SDK for Node.js
975 lines (974 loc) • 48.4 kB
JavaScript
"use strict";
/*
* The MIT License (MIT)
*
* Copyright (c) Aspose Pty Ltd
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.StorageApi = exports.LicenseApi = exports.InfoApi = exports.FolderApi = exports.FileApi = exports.ConvertApi = exports.AsyncApi = void 0;
const FormData = require("form-data");
const api_client_1 = require("./api_client");
const configuration_1 = require("./configuration");
const serializer_1 = require("./serializer");
__exportStar(require("./model"), exports);
__exportStar(require("./configuration"), exports);
/**
* GroupDocs.Conversion Cloud API
*/
class AsyncApi {
/**
* Creates new instance of AsyncApi
* @param appSid Application identifier (App SID).
* @param appKey Application private key (App Key).
*/
static fromKeys(appSid, appKey) {
const config = new configuration_1.Configuration(appSid, appKey);
return new AsyncApi(config);
}
/**
* Creates new instance of AsyncApi
* @param config API configuration.
*/
static fromConfig(config) {
return new AsyncApi(config);
}
/**
* @param config Configuration.
*/
constructor(config) {
this.configuration = config;
}
/**
* Get async operation result
* @param requestObj contains request parameters
*/
getOperationResult(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling getOperationResult.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/async/result";
const queryParameters = {};
// verify required parameter 'requestObj.id' is not null or undefined
if (requestObj.id === null || requestObj.id === undefined) {
throw new Error('Required parameter "requestObj.id" was null or undefined when calling getOperationResult.');
}
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "id", requestObj.id);
const requestOptions = {
method: "GET",
params: queryParameters,
url: localVarPath,
responseType: "arraybuffer",
responseEncoding: null,
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "Buffer");
return Promise.resolve(result);
});
}
/**
* Get async operation status
* @param requestObj contains request parameters
*/
getOperationStatus(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling getOperationStatus.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/async";
const queryParameters = {};
// verify required parameter 'requestObj.id' is not null or undefined
if (requestObj.id === null || requestObj.id === undefined) {
throw new Error('Required parameter "requestObj.id" was null or undefined when calling getOperationStatus.');
}
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "id", requestObj.id);
const requestOptions = {
method: "GET",
params: queryParameters,
url: localVarPath,
responseType: "json",
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "OperationResult");
return Promise.resolve(result);
});
}
/**
* Starts async conversion specified input document, from request body, to format specified
* @param requestObj contains request parameters
*/
startConvert(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling startConvert.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/async";
const queryParameters = {};
const formParams = new FormData();
// verify required parameter 'requestObj.format' is not null or undefined
if (requestObj.format === null || requestObj.format === undefined) {
throw new Error('Required parameter "requestObj.format" was null or undefined when calling startConvert.');
}
// verify required parameter 'requestObj.file' is not null or undefined
if (requestObj.file === null || requestObj.file === undefined) {
throw new Error('Required parameter "requestObj.file" was null or undefined when calling startConvert.');
}
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "format", requestObj.format);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "fromPage", requestObj.fromPage);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "pagesCount", requestObj.pagesCount);
if (requestObj.file !== undefined) {
formParams.append("File", requestObj.file, { filename: "file.name" });
}
const requestOptions = {
method: "PUT",
params: queryParameters,
url: localVarPath,
responseType: "json",
data: formParams,
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "string");
return Promise.resolve(result);
});
}
/**
* Starts async conversion specified input document to format specified in the convertSettings with specified options
* @param requestObj contains request parameters
*/
startConvertAndSave(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling startConvertAndSave.');
}
const localVarPath = this.configuration.getServerUrl() + "/conversion/async";
const queryParameters = {};
// verify required parameter 'requestObj.convertSettings' is not null or undefined
if (requestObj.convertSettings === null || requestObj.convertSettings === undefined) {
throw new Error('Required parameter "requestObj.convertSettings" was null or undefined when calling startConvertAndSave.');
}
const requestOptions = {
method: "POST",
params: queryParameters,
url: localVarPath,
responseType: "json",
data: serializer_1.Serializer.serialize(requestObj.convertSettings, requestObj.convertSettings.constructor.name === "Object" ? "ConvertSettings" : requestObj.convertSettings.constructor.name),
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "string");
return Promise.resolve(result);
});
}
}
exports.AsyncApi = AsyncApi;
/**
* GroupDocs.Conversion Cloud API
*/
class ConvertApi {
/**
* Creates new instance of ConvertApi
* @param appSid Application identifier (App SID).
* @param appKey Application private key (App Key).
*/
static fromKeys(appSid, appKey) {
const config = new configuration_1.Configuration(appSid, appKey);
return new ConvertApi(config);
}
/**
* Creates new instance of ConvertApi
* @param config API configuration.
*/
static fromConfig(config) {
return new ConvertApi(config);
}
/**
* @param config Configuration.
*/
constructor(config) {
this.configuration = config;
}
/**
* Converts specified input document to format specified in the convertSettings with specified options
* @param requestObj contains request parameters
*/
convertDocument(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling convertDocument.');
}
const localVarPath = this.configuration.getServerUrl() + "/conversion";
const queryParameters = {};
// verify required parameter 'requestObj.convertSettings' is not null or undefined
if (requestObj.convertSettings === null || requestObj.convertSettings === undefined) {
throw new Error('Required parameter "requestObj.convertSettings" was null or undefined when calling convertDocument.');
}
const requestOptions = {
method: "POST",
params: queryParameters,
url: localVarPath,
data: serializer_1.Serializer.serialize(requestObj.convertSettings, requestObj.convertSettings.constructor.name === "Object" ? "ConvertSettings" : requestObj.convertSettings.constructor.name),
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "Array<StoredConvertedResult>");
return Promise.resolve(result);
});
}
/**
* Converts specified input document to format specified in the convertSettings with specified options
* @param requestObj contains request parameters
*/
convertDocumentDownload(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling convertDocument.');
}
const localVarPath = this.configuration.getServerUrl() + "/conversion";
const queryParameters = {};
// verify required parameter 'requestObj.convertSettings' is not null or undefined
if (requestObj.convertSettings === null || requestObj.convertSettings === undefined) {
throw new Error('Required parameter "requestObj.convertSettings" was null or undefined when calling convertDocument.');
}
const requestOptions = {
method: "POST",
params: queryParameters,
url: localVarPath,
data: serializer_1.Serializer.serialize(requestObj.convertSettings, requestObj.convertSettings.constructor.name === "Object" ? "ConvertSettings" : requestObj.convertSettings.constructor.name),
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "Buffer");
return Promise.resolve(result);
});
}
/**
* Converts input document file to format specified
* @param requestObj contains request parameters
*/
convertDocumentDirect(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling convertDocumentDirect.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion";
const queryParameters = {};
const formParams = new FormData();
// verify required parameter 'requestObj.format' is not null or undefined
if (requestObj.format === null || requestObj.format === undefined) {
throw new Error('Required parameter "requestObj.format" was null or undefined when calling convertDocumentDirect.');
}
// verify required parameter 'requestObj.file' is not null or undefined
if (requestObj.file === null || requestObj.file === undefined) {
throw new Error('Required parameter "requestObj.file" was null or undefined when calling convertDocumentDirect.');
}
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "format", requestObj.format);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "fromPage", requestObj.fromPage);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "pagesCount", requestObj.pagesCount);
if (requestObj.file !== undefined) {
formParams.append("File", requestObj.file, { filename: "file.name" });
}
if (requestObj.loadOptions !== undefined) {
formParams.append("loadOptions", JSON.stringify(requestObj.loadOptions));
}
if (requestObj.convertOptions !== undefined) {
formParams.append("convertOptions", JSON.stringify(requestObj.convertOptions));
}
const requestOptions = {
method: "PUT",
params: queryParameters,
url: localVarPath,
responseType: "arraybuffer",
responseEncoding: null,
data: formParams,
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "Buffer");
return Promise.resolve(result);
});
}
}
exports.ConvertApi = ConvertApi;
/**
* GroupDocs.Conversion Cloud API
*/
class FileApi {
/**
* Creates new instance of FileApi
* @param appSid Application identifier (App SID).
* @param appKey Application private key (App Key).
*/
static fromKeys(appSid, appKey) {
const config = new configuration_1.Configuration(appSid, appKey);
return new FileApi(config);
}
/**
* Creates new instance of FileApi
* @param config API configuration.
*/
static fromConfig(config) {
return new FileApi(config);
}
/**
* @param config Configuration.
*/
constructor(config) {
this.configuration = config;
}
/**
* Copy file
* @param requestObj contains request parameters
*/
copyFile(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling copyFile.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/storage/file/copy/{srcPath}"
.replace("{" + "srcPath" + "}", String(requestObj.srcPath));
const queryParameters = {};
// verify required parameter 'requestObj.srcPath' is not null or undefined
if (requestObj.srcPath === null || requestObj.srcPath === undefined) {
throw new Error('Required parameter "requestObj.srcPath" was null or undefined when calling copyFile.');
}
// verify required parameter 'requestObj.destPath' is not null or undefined
if (requestObj.destPath === null || requestObj.destPath === undefined) {
throw new Error('Required parameter "requestObj.destPath" was null or undefined when calling copyFile.');
}
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "destPath", requestObj.destPath);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "srcStorageName", requestObj.srcStorageName);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "destStorageName", requestObj.destStorageName);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "versionId", requestObj.versionId);
const requestOptions = {
method: "PUT",
params: queryParameters,
url: localVarPath,
responseType: "json",
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
return Promise.resolve(response);
});
}
/**
* Delete file
* @param requestObj contains request parameters
*/
deleteFile(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling deleteFile.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/storage/file/{path}"
.replace("{" + "path" + "}", String(requestObj.path));
const queryParameters = {};
// verify required parameter 'requestObj.path' is not null or undefined
if (requestObj.path === null || requestObj.path === undefined) {
throw new Error('Required parameter "requestObj.path" was null or undefined when calling deleteFile.');
}
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "storageName", requestObj.storageName);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "versionId", requestObj.versionId);
const requestOptions = {
method: "DELETE",
params: queryParameters,
url: localVarPath,
responseType: "json",
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
return Promise.resolve(response);
});
}
/**
* Download file
* @param requestObj contains request parameters
*/
downloadFile(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling downloadFile.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/storage/file/{path}"
.replace("{" + "path" + "}", String(requestObj.path));
const queryParameters = {};
// verify required parameter 'requestObj.path' is not null or undefined
if (requestObj.path === null || requestObj.path === undefined) {
throw new Error('Required parameter "requestObj.path" was null or undefined when calling downloadFile.');
}
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "storageName", requestObj.storageName);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "versionId", requestObj.versionId);
const requestOptions = {
method: "GET",
params: queryParameters,
url: localVarPath,
responseType: "arraybuffer",
responseEncoding: null,
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "Buffer");
return Promise.resolve(result);
});
}
/**
* Move file
* @param requestObj contains request parameters
*/
moveFile(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling moveFile.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/storage/file/move/{srcPath}"
.replace("{" + "srcPath" + "}", String(requestObj.srcPath));
const queryParameters = {};
// verify required parameter 'requestObj.srcPath' is not null or undefined
if (requestObj.srcPath === null || requestObj.srcPath === undefined) {
throw new Error('Required parameter "requestObj.srcPath" was null or undefined when calling moveFile.');
}
// verify required parameter 'requestObj.destPath' is not null or undefined
if (requestObj.destPath === null || requestObj.destPath === undefined) {
throw new Error('Required parameter "requestObj.destPath" was null or undefined when calling moveFile.');
}
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "destPath", requestObj.destPath);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "srcStorageName", requestObj.srcStorageName);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "destStorageName", requestObj.destStorageName);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "versionId", requestObj.versionId);
const requestOptions = {
method: "PUT",
params: queryParameters,
url: localVarPath,
responseType: "json",
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
return Promise.resolve(response);
});
}
/**
* Upload file
* @param requestObj contains request parameters
*/
uploadFile(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling uploadFile.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/storage/file/{path}"
.replace("{" + "path" + "}", String(requestObj.path));
const queryParameters = {};
const formParams = new FormData();
// verify required parameter 'requestObj.path' is not null or undefined
if (requestObj.path === null || requestObj.path === undefined) {
throw new Error('Required parameter "requestObj.path" was null or undefined when calling uploadFile.');
}
// verify required parameter 'requestObj.file' is not null or undefined
if (requestObj.file === null || requestObj.file === undefined) {
throw new Error('Required parameter "requestObj.file" was null or undefined when calling uploadFile.');
}
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "storageName", requestObj.storageName);
if (requestObj.file !== undefined) {
formParams.append("File", requestObj.file, { filename: "file.name" });
}
const requestOptions = {
method: "PUT",
params: queryParameters,
url: localVarPath,
responseType: "json",
data: formParams,
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "FilesUploadResult");
return Promise.resolve(result);
});
}
}
exports.FileApi = FileApi;
/**
* GroupDocs.Conversion Cloud API
*/
class FolderApi {
/**
* Creates new instance of FolderApi
* @param appSid Application identifier (App SID).
* @param appKey Application private key (App Key).
*/
static fromKeys(appSid, appKey) {
const config = new configuration_1.Configuration(appSid, appKey);
return new FolderApi(config);
}
/**
* Creates new instance of FolderApi
* @param config API configuration.
*/
static fromConfig(config) {
return new FolderApi(config);
}
/**
* @param config Configuration.
*/
constructor(config) {
this.configuration = config;
}
/**
* Copy folder
* @param requestObj contains request parameters
*/
copyFolder(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling copyFolder.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/storage/folder/copy/{srcPath}"
.replace("{" + "srcPath" + "}", String(requestObj.srcPath));
const queryParameters = {};
// verify required parameter 'requestObj.srcPath' is not null or undefined
if (requestObj.srcPath === null || requestObj.srcPath === undefined) {
throw new Error('Required parameter "requestObj.srcPath" was null or undefined when calling copyFolder.');
}
// verify required parameter 'requestObj.destPath' is not null or undefined
if (requestObj.destPath === null || requestObj.destPath === undefined) {
throw new Error('Required parameter "requestObj.destPath" was null or undefined when calling copyFolder.');
}
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "destPath", requestObj.destPath);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "srcStorageName", requestObj.srcStorageName);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "destStorageName", requestObj.destStorageName);
const requestOptions = {
method: "PUT",
params: queryParameters,
url: localVarPath,
responseType: "json",
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
return Promise.resolve(response);
});
}
/**
* Create the folder
* @param requestObj contains request parameters
*/
createFolder(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling createFolder.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/storage/folder/{path}"
.replace("{" + "path" + "}", String(requestObj.path));
const queryParameters = {};
// verify required parameter 'requestObj.path' is not null or undefined
if (requestObj.path === null || requestObj.path === undefined) {
throw new Error('Required parameter "requestObj.path" was null or undefined when calling createFolder.');
}
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "storageName", requestObj.storageName);
const requestOptions = {
method: "PUT",
params: queryParameters,
url: localVarPath,
responseType: "json",
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
return Promise.resolve(response);
});
}
/**
* Delete folder
* @param requestObj contains request parameters
*/
deleteFolder(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling deleteFolder.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/storage/folder/{path}"
.replace("{" + "path" + "}", String(requestObj.path));
const queryParameters = {};
// verify required parameter 'requestObj.path' is not null or undefined
if (requestObj.path === null || requestObj.path === undefined) {
throw new Error('Required parameter "requestObj.path" was null or undefined when calling deleteFolder.');
}
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "storageName", requestObj.storageName);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "recursive", requestObj.recursive);
const requestOptions = {
method: "DELETE",
params: queryParameters,
url: localVarPath,
responseType: "json",
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
return Promise.resolve(response);
});
}
/**
* Get all files and folders within a folder
* @param requestObj contains request parameters
*/
getFilesList(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling getFilesList.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/storage/folder/{path}"
.replace("{" + "path" + "}", String(requestObj.path));
const queryParameters = {};
// verify required parameter 'requestObj.path' is not null or undefined
if (requestObj.path === null || requestObj.path === undefined) {
throw new Error('Required parameter "requestObj.path" was null or undefined when calling getFilesList.');
}
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "storageName", requestObj.storageName);
const requestOptions = {
method: "GET",
params: queryParameters,
url: localVarPath,
responseType: "json",
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "FilesList");
return Promise.resolve(result);
});
}
/**
* Move folder
* @param requestObj contains request parameters
*/
moveFolder(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling moveFolder.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/storage/folder/move/{srcPath}"
.replace("{" + "srcPath" + "}", String(requestObj.srcPath));
const queryParameters = {};
// verify required parameter 'requestObj.srcPath' is not null or undefined
if (requestObj.srcPath === null || requestObj.srcPath === undefined) {
throw new Error('Required parameter "requestObj.srcPath" was null or undefined when calling moveFolder.');
}
// verify required parameter 'requestObj.destPath' is not null or undefined
if (requestObj.destPath === null || requestObj.destPath === undefined) {
throw new Error('Required parameter "requestObj.destPath" was null or undefined when calling moveFolder.');
}
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "destPath", requestObj.destPath);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "srcStorageName", requestObj.srcStorageName);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "destStorageName", requestObj.destStorageName);
const requestOptions = {
method: "PUT",
params: queryParameters,
url: localVarPath,
responseType: "json",
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
return Promise.resolve(response);
});
}
}
exports.FolderApi = FolderApi;
/**
* GroupDocs.Conversion Cloud API
*/
class InfoApi {
/**
* Creates new instance of InfoApi
* @param appSid Application identifier (App SID).
* @param appKey Application private key (App Key).
*/
static fromKeys(appSid, appKey) {
const config = new configuration_1.Configuration(appSid, appKey);
return new InfoApi(config);
}
/**
* Creates new instance of InfoApi
* @param config API configuration.
*/
static fromConfig(config) {
return new InfoApi(config);
}
/**
* @param config Configuration.
*/
constructor(config) {
this.configuration = config;
}
/**
* Returns metadata for provided document
* @param requestObj contains request parameters
*/
getDocumentMetadata(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling getDocumentMetadata.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/info";
const queryParameters = {};
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "filePath", requestObj.filePath);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "storageName", requestObj.storageName);
const requestOptions = {
method: "GET",
params: queryParameters,
url: localVarPath,
responseType: "json",
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "DocumentMetadata");
return Promise.resolve(result);
});
}
/**
* Returns all supported conversion types
* @param requestObj contains request parameters
*/
getSupportedConversionTypes(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling getSupportedConversionTypes.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/formats";
const queryParameters = {};
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "filePath", requestObj.filePath);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "storageName", requestObj.storageName);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "format", requestObj.format);
const requestOptions = {
method: "GET",
params: queryParameters,
url: localVarPath,
responseType: "json",
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "Array<SupportedFormat>");
return Promise.resolve(result);
});
}
}
exports.InfoApi = InfoApi;
/**
* GroupDocs.Conversion Cloud API
*/
class LicenseApi {
/**
* Creates new instance of LicenseApi
* @param appSid Application identifier (App SID).
* @param appKey Application private key (App Key).
*/
static fromKeys(appSid, appKey) {
const config = new configuration_1.Configuration(appSid, appKey);
return new LicenseApi(config);
}
/**
* Creates new instance of LicenseApi
* @param config API configuration.
*/
static fromConfig(config) {
return new LicenseApi(config);
}
/**
* @param config Configuration.
*/
constructor(config) {
this.configuration = config;
}
/**
* Get license consumption
* @param requestObj contains request parameters
*/
getConsumptionCredit() {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.configuration.getServerUrl() + "/conversion/consumption";
const queryParameters = {};
const requestOptions = {
method: "GET",
params: queryParameters,
url: localVarPath,
responseType: "json",
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "ConsumptionResult");
return Promise.resolve(result);
});
}
/**
* Get license information
* @param requestObj contains request parameters
*/
getLicenseInfo() {
return __awaiter(this, void 0, void 0, function* () {
const localVarPath = this.configuration.getServerUrl() + "/conversion/license";
const queryParameters = {};
const requestOptions = {
method: "GET",
params: queryParameters,
url: localVarPath,
responseType: "json",
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "LicenseInfo");
return Promise.resolve(result);
});
}
}
exports.LicenseApi = LicenseApi;
/**
* GroupDocs.Conversion Cloud API
*/
class StorageApi {
/**
* Creates new instance of StorageApi
* @param appSid Application identifier (App SID).
* @param appKey Application private key (App Key).
*/
static fromKeys(appSid, appKey) {
const config = new configuration_1.Configuration(appSid, appKey);
return new StorageApi(config);
}
/**
* Creates new instance of StorageApi
* @param config API configuration.
*/
static fromConfig(config) {
return new StorageApi(config);
}
/**
* @param config Configuration.
*/
constructor(config) {
this.configuration = config;
}
/**
* Get disc usage
* @param requestObj contains request parameters
*/
getDiscUsage(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling getDiscUsage.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/storage/disc";
const queryParameters = {};
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "storageName", requestObj.storageName);
const requestOptions = {
method: "GET",
params: queryParameters,
url: localVarPath,
responseType: "json",
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "DiscUsage");
return Promise.resolve(result);
});
}
/**
* Get file versions
* @param requestObj contains request parameters
*/
getFileVersions(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling getFileVersions.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/storage/version/{path}"
.replace("{" + "path" + "}", String(requestObj.path));
const queryParameters = {};
// verify required parameter 'requestObj.path' is not null or undefined
if (requestObj.path === null || requestObj.path === undefined) {
throw new Error('Required parameter "requestObj.path" was null or undefined when calling getFileVersions.');
}
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "storageName", requestObj.storageName);
const requestOptions = {
method: "GET",
params: queryParameters,
url: localVarPath,
responseType: "json",
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "FileVersions");
return Promise.resolve(result);
});
}
/**
* Check if file or folder exists
* @param requestObj contains request parameters
*/
objectExists(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling objectExists.');
}
let localVarPath = this.configuration.getServerUrl() + "/conversion/storage/exist/{path}"
.replace("{" + "path" + "}", String(requestObj.path));
const queryParameters = {};
// verify required parameter 'requestObj.path' is not null or undefined
if (requestObj.path === null || requestObj.path === undefined) {
throw new Error('Required parameter "requestObj.path" was null or undefined when calling objectExists.');
}
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "storageName", requestObj.storageName);
localVarPath = (0, api_client_1.addQueryParameterToUrl)(localVarPath, queryParameters, "versionId", requestObj.versionId);
const requestOptions = {
method: "GET",
params: queryParameters,
url: localVarPath,
responseType: "json",
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "ObjectExist");
return Promise.resolve(result);
});
}
/**
* Check if storage exists
* @param requestObj contains request parameters
*/
storageExists(requestObj) {
return __awaiter(this, void 0, void 0, function* () {
if (requestObj === null || requestObj === undefined) {
throw new Error('Required parameter "requestObj" was null or undefined when calling storageExists.');
}
const localVarPath = this.configuration.getServerUrl() + "/conversion/storage/{storageName}/exist"
.replace("{" + "storageName" + "}", String(requestObj.storageName));
const queryParameters = {};
// verify required parameter 'requestObj.storageName' is not null or undefined
if (requestObj.storageName === null || requestObj.storageName === undefined) {
throw new Error('Required parameter "requestObj.storageName" was null or undefined when calling storageExists.');
}
const requestOptions = {
method: "GET",
params: queryParameters,
url: localVarPath,
responseType: "json",
};
const response = yield (0, api_client_1.invokeApiMethod)(requestOptions, this.configuration);
const result = serializer_1.Serializer.deserialize(response.data, "StorageExist");
return Promise.resolve(result);
});
}
}
exports.StorageApi = StorageApi;