/* 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 { ApiAppliedLicenseOverridesDTO, ApiLicenseOverrideDTO, ComponentIdentifier, } from '../models/index'; import { ApiAppliedLicenseOverridesDTOFromJSON, ApiAppliedLicenseOverridesDTOToJSON, ApiLicenseOverrideDTOFromJSON, ApiLicenseOverrideDTOToJSON, ComponentIdentifierFromJSON, ComponentIdentifierToJSON, } from '../models/index'; export interface LicenseOverridesApiAddLicenseOverrideRequest { ownerType: AddLicenseOverrideOwnerTypeEnum; ownerId: string; apiLicenseOverrideDTO: ApiLicenseOverrideDTO; where?: string; } export interface LicenseOverridesApiDeleteLicenseOverrideRequest { ownerType: DeleteLicenseOverrideOwnerTypeEnum; ownerId: string; licenseOverrideId: string; where?: string; } export interface LicenseOverridesApiGetAppliedLicenseOverridesRequest { ownerType: GetAppliedLicenseOverridesOwnerTypeEnum; ownerId: string; componentIdentifier: ComponentIdentifier; } export interface LicenseOverridesApiGetAppliedLicenseOverridesForLegalReviewerRequest { ownerType: GetAppliedLicenseOverridesForLegalReviewerOwnerTypeEnum; ownerId: string; componentIdentifier: ComponentIdentifier; } /** * LicenseOverridesApi - interface * * @export * @interface LicenseOverridesApiInterface */ export interface LicenseOverridesApiInterface { /** * Use this method to add or update a license override to a component for a given owner scope. Permissions required: Change Licenses * @param {'application' | 'organization' | 'repository_container' | 'repository_manager' | 'repository' | 'hosted_repository_component'} ownerType Select the `ownerType` scope for which you want to add or update a license override * @param {string} ownerId Enter the id of the application, organization or the repository. * @param {ApiLicenseOverrideDTO} apiLicenseOverrideDTO Enter the license override details to add or update a license override for a component. The request body should contain the following fields: - `ownerId`: Enter the id of the application, organization or the repository. - `comment`: Enter a comment for the license override. - `licenseIds`: Enter the license ids for the license override. - `componentIdentifier`: Enter the componentIdentifier consisting of format and coordinates. - `status`: Enter the status of the license override. The possible values are `OPEN`, `ACKNOWLEDGED`, `OVERRIDDEN`, `SELECTED`, and `CONFIRMED`. * @param {string} [where] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LicenseOverridesApiInterface */ addLicenseOverrideRaw(requestParameters: LicenseOverridesApiAddLicenseOverrideRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to add or update a license override to a component for a given owner scope. Permissions required: Change Licenses */ addLicenseOverride(requestParameters: LicenseOverridesApiAddLicenseOverrideRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to delete a license override for a component. Permissions required: Change Licenses * @param {'application' | 'organization' | 'repository_container' | 'repository_manager' | 'repository' | 'hosted_repository_component'} ownerType Select the `ownerType` scope for which you want to delete license override * @param {string} ownerId Enter the id of the application, organization or the repository. * @param {string} licenseOverrideId Enter the id of the license override you want to delete. * @param {string} [where] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LicenseOverridesApiInterface */ deleteLicenseOverrideRaw(requestParameters: LicenseOverridesApiDeleteLicenseOverrideRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to delete a license override for a component. Permissions required: Change Licenses */ deleteLicenseOverride(requestParameters: LicenseOverridesApiDeleteLicenseOverrideRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve the applied license overrides for a component. Permissions required: View IQ Elements * @param {'application' | 'organization' | 'repository_container' | 'repository_manager' | 'repository' | 'hosted_repository_component'} ownerType Select the `ownerType` for which you want to retrieve the applied license overrides. * @param {string} ownerId Enter the id of the application, organization or the repository. * @param {ComponentIdentifier} componentIdentifier Enter the componentIdentifier consisting of format and coordinates as a JSON e.g., `?componentIdentifier={\"format\":\"maven\",\"coordinates\":\"{...}}\"} * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LicenseOverridesApiInterface */ getAppliedLicenseOverridesRaw(requestParameters: LicenseOverridesApiGetAppliedLicenseOverridesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve the applied license overrides for a component. Permissions required: View IQ Elements */ getAppliedLicenseOverrides(requestParameters: LicenseOverridesApiGetAppliedLicenseOverridesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve the applied license overrides for a given component and owner. Permissions required: Review Legal Obligations For Components Licenses * @param {'application' | 'organization' | 'repository_container' | 'repository_manager' | 'repository' | 'hosted_repository_component'} ownerType Select the `ownerType` for which you want to retrieve the applied license overrides. * @param {string} ownerId Enter the id of the owner. * @param {ComponentIdentifier} componentIdentifier Enter the component format and coordinates. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LicenseOverridesApiInterface */ getAppliedLicenseOverridesForLegalReviewerRaw(requestParameters: LicenseOverridesApiGetAppliedLicenseOverridesForLegalReviewerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve the applied license overrides for a given component and owner. Permissions required: Review Legal Obligations For Components Licenses */ getAppliedLicenseOverridesForLegalReviewer(requestParameters: LicenseOverridesApiGetAppliedLicenseOverridesForLegalReviewerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class LicenseOverridesApi extends runtime.BaseAPI implements LicenseOverridesApiInterface { /** * Use this method to add or update a license override to a component for a given owner scope. Permissions required: Change Licenses */ async addLicenseOverrideRaw(requestParameters: LicenseOverridesApiAddLicenseOverrideRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling addLicenseOverride().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling addLicenseOverride().' ); } if (requestParameters['apiLicenseOverrideDTO'] == null) { throw new runtime.RequiredError( 'apiLicenseOverrideDTO', 'Required parameter "apiLicenseOverrideDTO" was null or undefined when calling addLicenseOverride().' ); } const queryParameters: any = {}; if (requestParameters['where'] != null) { queryParameters['where'] = requestParameters['where']; } const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; 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/licenseOverrides/{ownerType}/{ownerId}`; urlPath = urlPath.replace(`{${"ownerType"}}`, encodeURIComponent(String(requestParameters['ownerType']))); urlPath = urlPath.replace(`{${"ownerId"}}`, encodeURIComponent(String(requestParameters['ownerId']))); const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: ApiLicenseOverrideDTOToJSON(requestParameters['apiLicenseOverrideDTO']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiLicenseOverrideDTOFromJSON(jsonValue)); } /** * Use this method to add or update a license override to a component for a given owner scope. Permissions required: Change Licenses */ async addLicenseOverride(requestParameters: LicenseOverridesApiAddLicenseOverrideRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.addLicenseOverrideRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to delete a license override for a component. Permissions required: Change Licenses */ async deleteLicenseOverrideRaw(requestParameters: LicenseOverridesApiDeleteLicenseOverrideRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling deleteLicenseOverride().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling deleteLicenseOverride().' ); } if (requestParameters['licenseOverrideId'] == null) { throw new runtime.RequiredError( 'licenseOverrideId', 'Required parameter "licenseOverrideId" was null or undefined when calling deleteLicenseOverride().' ); } const queryParameters: any = {}; if (requestParameters['where'] != null) { queryParameters['where'] = requestParameters['where']; } 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/licenseOverrides/{ownerType}/{ownerId}/{licenseOverrideId}`; urlPath = urlPath.replace(`{${"ownerType"}}`, encodeURIComponent(String(requestParameters['ownerType']))); urlPath = urlPath.replace(`{${"ownerId"}}`, encodeURIComponent(String(requestParameters['ownerId']))); urlPath = urlPath.replace(`{${"licenseOverrideId"}}`, encodeURIComponent(String(requestParameters['licenseOverrideId']))); const response = await this.request({ path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Use this method to delete a license override for a component. Permissions required: Change Licenses */ async deleteLicenseOverride(requestParameters: LicenseOverridesApiDeleteLicenseOverrideRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.deleteLicenseOverrideRaw(requestParameters, initOverrides); } /** * Use this method to retrieve the applied license overrides for a component. Permissions required: View IQ Elements */ async getAppliedLicenseOverridesRaw(requestParameters: LicenseOverridesApiGetAppliedLicenseOverridesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling getAppliedLicenseOverrides().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling getAppliedLicenseOverrides().' ); } if (requestParameters['componentIdentifier'] == null) { throw new runtime.RequiredError( 'componentIdentifier', 'Required parameter "componentIdentifier" was null or undefined when calling getAppliedLicenseOverrides().' ); } const queryParameters: any = {}; if (requestParameters['componentIdentifier'] != null) { queryParameters['componentIdentifier'] = requestParameters['componentIdentifier']; } 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/licenseOverrides/{ownerType}/{ownerId}`; urlPath = urlPath.replace(`{${"ownerType"}}`, encodeURIComponent(String(requestParameters['ownerType']))); urlPath = urlPath.replace(`{${"ownerId"}}`, encodeURIComponent(String(requestParameters['ownerId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiAppliedLicenseOverridesDTOFromJSON(jsonValue)); } /** * Use this method to retrieve the applied license overrides for a component. Permissions required: View IQ Elements */ async getAppliedLicenseOverrides(requestParameters: LicenseOverridesApiGetAppliedLicenseOverridesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getAppliedLicenseOverridesRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to retrieve the applied license overrides for a given component and owner. Permissions required: Review Legal Obligations For Components Licenses */ async getAppliedLicenseOverridesForLegalReviewerRaw(requestParameters: LicenseOverridesApiGetAppliedLicenseOverridesForLegalReviewerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling getAppliedLicenseOverridesForLegalReviewer().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling getAppliedLicenseOverridesForLegalReviewer().' ); } if (requestParameters['componentIdentifier'] == null) { throw new runtime.RequiredError( 'componentIdentifier', 'Required parameter "componentIdentifier" was null or undefined when calling getAppliedLicenseOverridesForLegalReviewer().' ); } const queryParameters: any = {}; if (requestParameters['componentIdentifier'] != null) { queryParameters['componentIdentifier'] = requestParameters['componentIdentifier']; } 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/licenseOverrides/{ownerType}/{ownerId}/legalReviewer`; urlPath = urlPath.replace(`{${"ownerType"}}`, encodeURIComponent(String(requestParameters['ownerType']))); urlPath = urlPath.replace(`{${"ownerId"}}`, encodeURIComponent(String(requestParameters['ownerId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiAppliedLicenseOverridesDTOFromJSON(jsonValue)); } /** * Use this method to retrieve the applied license overrides for a given component and owner. Permissions required: Review Legal Obligations For Components Licenses */ async getAppliedLicenseOverridesForLegalReviewer(requestParameters: LicenseOverridesApiGetAppliedLicenseOverridesForLegalReviewerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getAppliedLicenseOverridesForLegalReviewerRaw(requestParameters, initOverrides); return await response.value(); } } /** * @export */ export const AddLicenseOverrideOwnerTypeEnum = { Application: 'application', Organization: 'organization', RepositoryContainer: 'repository_container', RepositoryManager: 'repository_manager', Repository: 'repository', HostedRepositoryComponent: 'hosted_repository_component' } as const; export type AddLicenseOverrideOwnerTypeEnum = typeof AddLicenseOverrideOwnerTypeEnum[keyof typeof AddLicenseOverrideOwnerTypeEnum]; /** * @export */ export const DeleteLicenseOverrideOwnerTypeEnum = { Application: 'application', Organization: 'organization', RepositoryContainer: 'repository_container', RepositoryManager: 'repository_manager', Repository: 'repository', HostedRepositoryComponent: 'hosted_repository_component' } as const; export type DeleteLicenseOverrideOwnerTypeEnum = typeof DeleteLicenseOverrideOwnerTypeEnum[keyof typeof DeleteLicenseOverrideOwnerTypeEnum]; /** * @export */ export const GetAppliedLicenseOverridesOwnerTypeEnum = { Application: 'application', Organization: 'organization', RepositoryContainer: 'repository_container', RepositoryManager: 'repository_manager', Repository: 'repository', HostedRepositoryComponent: 'hosted_repository_component' } as const; export type GetAppliedLicenseOverridesOwnerTypeEnum = typeof GetAppliedLicenseOverridesOwnerTypeEnum[keyof typeof GetAppliedLicenseOverridesOwnerTypeEnum]; /** * @export */ export const GetAppliedLicenseOverridesForLegalReviewerOwnerTypeEnum = { Application: 'application', Organization: 'organization', RepositoryContainer: 'repository_container', RepositoryManager: 'repository_manager', Repository: 'repository', HostedRepositoryComponent: 'hosted_repository_component' } as const; export type GetAppliedLicenseOverridesForLegalReviewerOwnerTypeEnum = typeof GetAppliedLicenseOverridesForLegalReviewerOwnerTypeEnum[keyof typeof GetAppliedLicenseOverridesForLegalReviewerOwnerTypeEnum];