/* tslint:disable */ /* eslint-disable */ /** * Sonatype Guide API * REST API into [Sonatype Guide](https://guide.sonatype.com). * * The version of the OpenAPI document: 202607 * * * 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 { ComponentReportGet, ComponentReportPost, PurlRequestPost, } from '../models/index'; import { ComponentReportGetFromJSON, ComponentReportGetToJSON, ComponentReportPostFromJSON, ComponentReportPostToJSON, PurlRequestPostFromJSON, PurlRequestPostToJSON, } from '../models/index'; export interface OSSIndexCompatibilityApiGetComponentReportRequest { userAgent?: string; } export interface OSSIndexCompatibilityApiGetComponentReport1Request { userAgent?: string; } export interface OSSIndexCompatibilityApiGetComponentReportsRequest { purlRequestPost: PurlRequestPost; userAgent?: string; } export interface OSSIndexCompatibilityApiGetComponentReports1Request { purlRequestPost: PurlRequestPost; userAgent?: string; } /** * */ export class OSSIndexCompatibilityApi extends runtime.BaseAPI { /** * Retrieves a component report for a single Package URL (PURL). Authentication: - HTTP Basic Authentication required - Authorization header: Basic Response Headers: - X-Credits-Used: Credits consumed for this request - X-Credits-Remaining: Available credit balance - X-Credits-Warning: Alert when approaching credit limit (JSON) Note: Credits are only charged when a component is found. Requests for the same component on the same day are not charged multiple times. * Get component report by PURL */ async getComponentReportRaw(requestParameters: OSSIndexCompatibilityApiGetComponentReportRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (requestParameters['userAgent'] != null) { headerParameters['User-Agent'] = String(requestParameters['userAgent']); } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } let urlPath = `/api/v3/authorized/component-report/**`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ComponentReportGetFromJSON(jsonValue)); } /** * Retrieves a component report for a single Package URL (PURL). Authentication: - HTTP Basic Authentication required - Authorization header: Basic Response Headers: - X-Credits-Used: Credits consumed for this request - X-Credits-Remaining: Available credit balance - X-Credits-Warning: Alert when approaching credit limit (JSON) Note: Credits are only charged when a component is found. Requests for the same component on the same day are not charged multiple times. * Get component report by PURL */ async getComponentReport(requestParameters: OSSIndexCompatibilityApiGetComponentReportRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getComponentReportRaw(requestParameters, initOverrides); return await response.value(); } /** * Retrieves a component report for a single Package URL (PURL). Authentication: - HTTP Basic Authentication required - Authorization header: Basic Response Headers: - X-Credits-Used: Credits consumed for this request - X-Credits-Remaining: Available credit balance - X-Credits-Warning: Alert when approaching credit limit (JSON) Note: Credits are only charged when a component is found. Requests for the same component on the same day are not charged multiple times. * Get component report by PURL */ async getComponentReport1Raw(requestParameters: OSSIndexCompatibilityApiGetComponentReport1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (requestParameters['userAgent'] != null) { headerParameters['User-Agent'] = String(requestParameters['userAgent']); } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } let urlPath = `/api/v3/component-report/**`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ComponentReportGetFromJSON(jsonValue)); } /** * Retrieves a component report for a single Package URL (PURL). Authentication: - HTTP Basic Authentication required - Authorization header: Basic Response Headers: - X-Credits-Used: Credits consumed for this request - X-Credits-Remaining: Available credit balance - X-Credits-Warning: Alert when approaching credit limit (JSON) Note: Credits are only charged when a component is found. Requests for the same component on the same day are not charged multiple times. * Get component report by PURL */ async getComponentReport1(requestParameters: OSSIndexCompatibilityApiGetComponentReport1Request = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getComponentReport1Raw(requestParameters, initOverrides); return await response.value(); } /** * Retrieves component reports for multiple Package URLs (PURLs) in a single request. Authentication: - HTTP Basic Authentication required - Authorization header: Basic Request Body: - Array of PURLs (max 128 components) - Each PURL must include a version Response Headers: - X-Batch-Size: Total number of components requested - X-Batch-Found: Number of components found - X-Credits-Used: Credits consumed for this request - X-Credits-Remaining: Available credit balance - X-Credits-Warning: Alert when approaching credit limit (JSON) Note: Credits are only charged for components found. Requests for the same components on the same day are not charged multiple times. * Get component reports for multiple PURLs */ async getComponentReportsRaw(requestParameters: OSSIndexCompatibilityApiGetComponentReportsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (requestParameters['purlRequestPost'] == null) { throw new runtime.RequiredError( 'purlRequestPost', 'Required parameter "purlRequestPost" was null or undefined when calling getComponentReports().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (requestParameters['userAgent'] != null) { headerParameters['User-Agent'] = String(requestParameters['userAgent']); } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } let urlPath = `/api/v3/component-report`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: PurlRequestPostToJSON(requestParameters['purlRequestPost']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(ComponentReportPostFromJSON)); } /** * Retrieves component reports for multiple Package URLs (PURLs) in a single request. Authentication: - HTTP Basic Authentication required - Authorization header: Basic Request Body: - Array of PURLs (max 128 components) - Each PURL must include a version Response Headers: - X-Batch-Size: Total number of components requested - X-Batch-Found: Number of components found - X-Credits-Used: Credits consumed for this request - X-Credits-Remaining: Available credit balance - X-Credits-Warning: Alert when approaching credit limit (JSON) Note: Credits are only charged for components found. Requests for the same components on the same day are not charged multiple times. * Get component reports for multiple PURLs */ async getComponentReports(requestParameters: OSSIndexCompatibilityApiGetComponentReportsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const response = await this.getComponentReportsRaw(requestParameters, initOverrides); return await response.value(); } /** * Retrieves component reports for multiple Package URLs (PURLs) in a single request. Authentication: - HTTP Basic Authentication required - Authorization header: Basic Request Body: - Array of PURLs (max 128 components) - Each PURL must include a version Response Headers: - X-Batch-Size: Total number of components requested - X-Batch-Found: Number of components found - X-Credits-Used: Credits consumed for this request - X-Credits-Remaining: Available credit balance - X-Credits-Warning: Alert when approaching credit limit (JSON) Note: Credits are only charged for components found. Requests for the same components on the same day are not charged multiple times. * Get component reports for multiple PURLs */ async getComponentReports1Raw(requestParameters: OSSIndexCompatibilityApiGetComponentReports1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (requestParameters['purlRequestPost'] == null) { throw new runtime.RequiredError( 'purlRequestPost', 'Required parameter "purlRequestPost" was null or undefined when calling getComponentReports1().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (requestParameters['userAgent'] != null) { headerParameters['User-Agent'] = String(requestParameters['userAgent']); } if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } let urlPath = `/api/v3/authorized/component-report`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: PurlRequestPostToJSON(requestParameters['purlRequestPost']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(ComponentReportPostFromJSON)); } /** * Retrieves component reports for multiple Package URLs (PURLs) in a single request. Authentication: - HTTP Basic Authentication required - Authorization header: Basic Request Body: - Array of PURLs (max 128 components) - Each PURL must include a version Response Headers: - X-Batch-Size: Total number of components requested - X-Batch-Found: Number of components found - X-Credits-Used: Credits consumed for this request - X-Credits-Remaining: Available credit balance - X-Credits-Warning: Alert when approaching credit limit (JSON) Note: Credits are only charged for components found. Requests for the same components on the same day are not charged multiple times. * Get component reports for multiple PURLs */ async getComponentReports1(requestParameters: OSSIndexCompatibilityApiGetComponentReports1Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const response = await this.getComponentReports1Raw(requestParameters, initOverrides); return await response.value(); } /** * Returns the API version information. This endpoint is public and does not require authentication. * Get API version * @deprecated */ async getVersionRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { 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); } let urlPath = `/api/v3/version`; 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; } } /** * Returns the API version information. This endpoint is public and does not require authentication. * Get API version * @deprecated */ async getVersion(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getVersionRaw(initOverrides); return await response.value(); } }