UNPKG

@devopness/sdk-js

Version:

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

364 lines (363 loc) 19.3 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.TeamsApiService = void 0; const ApiBaseService_1 = require("../../../services/ApiBaseService"); const ApiResponse_1 = require("../../../common/ApiResponse"); const Exceptions_1 = require("../../../common/Exceptions"); /** * TeamsApiService - Auto-generated */ class TeamsApiService extends ApiBaseService_1.ApiBaseService { /** * * @summary Add a team to the given organization * @param {string} organizationId The numeric ID or URL Slug of an organization. * @param {TeamOrganizationCreate} teamOrganizationCreate A JSON object containing the resource data */ addOrganizationTeam(organizationId, teamOrganizationCreate) { return __awaiter(this, void 0, void 0, function* () { if (organizationId === null || organizationId === undefined) { throw new Exceptions_1.ArgumentNullException('organizationId', 'addOrganizationTeam'); } if (teamOrganizationCreate === null || teamOrganizationCreate === undefined) { throw new Exceptions_1.ArgumentNullException('teamOrganizationCreate', 'addOrganizationTeam'); } let queryString = ''; const requestUrl = '/organizations/{organization_id}/teams' + (queryString ? `?${queryString}` : ''); const response = yield this.post(requestUrl.replace(`{${"organization_id"}}`, encodeURIComponent(String(organizationId))), teamOrganizationCreate); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Delete a given team * @param {number} teamId The ID of the team. */ deleteTeam(teamId) { return __awaiter(this, void 0, void 0, function* () { if (teamId === null || teamId === undefined) { throw new Exceptions_1.ArgumentNullException('teamId', 'deleteTeam'); } let queryString = ''; const requestUrl = '/teams/{team_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.delete(requestUrl.replace(`{${"team_id"}}`, encodeURIComponent(String(teamId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Get a team by ID * @param {number} teamId The ID of the team. */ getTeam(teamId) { return __awaiter(this, void 0, void 0, function* () { if (teamId === null || teamId === undefined) { throw new Exceptions_1.ArgumentNullException('teamId', 'getTeam'); } let queryString = ''; const requestUrl = '/teams/{team_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl.replace(`{${"team_id"}}`, encodeURIComponent(String(teamId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Link the given team to an environment with a specific role * @param {number} environmentId The ID of the environment. * @param {number} teamId The ID of the team. * @param {TeamEnvironmentLink} teamEnvironmentLink A JSON object containing the resource data */ linkTeamToEnvironment(environmentId, teamId, teamEnvironmentLink) { return __awaiter(this, void 0, void 0, function* () { if (environmentId === null || environmentId === undefined) { throw new Exceptions_1.ArgumentNullException('environmentId', 'linkTeamToEnvironment'); } if (teamId === null || teamId === undefined) { throw new Exceptions_1.ArgumentNullException('teamId', 'linkTeamToEnvironment'); } if (teamEnvironmentLink === null || teamEnvironmentLink === undefined) { throw new Exceptions_1.ArgumentNullException('teamEnvironmentLink', 'linkTeamToEnvironment'); } let queryString = ''; const requestUrl = '/environments/{environment_id}/teams/{team_id}/link' + (queryString ? `?${queryString}` : ''); const response = yield this.post(requestUrl.replace(`{${"environment_id"}}`, encodeURIComponent(String(environmentId))).replace(`{${"team_id"}}`, encodeURIComponent(String(teamId))), teamEnvironmentLink); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Link the given team to an organization with a specific role * @param {string} organizationId The ID of the organization. * @param {number} teamId The ID of the team. * @param {TeamOrganizationLink} teamOrganizationLink A JSON object containing the resource data */ linkTeamToOrganization(organizationId, teamId, teamOrganizationLink) { return __awaiter(this, void 0, void 0, function* () { if (organizationId === null || organizationId === undefined) { throw new Exceptions_1.ArgumentNullException('organizationId', 'linkTeamToOrganization'); } if (teamId === null || teamId === undefined) { throw new Exceptions_1.ArgumentNullException('teamId', 'linkTeamToOrganization'); } if (teamOrganizationLink === null || teamOrganizationLink === undefined) { throw new Exceptions_1.ArgumentNullException('teamOrganizationLink', 'linkTeamToOrganization'); } let queryString = ''; const requestUrl = '/organizations/{organization_id}/teams/{team_id}/link' + (queryString ? `?${queryString}` : ''); const response = yield this.post(requestUrl.replace(`{${"organization_id"}}`, encodeURIComponent(String(organizationId))).replace(`{${"team_id"}}`, encodeURIComponent(String(teamId))), teamOrganizationLink); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Link the given team to a project with a specific role * @param {number} projectId The ID of the project. * @param {number} teamId The ID of the team. * @param {TeamProjectLink} teamProjectLink A JSON object containing the resource data */ linkTeamToProject(projectId, teamId, teamProjectLink) { return __awaiter(this, void 0, void 0, function* () { if (projectId === null || projectId === undefined) { throw new Exceptions_1.ArgumentNullException('projectId', 'linkTeamToProject'); } if (teamId === null || teamId === undefined) { throw new Exceptions_1.ArgumentNullException('teamId', 'linkTeamToProject'); } if (teamProjectLink === null || teamProjectLink === undefined) { throw new Exceptions_1.ArgumentNullException('teamProjectLink', 'linkTeamToProject'); } let queryString = ''; const requestUrl = '/projects/{project_id}/teams/{team_id}/link' + (queryString ? `?${queryString}` : ''); const response = yield this.post(requestUrl.replace(`{${"project_id"}}`, encodeURIComponent(String(projectId))).replace(`{${"team_id"}}`, encodeURIComponent(String(teamId))), teamProjectLink); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Return a list of teams with access 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 */ listEnvironmentTeamMemberships(environmentId, page, perPage) { return __awaiter(this, void 0, void 0, function* () { if (environmentId === null || environmentId === undefined) { throw new Exceptions_1.ArgumentNullException('environmentId', 'listEnvironmentTeamMemberships'); } 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}/team-memberships' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl.replace(`{${"environment_id"}}`, encodeURIComponent(String(environmentId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Return a list of teams with access to an organization * @param {string} organizationId The ID of the organization. * @param {number} [page] Number of the page to be retrieved * @param {number} [perPage] Number of items returned per page */ listOrganizationTeamMemberships(organizationId, page, perPage) { return __awaiter(this, void 0, void 0, function* () { if (organizationId === null || organizationId === undefined) { throw new Exceptions_1.ArgumentNullException('organizationId', 'listOrganizationTeamMemberships'); } 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/{organization_id}/team-memberships' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl.replace(`{${"organization_id"}}`, encodeURIComponent(String(organizationId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Return a list of all teams belonging to an organization * @param {string} organizationId The numeric ID or URL Slug of an organization. * @param {number} [page] Number of the page to be retrieved * @param {number} [perPage] Number of items returned per page */ listOrganizationTeams(organizationId, page, perPage) { return __awaiter(this, void 0, void 0, function* () { if (organizationId === null || organizationId === undefined) { throw new Exceptions_1.ArgumentNullException('organizationId', 'listOrganizationTeams'); } 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/{organization_id}/teams' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl.replace(`{${"organization_id"}}`, encodeURIComponent(String(organizationId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Return a list of teams with access to a project * @param {number} projectId The ID of the project. * @param {number} [page] Number of the page to be retrieved * @param {number} [perPage] Number of items returned per page */ listProjectTeamMemberships(projectId, page, perPage) { return __awaiter(this, void 0, void 0, function* () { if (projectId === null || projectId === undefined) { throw new Exceptions_1.ArgumentNullException('projectId', 'listProjectTeamMemberships'); } 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 = '/projects/{project_id}/team-memberships' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl.replace(`{${"project_id"}}`, encodeURIComponent(String(projectId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Return a list of all memberships of a team * @param {number} teamId The ID of the team. * @param {number} [page] Number of the page to be retrieved * @param {number} [perPage] Number of items returned per page * @param {string} [filterBy] Returns only memberships associated with the given link type. */ listTeamMemberships(teamId, page, perPage, filterBy) { return __awaiter(this, void 0, void 0, function* () { if (teamId === null || teamId === undefined) { throw new Exceptions_1.ArgumentNullException('teamId', 'listTeamMemberships'); } let queryString = ''; const queryParams = { page: page, per_page: perPage, filter_by: filterBy, }; for (const key in queryParams) { if (queryParams[key] === undefined || queryParams[key] === null) { continue; } queryString += (queryString ? '&' : '') + `${key}=${encodeURI(queryParams[key])}`; } const requestUrl = '/teams/{team_id}/memberships' + (queryString ? `?${queryString}` : ''); const response = yield this.get(requestUrl.replace(`{${"team_id"}}`, encodeURIComponent(String(teamId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Unlink the given team from an environment * @param {number} environmentId The ID of the environment. * @param {number} teamId The ID of the team. */ unlinkTeamFromEnvironment(environmentId, teamId) { return __awaiter(this, void 0, void 0, function* () { if (environmentId === null || environmentId === undefined) { throw new Exceptions_1.ArgumentNullException('environmentId', 'unlinkTeamFromEnvironment'); } if (teamId === null || teamId === undefined) { throw new Exceptions_1.ArgumentNullException('teamId', 'unlinkTeamFromEnvironment'); } let queryString = ''; const requestUrl = '/environments/{environment_id}/teams/{team_id}/unlink' + (queryString ? `?${queryString}` : ''); const response = yield this.delete(requestUrl.replace(`{${"environment_id"}}`, encodeURIComponent(String(environmentId))).replace(`{${"team_id"}}`, encodeURIComponent(String(teamId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Unlink the given team from an organization * @param {string} organizationId The ID of the organization. * @param {number} teamId The ID of the team. */ unlinkTeamFromOrganization(organizationId, teamId) { return __awaiter(this, void 0, void 0, function* () { if (organizationId === null || organizationId === undefined) { throw new Exceptions_1.ArgumentNullException('organizationId', 'unlinkTeamFromOrganization'); } if (teamId === null || teamId === undefined) { throw new Exceptions_1.ArgumentNullException('teamId', 'unlinkTeamFromOrganization'); } let queryString = ''; const requestUrl = '/organizations/{organization_id}/teams/{team_id}/unlink' + (queryString ? `?${queryString}` : ''); const response = yield this.delete(requestUrl.replace(`{${"organization_id"}}`, encodeURIComponent(String(organizationId))).replace(`{${"team_id"}}`, encodeURIComponent(String(teamId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Unlink the given team from a project * @param {number} projectId The ID of the project. * @param {number} teamId The ID of the team. */ unlinkTeamFromProject(projectId, teamId) { return __awaiter(this, void 0, void 0, function* () { if (projectId === null || projectId === undefined) { throw new Exceptions_1.ArgumentNullException('projectId', 'unlinkTeamFromProject'); } if (teamId === null || teamId === undefined) { throw new Exceptions_1.ArgumentNullException('teamId', 'unlinkTeamFromProject'); } let queryString = ''; const requestUrl = '/projects/{project_id}/teams/{team_id}/unlink' + (queryString ? `?${queryString}` : ''); const response = yield this.delete(requestUrl.replace(`{${"project_id"}}`, encodeURIComponent(String(projectId))).replace(`{${"team_id"}}`, encodeURIComponent(String(teamId)))); return new ApiResponse_1.ApiResponse(response); }); } /** * * @summary Update an existing team * @param {number} teamId The ID of the team. * @param {TeamUpdate} teamUpdate A JSON object containing the resource data */ updateTeam(teamId, teamUpdate) { return __awaiter(this, void 0, void 0, function* () { if (teamId === null || teamId === undefined) { throw new Exceptions_1.ArgumentNullException('teamId', 'updateTeam'); } if (teamUpdate === null || teamUpdate === undefined) { throw new Exceptions_1.ArgumentNullException('teamUpdate', 'updateTeam'); } let queryString = ''; const requestUrl = '/teams/{team_id}' + (queryString ? `?${queryString}` : ''); const response = yield this.put(requestUrl.replace(`{${"team_id"}}`, encodeURIComponent(String(teamId))), teamUpdate); return new ApiResponse_1.ApiResponse(response); }); } } exports.TeamsApiService = TeamsApiService;