@codacy/codacy-mcp
Version:
Codacy MCP server
166 lines (165 loc) • 7.43 kB
JavaScript
import { OpenAPI } from '../core/OpenAPI.js';
import { request as __request } from '../core/request.js';
export class SegmentsService {
/**
* Get the status of the segments synchronization.
* @param provider Git provider* @param remoteOrganizationName Organization name on the Git provider * @returns SegmentsSyncStatusResponse Successful operation
* @throws ApiError
*/
static getSegmentsSyncStatus(provider, remoteOrganizationName, abortSignal) {
return __request(OpenAPI, {
method: 'GET',
url: '/organizations/{provider}/{remoteOrganizationName}/segments/sync',
path: {
'provider': provider,
'remoteOrganizationName': remoteOrganizationName,
},
abortSignal,
errors: {
400: `Bad Request`,
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
500: `Internal Server Error`,
},
});
}
/**
* Synchronize the segments of the organization with the git provider. For Github Segments are the repositories custom properties.
* @param provider Git provider* @param remoteOrganizationName Organization name on the Git provider * @returns any Sync already in progress
* @throws ApiError
*/
static syncSegments(provider, remoteOrganizationName, abortSignal) {
return __request(OpenAPI, {
method: 'POST',
url: '/organizations/{provider}/{remoteOrganizationName}/segments/sync',
path: {
'provider': provider,
'remoteOrganizationName': remoteOrganizationName,
},
abortSignal,
errors: {
400: `Bad Request`,
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
500: `Internal Server Error`,
},
});
}
/**
* Get the segments keys of the organization.
* @param provider Git provider* @param remoteOrganizationName Organization name on the 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* @param search Filter the results searching by this string. * @returns SegmentsKeysResponse Successful operation
* @throws ApiError
*/
static getSegmentsKeys(provider, remoteOrganizationName, cursor, limit = 100, search, abortSignal) {
return __request(OpenAPI, {
method: 'GET',
url: '/organizations/{provider}/{remoteOrganizationName}/segments/keys',
path: {
'provider': provider,
'remoteOrganizationName': remoteOrganizationName,
},
query: {
'cursor': cursor,
'limit': limit,
'search': search,
},
abortSignal,
errors: {
400: `Bad Request`,
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
500: `Internal Server Error`,
},
});
}
/**
* Get the segments keys with ids of the organization.
* @param provider Git provider* @param remoteOrganizationName Organization name on the 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* @param search Filter the results searching by this string. * @returns SegmentsKeysIdsResponse Successful operation
* @throws ApiError
*/
static getSegmentsKeysWithIds(provider, remoteOrganizationName, cursor, limit = 100, search, abortSignal) {
return __request(OpenAPI, {
method: 'GET',
url: '/organizations/{provider}/{remoteOrganizationName}/segments/keys/ids',
path: {
'provider': provider,
'remoteOrganizationName': remoteOrganizationName,
},
query: {
'cursor': cursor,
'limit': limit,
'search': search,
},
abortSignal,
errors: {
400: `Bad Request`,
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
500: `Internal Server Error`,
},
});
}
/**
* @deprecated
* This route is deprecated, use getSegments instead.
* @param provider Git provider* @param remoteOrganizationName Organization name on the Git provider* @param segmentKey Key of the segment.* @param cursor Cursor to [specify a batch of results to request](https://docs.codacy.com/codacy-api/using-the-codacy-api/#using-pagination)* @param search Filter the results searching by this string.* @param limit Maximum number of items to return * @returns SegmentsResponseDeprecated Successful operation
* @throws ApiError
*/
static getSegmentsValues(provider, remoteOrganizationName, segmentKey, cursor, search, limit = 100, abortSignal) {
return __request(OpenAPI, {
method: 'GET',
url: '/organizations/{provider}/{remoteOrganizationName}/segments/values/{segmentKey}',
path: {
'provider': provider,
'remoteOrganizationName': remoteOrganizationName,
'segmentKey': segmentKey,
},
query: {
'cursor': cursor,
'search': search,
'limit': limit,
},
abortSignal,
errors: {
400: `Bad Request`,
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
500: `Internal Server Error`,
},
});
}
/**
* Get the segments of the organization and segment key.
* @param provider Git provider* @param remoteOrganizationName Organization name on the Git provider* @param segmentKey Key of the segment.* @param cursor Cursor to [specify a batch of results to request](https://docs.codacy.com/codacy-api/using-the-codacy-api/#using-pagination)* @param search Filter the results searching by this string.* @param limit Maximum number of items to return * @returns SegmentsResponse Successful operation
* @throws ApiError
*/
static getSegments(provider, remoteOrganizationName, segmentKey, cursor, search, limit = 100, abortSignal) {
return __request(OpenAPI, {
method: 'GET',
url: '/organizations/{provider}/{remoteOrganizationName}/segments/{segmentKey}/values',
path: {
'provider': provider,
'remoteOrganizationName': remoteOrganizationName,
'segmentKey': segmentKey,
},
query: {
'cursor': cursor,
'search': search,
'limit': limit,
},
abortSignal,
errors: {
400: `Bad Request`,
401: `Unauthorized`,
403: `Forbidden`,
404: `Not Found`,
500: `Internal Server Error`,
},
});
}
}