UNPKG

@smartbear/mcp

Version:

MCP server for interacting SmartBear Products

65 lines (64 loc) 3.3 kB
import { ErrorsApiFetchParamCreator, } from "./api.js"; import { BaseAPI, getQueryParams } from "./base.js"; export class ErrorAPI extends BaseAPI { static filterFields = ["url", "project_url", "events_url"]; /** * View an Error on a Project * GET /projects/{project_id}/errors/{error_id} */ async viewErrorOnProject(projectId, errorId) { const localVarFetchArgs = ErrorsApiFetchParamCreator(this.configuration).viewErrorOnProject(projectId, errorId); return await this.requestObject(localVarFetchArgs.url, localVarFetchArgs.options); } /** * Get the latest Event in a Project, with optional filters * GET /projects/{project_id}/events */ async listEventsOnProject(projectId, base, sort, direction, perPage, filters, fullReports) { const localVarFetchArgs = ErrorsApiFetchParamCreator(this.configuration).listEventsOnProject(projectId, base ?? undefined, sort, direction, perPage, undefined, fullReports, { query: filters }); return await this.requestArray(localVarFetchArgs.url, localVarFetchArgs.options, false); } /** * View an Event by ID * GET /projects/{project_id}/events/{event_id} */ async viewEventById(projectId, eventId) { const localVarFetchArgs = ErrorsApiFetchParamCreator(this.configuration).viewEventById(projectId, eventId); return await this.requestObject(localVarFetchArgs.url, localVarFetchArgs.options); } /** * List the Errors on a Project * GET /projects/{project_id}/errors */ async listProjectErrors(projectId, base, sort, direction, perPage, filters, nextUrl) { const options = getQueryParams(nextUrl, nextUrl ? undefined : filters); if (nextUrl) { if (perPage) { // Next links need to be used as-is to ensure results are consistent, so only the page size can be modified // the others will get overridden options.query.per_page = perPage.toString(); } direction = undefined; sort = undefined; base = undefined; } const localVarFetchArgs = ErrorsApiFetchParamCreator(this.configuration).listProjectErrors(projectId, base ?? undefined, sort, direction, perPage, undefined, undefined, options); return await this.requestArray(localVarFetchArgs.url, localVarFetchArgs.options, false); } /** * Update an Error on a Project * PATCH /projects/{project_id}/errors/{error_id} */ async updateErrorOnProject(projectId, errorId, body) { const localVarFetchArgs = ErrorsApiFetchParamCreator(this.configuration).updateErrorOnProject(body, projectId, errorId); return await this.requestObject(localVarFetchArgs.url, localVarFetchArgs.options); } /** * List Pivots on an Error * GET /projects/{project_id}/errors/{error_id}/pivots */ async getPivotValuesOnAnError(projectId, errorId, filters, summarySize, pivots, perPage) { const localVarFetchArgs = ErrorsApiFetchParamCreator(this.configuration).listPivotsOnAnError(projectId, errorId, undefined, summarySize, pivots, perPage, { query: filters }); return await this.requestArray(localVarFetchArgs.url, localVarFetchArgs.options, false); } }