/* 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 { SearchResultDTO, } from '../models/index'; import { SearchResultDTOFromJSON, SearchResultDTOToJSON, } from '../models/index'; export interface AdvancedSearchApiGetExportResultsRequest { query: string; pageSize?: number; page?: number; allComponents?: boolean; mode?: GetExportResultsModeEnum; } export interface AdvancedSearchApiSearchIndexRequest { query?: string; pageSize?: number; page?: number; allComponents?: boolean; mode?: SearchIndexModeEnum; } /** * AdvancedSearchApi - interface * * @export * @interface AdvancedSearchApiInterface */ export interface AdvancedSearchApiInterface { /** * Request cancellation of an in-flight Advanced Search index rebuild. On a Lucene-backed deployment the previous complete index continues to serve search results. Cancellation is not supported on OpenSearch-backed deployments, where the rebuild runs to completion. Use the status method to confirm whether a rebuild is still in progress. Permissions required: Edit System Configuration and Users * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AdvancedSearchApiInterface */ cancelSearchIndexRebuildRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Request cancellation of an in-flight Advanced Search index rebuild. On a Lucene-backed deployment the previous complete index continues to serve search results. Cancellation is not supported on OpenSearch-backed deployments, where the rebuild runs to completion. Use the status method to confirm whether a rebuild is still in progress. Permissions required: Edit System Configuration and Users */ cancelSearchIndexRebuild(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to create or rebuild the index for Advanced Search. This is a resource intensive operation. Avoid creating indexes during peak usage hours. Permissions required: Edit System Configuration and Users * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AdvancedSearchApiInterface */ createSearchIndexAsyncRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to create or rebuild the index for Advanced Search. This is a resource intensive operation. Avoid creating indexes during peak usage hours. Permissions required: Edit System Configuration and Users */ createSearchIndexAsync(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to generate a csv file containing your search results. The default delimiter in the generated file is comma. Use the advancedSearchCSVExportDelimiter property of the Configuration REST API to change the delimiter in the generated file. * @param {string} query A well-formed search query. * @param {number} [pageSize] Enter the no. of results that should be visible per page, unset gives all results * @param {number} [page] Enter the page no. for the page containing results * @param {boolean} [allComponents] Set to `true` to retrieve results that include components with no violations. * @param {'sbomManager'} [mode] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AdvancedSearchApiInterface */ getExportResultsRaw(requestParameters: AdvancedSearchApiGetExportResultsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to generate a csv file containing your search results. The default delimiter in the generated file is comma. Use the advancedSearchCSVExportDelimiter property of the Configuration REST API to change the delimiter in the generated file. */ getExportResults(requestParameters: AdvancedSearchApiGetExportResultsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to perform an Advanced Search. * @param {string} [query] Enter your search query here * @param {number} [pageSize] Enter the no. of results that should be visible per page * @param {number} [page] Enter the page no. for the page containing results * @param {boolean} [allComponents] Set to `true` to retrieve results that include components with no violations * @param {'sbomManager'} [mode] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof AdvancedSearchApiInterface */ searchIndexRaw(requestParameters: AdvancedSearchApiSearchIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to perform an Advanced Search. */ searchIndex(requestParameters: AdvancedSearchApiSearchIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class AdvancedSearchApi extends runtime.BaseAPI implements AdvancedSearchApiInterface { /** * Request cancellation of an in-flight Advanced Search index rebuild. On a Lucene-backed deployment the previous complete index continues to serve search results. Cancellation is not supported on OpenSearch-backed deployments, where the rebuild runs to completion. Use the status method to confirm whether a rebuild is still in progress. Permissions required: Edit System Configuration and Users */ async cancelSearchIndexRebuildRaw(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); } 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/search/advanced/index/cancel`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Request cancellation of an in-flight Advanced Search index rebuild. On a Lucene-backed deployment the previous complete index continues to serve search results. Cancellation is not supported on OpenSearch-backed deployments, where the rebuild runs to completion. Use the status method to confirm whether a rebuild is still in progress. Permissions required: Edit System Configuration and Users */ async cancelSearchIndexRebuild(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.cancelSearchIndexRebuildRaw(initOverrides); } /** * Use this method to create or rebuild the index for Advanced Search. This is a resource intensive operation. Avoid creating indexes during peak usage hours. Permissions required: Edit System Configuration and Users */ async createSearchIndexAsyncRaw(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); } 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/search/advanced/index`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Use this method to create or rebuild the index for Advanced Search. This is a resource intensive operation. Avoid creating indexes during peak usage hours. Permissions required: Edit System Configuration and Users */ async createSearchIndexAsync(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.createSearchIndexAsyncRaw(initOverrides); } /** * Use this method to generate a csv file containing your search results. The default delimiter in the generated file is comma. Use the advancedSearchCSVExportDelimiter property of the Configuration REST API to change the delimiter in the generated file. */ async getExportResultsRaw(requestParameters: AdvancedSearchApiGetExportResultsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['query'] == null) { throw new runtime.RequiredError( 'query', 'Required parameter "query" was null or undefined when calling getExportResults().' ); } const queryParameters: any = {}; if (requestParameters['query'] != null) { queryParameters['query'] = requestParameters['query']; } if (requestParameters['pageSize'] != null) { queryParameters['pageSize'] = requestParameters['pageSize']; } if (requestParameters['page'] != null) { queryParameters['page'] = requestParameters['page']; } if (requestParameters['allComponents'] != null) { queryParameters['allComponents'] = requestParameters['allComponents']; } if (requestParameters['mode'] != null) { queryParameters['mode'] = requestParameters['mode']; } 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/search/advanced/export/csv`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Use this method to generate a csv file containing your search results. The default delimiter in the generated file is comma. Use the advancedSearchCSVExportDelimiter property of the Configuration REST API to change the delimiter in the generated file. */ async getExportResults(requestParameters: AdvancedSearchApiGetExportResultsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.getExportResultsRaw(requestParameters, initOverrides); } /** * Use this method to perform an Advanced Search. */ async searchIndexRaw(requestParameters: AdvancedSearchApiSearchIndexRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; if (requestParameters['query'] != null) { queryParameters['query'] = requestParameters['query']; } if (requestParameters['pageSize'] != null) { queryParameters['pageSize'] = requestParameters['pageSize']; } if (requestParameters['page'] != null) { queryParameters['page'] = requestParameters['page']; } if (requestParameters['allComponents'] != null) { queryParameters['allComponents'] = requestParameters['allComponents']; } if (requestParameters['mode'] != null) { queryParameters['mode'] = requestParameters['mode']; } 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/search/advanced`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => SearchResultDTOFromJSON(jsonValue)); } /** * Use this method to perform an Advanced Search. */ async searchIndex(requestParameters: AdvancedSearchApiSearchIndexRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.searchIndexRaw(requestParameters, initOverrides); return await response.value(); } } /** * @export */ export const GetExportResultsModeEnum = { SbomManager: 'sbomManager' } as const; export type GetExportResultsModeEnum = typeof GetExportResultsModeEnum[keyof typeof GetExportResultsModeEnum]; /** * @export */ export const SearchIndexModeEnum = { SbomManager: 'sbomManager' } as const; export type SearchIndexModeEnum = typeof SearchIndexModeEnum[keyof typeof SearchIndexModeEnum];