// TODO: better import syntax? import {BaseAPIRequestFactory, RequiredError, COLLECTION_FORMATS} from './baseapi'; import {Configuration} from '../configuration'; import {RequestContext, HttpMethod, ResponseContext, HttpFile} from '../http/http'; import {ObjectSerializer} from '../models/ObjectSerializer'; import {ApiException} from './exception'; import {canConsumeForm, isCodeInRange} from '../util'; import {SecurityAuthentication} from '../auth/auth'; import { CreateEmailCustomizationRequest } from '../models/CreateEmailCustomizationRequest'; import { CreateEmailCustomizationResponse } from '../models/CreateEmailCustomizationResponse'; import { DeleteOrgEmailCustomizationRequest } from '../models/DeleteOrgEmailCustomizationRequest'; import { ErrorResponse } from '../models/ErrorResponse'; import { SearchEmailCustomizationRequest } from '../models/SearchEmailCustomizationRequest'; import { UpdateEmailCustomizationRequest } from '../models/UpdateEmailCustomizationRequest'; /** * no description */ export class EmailCustomizationApiRequestFactory extends BaseAPIRequestFactory { /** * Version: 10.10.0.cl or later Creates a customization configuration for the notification email. #### Pre-requisites Requires `DEVELOPER` (**has developer privilege**) or `ADMINISTRATION` (**Can administer ThoughtSpot**) privilege. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance, the `DEVELOPER` (**Has developer privilege**) privilege is required. **NOTE**:This endpoint in currently in beta. Contact ThoughtSpot support to enable this on your instance. #### Usage guidelines To create a custom configuration pass these parameters in your API request: - A JSON map of configuration attributes `template_properties`. The following example shows a sample set of customization configuration: ``` { { \"cta_button_bg_color\": \"#444DEA\", \"cta_text_font_color\": \"#FFFFFF\", \"primary_bg_color\": \"#D3DEF0\", \"logo_url\": \"https://storage.pardot.com/710713/1642089901EbkRibJq/TS_fullworkmark_darkmode.png\", \"font_family\": \"\", \"product_name\": \"ThoughtSpot\", \"footer_address\": \"444 Castro St, Suite 1000 Mountain View, CA 94041\", \"footer_phone\": \"(800) 508-7008\", \"replacement_value_for_liveboard\": \"Dashboard\", \"replacement_value_for_answer\": \"Chart\", \"replacement_value_for_spot_iq\": \"AI Insights\", \"hide_footer_phone\": false, \"hide_footer_address\": false, \"hide_product_name\": false, \"hide_manage_notification\": false, \"hide_mobile_app_nudge\": false, \"hide_privacy_policy\": false, \"hide_ts_vocabulary_definitions\": false, \"hide_error_message\": false, \"hide_unsubscribe_link\": false, \"hide_notification_status\": false, \"hide_modify_alert\": false, \"company_website_url\": \"https://your-website.com/\", \"company_privacy_policy_url\" : \"https://link-to-privacy-policy.com/\", \"contact_support_url\": \"https://link-to-contact-support.com/\", \"hide_contact_support_url\": false, \"hide_logo_url\" : false } } ``` * @param createEmailCustomizationRequest */ public async createEmailCustomization(createEmailCustomizationRequest: CreateEmailCustomizationRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'createEmailCustomizationRequest' is not null or undefined if (createEmailCustomizationRequest === null || createEmailCustomizationRequest === undefined) { throw new RequiredError("EmailCustomizationApi", "createEmailCustomization", "createEmailCustomizationRequest"); } // Path Params const localVarPath = '/api/rest/2.0/customization/email'; // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") requestContext.setHeaderParam("User-Agent", "ThoughtSpot-Client/typescript/2.23.0") requestContext.setHeaderParam("X-ThoughtSpot-Client", "ThoughtSpot-ts-client/2.23.0") // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( ObjectSerializer.serialize(createEmailCustomizationRequest, "CreateEmailCustomizationRequest", ""), contentType ); requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } /** * Version: 10.10.0.cl or later Deletes the configuration for the email customization. #### Pre-requisites Requires `DEVELOPER` (**has developer privilege**) or `ADMINISTRATION` (**Can administer ThoughtSpot**) privilege. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance, the `DEVELOPER` (**Has developer privilege**) privilege is required. **NOTE**:This endpoint in currently in beta. Contact ThoughtSpot support to enable this on your instance. #### Usage guidelines - Call the search API endpoint to get the `template_identifier` from the response. - Use that `template_identifier` as a parameter in this API request. * @param templateIdentifier Unique ID or name of the email customization. */ public async deleteEmailCustomization(templateIdentifier: string, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'templateIdentifier' is not null or undefined if (templateIdentifier === null || templateIdentifier === undefined) { throw new RequiredError("EmailCustomizationApi", "deleteEmailCustomization", "templateIdentifier"); } // Path Params const localVarPath = '/api/rest/2.0/customization/email/{template_identifier}/delete' .replace('{' + 'template_identifier' + '}', encodeURIComponent(String(templateIdentifier))); // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") requestContext.setHeaderParam("User-Agent", "ThoughtSpot-Client/typescript/2.23.0") requestContext.setHeaderParam("X-ThoughtSpot-Client", "ThoughtSpot-ts-client/2.23.0") let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } /** * Version: 10.12.0.cl or later Deletes the configuration for the email customization. #### Pre-requisites Requires `DEVELOPER` (**has developer privilege**) or `ADMINISTRATION` (**Can administer ThoughtSpot**) privilege. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance, the `DEVELOPER` (**Has developer privilege**) privilege is required. **NOTE**:This endpoint in currently in beta. Contact ThoughtSpot support to enable this on your instance. #### Usage guidelines - Call the search API endpoint to get the `org_identifier` from the response. - Use that `org_identifier` as a parameter in this API request. * @param deleteOrgEmailCustomizationRequest */ public async deleteOrgEmailCustomization(deleteOrgEmailCustomizationRequest: DeleteOrgEmailCustomizationRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'deleteOrgEmailCustomizationRequest' is not null or undefined if (deleteOrgEmailCustomizationRequest === null || deleteOrgEmailCustomizationRequest === undefined) { throw new RequiredError("EmailCustomizationApi", "deleteOrgEmailCustomization", "deleteOrgEmailCustomizationRequest"); } // Path Params const localVarPath = '/api/rest/2.0/customization/email/delete'; // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") requestContext.setHeaderParam("User-Agent", "ThoughtSpot-Client/typescript/2.23.0") requestContext.setHeaderParam("X-ThoughtSpot-Client", "ThoughtSpot-ts-client/2.23.0") // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( ObjectSerializer.serialize(deleteOrgEmailCustomizationRequest, "DeleteOrgEmailCustomizationRequest", ""), contentType ); requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } /** * Version: 10.10.0.cl or later Search the email customization configuration if any set for the ThoughtSpot system. #### Pre-requisites Requires `DEVELOPER` (**has developer privilege**) or `ADMINISTRATION` (**Can administer ThoughtSpot**) privilege. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance, the `DEVELOPER` (**Has developer privilege**) privilege is required. **NOTE**:This endpoint in currently in beta. Contact ThoughtSpot support to enable this on your instance. * @param searchEmailCustomizationRequest */ public async searchEmailCustomization(searchEmailCustomizationRequest: SearchEmailCustomizationRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'searchEmailCustomizationRequest' is not null or undefined if (searchEmailCustomizationRequest === null || searchEmailCustomizationRequest === undefined) { throw new RequiredError("EmailCustomizationApi", "searchEmailCustomization", "searchEmailCustomizationRequest"); } // Path Params const localVarPath = '/api/rest/2.0/customization/email/search'; // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") requestContext.setHeaderParam("User-Agent", "ThoughtSpot-Client/typescript/2.23.0") requestContext.setHeaderParam("X-ThoughtSpot-Client", "ThoughtSpot-ts-client/2.23.0") // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( ObjectSerializer.serialize(searchEmailCustomizationRequest, "SearchEmailCustomizationRequest", ""), contentType ); requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } /** * Version: 10.12.0.cl or later Updates a customization configuration for the notification email. #### Pre-requisites Requires `DEVELOPER` (**has developer privilege**) or `ADMINISTRATION` (**Can administer ThoughtSpot**) privilege. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance, the `DEVELOPER` (**Has developer privilege**) privilege is required. **NOTE**:This endpoint in currently in beta. Contact ThoughtSpot support to enable this on your instance. #### Usage guidelines To update a custom configuration pass these parameters in your API request: - A JSON map of configuration attributes `template_properties`. The following example shows a sample set of customization configuration: ``` { { \"cta_button_bg_color\": \"#444DEA\", \"cta_text_font_color\": \"#FFFFFF\", \"primary_bg_color\": \"#D3DEF0\", \"logo_url\": \"https://storage.pardot.com/710713/1642089901EbkRibJq/TS_fullworkmark_darkmode.png\", \"font_family\": \"\", \"product_name\": \"ThoughtSpot\", \"footer_address\": \"444 Castro St, Suite 1000 Mountain View, CA 94041\", \"footer_phone\": \"(800) 508-7008\", \"replacement_value_for_liveboard\": \"Dashboard\", \"replacement_value_for_answer\": \"Chart\", \"replacement_value_for_spot_iq\": \"AI Insights\", \"hide_footer_phone\": false, \"hide_footer_address\": false, \"hide_product_name\": false, \"hide_manage_notification\": false, \"hide_mobile_app_nudge\": false, \"hide_privacy_policy\": false, \"hide_ts_vocabulary_definitions\": false, \"hide_error_message\": false, \"hide_unsubscribe_link\": false, \"hide_notification_status\": false, \"hide_modify_alert\": false, \"company_website_url\": \"https://your-website.com/\", \"company_privacy_policy_url\" : \"https://link-to-privacy-policy.com/\", \"contact_support_url\": \"https://link-to-contact-support.com/\", \"hide_contact_support_url\": false, \"hide_logo_url\" : false } } ``` * @param updateEmailCustomizationRequest */ public async updateEmailCustomization(updateEmailCustomizationRequest: UpdateEmailCustomizationRequest, _options?: Configuration): Promise { let _config = _options || this.configuration; // verify required parameter 'updateEmailCustomizationRequest' is not null or undefined if (updateEmailCustomizationRequest === null || updateEmailCustomizationRequest === undefined) { throw new RequiredError("EmailCustomizationApi", "updateEmailCustomization", "updateEmailCustomizationRequest"); } // Path Params const localVarPath = '/api/rest/2.0/customization/email/update'; // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") requestContext.setHeaderParam("User-Agent", "ThoughtSpot-Client/typescript/2.23.0") requestContext.setHeaderParam("X-ThoughtSpot-Client", "ThoughtSpot-ts-client/2.23.0") // Body Params const contentType = ObjectSerializer.getPreferredMediaType([ "application/json" ]); requestContext.setHeaderParam("Content-Type", contentType); const serializedBody = ObjectSerializer.stringify( ObjectSerializer.serialize(updateEmailCustomizationRequest, "UpdateEmailCustomizationRequest", ""), contentType ); requestContext.setBody(serializedBody); let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } /** * Version: 10.10.0.cl or later Validates the email customization configuration if any set for the ThoughtSpot system. #### Pre-requisites Requires `DEVELOPER` (**has developer privilege**) or `ADMINISTRATION` (**Can administer ThoughtSpot**) privilege. If [Role-Based Access Control (RBAC)](https://developers.thoughtspot.com/docs/rbac) is enabled on your instance, the `DEVELOPER` (**Has developer privilege**) privilege is required. **NOTE**:This endpoint in currently in beta. Contact ThoughtSpot support to enable this on your instance. */ public async validateEmailCustomization(_options?: Configuration): Promise { let _config = _options || this.configuration; // Path Params const localVarPath = '/api/rest/2.0/customization/email/validate'; // Make Request Context const requestContext = _config.baseServer.makeRequestContext(localVarPath, HttpMethod.POST); requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8") requestContext.setHeaderParam("User-Agent", "ThoughtSpot-Client/typescript/2.23.0") requestContext.setHeaderParam("X-ThoughtSpot-Client", "ThoughtSpot-ts-client/2.23.0") let authMethod: SecurityAuthentication | undefined; // Apply auth methods authMethod = _config.authMethods["bearerAuth"] if (authMethod?.applySecurityAuthentication) { await authMethod?.applySecurityAuthentication(requestContext); } const defaultAuth: SecurityAuthentication | undefined = _options?.authMethods?.default || this.configuration?.authMethods?.default if (defaultAuth?.applySecurityAuthentication) { await defaultAuth?.applySecurityAuthentication(requestContext); } return requestContext; } } export class EmailCustomizationApiResponseProcessor { /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to createEmailCustomization * @throws ApiException if the response code was not in [200, 299] */ public async createEmailCustomization(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: CreateEmailCustomizationResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "CreateEmailCustomizationResponse", "" ) as CreateEmailCustomizationResponse; return body; } if (isCodeInRange("400", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Invalid request.", body, response.headers); } if (isCodeInRange("403", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unauthorized access.", body, response.headers); } if (isCodeInRange("500", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unexpected error", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: CreateEmailCustomizationResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "CreateEmailCustomizationResponse", "" ) as CreateEmailCustomizationResponse; return body; } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to deleteEmailCustomization * @throws ApiException if the response code was not in [200, 299] */ public async deleteEmailCustomization(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("204", response.httpStatusCode)) { return; } if (isCodeInRange("400", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Invalid request.", body, response.headers); } if (isCodeInRange("403", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unauthorized access.", body, response.headers); } if (isCodeInRange("500", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unexpected error", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: void = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "void", "" ) as void; return body; } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to deleteOrgEmailCustomization * @throws ApiException if the response code was not in [200, 299] */ public async deleteOrgEmailCustomization(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("204", response.httpStatusCode)) { return; } if (isCodeInRange("400", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Invalid request.", body, response.headers); } if (isCodeInRange("401", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unauthorized access.", body, response.headers); } if (isCodeInRange("403", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unauthorized access.", body, response.headers); } if (isCodeInRange("500", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unexpected error", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: void = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "void", "" ) as void; return body; } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to searchEmailCustomization * @throws ApiException if the response code was not in [200, 299] */ public async searchEmailCustomization(response: ResponseContext): Promise > { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("200", response.httpStatusCode)) { const body: Array = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; return body; } if (isCodeInRange("400", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Invalid request.", body, response.headers); } if (isCodeInRange("403", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unauthorized access.", body, response.headers); } if (isCodeInRange("500", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unexpected error", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: Array = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "Array", "" ) as Array; return body; } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to updateEmailCustomization * @throws ApiException if the response code was not in [200, 299] */ public async updateEmailCustomization(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("204", response.httpStatusCode)) { return; } if (isCodeInRange("400", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Invalid request.", body, response.headers); } if (isCodeInRange("401", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unauthorized access.", body, response.headers); } if (isCodeInRange("403", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unauthorized access.", body, response.headers); } if (isCodeInRange("500", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unexpected error", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: void = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "void", "" ) as void; return body; } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } /** * Unwraps the actual response sent by the server from the response context and deserializes the response content * to the expected objects * * @params response Response returned by the server for a request to validateEmailCustomization * @throws ApiException if the response code was not in [200, 299] */ public async validateEmailCustomization(response: ResponseContext): Promise { const contentType = ObjectSerializer.normalizeMediaType(response.headers["content-type"]); if (isCodeInRange("204", response.httpStatusCode)) { return; } if (isCodeInRange("400", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Invalid request.", body, response.headers); } if (isCodeInRange("403", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unauthorized access.", body, response.headers); } if (isCodeInRange("500", response.httpStatusCode)) { const body: ErrorResponse = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "ErrorResponse", "" ) as ErrorResponse; throw new ApiException(response.httpStatusCode, "Unexpected error", body, response.headers); } // Work around for missing responses in specification, e.g. for petstore.yaml if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) { const body: void = ObjectSerializer.deserialize( ObjectSerializer.parse(await response.body.text(), contentType), "void", "" ) as void; return body; } throw new ApiException(response.httpStatusCode, "Unknown API Status Code!", await response.getBodyAsAny(), response.headers); } }