/* 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 { ApiOrganizationDTO, ApiOrganizationListDTO, MoveOrganizationResponseDTO, } from '../models/index'; import { ApiOrganizationDTOFromJSON, ApiOrganizationDTOToJSON, ApiOrganizationListDTOFromJSON, ApiOrganizationListDTOToJSON, MoveOrganizationResponseDTOFromJSON, MoveOrganizationResponseDTOToJSON, } from '../models/index'; export interface OrganizationsApiAddOrganizationRequest { apiOrganizationDTO?: ApiOrganizationDTO; } export interface OrganizationsApiDeleteOrganizationRequest { organizationId: string; } export interface OrganizationsApiGetOrganizationRequest { organizationId: string; } export interface OrganizationsApiGetOrganizationsRequest { organizationName?: Set; } export interface OrganizationsApiGetOrganizationsByIdsRequest { id?: Set; } export interface OrganizationsApiMoveOrganizationRequest { organizationId: string; destinationId: string; failEarlyOnError?: boolean; } /** * OrganizationsApi - interface * * @export * @interface OrganizationsApiInterface */ export interface OrganizationsApiInterface { /** * Use this method to add a new organization. Permissions required: Edit IQ Elements * @param {ApiOrganizationDTO} [apiOrganizationDTO] The request JSON should include the name of the organization (should be unique), name of the parent organization and tags containing additional organization details. If the parent organization is not specified, this organization will be created under the root organization. Tags represent identifying characteristics of an application. They are created at the organization level and then applied to applications under the organization. The tags can be used to decide which applications will be evaluated against a selected policy. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof OrganizationsApiInterface */ addOrganizationRaw(requestParameters: OrganizationsApiAddOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to add a new organization. Permissions required: Edit IQ Elements */ addOrganization(requestParameters: OrganizationsApiAddOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to delete an existing organization, by providing the organization id. Permissions required: Edit IQ Elements * @param {string} organizationId Enter the organization id to be deleted. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof OrganizationsApiInterface */ deleteOrganizationRaw(requestParameters: OrganizationsApiDeleteOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to delete an existing organization, by providing the organization id. Permissions required: Edit IQ Elements */ deleteOrganization(requestParameters: OrganizationsApiDeleteOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve the details of an organization by providing the organization id. Permissions required: View IQ Elements * @param {string} organizationId Enter the organization id. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof OrganizationsApiInterface */ getOrganizationRaw(requestParameters: OrganizationsApiGetOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve the details of an organization by providing the organization id. Permissions required: View IQ Elements */ getOrganization(requestParameters: OrganizationsApiGetOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve organizations with names matching those specified or all if not specified. Permissions required: View IQ Elements * @param {Set} [organizationName] Enter the organization names. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof OrganizationsApiInterface */ getOrganizationsRaw(requestParameters: OrganizationsApiGetOrganizationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve organizations with names matching those specified or all if not specified. Permissions required: View IQ Elements */ getOrganizations(requestParameters: OrganizationsApiGetOrganizationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to retrieve organizations by their internal IDs. Permissions required: View IQ Elements * @param {Set} [id] Enter the internal organization IDs. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof OrganizationsApiInterface */ getOrganizationsByIdsRaw(requestParameters: OrganizationsApiGetOrganizationsByIdsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to retrieve organizations by their internal IDs. Permissions required: View IQ Elements */ getOrganizationsByIds(requestParameters: OrganizationsApiGetOrganizationsByIdsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to change the parent organization. Permissions required: Edit IQ Elements * @param {string} organizationId Enter the id for the organization to be moved under the new parent. * @param {string} destinationId Enter the id for the new parent organization. * @param {boolean} [failEarlyOnError] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof OrganizationsApiInterface */ moveOrganizationRaw(requestParameters: OrganizationsApiMoveOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to change the parent organization. Permissions required: Edit IQ Elements */ moveOrganization(requestParameters: OrganizationsApiMoveOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class OrganizationsApi extends runtime.BaseAPI implements OrganizationsApiInterface { /** * Use this method to add a new organization. Permissions required: Edit IQ Elements */ async addOrganizationRaw(requestParameters: OrganizationsApiAddOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { 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/organizations`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: ApiOrganizationDTOToJSON(requestParameters['apiOrganizationDTO']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiOrganizationDTOFromJSON(jsonValue)); } /** * Use this method to add a new organization. Permissions required: Edit IQ Elements */ async addOrganization(requestParameters: OrganizationsApiAddOrganizationRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.addOrganizationRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to delete an existing organization, by providing the organization id. Permissions required: Edit IQ Elements */ async deleteOrganizationRaw(requestParameters: OrganizationsApiDeleteOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['organizationId'] == null) { throw new runtime.RequiredError( 'organizationId', 'Required parameter "organizationId" was null or undefined when calling deleteOrganization().' ); } 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/organizations/{organizationId}`; urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))); 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 organization, by providing the organization id. Permissions required: Edit IQ Elements */ async deleteOrganization(requestParameters: OrganizationsApiDeleteOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.deleteOrganizationRaw(requestParameters, initOverrides); } /** * Use this method to retrieve the details of an organization by providing the organization id. Permissions required: View IQ Elements */ async getOrganizationRaw(requestParameters: OrganizationsApiGetOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['organizationId'] == null) { throw new runtime.RequiredError( 'organizationId', 'Required parameter "organizationId" was null or undefined when calling getOrganization().' ); } 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/organizations/{organizationId}`; urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiOrganizationDTOFromJSON(jsonValue)); } /** * Use this method to retrieve the details of an organization by providing the organization id. Permissions required: View IQ Elements */ async getOrganization(requestParameters: OrganizationsApiGetOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getOrganizationRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to retrieve organizations with names matching those specified or all if not specified. Permissions required: View IQ Elements */ async getOrganizationsRaw(requestParameters: OrganizationsApiGetOrganizationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; if (requestParameters['organizationName'] != null) { queryParameters['organizationName'] = requestParameters['organizationName']; } 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/organizations`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiOrganizationListDTOFromJSON(jsonValue)); } /** * Use this method to retrieve organizations with names matching those specified or all if not specified. Permissions required: View IQ Elements */ async getOrganizations(requestParameters: OrganizationsApiGetOrganizationsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getOrganizationsRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to retrieve organizations by their internal IDs. Permissions required: View IQ Elements */ async getOrganizationsByIdsRaw(requestParameters: OrganizationsApiGetOrganizationsByIdsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const queryParameters: any = {}; if (requestParameters['id'] != null) { queryParameters['id'] = requestParameters['id']; } 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/organizations/byid`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiOrganizationListDTOFromJSON(jsonValue)); } /** * Use this method to retrieve organizations by their internal IDs. Permissions required: View IQ Elements */ async getOrganizationsByIds(requestParameters: OrganizationsApiGetOrganizationsByIdsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getOrganizationsByIdsRaw(requestParameters, initOverrides); return await response.value(); } /** * Use this method to change the parent organization. Permissions required: Edit IQ Elements */ async moveOrganizationRaw(requestParameters: OrganizationsApiMoveOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['organizationId'] == null) { throw new runtime.RequiredError( 'organizationId', 'Required parameter "organizationId" was null or undefined when calling moveOrganization().' ); } if (requestParameters['destinationId'] == null) { throw new runtime.RequiredError( 'destinationId', 'Required parameter "destinationId" was null or undefined when calling moveOrganization().' ); } const queryParameters: any = {}; if (requestParameters['failEarlyOnError'] != null) { queryParameters['failEarlyOnError'] = requestParameters['failEarlyOnError']; } 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/organizations/{organizationId}/move/destination/{destinationId}`; urlPath = urlPath.replace(`{${"organizationId"}}`, encodeURIComponent(String(requestParameters['organizationId']))); urlPath = urlPath.replace(`{${"destinationId"}}`, encodeURIComponent(String(requestParameters['destinationId']))); const response = await this.request({ path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => MoveOrganizationResponseDTOFromJSON(jsonValue)); } /** * Use this method to change the parent organization. Permissions required: Edit IQ Elements */ async moveOrganization(requestParameters: OrganizationsApiMoveOrganizationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.moveOrganizationRaw(requestParameters, initOverrides); return await response.value(); } }