UNPKG

@codacy/codacy-mcp

Version:

Codacy MCP server

197 lines (196 loc) 7.34 kB
import { OpenAPI } from '../core/OpenAPI.js'; import { request as __request } from '../core/request.js'; export class EnterpriseService { /** * Delete an Enterprise account token * This endpoint allows the authenticated user to delete a GitHub Enterprise account token. * The token will no longer be used to access enterprise-level resources on GitHub. * * @param provider Git provider * @returns void * @throws ApiError */ static deleteEnterpriseToken(provider, abortSignal) { return __request(OpenAPI, { method: 'DELETE', url: '/user/enterprise/integrations/{provider}', path: { 'provider': provider, }, abortSignal, errors: { 400: `Bad Request`, 401: `Unauthorized`, 404: `Not Found`, 500: `Internal Server Error`, }, }); } /** * Clean enterprise cache for the authenticated user * Clean cached information regarding the authenticated user on the specified enterprise, such as the list of repositories in the enterprise. * @param provider Git provider * @returns void * @throws ApiError */ static cleanEnterpriseCache(provider, abortSignal) { return __request(OpenAPI, { method: 'POST', url: '/enterprises/{provider}/cache/clean', path: { 'provider': provider, }, abortSignal, errors: { 400: `Bad Request`, 401: `Unauthorized`, 404: `Not Found`, 500: `Internal Server Error`, }, }); } /** * List user configured enterprise provider account tokens on Codacy's platform * @returns EnterpriseAccountTokenListResponse Successful operation * @throws ApiError */ static listUserEnterpriseProviderTokens(abortSignal) { return __request(OpenAPI, { method: 'GET', url: '/user/enterprise/integrations', abortSignal, errors: { 400: `Bad Request`, 401: `Unauthorized`, 500: `Internal Server Error`, }, }); } /** * Add an Enterprise account token * This endpoint allows the authenticated user to add a GitHub Enterprise account token with read permissions. * The token will be used to access enterprise-level resources on GitHub. * * @param requestBody Information of the enterprise token to create * @returns void * @throws ApiError */ static addEnterpriseToken(requestBody, abortSignal) { return __request(OpenAPI, { method: 'POST', url: '/user/enterprise/integrations', abortSignal, body: requestBody, mediaType: 'application/json', errors: { 400: `Bad Request`, 401: `Unauthorized`, 409: `Conflict`, 500: `Internal Server Error`, }, }); } /** * Get the organizations of an enterprise. * @param enterpriseName Enterprise name (slug)* @param provider Git provider* @param cursor Cursor to [specify a batch of results to request](https://docs.codacy.com/codacy-api/using-the-codacy-api/#using-pagination)* @param limit Maximum number of items to return * @returns EnterpriseOrganizationsResponse Successful operation * @throws ApiError */ static listEnterpriseOrganizations(enterpriseName, provider, cursor, limit = 100, abortSignal) { return __request(OpenAPI, { method: 'GET', url: '/enterprises/{provider}/{enterpriseName}/organizations', path: { 'enterpriseName': enterpriseName, 'provider': provider, }, query: { 'cursor': cursor, 'limit': limit, }, abortSignal, errors: { 400: `Bad Request`, 401: `Unauthorized`, 403: `Forbidden`, 404: `Not Found`, 500: `Internal Server Error`, }, }); } /** * List user enterprises * @param provider Git provider* @param cursor Cursor to [specify a batch of results to request](https://docs.codacy.com/codacy-api/using-the-codacy-api/#using-pagination)* @param limit Maximum number of items to return * @returns EnterpriseListResponse Successful operation * @throws ApiError */ static listEnterprises(provider, cursor, limit = 100, abortSignal) { return __request(OpenAPI, { method: 'GET', url: '/enterprises/{provider}', path: { 'provider': provider, }, query: { 'cursor': cursor, 'limit': limit, }, abortSignal, errors: { 400: `Bad Request`, 401: `Unauthorized`, 404: `Not Found`, 500: `Internal Server Error`, 502: `Bad Gateway`, }, }); } /** * Get an enterprise * @param enterpriseName Enterprise name (slug)* @param provider Git provider * @returns GetEnterpriseResponse Successful operation * @throws ApiError */ static getEnterprise(enterpriseName, provider, abortSignal) { return __request(OpenAPI, { method: 'GET', url: '/enterprises/{provider}/{enterpriseName}', path: { 'enterpriseName': enterpriseName, 'provider': provider, }, abortSignal, errors: { 400: `Bad Request`, 401: `Unauthorized`, 403: `Forbidden`, 404: `Not Found`, 500: `Internal Server Error`, 502: `Bad Gateway`, }, }); } /** * Get enterprise seats * List all seats of an enterprise * @param provider Git provider* @param enterpriseName Enterprise name (slug)* @param cursor Cursor to [specify a batch of results to request](https://docs.codacy.com/codacy-api/using-the-codacy-api/#using-pagination)* @param limit Maximum number of items to return* @param search Filter the results searching by this string. * @returns SeatsResponse Successful operation * @throws ApiError */ static listEnterpriseSeats(provider, enterpriseName, cursor, limit = 100, search, abortSignal) { return __request(OpenAPI, { method: 'GET', url: '/enterprises/{provider}/{enterpriseName}/seats', path: { 'provider': provider, 'enterpriseName': enterpriseName, }, query: { 'cursor': cursor, 'limit': limit, 'search': search, }, abortSignal, errors: { 400: `Bad Request`, 401: `Unauthorized`, 403: `Forbidden`, 404: `Not Found`, 500: `Internal Server Error`, }, }); } }