/* 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'; export interface SPDXApiGetByScanId1Request { applicationId: string; scanId: string; format?: string; generateCycloneDx?: boolean; spdxVersion?: string; } export interface SPDXApiGetLatestForStage1Request { applicationId: string; stageId: string; format?: string; generateCycloneDx?: boolean; spdxVersion?: string; } /** * SPDXApi - interface * * @export * @interface SPDXApiInterface */ export interface SPDXApiInterface { /** * Use this method to generate SBOM(s) based on a specific application scan. Permissions required: View IQ Elemets * @param {string} applicationId Enter the applicationId for the application you want to generate the SBOM(s). * @param {string} scanId Enter the scanId of the application scan. * @param {string} [format] Enter the format for the SBOM(s) to be generated. * @param {boolean} [generateCycloneDx] Set to `true` to generate an equivalent CycloneDx SBOM. Both SBOMs will be combined as a tar.gz archive. * @param {string} [spdxVersion] Enter the desired SPDX version, possible values are 2.2|2.3|3.0 (3.0 only supports JSON format) * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SPDXApiInterface */ getByScanId1Raw(requestParameters: SPDXApiGetByScanId1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to generate SBOM(s) based on a specific application scan. Permissions required: View IQ Elemets */ getByScanId1(requestParameters: SPDXApiGetByScanId1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to generate SBOM(s) based on the latest application evaluation report at the specified stage. Permissions required: View IQ Elements * @param {string} applicationId Enter the applicationId for the application you want to generate the SBOM(s). * @param {string} stageId Specify the stageId for the application evaluation. Allowed values are `develop`, `build`, `stage-release`, `release` and `operate`. * @param {string} [format] Enter the format for the SBOM(s) to be generated. * @param {boolean} [generateCycloneDx] Set to `true` to generate an equivalent CycloneDx SBOM. Both SBOMs will be combined as a tar.gz archive. * @param {string} [spdxVersion] Enter the desired SPDX version, possible values are 2.2|2.3|3.0 (3.0 only supports JSON format) * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SPDXApiInterface */ getLatestForStage1Raw(requestParameters: SPDXApiGetLatestForStage1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to generate SBOM(s) based on the latest application evaluation report at the specified stage. Permissions required: View IQ Elements */ getLatestForStage1(requestParameters: SPDXApiGetLatestForStage1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class SPDXApi extends runtime.BaseAPI implements SPDXApiInterface { /** * Use this method to generate SBOM(s) based on a specific application scan. Permissions required: View IQ Elemets */ async getByScanId1Raw(requestParameters: SPDXApiGetByScanId1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['applicationId'] == null) { throw new runtime.RequiredError( 'applicationId', 'Required parameter "applicationId" was null or undefined when calling getByScanId1().' ); } if (requestParameters['scanId'] == null) { throw new runtime.RequiredError( 'scanId', 'Required parameter "scanId" was null or undefined when calling getByScanId1().' ); } const queryParameters: any = {}; if (requestParameters['format'] != null) { queryParameters['format'] = requestParameters['format']; } if (requestParameters['generateCycloneDx'] != null) { queryParameters['generateCycloneDx'] = requestParameters['generateCycloneDx']; } if (requestParameters['spdxVersion'] != null) { queryParameters['spdxVersion'] = requestParameters['spdxVersion']; } 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/spdx/{applicationId}/reports/{scanId}`; urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId']))); urlPath = urlPath.replace(`{${"scanId"}}`, encodeURIComponent(String(requestParameters['scanId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); } else { return new runtime.TextApiResponse(response) as any; } } /** * Use this method to generate SBOM(s) based on a specific application scan. Permissions required: View IQ Elemets */ async getByScanId1(requestParameters: SPDXApiGetByScanId1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getByScanId1Raw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to generate SBOM(s) based on the latest application evaluation report at the specified stage. Permissions required: View IQ Elements */ async getLatestForStage1Raw(requestParameters: SPDXApiGetLatestForStage1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['applicationId'] == null) { throw new runtime.RequiredError( 'applicationId', 'Required parameter "applicationId" was null or undefined when calling getLatestForStage1().' ); } if (requestParameters['stageId'] == null) { throw new runtime.RequiredError( 'stageId', 'Required parameter "stageId" was null or undefined when calling getLatestForStage1().' ); } const queryParameters: any = {}; if (requestParameters['format'] != null) { queryParameters['format'] = requestParameters['format']; } if (requestParameters['generateCycloneDx'] != null) { queryParameters['generateCycloneDx'] = requestParameters['generateCycloneDx']; } if (requestParameters['spdxVersion'] != null) { queryParameters['spdxVersion'] = requestParameters['spdxVersion']; } 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/spdx/{applicationId}/stages/{stageId}`; urlPath = urlPath.replace(`{${"applicationId"}}`, encodeURIComponent(String(requestParameters['applicationId']))); urlPath = urlPath.replace(`{${"stageId"}}`, encodeURIComponent(String(requestParameters['stageId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); if (this.isJsonMime(response.headers.get('content-type'))) { return new runtime.JSONApiResponse(response); } else { return new runtime.TextApiResponse(response) as any; } } /** * Use this method to generate SBOM(s) based on the latest application evaluation report at the specified stage. Permissions required: View IQ Elements */ async getLatestForStage1(requestParameters: SPDXApiGetLatestForStage1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getLatestForStage1Raw(requestParameters, initOverrides); return await response.value(); } }