/* tslint:disable */ /* eslint-disable */ /** * Sonatype Lifecycle Public REST API * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.207.0-01 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from '../runtime'; import type { ApiPullRequestResults, } from '../models/index'; import { ApiPullRequestResultsFromJSON, ApiPullRequestResultsToJSON, } from '../models/index'; export interface SourceControlMetricsApiGetSourceControlRequest { ownerType: GetSourceControlOwnerTypeEnum; internalOwnerId: string; } /** * SourceControlMetricsApi - interface * * @export * @interface SourceControlMetricsApiInterface */ export interface SourceControlMetricsApiInterface { /** * Use this method to view the source control pull request metrics. Permissions required: View IQ Elements * @param {'application' | 'organization'} ownerType Select the ownerType for the pull requests. * @param {string} internalOwnerId Enter the ownerId corresponding to the ownerType. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SourceControlMetricsApiInterface */ getSourceControlRaw(requestParameters: SourceControlMetricsApiGetSourceControlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to view the source control pull request metrics. Permissions required: View IQ Elements */ getSourceControl(requestParameters: SourceControlMetricsApiGetSourceControlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class SourceControlMetricsApi extends runtime.BaseAPI implements SourceControlMetricsApiInterface { /** * Use this method to view the source control pull request metrics. Permissions required: View IQ Elements */ async getSourceControlRaw(requestParameters: SourceControlMetricsApiGetSourceControlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling getSourceControl().' ); } if (requestParameters['internalOwnerId'] == null) { throw new runtime.RequiredError( 'internalOwnerId', 'Required parameter "internalOwnerId" was null or undefined when calling getSourceControl().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("BearerAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/api/v2/sourceControlMetrics/{ownerType}/{internalOwnerId}`; urlPath = urlPath.replace(`{${"ownerType"}}`, encodeURIComponent(String(requestParameters['ownerType']))); urlPath = urlPath.replace(`{${"internalOwnerId"}}`, encodeURIComponent(String(requestParameters['internalOwnerId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiPullRequestResultsFromJSON(jsonValue)); } /** * Use this method to view the source control pull request metrics. Permissions required: View IQ Elements */ async getSourceControl(requestParameters: SourceControlMetricsApiGetSourceControlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getSourceControlRaw(requestParameters, initOverrides); return await response.value(); } } /** * @export */ export const GetSourceControlOwnerTypeEnum = { Application: 'application', Organization: 'organization' } as const; export type GetSourceControlOwnerTypeEnum = typeof GetSourceControlOwnerTypeEnum[keyof typeof GetSourceControlOwnerTypeEnum];