/* 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 { ApiLabelDTO, ApplicableContext, ApplicableLabels, } from '../models/index'; import { ApiLabelDTOFromJSON, ApiLabelDTOToJSON, ApplicableContextFromJSON, ApplicableContextToJSON, ApplicableLabelsFromJSON, ApplicableLabelsToJSON, } from '../models/index'; export interface ComponentLabelsApiAddLabelRequest { ownerType: AddLabelOwnerTypeEnum; ownerId: string; apiLabelDTO?: ApiLabelDTO; } export interface ComponentLabelsApiDeleteLabelRequest { ownerType: DeleteLabelOwnerTypeEnum; ownerId: string; labelId: string; } export interface ComponentLabelsApiGetApplicableContextsRequest { ownerType: GetApplicableContextsOwnerTypeEnum; ownerId: string; labelId: string; } export interface ComponentLabelsApiGetApplicableLabelsRequest { ownerType: GetApplicableLabelsOwnerTypeEnum; ownerId: string; } export interface ComponentLabelsApiGetLabelsRequest { ownerType: GetLabelsOwnerTypeEnum; ownerId: string; inherit?: boolean; } export interface ComponentLabelsApiUpdateLabelRequest { ownerType: UpdateLabelOwnerTypeEnum; ownerId: string; apiLabelDTO?: ApiLabelDTO; } /** * ComponentLabelsApi - interface * * @export * @interface ComponentLabelsApiInterface */ export interface ComponentLabelsApiInterface { /** * Use this method to create and assign a component label to an application, organization or repository. Permissions required: Edit IQ Elements * @param {'application' | 'organization' | 'repository_container' | 'repository_manager' | 'repository' | 'hosted_repository_component'} ownerType Select the ownerType to which the label will be assigned. * @param {string} ownerId Enter the id for the selected ownerType. * @param {ApiLabelDTO} [apiLabelDTO] Specify a label name, description and color for the label. Valid values for color are `light-red` , `light-green` , `light-blue` , `light-purple`, `dark-red` , `dark-green` , `dark-blue` , `dark-purple` , `orange` , `yellow`. Do not enter value for the `id` field. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ComponentLabelsApiInterface */ addLabelRaw(requestParameters: ComponentLabelsApiAddLabelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to create and assign a component label to an application, organization or repository. Permissions required: Edit IQ Elements */ addLabel(requestParameters: ComponentLabelsApiAddLabelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to delete an existing component label. Permissions required: Edit IQ Elements * @param {'application' | 'organization' | 'repository_container' | 'repository_manager' | 'repository' | 'hosted_repository_component'} ownerType Select the ownerType for which the label will be deleted. * @param {string} ownerId Enter the id for the selected ownerType. * @param {string} labelId Enter the id for the label to be deleted. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ComponentLabelsApiInterface */ deleteLabelRaw(requestParameters: ComponentLabelsApiDeleteLabelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to delete an existing component label. Permissions required: Edit IQ Elements */ deleteLabel(requestParameters: ComponentLabelsApiDeleteLabelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve the hierarchy of owners (applications, organizations, repositories) in which the label can be applied. Permissions required: Edit IQ Elements * @param {'application' | 'organization' | 'repository_container' | 'repository_manager' | 'repository' | 'hosted_repository_component'} ownerType Select the ownerType. * @param {string} ownerId Enter the ownerId * @param {string} labelId Enter the labelId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ComponentLabelsApiInterface */ getApplicableContextsRaw(requestParameters: ComponentLabelsApiGetApplicableContextsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve the hierarchy of owners (applications, organizations, repositories) in which the label can be applied. Permissions required: Edit IQ Elements */ getApplicableContexts(requestParameters: ComponentLabelsApiGetApplicableContextsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve all component labels that are applicable to the specified application, organization or repository. Permissions required: View IQ Elements * @param {'application' | 'organization' | 'repository_container' | 'repository_manager' | 'repository' | 'hosted_repository_component'} ownerType Select the ownerType to retrieve the component label information for. * @param {string} ownerId Enter the id for the application, organization or repository * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ComponentLabelsApiInterface */ getApplicableLabelsRaw(requestParameters: ComponentLabelsApiGetApplicableLabelsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve all component labels that are applicable to the specified application, organization or repository. Permissions required: View IQ Elements */ getApplicableLabels(requestParameters: ComponentLabelsApiGetApplicableLabelsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve the details for component labels for an application, organization or a repository. 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 component label information. * @param {string} ownerId Enter the id of the application, organization or the repository. * @param {boolean} [inherit] Set to `true` to retrieve inherited component labels. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ComponentLabelsApiInterface */ getLabelsRaw(requestParameters: ComponentLabelsApiGetLabelsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>>; /** * Use this method to retrieve the details for component labels for an application, organization or a repository. Permissions required: View IQ Elements */ getLabels(requestParameters: ComponentLabelsApiGetLabelsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to update an existing component label for an application, organization or repository. Permissions required: Edit IQ Elements * @param {'application' | 'organization' | 'repository_container' | 'repository_manager' | 'repository' | 'hosted_repository_component'} ownerType Select the ownerType for which the label will be updated. * @param {string} ownerId Enter the id for the selected ownerType. * @param {ApiLabelDTO} [apiLabelDTO] Specify the new values for label name, description, color and the corresponding label id for the component label to be updated. Valid values for color are `light-red` , `light-green` , `light-blue` , `light--purple`, `dark-red` , `dark-green` ,`dark-blue` , `dark-purple` ,`orange` , `yellow`. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ComponentLabelsApiInterface */ updateLabelRaw(requestParameters: ComponentLabelsApiUpdateLabelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to update an existing component label for an application, organization or repository. Permissions required: Edit IQ Elements */ updateLabel(requestParameters: ComponentLabelsApiUpdateLabelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class ComponentLabelsApi extends runtime.BaseAPI implements ComponentLabelsApiInterface { /** * Use this method to create and assign a component label to an application, organization or repository. Permissions required: Edit IQ Elements */ async addLabelRaw(requestParameters: ComponentLabelsApiAddLabelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling addLabel().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling addLabel().' ); } const queryParameters: any = {}; 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/labels/{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: ApiLabelDTOToJSON(requestParameters['apiLabelDTO']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiLabelDTOFromJSON(jsonValue)); } /** * Use this method to create and assign a component label to an application, organization or repository. Permissions required: Edit IQ Elements */ async addLabel(requestParameters: ComponentLabelsApiAddLabelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.addLabelRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to delete an existing component label. Permissions required: Edit IQ Elements */ async deleteLabelRaw(requestParameters: ComponentLabelsApiDeleteLabelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling deleteLabel().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling deleteLabel().' ); } if (requestParameters['labelId'] == null) { throw new runtime.RequiredError( 'labelId', 'Required parameter "labelId" was null or undefined when calling deleteLabel().' ); } 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/labels/{ownerType}/{ownerId}/{labelId}`; urlPath = urlPath.replace(`{${"ownerType"}}`, encodeURIComponent(String(requestParameters['ownerType']))); urlPath = urlPath.replace(`{${"ownerId"}}`, encodeURIComponent(String(requestParameters['ownerId']))); urlPath = urlPath.replace(`{${"labelId"}}`, encodeURIComponent(String(requestParameters['labelId']))); const response = await this.request({ path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Use this method to delete an existing component label. Permissions required: Edit IQ Elements */ async deleteLabel(requestParameters: ComponentLabelsApiDeleteLabelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.deleteLabelRaw(requestParameters, initOverrides); } /** * Use this method to retrieve the hierarchy of owners (applications, organizations, repositories) in which the label can be applied. Permissions required: Edit IQ Elements */ async getApplicableContextsRaw(requestParameters: ComponentLabelsApiGetApplicableContextsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling getApplicableContexts().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling getApplicableContexts().' ); } if (requestParameters['labelId'] == null) { throw new runtime.RequiredError( 'labelId', 'Required parameter "labelId" was null or undefined when calling getApplicableContexts().' ); } 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/labels/{ownerType}/{ownerId}/applicable/context/{labelId}`; urlPath = urlPath.replace(`{${"ownerType"}}`, encodeURIComponent(String(requestParameters['ownerType']))); urlPath = urlPath.replace(`{${"ownerId"}}`, encodeURIComponent(String(requestParameters['ownerId']))); urlPath = urlPath.replace(`{${"labelId"}}`, encodeURIComponent(String(requestParameters['labelId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApplicableContextFromJSON(jsonValue)); } /** * Use this method to retrieve the hierarchy of owners (applications, organizations, repositories) in which the label can be applied. Permissions required: Edit IQ Elements */ async getApplicableContexts(requestParameters: ComponentLabelsApiGetApplicableContextsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getApplicableContextsRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to retrieve all component labels that are applicable to the specified application, organization or repository. Permissions required: View IQ Elements */ async getApplicableLabelsRaw(requestParameters: ComponentLabelsApiGetApplicableLabelsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling getApplicableLabels().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling getApplicableLabels().' ); } 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/labels/{ownerType}/{ownerId}/applicable`; 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) => ApplicableLabelsFromJSON(jsonValue)); } /** * Use this method to retrieve all component labels that are applicable to the specified application, organization or repository. Permissions required: View IQ Elements */ async getApplicableLabels(requestParameters: ComponentLabelsApiGetApplicableLabelsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getApplicableLabelsRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to retrieve the details for component labels for an application, organization or a repository. Permissions required: View IQ Elements */ async getLabelsRaw(requestParameters: ComponentLabelsApiGetLabelsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling getLabels().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling getLabels().' ); } const queryParameters: any = {}; if (requestParameters['inherit'] != null) { queryParameters['inherit'] = requestParameters['inherit']; } 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/labels/{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) => jsonValue.map(ApiLabelDTOFromJSON)); } /** * Use this method to retrieve the details for component labels for an application, organization or a repository. Permissions required: View IQ Elements */ async getLabels(requestParameters: ComponentLabelsApiGetLabelsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const response = await this.getLabelsRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to update an existing component label for an application, organization or repository. Permissions required: Edit IQ Elements */ async updateLabelRaw(requestParameters: ComponentLabelsApiUpdateLabelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling updateLabel().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling updateLabel().' ); } const queryParameters: any = {}; 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/labels/{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: 'PUT', headers: headerParameters, query: queryParameters, body: ApiLabelDTOToJSON(requestParameters['apiLabelDTO']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiLabelDTOFromJSON(jsonValue)); } /** * Use this method to update an existing component label for an application, organization or repository. Permissions required: Edit IQ Elements */ async updateLabel(requestParameters: ComponentLabelsApiUpdateLabelRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.updateLabelRaw(requestParameters, initOverrides); return await response.value(); } } /** * @export */ export const AddLabelOwnerTypeEnum = { Application: 'application', Organization: 'organization', RepositoryContainer: 'repository_container', RepositoryManager: 'repository_manager', Repository: 'repository', HostedRepositoryComponent: 'hosted_repository_component' } as const; export type AddLabelOwnerTypeEnum = typeof AddLabelOwnerTypeEnum[keyof typeof AddLabelOwnerTypeEnum]; /** * @export */ export const DeleteLabelOwnerTypeEnum = { Application: 'application', Organization: 'organization', RepositoryContainer: 'repository_container', RepositoryManager: 'repository_manager', Repository: 'repository', HostedRepositoryComponent: 'hosted_repository_component' } as const; export type DeleteLabelOwnerTypeEnum = typeof DeleteLabelOwnerTypeEnum[keyof typeof DeleteLabelOwnerTypeEnum]; /** * @export */ export const GetApplicableContextsOwnerTypeEnum = { Application: 'application', Organization: 'organization', RepositoryContainer: 'repository_container', RepositoryManager: 'repository_manager', Repository: 'repository', HostedRepositoryComponent: 'hosted_repository_component' } as const; export type GetApplicableContextsOwnerTypeEnum = typeof GetApplicableContextsOwnerTypeEnum[keyof typeof GetApplicableContextsOwnerTypeEnum]; /** * @export */ export const GetApplicableLabelsOwnerTypeEnum = { Application: 'application', Organization: 'organization', RepositoryContainer: 'repository_container', RepositoryManager: 'repository_manager', Repository: 'repository', HostedRepositoryComponent: 'hosted_repository_component' } as const; export type GetApplicableLabelsOwnerTypeEnum = typeof GetApplicableLabelsOwnerTypeEnum[keyof typeof GetApplicableLabelsOwnerTypeEnum]; /** * @export */ export const GetLabelsOwnerTypeEnum = { Application: 'application', Organization: 'organization', RepositoryContainer: 'repository_container', RepositoryManager: 'repository_manager', Repository: 'repository', HostedRepositoryComponent: 'hosted_repository_component' } as const; export type GetLabelsOwnerTypeEnum = typeof GetLabelsOwnerTypeEnum[keyof typeof GetLabelsOwnerTypeEnum]; /** * @export */ export const UpdateLabelOwnerTypeEnum = { Application: 'application', Organization: 'organization', RepositoryContainer: 'repository_container', RepositoryManager: 'repository_manager', Repository: 'repository', HostedRepositoryComponent: 'hosted_repository_component' } as const; export type UpdateLabelOwnerTypeEnum = typeof UpdateLabelOwnerTypeEnum[keyof typeof UpdateLabelOwnerTypeEnum];