UNPKG

@codacy/codacy-mcp

Version:

Codacy MCP server

162 lines (161 loc) 7.21 kB
import { OpenAPI } from '../core/OpenAPI.js'; import { request as __request } from '../core/request.js'; export class MetricsService { /** * Get latest value metric * Retrieves the latest value for an aggregating metric, e.g. open issues. * * **Note:** It does not work for accumulating metrics, such as fixed issues * * @param provider Git provider* @param remoteOrganizationName Organization name on the Git provider* @param metricName Metric name* @param requestBody * @returns MetricValueResponse The latest value of the requested metric * @throws ApiError */ static retrieveLatestMetricValue(provider, remoteOrganizationName, metricName, requestBody, abortSignal) { return __request(OpenAPI, { method: 'POST', url: '/organizations/{provider}/{remoteOrganizationName}/metrics/{metricName}/latest', path: { 'provider': provider, 'remoteOrganizationName': remoteOrganizationName, 'metricName': metricName, }, abortSignal, body: requestBody, mediaType: 'application/json', errors: { 400: `Bad Request`, 401: `Unauthorized`, 404: `Not Found`, 500: `Internal Server Error`, }, }); } /** * Get latest value metric grouped * Retrieves an array of latest value for an aggregating metric, based on the `groupBy` options. * The `groupBy` can be `organization`, `repository` or a valid dimension for the requested metric. * * **Note:** * - It does not work for accumulating metrics, such as fixed issues * * @param provider Git provider* @param remoteOrganizationName Organization name on the Git provider* @param metricName Metric name* @param requestBody * @returns PeriodGroupedMetricValuesResponse A grouping of the latest values for the requested metric * @throws ApiError */ static retrieveLatestMetricGroupedValues(provider, remoteOrganizationName, metricName, requestBody, abortSignal) { return __request(OpenAPI, { method: 'POST', url: '/organizations/{provider}/{remoteOrganizationName}/metrics/{metricName}/latest-grouped', path: { 'provider': provider, 'remoteOrganizationName': remoteOrganizationName, 'metricName': metricName, }, abortSignal, body: requestBody, mediaType: 'application/json', errors: { 400: `Bad Request`, 401: `Unauthorized`, 404: `Not Found`, 500: `Internal Server Error`, }, }); } /** * Get a period value metric grouped * Retrieves the value for a metric, for a specific period, marked by its start date. * * **Notes:** * - Aggregating metrics provide the average value. * - Accumulating metrics provide the sum, representing the total historical change. * * @param provider Git provider* @param remoteOrganizationName Organization name on the Git provider* @param metricName Metric name* @param requestBody * @returns MetricValueResponse The value of the requested metric * @throws ApiError */ static retrieveValueForPeriod(provider, remoteOrganizationName, metricName, requestBody, abortSignal) { return __request(OpenAPI, { method: 'POST', url: '/organizations/{provider}/{remoteOrganizationName}/metrics/{metricName}/period', path: { 'provider': provider, 'remoteOrganizationName': remoteOrganizationName, 'metricName': metricName, }, abortSignal, body: requestBody, mediaType: 'application/json', errors: { 400: `Bad Request`, 401: `Unauthorized`, 404: `Not Found`, 500: `Internal Server Error`, }, }); } /** * Get a period value metric grouped * Retrieves an array of latest values for a metric, for a specific period, marked by its start date, * grouped accordingly to the `groupBy` field. The `groupBy` can be `organization`, `repository` or a * valid dimension for the requested metric. * * **Notes:** * - Aggregating metrics provide the average value. * - Accumulating metrics provide the sum, representing the total historical change. * * @param provider Git provider* @param remoteOrganizationName Organization name on the Git provider* @param metricName Metric name* @param requestBody * @returns PeriodGroupedMetricValuesResponse The value of the requested metric * @throws ApiError */ static retrieveGroupedValuesForPeriod(provider, remoteOrganizationName, metricName, requestBody, abortSignal) { return __request(OpenAPI, { method: 'POST', url: '/organizations/{provider}/{remoteOrganizationName}/metrics/{metricName}/period-grouped', path: { 'provider': provider, 'remoteOrganizationName': remoteOrganizationName, 'metricName': metricName, }, abortSignal, body: requestBody, mediaType: 'application/json', errors: { 400: `Bad Request`, 401: `Unauthorized`, 404: `Not Found`, 500: `Internal Server Error`, }, }); } /** * Get a period value metric grouped * Retrieves a specific metric's values for a given time range. The response includes values grouped by * period date and optionally by an additional `groupBy` parameter. The `groupBy` can be `organization`, * `repository` or a valid dimension for the requested metric. * * **Notes:** * - Aggregating metrics provide the average value. * - Accumulating metrics provide the sum, representing the total historical change. * * @param provider Git provider* @param remoteOrganizationName Organization name on the Git provider* @param metricName Metric name* @param requestBody * @returns TimerangeMetricValuesResponse The value of the requested metric * @throws ApiError */ static retrieveTimerangeMetricValues(provider, remoteOrganizationName, metricName, requestBody, abortSignal) { return __request(OpenAPI, { method: 'POST', url: '/organizations/{provider}/{remoteOrganizationName}/metrics/{metricName}/timerange', path: { 'provider': provider, 'remoteOrganizationName': remoteOrganizationName, 'metricName': metricName, }, abortSignal, body: requestBody, mediaType: 'application/json', errors: { 400: `Bad Request`, 401: `Unauthorized`, 404: `Not Found`, 500: `Internal Server Error`, }, }); } }