/* 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 { ApiMailConfigurationDTO, } from '../models/index'; import { ApiMailConfigurationDTOFromJSON, ApiMailConfigurationDTOToJSON, } from '../models/index'; export interface ConfigMailApiSetConfiguration3Request { apiMailConfigurationDTO?: ApiMailConfigurationDTO; } export interface ConfigMailApiTestConfigurationRequest { recipientEmail: string; apiMailConfigurationDTO?: ApiMailConfigurationDTO; } /** * ConfigMailApi - interface * * @export * @interface ConfigMailApiInterface */ export interface ConfigMailApiInterface { /** * Use this method to disable or remove an SMTP configuration. Permissions required: Edit System Configuration and Users * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ConfigMailApiInterface */ deleteConfiguration3Raw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to disable or remove an SMTP configuration. Permissions required: Edit System Configuration and Users */ deleteConfiguration3(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to review the configuration for an SMTP server. Permissions required: Edit System Configuration and Users * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ConfigMailApiInterface */ getConfiguration3Raw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to review the configuration for an SMTP server. Permissions required: Edit System Configuration and Users */ getConfiguration3(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to configure or update an existing SMTP server configuration. Permissions required: Edit System Configuration and Users * @param {ApiMailConfigurationDTO} [apiMailConfigurationDTO] Provide one or more values for the following in the JSON payload:<ul><li>`hostname` - is the hostname or IP address of the SMTP server used for outgoing mail.</li><li>`port` - is the port number on which the SMTP server accepts email requests.</li><li>`password` - depends upon the value of `passwordIsIncluded`.</li><li>`passwordIsIncluded` - if set to true, value must be provided for `password`, null is allowed.If set to false, the previous value will remain unchanged, provided that `hostname` and `port` are not changed.<li>`sslEnabled` - is a boolean flag indicating if the connection to the SMTP server should use SSL/TLSright from the start.</li><li>`startIsEnabled`- is a boolean flag indicating if the connection to the SMTP server should attempt toupgrade to SSL/TLS using the STARTTLS command.<li>`systemEmail` - is the email address used for the FROM header in emails sent by the IQ Server.</li></ul> * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ConfigMailApiInterface */ setConfiguration3Raw(requestParameters: ConfigMailApiSetConfiguration3Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to configure or update an existing SMTP server configuration. Permissions required: Edit System Configuration and Users */ setConfiguration3(requestParameters: ConfigMailApiSetConfiguration3Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Use this method to test an SMTP configuration, without affecting the current configuration. Permissions required:Edit System Configuration and Users * @param {string} recipientEmail Enter the test recipient email address. * @param {ApiMailConfigurationDTO} [apiMailConfigurationDTO] Provide one or more values for the following in the JSON payload:<ul><li>`hostname` - is the hostname or IP address of the SMTP server used for outgoing mail.</li><li>`port` - is the port number on which the SMTP server accepts email requests.</li><li>`password` - depends upon the value of `passwordIsIncluded`.</li><li>`passwordIsIncluded` - if set to true, value must be provided for `password`, null is allowed.If set to false, the previous value will remain unchanged, provided that `hostname` and `port` are not changed.<li>`sslEnabled` - is a boolean flag indicating if the connection to the SMTP server should use SSL/TLSright from the start.</li><li>`startIsEnabled`- is a boolean flag indicating if the connection to the SMTP server should attempt toupgrade to SSL/TLS using the STARTTLS command.<li>`systemEmail` - is the email address used for the FROM header in emails sent by the IQ Server.</li></ul> * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ConfigMailApiInterface */ testConfigurationRaw(requestParameters: ConfigMailApiTestConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Use this method to test an SMTP configuration, without affecting the current configuration. Permissions required:Edit System Configuration and Users */ testConfiguration(requestParameters: ConfigMailApiTestConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class ConfigMailApi extends runtime.BaseAPI implements ConfigMailApiInterface { /** * Use this method to disable or remove an SMTP configuration. Permissions required: Edit System Configuration and Users */ async deleteConfiguration3Raw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { 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/mail`; const response = await this.request({ path: urlPath, method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Use this method to disable or remove an SMTP configuration. Permissions required: Edit System Configuration and Users */ async deleteConfiguration3(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.deleteConfiguration3Raw(initOverrides); } /** * Use this method to review the configuration for an SMTP server. Permissions required: Edit System Configuration and Users */ async getConfiguration3Raw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { 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/mail`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ApiMailConfigurationDTOFromJSON(jsonValue)); } /** * Use this method to review the configuration for an SMTP server. Permissions required: Edit System Configuration and Users */ async getConfiguration3(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getConfiguration3Raw(initOverrides); return await response.value(); } /** * Use this method to configure or update an existing SMTP server configuration. Permissions required: Edit System Configuration and Users */ async setConfiguration3Raw(requestParameters: ConfigMailApiSetConfiguration3Request, 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/config/mail`; const response = await this.request({ path: urlPath, method: 'PUT', headers: headerParameters, query: queryParameters, body: ApiMailConfigurationDTOToJSON(requestParameters['apiMailConfigurationDTO']), }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Use this method to configure or update an existing SMTP server configuration. Permissions required: Edit System Configuration and Users */ async setConfiguration3(requestParameters: ConfigMailApiSetConfiguration3Request = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.setConfiguration3Raw(requestParameters, initOverrides); } /** * Use this method to test an SMTP configuration, without affecting the current configuration. Permissions required:Edit System Configuration and Users */ async testConfigurationRaw(requestParameters: ConfigMailApiTestConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters['recipientEmail'] == null) { throw new runtime.RequiredError( 'recipientEmail', 'Required parameter "recipientEmail" was null or undefined when calling testConfiguration().' ); } 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/mail/test/{recipientEmail}`; urlPath = urlPath.replace(`{${"recipientEmail"}}`, encodeURIComponent(String(requestParameters['recipientEmail']))); const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: ApiMailConfigurationDTOToJSON(requestParameters['apiMailConfigurationDTO']), }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Use this method to test an SMTP configuration, without affecting the current configuration. Permissions required:Edit System Configuration and Users */ async testConfiguration(requestParameters: ConfigMailApiTestConfigurationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { await this.testConfigurationRaw(requestParameters, initOverrides); } }