UNPKG

@codacy/codacy-mcp

Version:

Codacy MCP server

249 lines (248 loc) 8.63 kB
import { OpenAPI } from '../core/OpenAPI.js'; import { request as __request } from '../core/request.js'; export class AccountService { /** * Get the authenticated user * Get the authenticated user * @returns UserResponse Successful operation * @throws ApiError */ static getUser(abortSignal) { return __request(OpenAPI, { method: 'GET', url: '/user', abortSignal, errors: { 401: `Unauthorized`, 500: `Internal Server Error`, }, }); } /** * @returns void * @throws ApiError */ static deleteUser(abortSignal) { return __request(OpenAPI, { method: 'DELETE', url: '/user', abortSignal, errors: { 401: `Unauthorized`, 409: `Conflict`, 500: `Internal Server Error`, }, }); } /** * @param requestBody * @returns UserResponse Successful operation * @throws ApiError */ static patchUser(requestBody, abortSignal) { return __request(OpenAPI, { method: 'PATCH', url: '/user', abortSignal, body: requestBody, mediaType: 'application/json', errors: { 400: `Bad Request`, 401: `Unauthorized`, 404: `Not Found`, 500: `Internal Server Error`, }, }); } /** * List organizations for the authenticated user * List organizations for the authenticated user * @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 OrganizationListResponse Successful operation * @throws ApiError */ static listUserOrganizations(cursor, limit = 100, abortSignal) { return __request(OpenAPI, { method: 'GET', url: '/user/organizations', query: { 'cursor': cursor, 'limit': limit, }, abortSignal, errors: { 400: `Bad Request`, 401: `Unauthorized`, 500: `Internal Server Error`, }, }); } /** * List organizations for the authenticated user * List organizations for the authenticated user * @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 OrganizationListResponse Successful operation * @throws ApiError */ static listOrganizations(provider, cursor, limit = 100, abortSignal) { return __request(OpenAPI, { method: 'GET', url: '/user/organizations/{provider}', path: { 'provider': provider, }, query: { 'cursor': cursor, 'limit': limit, }, abortSignal, errors: { 400: `Bad Request`, 401: `Unauthorized`, 500: `Internal Server Error`, }, }); } /** * Get organization for the authenticated user * Get organization for the authenticated user * @param provider Git provider* @param remoteOrganizationName Organization name on the Git provider * @returns OrganizationResponse Successful operation * @throws ApiError */ static getUserOrganization(provider, remoteOrganizationName, abortSignal) { return __request(OpenAPI, { method: 'GET', url: '/user/organizations/{provider}/{remoteOrganizationName}', path: { 'provider': provider, 'remoteOrganizationName': remoteOrganizationName, }, abortSignal, errors: { 400: `Bad Request`, 401: `Unauthorized`, 404: `Not Found`, 500: `Internal Server Error`, }, }); } /** * List integrations for the authenticated user * List integrations for the authenticated user * @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 IntegrationListResponse Successful operation * @throws ApiError */ static listUserIntegrations(cursor, limit = 100, abortSignal) { return __request(OpenAPI, { method: 'GET', url: '/user/integrations', query: { 'cursor': cursor, 'limit': limit, }, abortSignal, errors: { 400: `Bad Request`, 401: `Unauthorized`, 500: `Internal Server Error`, }, }); } /** * @param provider Git provider * @returns void * @throws ApiError */ static deleteIntegration(provider, abortSignal) { return __request(OpenAPI, { method: 'DELETE', url: '/user/integrations/{provider}', path: { 'provider': provider, }, abortSignal, errors: { 400: `Bad Request`, 401: `Unauthorized`, 404: `Not Found`, 500: `Internal Server Error`, }, }); } /** * Get organization by provider installation id * __Note__ Currently supports only `gh` as the `provider` parameter. * @param provider Git provider* @param installationId Identifier of the Codacy installation * @returns OrganizationResponse Successful operation * @throws ApiError */ static getOrganizationByInstallationId(provider, installationId, abortSignal) { return __request(OpenAPI, { method: 'GET', url: '/organizations/{provider}/installation/{installationId}', path: { 'provider': provider, 'installationId': installationId, }, abortSignal, errors: { 400: `Bad Request`, 401: `Unauthorized`, 404: `Not Found`, 500: `Internal Server Error`, }, }); } /** * List the [account API tokens](https://docs.codacy.com/codacy-api/api-tokens/) of the authenticated user * @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 ApiTokenListResponse Successful operation * @throws ApiError */ static getUserApiTokens(cursor, limit = 100, abortSignal) { return __request(OpenAPI, { method: 'GET', url: '/user/tokens', query: { 'cursor': cursor, 'limit': limit, }, abortSignal, errors: { 400: `Bad Request`, 401: `Unauthorized`, 500: `Internal Server Error`, }, }); } /** * Create a new [account API token](https://docs.codacy.com/codacy-api/api-tokens/) for the authenticated user * @returns ApiToken Successful operation * @throws ApiError */ static createUserApiToken(abortSignal) { return __request(OpenAPI, { method: 'POST', url: '/user/tokens', abortSignal, errors: { 401: `Unauthorized`, 500: `Internal Server Error`, }, }); } /** * Delete an [account API token](https://docs.codacy.com/codacy-api/api-tokens/) for the authenticated user by ID * @param tokenId API token ID * @returns void * @throws ApiError */ static deleteUserApiToken(tokenId, abortSignal) { return __request(OpenAPI, { method: 'DELETE', url: '/user/tokens/{tokenId}', path: { 'tokenId': tokenId, }, abortSignal, errors: { 401: `Unauthorized`, 404: `Not Found`, 500: `Internal Server Error`, }, }); } }