/* tslint:disable */
/* eslint-disable */
/**
* templates
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: v2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import {
DUMMY_BASE_URL,
assertParamExists,
setApiKeyToObject,
setBasicAuthToObject,
setBearerAuthToObject,
setOAuthToObject,
setSearchParams,
serializeDataIfNeeded,
toPathString,
createRequestFunction,
replaceWithSerializableTypeIfNeeded,
} from '../common';
// @ts-ignore
import {
BASE_PATH,
COLLECTION_FORMATS,
type RequestArgs,
BaseAPI,
RequiredError,
operationServerMap,
} from '../base';
// @ts-ignore
import type { BaseTemplateConfiguration } from '../models';
// @ts-ignore
import type { ErrorResponse } from '../models';
// @ts-ignore
import type { PatchOperation } from '../models';
/**
* TemplatesApi - axios parameter creator
*/
export const TemplatesApiAxiosParamCreator = function (
configuration?: Configuration,
) {
return {
/**
* This endpoint deletes an existing webhook template identified by the provided templateId.
* @summary Delete an existing template
* @param {string} templateId The ID of the template to be deleted.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
_delete: async (
templateId: string,
options: RawAxiosRequestConfig = {},
): Promise => {
// verify required parameter 'templateId' is not null or undefined
assertParamExists('_delete', 'templateId', templateId);
const localVarPath = `/templates/{templateId}`.replace(
`{${'templateId'}}`,
encodeURIComponent(String(templateId)),
);
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = {
method: 'DELETE',
...baseOptions,
...options,
};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication basic required
// http basic authentication required
setBasicAuthToObject(localVarRequestOptions, configuration);
localVarHeaderParameter['Accept'] = 'application/vnd.mambu.v2+json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions =
baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {
...localVarHeaderParameter,
...headersFromBaseOptions,
...options.headers,
};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* This endpoint creates a new template, performing all necessary validations. Note: Currently, only Webhook templates are supported.
* @summary Create a new template
* @param {BaseTemplateConfiguration} baseTemplateConfiguration Object which contains the values of the to-be-created template.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createTemplate: async (
baseTemplateConfiguration: BaseTemplateConfiguration,
options: RawAxiosRequestConfig = {},
): Promise => {
// verify required parameter 'baseTemplateConfiguration' is not null or undefined
assertParamExists(
'createTemplate',
'baseTemplateConfiguration',
baseTemplateConfiguration,
);
const localVarPath = `/templates`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = {
method: 'POST',
...baseOptions,
...options,
};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication basic required
// http basic authentication required
setBasicAuthToObject(localVarRequestOptions, configuration);
localVarHeaderParameter['Content-Type'] = 'application/json';
localVarHeaderParameter['Accept'] = 'application/vnd.mambu.v2+json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions =
baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {
...localVarHeaderParameter,
...headersFromBaseOptions,
...options.headers,
};
localVarRequestOptions.data = serializeDataIfNeeded(
baseTemplateConfiguration,
localVarRequestOptions,
configuration,
);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* This endpoint retrieves a specific template, regardless of its type (webhook, SMS, or email), based on the provided templateId.
* @summary Get template by id
* @param {string} templateId The ID of the template to be retrieved.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getByTemplateId: async (
templateId: string,
options: RawAxiosRequestConfig = {},
): Promise => {
// verify required parameter 'templateId' is not null or undefined
assertParamExists('getByTemplateId', 'templateId', templateId);
const localVarPath = `/templates/{templateId}`.replace(
`{${'templateId'}}`,
encodeURIComponent(String(templateId)),
);
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = {
method: 'GET',
...baseOptions,
...options,
};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication basic required
// http basic authentication required
setBasicAuthToObject(localVarRequestOptions, configuration);
localVarHeaderParameter['Accept'] = 'application/vnd.mambu.v2+json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions =
baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {
...localVarHeaderParameter,
...headersFromBaseOptions,
...options.headers,
};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* This endpoint updates an existing template, performing all necessary validations on the updated object. Note: Currently, only Webhook templates are supported. A valid PATCH request contains an array of PATCH operation objects.
Click for more details on the PATCH Request Object Structure
These objects can be:
- For
REPLACE Operation:
{
\\\"op\\\": \\\"REPLACE\\\",
\\\"path\\\": \\\"<path for replacement>\\\",
\\\"value\\\": \\\"<new value for the property>\\\"
}path: Can be an editable property of the webhook template or the ID of a filter constraint or request header (\\\"path\\\": \\\"<nested object id>/<nested object property to be edited>\\\") along with the property to be edited.value: Mandatory.
- For
REMOVE Operation:
{
\\\"op\\\": \\\"REMOVE\\\",
\\\"path\\\": \\\"<path_for_removal>\\\"
}path: Can be a nullable property of the webhook template or the ID (\\\"path\\\": \\\"<nested object id>\\\") of an existing filter constraint or request header.- No
value should be set.
- For
ADD operation- For simple properties:
{
\\\"op\\\": \\\"ADD\\\",
\\\"path\\\": \\\"<property_to_add_value_for>\\\",
\\\"value\\\": \\\"<value_for_the_property>\\\"
}path: Can be a template property.
- For new request headers or filter constraints:
{
\\\"op\\\": \\\"ADD\\\",
\\\"path\\\": \\\"headers/<header property>\\\",
\\\"value\\\": \\\"<value to be added for specified property for the new header>\\\"
} {
\\\"op\\\": \\\"ADD\\\",
\\\"path\\\": \\\"filterConstraints/<filter constraint property>\\\",
\\\"value\\\": \\\"<value to be added for specified property for the new filter constraint>\\\"
}
- In a single
PATCH call, you can add only one new request header and one new filter constraint. If multiple attempts are made to add within the same array, only the last value for each type will be populated in the newly added nested object of each type. - For nested objects inside the template with
PATCH, ADD works for addition only (given the custom syntax with the headers or filterConstraints identifiers) and REPLACE is the one used for the replacement of the values of the nested objects\' properties.
\"
* @summary Update an existing template
* @param {string} templateId The ID of the template to be updated.
* @param {Array} patchOperation Patch operations to be applied to a resource.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateTemplate: async (
templateId: string,
patchOperation: Array,
options: RawAxiosRequestConfig = {},
): Promise => {
// verify required parameter 'templateId' is not null or undefined
assertParamExists('updateTemplate', 'templateId', templateId);
// verify required parameter 'patchOperation' is not null or undefined
assertParamExists('updateTemplate', 'patchOperation', patchOperation);
const localVarPath = `/templates/{templateId}`.replace(
`{${'templateId'}}`,
encodeURIComponent(String(templateId)),
);
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = {
method: 'PATCH',
...baseOptions,
...options,
};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication basic required
// http basic authentication required
setBasicAuthToObject(localVarRequestOptions, configuration);
localVarHeaderParameter['Content-Type'] = 'application/json';
localVarHeaderParameter['Accept'] = 'application/vnd.mambu.v2+json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions =
baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {
...localVarHeaderParameter,
...headersFromBaseOptions,
...options.headers,
};
localVarRequestOptions.data = serializeDataIfNeeded(
patchOperation,
localVarRequestOptions,
configuration,
);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
};
};
/**
* TemplatesApi - functional programming interface
*/
export const TemplatesApiFp = function (configuration?: Configuration) {
const localVarAxiosParamCreator =
TemplatesApiAxiosParamCreator(configuration);
return {
/**
* This endpoint deletes an existing webhook template identified by the provided templateId.
* @summary Delete an existing template
* @param {string} templateId The ID of the template to be deleted.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async _delete(
templateId: string,
options?: RawAxiosRequestConfig,
): Promise<
(axios?: AxiosInstance, basePath?: string) => AxiosPromise
> {
const localVarAxiosArgs = await localVarAxiosParamCreator._delete(
templateId,
options,
);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath =
operationServerMap['TemplatesApi._delete']?.[
localVarOperationServerIndex
]?.url;
return (axios, basePath) =>
createRequestFunction(
localVarAxiosArgs,
globalAxios,
BASE_PATH,
configuration,
)(axios, localVarOperationServerBasePath || basePath);
},
/**
* This endpoint creates a new template, performing all necessary validations. Note: Currently, only Webhook templates are supported.
* @summary Create a new template
* @param {BaseTemplateConfiguration} baseTemplateConfiguration Object which contains the values of the to-be-created template.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createTemplate(
baseTemplateConfiguration: BaseTemplateConfiguration,
options?: RawAxiosRequestConfig,
): Promise<
(
axios?: AxiosInstance,
basePath?: string,
) => AxiosPromise
> {
const localVarAxiosArgs = await localVarAxiosParamCreator.createTemplate(
baseTemplateConfiguration,
options,
);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath =
operationServerMap['TemplatesApi.createTemplate']?.[
localVarOperationServerIndex
]?.url;
return (axios, basePath) =>
createRequestFunction(
localVarAxiosArgs,
globalAxios,
BASE_PATH,
configuration,
)(axios, localVarOperationServerBasePath || basePath);
},
/**
* This endpoint retrieves a specific template, regardless of its type (webhook, SMS, or email), based on the provided templateId.
* @summary Get template by id
* @param {string} templateId The ID of the template to be retrieved.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getByTemplateId(
templateId: string,
options?: RawAxiosRequestConfig,
): Promise<
(
axios?: AxiosInstance,
basePath?: string,
) => AxiosPromise
> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getByTemplateId(
templateId,
options,
);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath =
operationServerMap['TemplatesApi.getByTemplateId']?.[
localVarOperationServerIndex
]?.url;
return (axios, basePath) =>
createRequestFunction(
localVarAxiosArgs,
globalAxios,
BASE_PATH,
configuration,
)(axios, localVarOperationServerBasePath || basePath);
},
/**
* This endpoint updates an existing template, performing all necessary validations on the updated object. Note: Currently, only Webhook templates are supported. A valid PATCH request contains an array of PATCH operation objects.
Click for more details on the PATCH Request Object Structure
These objects can be:
- For
REPLACE Operation:
{
\\\"op\\\": \\\"REPLACE\\\",
\\\"path\\\": \\\"<path for replacement>\\\",
\\\"value\\\": \\\"<new value for the property>\\\"
}path: Can be an editable property of the webhook template or the ID of a filter constraint or request header (\\\"path\\\": \\\"<nested object id>/<nested object property to be edited>\\\") along with the property to be edited.value: Mandatory.
- For
REMOVE Operation:
{
\\\"op\\\": \\\"REMOVE\\\",
\\\"path\\\": \\\"<path_for_removal>\\\"
}path: Can be a nullable property of the webhook template or the ID (\\\"path\\\": \\\"<nested object id>\\\") of an existing filter constraint or request header.- No
value should be set.
- For
ADD operation- For simple properties:
{
\\\"op\\\": \\\"ADD\\\",
\\\"path\\\": \\\"<property_to_add_value_for>\\\",
\\\"value\\\": \\\"<value_for_the_property>\\\"
}path: Can be a template property.
- For new request headers or filter constraints:
{
\\\"op\\\": \\\"ADD\\\",
\\\"path\\\": \\\"headers/<header property>\\\",
\\\"value\\\": \\\"<value to be added for specified property for the new header>\\\"
} {
\\\"op\\\": \\\"ADD\\\",
\\\"path\\\": \\\"filterConstraints/<filter constraint property>\\\",
\\\"value\\\": \\\"<value to be added for specified property for the new filter constraint>\\\"
}
- In a single
PATCH call, you can add only one new request header and one new filter constraint. If multiple attempts are made to add within the same array, only the last value for each type will be populated in the newly added nested object of each type. - For nested objects inside the template with
PATCH, ADD works for addition only (given the custom syntax with the headers or filterConstraints identifiers) and REPLACE is the one used for the replacement of the values of the nested objects\' properties.
\"
* @summary Update an existing template
* @param {string} templateId The ID of the template to be updated.
* @param {Array} patchOperation Patch operations to be applied to a resource.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async updateTemplate(
templateId: string,
patchOperation: Array,
options?: RawAxiosRequestConfig,
): Promise<
(
axios?: AxiosInstance,
basePath?: string,
) => AxiosPromise
> {
const localVarAxiosArgs = await localVarAxiosParamCreator.updateTemplate(
templateId,
patchOperation,
options,
);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath =
operationServerMap['TemplatesApi.updateTemplate']?.[
localVarOperationServerIndex
]?.url;
return (axios, basePath) =>
createRequestFunction(
localVarAxiosArgs,
globalAxios,
BASE_PATH,
configuration,
)(axios, localVarOperationServerBasePath || basePath);
},
};
};
/**
* TemplatesApi - factory interface
*/
export const TemplatesApiFactory = function (
configuration?: Configuration,
basePath?: string,
axios?: AxiosInstance,
) {
const localVarFp = TemplatesApiFp(configuration);
return {
/**
* This endpoint deletes an existing webhook template identified by the provided templateId.
* @summary Delete an existing template
* @param {string} templateId The ID of the template to be deleted.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
_delete(
templateId: string,
options?: RawAxiosRequestConfig,
): AxiosPromise {
return localVarFp
._delete(templateId, options)
.then((request) => request(axios, basePath));
},
/**
* This endpoint creates a new template, performing all necessary validations. Note: Currently, only Webhook templates are supported.
* @summary Create a new template
* @param {BaseTemplateConfiguration} baseTemplateConfiguration Object which contains the values of the to-be-created template.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createTemplate(
baseTemplateConfiguration: BaseTemplateConfiguration,
options?: RawAxiosRequestConfig,
): AxiosPromise {
return localVarFp
.createTemplate(baseTemplateConfiguration, options)
.then((request) => request(axios, basePath));
},
/**
* This endpoint retrieves a specific template, regardless of its type (webhook, SMS, or email), based on the provided templateId.
* @summary Get template by id
* @param {string} templateId The ID of the template to be retrieved.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getByTemplateId(
templateId: string,
options?: RawAxiosRequestConfig,
): AxiosPromise {
return localVarFp
.getByTemplateId(templateId, options)
.then((request) => request(axios, basePath));
},
/**
* This endpoint updates an existing template, performing all necessary validations on the updated object. Note: Currently, only Webhook templates are supported. A valid PATCH request contains an array of PATCH operation objects.
Click for more details on the PATCH Request Object Structure
These objects can be:
- For
REPLACE Operation:
{
\\\"op\\\": \\\"REPLACE\\\",
\\\"path\\\": \\\"<path for replacement>\\\",
\\\"value\\\": \\\"<new value for the property>\\\"
}path: Can be an editable property of the webhook template or the ID of a filter constraint or request header (\\\"path\\\": \\\"<nested object id>/<nested object property to be edited>\\\") along with the property to be edited.value: Mandatory.
- For
REMOVE Operation:
{
\\\"op\\\": \\\"REMOVE\\\",
\\\"path\\\": \\\"<path_for_removal>\\\"
}path: Can be a nullable property of the webhook template or the ID (\\\"path\\\": \\\"<nested object id>\\\") of an existing filter constraint or request header.- No
value should be set.
- For
ADD operation- For simple properties:
{
\\\"op\\\": \\\"ADD\\\",
\\\"path\\\": \\\"<property_to_add_value_for>\\\",
\\\"value\\\": \\\"<value_for_the_property>\\\"
}path: Can be a template property.
- For new request headers or filter constraints:
{
\\\"op\\\": \\\"ADD\\\",
\\\"path\\\": \\\"headers/<header property>\\\",
\\\"value\\\": \\\"<value to be added for specified property for the new header>\\\"
} {
\\\"op\\\": \\\"ADD\\\",
\\\"path\\\": \\\"filterConstraints/<filter constraint property>\\\",
\\\"value\\\": \\\"<value to be added for specified property for the new filter constraint>\\\"
}
- In a single
PATCH call, you can add only one new request header and one new filter constraint. If multiple attempts are made to add within the same array, only the last value for each type will be populated in the newly added nested object of each type. - For nested objects inside the template with
PATCH, ADD works for addition only (given the custom syntax with the headers or filterConstraints identifiers) and REPLACE is the one used for the replacement of the values of the nested objects\' properties.
\"
* @summary Update an existing template
* @param {string} templateId The ID of the template to be updated.
* @param {Array} patchOperation Patch operations to be applied to a resource.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateTemplate(
templateId: string,
patchOperation: Array,
options?: RawAxiosRequestConfig,
): AxiosPromise {
return localVarFp
.updateTemplate(templateId, patchOperation, options)
.then((request) => request(axios, basePath));
},
};
};
/**
* TemplatesApi - object-oriented interface
*/
export class TemplatesApi extends BaseAPI {
/**
* This endpoint deletes an existing webhook template identified by the provided templateId.
* @summary Delete an existing template
* @param {string} templateId The ID of the template to be deleted.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
public _delete(templateId: string, options?: RawAxiosRequestConfig) {
return TemplatesApiFp(this.configuration)
._delete(templateId, options)
.then((request) => request(this.axios, this.basePath));
}
/**
* This endpoint creates a new template, performing all necessary validations. Note: Currently, only Webhook templates are supported.
* @summary Create a new template
* @param {BaseTemplateConfiguration} baseTemplateConfiguration Object which contains the values of the to-be-created template.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
public createTemplate(
baseTemplateConfiguration: BaseTemplateConfiguration,
options?: RawAxiosRequestConfig,
) {
return TemplatesApiFp(this.configuration)
.createTemplate(baseTemplateConfiguration, options)
.then((request) => request(this.axios, this.basePath));
}
/**
* This endpoint retrieves a specific template, regardless of its type (webhook, SMS, or email), based on the provided templateId.
* @summary Get template by id
* @param {string} templateId The ID of the template to be retrieved.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
public getByTemplateId(templateId: string, options?: RawAxiosRequestConfig) {
return TemplatesApiFp(this.configuration)
.getByTemplateId(templateId, options)
.then((request) => request(this.axios, this.basePath));
}
/**
* This endpoint updates an existing template, performing all necessary validations on the updated object. Note: Currently, only Webhook templates are supported. A valid PATCH request contains an array of PATCH operation objects.
Click for more details on the PATCH Request Object Structure
These objects can be:
- For
REPLACE Operation:
{
\\\"op\\\": \\\"REPLACE\\\",
\\\"path\\\": \\\"<path for replacement>\\\",
\\\"value\\\": \\\"<new value for the property>\\\"
}path: Can be an editable property of the webhook template or the ID of a filter constraint or request header (\\\"path\\\": \\\"<nested object id>/<nested object property to be edited>\\\") along with the property to be edited.value: Mandatory.
- For
REMOVE Operation:
{
\\\"op\\\": \\\"REMOVE\\\",
\\\"path\\\": \\\"<path_for_removal>\\\"
}path: Can be a nullable property of the webhook template or the ID (\\\"path\\\": \\\"<nested object id>\\\") of an existing filter constraint or request header.- No
value should be set.
- For
ADD operation- For simple properties:
{
\\\"op\\\": \\\"ADD\\\",
\\\"path\\\": \\\"<property_to_add_value_for>\\\",
\\\"value\\\": \\\"<value_for_the_property>\\\"
}path: Can be a template property.
- For new request headers or filter constraints:
{
\\\"op\\\": \\\"ADD\\\",
\\\"path\\\": \\\"headers/<header property>\\\",
\\\"value\\\": \\\"<value to be added for specified property for the new header>\\\"
} {
\\\"op\\\": \\\"ADD\\\",
\\\"path\\\": \\\"filterConstraints/<filter constraint property>\\\",
\\\"value\\\": \\\"<value to be added for specified property for the new filter constraint>\\\"
}
- In a single
PATCH call, you can add only one new request header and one new filter constraint. If multiple attempts are made to add within the same array, only the last value for each type will be populated in the newly added nested object of each type. - For nested objects inside the template with
PATCH, ADD works for addition only (given the custom syntax with the headers or filterConstraints identifiers) and REPLACE is the one used for the replacement of the values of the nested objects\' properties.
\"
* @summary Update an existing template
* @param {string} templateId The ID of the template to be updated.
* @param {Array} patchOperation Patch operations to be applied to a resource.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
public updateTemplate(
templateId: string,
patchOperation: Array,
options?: RawAxiosRequestConfig,
) {
return TemplatesApiFp(this.configuration)
.updateTemplate(templateId, patchOperation, options)
.then((request) => request(this.axios, this.basePath));
}
}