UNPKG

@devopness/sdk-js

Version:

Devopness API JS/TS SDK - Painless essential DevOps to everyone

151 lines (150 loc) 7.91 kB
"use strict"; /* eslint-disable */ /** * devopness API * Devopness API - Painless essential DevOps to everyone * * The version of the OpenAPI document: latest * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ 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.ApplicationsApiService = void 0; const ApiBaseService_1 = require("../../../services/ApiBaseService"); const ApiResponse_1 = require("../../../common/ApiResponse"); const Exceptions_1 = require("../../../common/Exceptions"); /** * ApplicationsApiService - Auto-generated */ class ApplicationsApiService extends ApiBaseService_1.ApiBaseService { /** * * @summary Trigger a new deployment for current application * @param {number} applicationId The ID of the application. * @param {DeploymentApplicationCreate} deploymentApplicationCreate A JSON object containing the resource data */ addApplicationDeployment(applicationId, deploymentApplicationCreate) { return __awaiter(this, void 0, void 0, function* () { if (applicationId === null || applicationId === undefined) { throw new Exceptions_1.ArgumentNullException('applicationId', 'addApplicationDeployment'); } if (deploymentApplicationCreate === null || deploymentApplicationCreate === undefined) { throw new Exceptions_1.ArgumentNullException('deploymentApplicationCreate', 'addApplicationDeployment'); } let queryString = ''; const requestUrl = '/applications/{application_id}/deployments' + (queryString ? `?${queryString}` : ''); const response = yield this.post(requestUrl.replace(`{${"application_id"}}`, encodeURIComponent(String(applicationId))), deploymentApplicationCreate); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Create a new application * @param {number} environmentId The ID of the environment. * @param {ApplicationEnvironmentCreate} applicationEnvironmentCreate A JSON object containing the resource data */ addEnvironmentApplication(environmentId, applicationEnvironmentCreate) { return __awaiter(this, void 0, void 0, function* () { if (environmentId === null || environmentId === undefined) { throw new Exceptions_1.ArgumentNullException('environmentId', 'addEnvironmentApplication'); } if (applicationEnvironmentCreate === null || applicationEnvironmentCreate === undefined) { throw new Exceptions_1.ArgumentNullException('applicationEnvironmentCreate', 'addEnvironmentApplication'); } let queryString = ''; const requestUrl = '/environments/{environment_id}/applications' + (queryString ? `?${queryString}` : ''); const response = yield this.post(requestUrl.replace(`{${"environment_id"}}`, encodeURIComponent(String(environmentId))), applicationEnvironmentCreate); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Delete a given application * @param {number} applicationId The ID of the application. */ deleteApplication(applicationId) { return __awaiter(this, void 0, void 0, function* () { if (applicationId === null || applicationId === undefined) { throw new Exceptions_1.ArgumentNullException('applicationId', 'deleteApplication'); } let queryString = ''; const requestUrl = '/applications/{application_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.delete(requestUrl.replace(`{${"application_id"}}`, encodeURIComponent(String(applicationId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Get an application by ID * @param {number} applicationId The ID of the application. */ getApplication(applicationId) { return __awaiter(this, void 0, void 0, function* () { if (applicationId === null || applicationId === undefined) { throw new Exceptions_1.ArgumentNullException('applicationId', 'getApplication'); } let queryString = ''; const requestUrl = '/applications/{application_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl.replace(`{${"application_id"}}`, encodeURIComponent(String(applicationId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Return a list of all Applications belonging to an environment * @param {number} environmentId The ID of the environment. * @param {number} [page] Number of the page to be retrieved * @param {number} [perPage] Number of items returned per page */ listEnvironmentApplications(environmentId, page, perPage) { return __awaiter(this, void 0, void 0, function* () { if (environmentId === null || environmentId === undefined) { throw new Exceptions_1.ArgumentNullException('environmentId', 'listEnvironmentApplications'); } let queryString = ''; const queryParams = { page: page, per_page: perPage, }; for (const key in queryParams) { if (queryParams[key] === undefined || queryParams[key] === null) { continue; } queryString += (queryString ? '&' : '') + `${key}=${encodeURI(queryParams[key])}`; } const requestUrl = '/environments/{environment_id}/applications' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl.replace(`{${"environment_id"}}`, encodeURIComponent(String(environmentId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Update an existing application * @param {number} applicationId The ID of the application. * @param {ApplicationUpdate} applicationUpdate A JSON object containing the resource data */ updateApplication(applicationId, applicationUpdate) { return __awaiter(this, void 0, void 0, function* () { if (applicationId === null || applicationId === undefined) { throw new Exceptions_1.ArgumentNullException('applicationId', 'updateApplication'); } if (applicationUpdate === null || applicationUpdate === undefined) { throw new Exceptions_1.ArgumentNullException('applicationUpdate', 'updateApplication'); } let queryString = ''; const requestUrl = '/applications/{application_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.put(requestUrl.replace(`{${"application_id"}}`, encodeURIComponent(String(applicationId))), applicationUpdate); return new ApiResponse_1.ApiResponse(response); }); } } exports.ApplicationsApiService = ApplicationsApiService;