UNPKG

@devopness/sdk-js

Version:

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

139 lines (138 loc) 7 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.PipelinesApiService = void 0; const ApiBaseService_1 = require("../../../services/ApiBaseService"); const ApiResponse_1 = require("../../../common/ApiResponse"); const Exceptions_1 = require("../../../common/Exceptions"); /** * PipelinesApiService - Auto-generated */ class PipelinesApiService extends ApiBaseService_1.ApiBaseService { /** * * @summary Add a Pipeline to a resource * @param {number} resourceId The resource ID. * @param {string} resourceType The resource type to add a pipeline to. * @param {PipelineCreate} pipelineCreate A JSON object containing the resource data */ addPipeline(resourceId, resourceType, pipelineCreate) { return __awaiter(this, void 0, void 0, function* () { if (resourceId === null || resourceId === undefined) { throw new Exceptions_1.ArgumentNullException('resourceId', 'addPipeline'); } if (resourceType === null || resourceType === undefined) { throw new Exceptions_1.ArgumentNullException('resourceType', 'addPipeline'); } if (pipelineCreate === null || pipelineCreate === undefined) { throw new Exceptions_1.ArgumentNullException('pipelineCreate', 'addPipeline'); } let queryString = ''; const requestUrl = '/pipelines/{resource_type}/{resource_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.post(requestUrl.replace(`{${"resource_id"}}`, encodeURIComponent(String(resourceId))).replace(`{${"resource_type"}}`, encodeURIComponent(String(resourceType))), pipelineCreate); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Delete a given Pipeline * @param {number} pipelineId The ID of the pipeline. */ deletePipeline(pipelineId) { return __awaiter(this, void 0, void 0, function* () { if (pipelineId === null || pipelineId === undefined) { throw new Exceptions_1.ArgumentNullException('pipelineId', 'deletePipeline'); } let queryString = ''; const requestUrl = '/pipelines/{pipeline_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.delete(requestUrl.replace(`{${"pipeline_id"}}`, encodeURIComponent(String(pipelineId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Get a Pipeline by ID * @param {number} pipelineId The ID of the pipeline. */ getPipeline(pipelineId) { return __awaiter(this, void 0, void 0, function* () { if (pipelineId === null || pipelineId === undefined) { throw new Exceptions_1.ArgumentNullException('pipelineId', 'getPipeline'); } let queryString = ''; const requestUrl = '/pipelines/{pipeline_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl.replace(`{${"pipeline_id"}}`, encodeURIComponent(String(pipelineId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Return a list of pipelines to a resource * @param {number} resourceId The resource ID. * @param {string} resourceType The resource type to get pipelines from. * @param {number} [page] Number of the page to be retrieved * @param {number} [perPage] Number of items returned per page */ listPipelinesByResourceType(resourceId, resourceType, page, perPage) { return __awaiter(this, void 0, void 0, function* () { if (resourceId === null || resourceId === undefined) { throw new Exceptions_1.ArgumentNullException('resourceId', 'listPipelinesByResourceType'); } if (resourceType === null || resourceType === undefined) { throw new Exceptions_1.ArgumentNullException('resourceType', 'listPipelinesByResourceType'); } 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 = '/pipelines/{resource_type}/{resource_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl.replace(`{${"resource_id"}}`, encodeURIComponent(String(resourceId))).replace(`{${"resource_type"}}`, encodeURIComponent(String(resourceType)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Update an existing Pipeline * @param {number} pipelineId The ID of the pipeline. * @param {PipelineUpdate} pipelineUpdate A JSON object containing the resource data */ updatePipeline(pipelineId, pipelineUpdate) { return __awaiter(this, void 0, void 0, function* () { if (pipelineId === null || pipelineId === undefined) { throw new Exceptions_1.ArgumentNullException('pipelineId', 'updatePipeline'); } if (pipelineUpdate === null || pipelineUpdate === undefined) { throw new Exceptions_1.ArgumentNullException('pipelineUpdate', 'updatePipeline'); } let queryString = ''; const requestUrl = '/pipelines/{pipeline_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.put(requestUrl.replace(`{${"pipeline_id"}}`, encodeURIComponent(String(pipelineId))), pipelineUpdate); return new ApiResponse_1.ApiResponse(response); }); } } exports.PipelinesApiService = PipelinesApiService;