UNPKG

@asposecloud/aspose-email-cloud

Version:
137 lines (133 loc) 6.5 kB
"use strict"; /* * MIT License * Copyright (c) 2018-2020 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 __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.ClientFolderApi = void 0; const object_serializer_1 = require("../internal/object-serializer"); const request_helper_1 = require("../internal/request-helper"); /** * ClientFolderApi operations. */ class ClientFolderApi { constructor(configuration) { this.configuration = configuration; } /** * Create new folder in email account * @param request Create folder request */ create(request) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.configuration.getApiBaseUrl() + "/email/client/folder"; // verify required parameter 'request' is not null or undefined if (request === null || request === undefined) { throw new Error('Required parameter "request" was null or undefined when calling create.'); } const requestOptions = { method: "PUT", uri: localVarPath, json: true, body: object_serializer_1.ObjectSerializer.serialize(request, "ClientFolderCreateRequest"), }; yield request_helper_1.invokeApiMethod(requestOptions, this.configuration); return Promise.resolve(null); }); } /** * Delete a folder in email account * @param request Delete folder request */ delete(request) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.configuration.getApiBaseUrl() + "/email/client/folder"; // verify required parameter 'request' is not null or undefined if (request === null || request === undefined) { throw new Error('Required parameter "request" was null or undefined when calling delete.'); } const requestOptions = { method: "DELETE", uri: localVarPath, json: true, body: object_serializer_1.ObjectSerializer.serialize(request, "ClientFolderDeleteRequest"), }; yield request_helper_1.invokeApiMethod(requestOptions, this.configuration); return Promise.resolve(null); }); } /** * Get folders list in email account * @param request contains request parameters */ getList(request) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.configuration.getApiBaseUrl() + "/email/client/folder/list"; const queryParameters = {}; const headerParams = {}; const formParams = {}; // verify required parameter 'request.account' is not null or undefined if (request.account === null || request.account === undefined) { throw new Error('Required parameter "request.account" was null or undefined when calling getList.'); } if (request.account !== undefined) { queryParameters.account = object_serializer_1.ObjectSerializer.serialize(request.account, "string"); } if (request.storage !== undefined) { queryParameters.storage = object_serializer_1.ObjectSerializer.serialize(request.storage, "string"); } if (request.accountStorageFolder !== undefined) { queryParameters.accountStorageFolder = object_serializer_1.ObjectSerializer.serialize(request.accountStorageFolder, "string"); } if (request.parentFolder !== undefined) { queryParameters.parentFolder = object_serializer_1.ObjectSerializer.serialize(request.parentFolder, "string"); } // tslint:disable-next-line:prefer-const let useFormData = false; const requestOptions = { method: "GET", qs: queryParameters, headers: headerParams, uri: localVarPath, json: true, }; if (Object.keys(formParams).length) { if (useFormData) { requestOptions.formData = formParams; } else { requestOptions.form = formParams; } } const response = yield request_helper_1.invokeApiMethod(requestOptions, this.configuration); const result = object_serializer_1.ObjectSerializer.deserialize(response.body, "MailServerFolderList"); return Promise.resolve(result); }); } } exports.ClientFolderApi = ClientFolderApi; //# sourceMappingURL=client-folder-api.js.map