UNPKG

@devopness/sdk-js

Version:

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

123 lines (122 loc) 5.96 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.OrganizationsApiService = void 0; const ApiBaseService_1 = require("../../../services/ApiBaseService"); const ApiResponse_1 = require("../../../common/ApiResponse"); const Exceptions_1 = require("../../../common/Exceptions"); /** * OrganizationsApiService - Auto-generated */ class OrganizationsApiService extends ApiBaseService_1.ApiBaseService { /** * * @summary Create a new organization * @param {OrganizationCreate} organizationCreate A JSON object containing the resource data */ addOrganization(organizationCreate) { return __awaiter(this, void 0, void 0, function* () { if (organizationCreate === null || organizationCreate === undefined) { throw new Exceptions_1.ArgumentNullException('organizationCreate', 'addOrganization'); } let queryString = ''; const requestUrl = '/organizations' + (queryString ? `?${queryString}` : ''); const response = yield this.post(requestUrl, organizationCreate); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Get an organization by ID or URL Slug * @param {string} organizationId The numeric ID or URL Slug of an organization. */ getOrganization(organizationId) { return __awaiter(this, void 0, void 0, function* () { if (organizationId === null || organizationId === undefined) { throw new Exceptions_1.ArgumentNullException('organizationId', 'getOrganization'); } let queryString = ''; const requestUrl = '/organizations/{organization_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl.replace(`{${"organization_id"}}`, encodeURIComponent(String(organizationId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Get activity information for an organization * @param {string} organizationId The numeric ID or URL Slug of an organization. */ getOrganizationActivity(organizationId) { return __awaiter(this, void 0, void 0, function* () { if (organizationId === null || organizationId === undefined) { throw new Exceptions_1.ArgumentNullException('organizationId', 'getOrganizationActivity'); } let queryString = ''; const requestUrl = '/organizations/{organization_id}/activity' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl.replace(`{${"organization_id"}}`, encodeURIComponent(String(organizationId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary List all organizations of authenticated user * @param {number} [page] Number of the page to be retrieved * @param {number} [perPage] Number of items returned per page */ listOrganizations(page, perPage) { return __awaiter(this, void 0, void 0, function* () { 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 = '/organizations' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Update an existing organization * @param {string} organizationId The numeric ID or URL Slug of an organization. * @param {OrganizationUpdate} organizationUpdate A JSON object containing the resource data */ updateOrganization(organizationId, organizationUpdate) { return __awaiter(this, void 0, void 0, function* () { if (organizationId === null || organizationId === undefined) { throw new Exceptions_1.ArgumentNullException('organizationId', 'updateOrganization'); } if (organizationUpdate === null || organizationUpdate === undefined) { throw new Exceptions_1.ArgumentNullException('organizationUpdate', 'updateOrganization'); } let queryString = ''; const requestUrl = '/organizations/{organization_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.put(requestUrl.replace(`{${"organization_id"}}`, encodeURIComponent(String(organizationId))), organizationUpdate); return new ApiResponse_1.ApiResponse(response); }); } } exports.OrganizationsApiService = OrganizationsApiService;