/* 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 { ApiDependencyTreeResponseDTO, ApiPolicyViolationDiffDTO, ApiReportPolicyDataDTOV2, ApiReportRawDataDTOV2, } from '../models/index'; import { ApiDependencyTreeResponseDTOFromJSON, ApiDependencyTreeResponseDTOToJSON, ApiPolicyViolationDiffDTOFromJSON, ApiPolicyViolationDiffDTOToJSON, ApiReportPolicyDataDTOV2FromJSON, ApiReportPolicyDataDTOV2ToJSON, ApiReportRawDataDTOV2FromJSON, ApiReportRawDataDTOV2ToJSON, } from '../models/index'; export interface ApplicationReportDataApiGetDataRequest { applicationPublicId: string; scanId: string; } export interface ApplicationReportDataApiGetDependencyTree1Request { applicationPublicId: string; scanId: string; } export interface ApplicationReportDataApiGetMetadataRequest { applicationPublicId: string; scanId: string; } export interface ApplicationReportDataApiGetPolicyViolationDiffRequest { applicationPublicId: string; fromCommit: string; toCommit: string; fromPolicyEvaluationId?: string; toPolicyEvaluationId?: string; includeViolationTimes?: boolean; } export interface ApplicationReportDataApiGetPolicyViolations2Request { applicationPublicId: string; scanId: string; includeViolationTimes?: boolean; page?: number; pageSize?: number; } export interface ApplicationReportDataApiGetRawData1Request { applicationPublicId: string; scanId: string; includeCustomSecurityVulnerabilityData?: boolean; } /** * ApplicationReportDataApi - interface * * @export * @interface ApplicationReportDataApiInterface */ export interface ApplicationReportDataApiInterface { /** * This is an older version of the endpoint. This call will now be redirected to /api/v2/applications/{applicationPublicId}/reports/{scanId}/raw. * @param {string} applicationPublicId Enter the applicationPublicId for the evaluated application. * @param {string} scanId Enter the scanId (reportId) of the application report created after the evaluation. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ApplicationReportDataApiInterface */ getDataRaw(requestParameters: ApplicationReportDataApiGetDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * This is an older version of the endpoint. This call will now be redirected to /api/v2/applications/{applicationPublicId}/reports/{scanId}/raw. */ getData(requestParameters: ApplicationReportDataApiGetDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve the dependencies related to the component identified at the time of application evaluation. This is currently available only for Java (Maven) and NPM applications. Permissions required: View IQ Elements * @param {string} applicationPublicId Enter the applicationPublicId created at the time of creating the application. * @param {string} scanId Enter the reportId (scanId) created at the time of evaluating the application. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ApplicationReportDataApiInterface */ getDependencyTree1Raw(requestParameters: ApplicationReportDataApiGetDependencyTree1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve the dependencies related to the component identified at the time of application evaluation. This is currently available only for Java (Maven) and NPM applications. Permissions required: View IQ Elements */ getDependencyTree1(requestParameters: ApplicationReportDataApiGetDependencyTree1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Get evaluation metadata for a specific scan. Requires READ permission on the application. * @param {string} applicationPublicId Enter the applicationPublicId for the evaluated application. * @param {string} scanId Enter the scanId (reportId) of the application report. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ApplicationReportDataApiInterface */ getMetadataRaw(requestParameters: ApplicationReportDataApiGetMetadataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Get evaluation metadata for a specific scan. Requires READ permission on the application. */ getMetadata(requestParameters: ApplicationReportDataApiGetMetadataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * By configuring Lifecycle with SCM, policy evaluations can be linked to the Git commit hash. Use this method to compare the violations between policy evaluations for 2 commits, by providing the linked commit hashes. Permissions required: View IQ Elements * @param {string} applicationPublicId Enter the applicationPublicId, created at the time of creating the application * @param {string} fromCommit Enter the commit hash linked to the earlier policy evaluation. * @param {string} toCommit Enter the commit hash linked to the other (later) policy evaluation to compare. * @param {string} [fromPolicyEvaluationId] Enter the policy evaluation Id linked to the earlier policy evaluation to compare * @param {string} [toPolicyEvaluationId] Enter the policy evaluation Id linked to the other (later) policy evaluation to compare * @param {boolean} [includeViolationTimes] Set to true to include policy violation times (open, legacy, waived, fixed) in the response if set. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ApplicationReportDataApiInterface */ getPolicyViolationDiffRaw(requestParameters: ApplicationReportDataApiGetPolicyViolationDiffRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * By configuring Lifecycle with SCM, policy evaluations can be linked to the Git commit hash. Use this method to compare the violations between policy evaluations for 2 commits, by providing the linked commit hashes. Permissions required: View IQ Elements */ getPolicyViolationDiff(requestParameters: ApplicationReportDataApiGetPolicyViolationDiffRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve the policy violation data generated as a result of an application evaluation, for each component identified in the application evaluation./n/nPermissions required: View IQ Elements * @param {string} applicationPublicId Enter the applicationPublicId created at the time of creating the application. * @param {string} scanId Enter the reportId (scanId) created at the time of evaluating the application. * @param {boolean} [includeViolationTimes] Set to true to include policy violation times (open, legacy, waived, fixed) in the response if set. * @param {number} [page] Page number (1-indexed). Must be provided together with \'pageSize\'. When omitted, all components are returned. * @param {number} [pageSize] Number of components per page (1-500). Must be provided together with \'page\'. When omitted, all components are returned. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ApplicationReportDataApiInterface */ getPolicyViolations2Raw(requestParameters: ApplicationReportDataApiGetPolicyViolations2Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve the policy violation data generated as a result of an application evaluation, for each component identified in the application evaluation./n/nPermissions required: View IQ Elements */ getPolicyViolations2(requestParameters: ApplicationReportDataApiGetPolicyViolations2Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve the \'raw\' data generated as a result of an application evaluation. \'raw\' data includes: the components identified in the application, and the licenses and vulnerabilities associated with the identified components. Optionally set `includeCustomSecurityVulnerabilityData=true` to include any configured security vulnerability custom data (remediation, cweId, cvssVector, cvssSeverity) for each securityIssue. NOT to be confused with `SecurityVulnerabilityOverride` (hash-based violation-state override). Permissions required: View IQ Elements * @param {string} applicationPublicId Enter the applicationPublicId (assigned at the time of creating a new application.) * @param {string} scanId Enter the reportId (scanId) created at the time of evaluating the application. * @param {boolean} [includeCustomSecurityVulnerabilityData] Set to true to include security vulnerability custom data (remediation, cweId, cvssVector, cvssSeverity) for each securityIssue. Defaults to false. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ApplicationReportDataApiInterface */ getRawData1Raw(requestParameters: ApplicationReportDataApiGetRawData1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve the \'raw\' data generated as a result of an application evaluation. \'raw\' data includes: the components identified in the application, and the licenses and vulnerabilities associated with the identified components. Optionally set `includeCustomSecurityVulnerabilityData=true` to include any configured security vulnerability custom data (remediation, cweId, cvssVector, cvssSeverity) for each securityIssue. NOT to be confused with `SecurityVulnerabilityOverride` (hash-based violation-state override). Permissions required: View IQ Elements */ getRawData1(requestParameters: ApplicationReportDataApiGetRawData1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class ApplicationReportDataApi extends runtime.BaseAPI implements ApplicationReportDataApiInterface { /** * This is an older version of the endpoint. This call will now be redirected to /api/v2/applications/{applicationPublicId}/reports/{scanId}/raw. */ async getDataRaw(requestParameters: ApplicationReportDataApiGetDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['applicationPublicId'] == null) { throw new runtime.RequiredError( 'applicationPublicId', 'Required parameter "applicationPublicId" was null or undefined when calling getData().' ); } if (requestParameters['scanId'] == null) { throw new runtime.RequiredError( 'scanId', 'Required parameter "scanId" was null or undefined when calling getData().' ); } 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/applications/{applicationPublicId}/reports/{scanId}`; urlPath = urlPath.replace(`{${"applicationPublicId"}}`, encodeURIComponent(String(requestParameters['applicationPublicId']))); urlPath = urlPath.replace(`{${"scanId"}}`, encodeURIComponent(String(requestParameters['scanId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * This is an older version of the endpoint. This call will now be redirected to /api/v2/applications/{applicationPublicId}/reports/{scanId}/raw. */ async getData(requestParameters: ApplicationReportDataApiGetDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.getDataRaw(requestParameters, initOverrides); } /** * Use this method to retrieve the dependencies related to the component identified at the time of application evaluation. This is currently available only for Java (Maven) and NPM applications. Permissions required: View IQ Elements */ async getDependencyTree1Raw(requestParameters: ApplicationReportDataApiGetDependencyTree1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['applicationPublicId'] == null) { throw new runtime.RequiredError( 'applicationPublicId', 'Required parameter "applicationPublicId" was null or undefined when calling getDependencyTree1().' ); } if (requestParameters['scanId'] == null) { throw new runtime.RequiredError( 'scanId', 'Required parameter "scanId" was null or undefined when calling getDependencyTree1().' ); } 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/applications/{applicationPublicId}/reports/{scanId}/dependencyTree`; urlPath = urlPath.replace(`{${"applicationPublicId"}}`, encodeURIComponent(String(requestParameters['applicationPublicId']))); urlPath = urlPath.replace(`{${"scanId"}}`, encodeURIComponent(String(requestParameters['scanId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiDependencyTreeResponseDTOFromJSON(jsonValue)); } /** * Use this method to retrieve the dependencies related to the component identified at the time of application evaluation. This is currently available only for Java (Maven) and NPM applications. Permissions required: View IQ Elements */ async getDependencyTree1(requestParameters: ApplicationReportDataApiGetDependencyTree1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getDependencyTree1Raw(requestParameters, initOverrides); return await response.value(); } /** * Get evaluation metadata for a specific scan. Requires READ permission on the application. */ async getMetadataRaw(requestParameters: ApplicationReportDataApiGetMetadataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['applicationPublicId'] == null) { throw new runtime.RequiredError( 'applicationPublicId', 'Required parameter "applicationPublicId" was null or undefined when calling getMetadata().' ); } if (requestParameters['scanId'] == null) { throw new runtime.RequiredError( 'scanId', 'Required parameter "scanId" was null or undefined when calling getMetadata().' ); } 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/applications/{applicationPublicId}/reports/{scanId}/metadata`; urlPath = urlPath.replace(`{${"applicationPublicId"}}`, encodeURIComponent(String(requestParameters['applicationPublicId']))); urlPath = urlPath.replace(`{${"scanId"}}`, encodeURIComponent(String(requestParameters['scanId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Get evaluation metadata for a specific scan. Requires READ permission on the application. */ async getMetadata(requestParameters: ApplicationReportDataApiGetMetadataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.getMetadataRaw(requestParameters, initOverrides); } /** * By configuring Lifecycle with SCM, policy evaluations can be linked to the Git commit hash. Use this method to compare the violations between policy evaluations for 2 commits, by providing the linked commit hashes. Permissions required: View IQ Elements */ async getPolicyViolationDiffRaw(requestParameters: ApplicationReportDataApiGetPolicyViolationDiffRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['applicationPublicId'] == null) { throw new runtime.RequiredError( 'applicationPublicId', 'Required parameter "applicationPublicId" was null or undefined when calling getPolicyViolationDiff().' ); } if (requestParameters['fromCommit'] == null) { throw new runtime.RequiredError( 'fromCommit', 'Required parameter "fromCommit" was null or undefined when calling getPolicyViolationDiff().' ); } if (requestParameters['toCommit'] == null) { throw new runtime.RequiredError( 'toCommit', 'Required parameter "toCommit" was null or undefined when calling getPolicyViolationDiff().' ); } const queryParameters: any = {}; if (requestParameters['fromCommit'] != null) { queryParameters['fromCommit'] = requestParameters['fromCommit']; } if (requestParameters['toCommit'] != null) { queryParameters['toCommit'] = requestParameters['toCommit']; } if (requestParameters['fromPolicyEvaluationId'] != null) { queryParameters['fromPolicyEvaluationId'] = requestParameters['fromPolicyEvaluationId']; } if (requestParameters['toPolicyEvaluationId'] != null) { queryParameters['toPolicyEvaluationId'] = requestParameters['toPolicyEvaluationId']; } if (requestParameters['includeViolationTimes'] != null) { queryParameters['includeViolationTimes'] = requestParameters['includeViolationTimes']; } 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/applications/{applicationPublicId}/reports/policyViolations/diff`; urlPath = urlPath.replace(`{${"applicationPublicId"}}`, encodeURIComponent(String(requestParameters['applicationPublicId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiPolicyViolationDiffDTOFromJSON(jsonValue)); } /** * By configuring Lifecycle with SCM, policy evaluations can be linked to the Git commit hash. Use this method to compare the violations between policy evaluations for 2 commits, by providing the linked commit hashes. Permissions required: View IQ Elements */ async getPolicyViolationDiff(requestParameters: ApplicationReportDataApiGetPolicyViolationDiffRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getPolicyViolationDiffRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to retrieve the policy violation data generated as a result of an application evaluation, for each component identified in the application evaluation./n/nPermissions required: View IQ Elements */ async getPolicyViolations2Raw(requestParameters: ApplicationReportDataApiGetPolicyViolations2Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['applicationPublicId'] == null) { throw new runtime.RequiredError( 'applicationPublicId', 'Required parameter "applicationPublicId" was null or undefined when calling getPolicyViolations2().' ); } if (requestParameters['scanId'] == null) { throw new runtime.RequiredError( 'scanId', 'Required parameter "scanId" was null or undefined when calling getPolicyViolations2().' ); } const queryParameters: any = {}; if (requestParameters['includeViolationTimes'] != null) { queryParameters['includeViolationTimes'] = requestParameters['includeViolationTimes']; } if (requestParameters['page'] != null) { queryParameters['page'] = requestParameters['page']; } if (requestParameters['pageSize'] != null) { queryParameters['pageSize'] = requestParameters['pageSize']; } 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/applications/{applicationPublicId}/reports/{scanId}/policy`; urlPath = urlPath.replace(`{${"applicationPublicId"}}`, encodeURIComponent(String(requestParameters['applicationPublicId']))); urlPath = urlPath.replace(`{${"scanId"}}`, encodeURIComponent(String(requestParameters['scanId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiReportPolicyDataDTOV2FromJSON(jsonValue)); } /** * Use this method to retrieve the policy violation data generated as a result of an application evaluation, for each component identified in the application evaluation./n/nPermissions required: View IQ Elements */ async getPolicyViolations2(requestParameters: ApplicationReportDataApiGetPolicyViolations2Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getPolicyViolations2Raw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to retrieve the \'raw\' data generated as a result of an application evaluation. \'raw\' data includes: the components identified in the application, and the licenses and vulnerabilities associated with the identified components. Optionally set `includeCustomSecurityVulnerabilityData=true` to include any configured security vulnerability custom data (remediation, cweId, cvssVector, cvssSeverity) for each securityIssue. NOT to be confused with `SecurityVulnerabilityOverride` (hash-based violation-state override). Permissions required: View IQ Elements */ async getRawData1Raw(requestParameters: ApplicationReportDataApiGetRawData1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['applicationPublicId'] == null) { throw new runtime.RequiredError( 'applicationPublicId', 'Required parameter "applicationPublicId" was null or undefined when calling getRawData1().' ); } if (requestParameters['scanId'] == null) { throw new runtime.RequiredError( 'scanId', 'Required parameter "scanId" was null or undefined when calling getRawData1().' ); } const queryParameters: any = {}; if (requestParameters['includeCustomSecurityVulnerabilityData'] != null) { queryParameters['includeCustomSecurityVulnerabilityData'] = requestParameters['includeCustomSecurityVulnerabilityData']; } 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/applications/{applicationPublicId}/reports/{scanId}/raw`; urlPath = urlPath.replace(`{${"applicationPublicId"}}`, encodeURIComponent(String(requestParameters['applicationPublicId']))); urlPath = urlPath.replace(`{${"scanId"}}`, encodeURIComponent(String(requestParameters['scanId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiReportRawDataDTOV2FromJSON(jsonValue)); } /** * Use this method to retrieve the \'raw\' data generated as a result of an application evaluation. \'raw\' data includes: the components identified in the application, and the licenses and vulnerabilities associated with the identified components. Optionally set `includeCustomSecurityVulnerabilityData=true` to include any configured security vulnerability custom data (remediation, cweId, cvssVector, cvssSeverity) for each securityIssue. NOT to be confused with `SecurityVulnerabilityOverride` (hash-based violation-state override). Permissions required: View IQ Elements */ async getRawData1(requestParameters: ApplicationReportDataApiGetRawData1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getRawData1Raw(requestParameters, initOverrides); return await response.value(); } }