/* 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 { ApiLegacyViolationStatusDTO, } from '../models/index'; import { ApiLegacyViolationStatusDTOFromJSON, ApiLegacyViolationStatusDTOToJSON, } from '../models/index'; export interface LegacyViolationsConfigurationApiGetConfigRequest { ownerType: string; ownerId: string; } export interface LegacyViolationsConfigurationApiSetConfigRequest { ownerType: string; ownerId: string; apiLegacyViolationStatusDTO?: Omit; } /** * LegacyViolationsConfigurationApi - interface * * @export * @interface LegacyViolationsConfigurationApiInterface */ export interface LegacyViolationsConfigurationApiInterface { /** * Use this method to retrieve the legacy-violation configuration for an owner. Permissions required: View IQ Elements * @param {string} ownerType Owner type. Allowed values: `application`, `organization`. * @param {string} ownerId Public id of the application, or id of the organization. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LegacyViolationsConfigurationApiInterface */ getConfigRaw(requestParameters: LegacyViolationsConfigurationApiGetConfigRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve the legacy-violation configuration for an owner. Permissions required: View IQ Elements */ getConfig(requestParameters: LegacyViolationsConfigurationApiGetConfigRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to update the legacy-violation configuration for an owner. Permissions required: Edit IQ Elements * @param {string} ownerType Owner type. Allowed values: `application`, `organization`. * @param {string} ownerId Public id of the application, or id of the organization. * @param {ApiLegacyViolationStatusDTO} [apiLegacyViolationStatusDTO] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LegacyViolationsConfigurationApiInterface */ setConfigRaw(requestParameters: LegacyViolationsConfigurationApiSetConfigRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to update the legacy-violation configuration for an owner. Permissions required: Edit IQ Elements */ setConfig(requestParameters: LegacyViolationsConfigurationApiSetConfigRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class LegacyViolationsConfigurationApi extends runtime.BaseAPI implements LegacyViolationsConfigurationApiInterface { /** * Use this method to retrieve the legacy-violation configuration for an owner. Permissions required: View IQ Elements */ async getConfigRaw(requestParameters: LegacyViolationsConfigurationApiGetConfigRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling getConfig().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling getConfig().' ); } 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/legacyViolations/{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) => ApiLegacyViolationStatusDTOFromJSON(jsonValue)); } /** * Use this method to retrieve the legacy-violation configuration for an owner. Permissions required: View IQ Elements */ async getConfig(requestParameters: LegacyViolationsConfigurationApiGetConfigRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getConfigRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to update the legacy-violation configuration for an owner. Permissions required: Edit IQ Elements */ async setConfigRaw(requestParameters: LegacyViolationsConfigurationApiSetConfigRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['ownerType'] == null) { throw new runtime.RequiredError( 'ownerType', 'Required parameter "ownerType" was null or undefined when calling setConfig().' ); } if (requestParameters['ownerId'] == null) { throw new runtime.RequiredError( 'ownerId', 'Required parameter "ownerId" was null or undefined when calling setConfig().' ); } 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/legacyViolations/{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: ApiLegacyViolationStatusDTOToJSON(requestParameters['apiLegacyViolationStatusDTO']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiLegacyViolationStatusDTOFromJSON(jsonValue)); } /** * Use this method to update the legacy-violation configuration for an owner. Permissions required: Edit IQ Elements */ async setConfig(requestParameters: LegacyViolationsConfigurationApiSetConfigRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.setConfigRaw(requestParameters, initOverrides); return await response.value(); } }