/* 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 { ApiCiConfigurationDto, ApiCiConfigurationResponseDto, } from '../models/index'; import { ApiCiConfigurationDtoFromJSON, ApiCiConfigurationDtoToJSON, ApiCiConfigurationResponseDtoFromJSON, ApiCiConfigurationResponseDtoToJSON, } from '../models/index'; export interface CIConfigurationApiDeleteConfigurationRequest { ownerType: DeleteConfigurationOwnerTypeEnum; ownerId: string; } export interface CIConfigurationApiGetConfigurationRequest { ownerType: GetConfigurationOwnerTypeEnum; ownerId: string; direct?: boolean; } export interface CIConfigurationApiSetConfigurationRequest { ownerType: SetConfigurationOwnerTypeEnum; ownerId: string; apiCiConfigurationDto?: ApiCiConfigurationDto; } /** * CIConfigurationApi - interface * * @export * @interface CIConfigurationApiInterface */ export interface CIConfigurationApiInterface { /** * Use this method to delete CI integration configuration for the specified owner. Permissions required: Edit IQ Elements * @param {'application' | 'organization'} ownerType The owner type (application or organization) * @param {string} ownerId The internal ID of the owner * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CIConfigurationApiInterface */ deleteConfigurationRaw(requestParameters: CIConfigurationApiDeleteConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to delete CI integration configuration for the specified owner. Permissions required: Edit IQ Elements */ deleteConfiguration(requestParameters: CIConfigurationApiDeleteConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve CI integration configuration for the specified owner. Set the `direct` query parameter to `true` to retrieve only the configuration directly associated with the specified owner. Set it to `false` (default) to retrieve the merged configuration from the organization hierarchy, where configurations from parent organizations are combined with lower levels taking precedence. The response includes a `source` map that indicates which owner (organization or application) contributed each configuration field when using merged mode. Permissions required: View IQ Elements * @param {'application' | 'organization'} ownerType The owner type (application or organization) * @param {string} ownerId The internal ID of the owner * @param {boolean} [direct] Set to true to retrieve only direct configuration, false (default) to retrieve merged configuration from hierarchy * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CIConfigurationApiInterface */ getConfigurationRaw(requestParameters: CIConfigurationApiGetConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve CI integration configuration for the specified owner. Set the `direct` query parameter to `true` to retrieve only the configuration directly associated with the specified owner. Set it to `false` (default) to retrieve the merged configuration from the organization hierarchy, where configurations from parent organizations are combined with lower levels taking precedence. The response includes a `source` map that indicates which owner (organization or application) contributed each configuration field when using merged mode. Permissions required: View IQ Elements */ getConfiguration(requestParameters: CIConfigurationApiGetConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to create or update CI integration configuration for the specified owner. The configuration is stored as a JSON object to support various CI systems (GitHub Actions, GitLab CI, etc.). String values must be non-empty. Permissions required: Edit IQ Elements * @param {'application' | 'organization'} ownerType The owner type (application or organization) * @param {string} ownerId The internal ID of the owner * @param {ApiCiConfigurationDto} [apiCiConfigurationDto] Provide the CI integration configuration as a JSON object. The structure supports different CI systems. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CIConfigurationApiInterface */ setConfigurationRaw(requestParameters: CIConfigurationApiSetConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to create or update CI integration configuration for the specified owner. The configuration is stored as a JSON object to support various CI systems (GitHub Actions, GitLab CI, etc.). String values must be non-empty. Permissions required: Edit IQ Elements */ setConfiguration(requestParameters: CIConfigurationApiSetConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class CIConfigurationApi extends runtime.BaseAPI implements CIConfigurationApiInterface { /** * Use this method to delete CI integration configuration for the specified owner. Permissions required: Edit IQ Elements */ async deleteConfigurationRaw(requestParameters: CIConfigurationApiDeleteConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling deleteConfiguration().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling deleteConfiguration().' ); } 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/config/ci/{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: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Use this method to delete CI integration configuration for the specified owner. Permissions required: Edit IQ Elements */ async deleteConfiguration(requestParameters: CIConfigurationApiDeleteConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.deleteConfigurationRaw(requestParameters, initOverrides); } /** * Use this method to retrieve CI integration configuration for the specified owner. Set the `direct` query parameter to `true` to retrieve only the configuration directly associated with the specified owner. Set it to `false` (default) to retrieve the merged configuration from the organization hierarchy, where configurations from parent organizations are combined with lower levels taking precedence. The response includes a `source` map that indicates which owner (organization or application) contributed each configuration field when using merged mode. Permissions required: View IQ Elements */ async getConfigurationRaw(requestParameters: CIConfigurationApiGetConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling getConfiguration().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling getConfiguration().' ); } const queryParameters: any = {}; if (requestParameters['direct'] != null) { queryParameters['direct'] = requestParameters['direct']; } 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/config/ci/{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) => ApiCiConfigurationResponseDtoFromJSON(jsonValue)); } /** * Use this method to retrieve CI integration configuration for the specified owner. Set the `direct` query parameter to `true` to retrieve only the configuration directly associated with the specified owner. Set it to `false` (default) to retrieve the merged configuration from the organization hierarchy, where configurations from parent organizations are combined with lower levels taking precedence. The response includes a `source` map that indicates which owner (organization or application) contributed each configuration field when using merged mode. Permissions required: View IQ Elements */ async getConfiguration(requestParameters: CIConfigurationApiGetConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getConfigurationRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to create or update CI integration configuration for the specified owner. The configuration is stored as a JSON object to support various CI systems (GitHub Actions, GitLab CI, etc.). String values must be non-empty. Permissions required: Edit IQ Elements */ async setConfigurationRaw(requestParameters: CIConfigurationApiSetConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling setConfiguration().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling setConfiguration().' ); } 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/config/ci/{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: ApiCiConfigurationDtoToJSON(requestParameters['apiCiConfigurationDto']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiCiConfigurationDtoFromJSON(jsonValue)); } /** * Use this method to create or update CI integration configuration for the specified owner. The configuration is stored as a JSON object to support various CI systems (GitHub Actions, GitLab CI, etc.). String values must be non-empty. Permissions required: Edit IQ Elements */ async setConfiguration(requestParameters: CIConfigurationApiSetConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.setConfigurationRaw(requestParameters, initOverrides); return await response.value(); } } /** * @export */ export const DeleteConfigurationOwnerTypeEnum = { Application: 'application', Organization: 'organization' } as const; export type DeleteConfigurationOwnerTypeEnum = typeof DeleteConfigurationOwnerTypeEnum[keyof typeof DeleteConfigurationOwnerTypeEnum]; /** * @export */ export const GetConfigurationOwnerTypeEnum = { Application: 'application', Organization: 'organization' } as const; export type GetConfigurationOwnerTypeEnum = typeof GetConfigurationOwnerTypeEnum[keyof typeof GetConfigurationOwnerTypeEnum]; /** * @export */ export const SetConfigurationOwnerTypeEnum = { Application: 'application', Organization: 'organization' } as const; export type SetConfigurationOwnerTypeEnum = typeof SetConfigurationOwnerTypeEnum[keyof typeof SetConfigurationOwnerTypeEnum];