conekta/conekta-node

View on GitHub
api/webhooks-api.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
91%
/* tslint:disable */
/* eslint-disable */
/**
 * Conekta API
 * Conekta sdk
 *
 * The version of the OpenAPI document: 2.1.0
 * Contact: engineering@conekta.com
 *
 * 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 } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import { GetWebhooksResponse } from '../model';
// @ts-ignore
import { ModelError } from '../model';
// @ts-ignore
import { WebhookRequest } from '../model';
// @ts-ignore
import { WebhookResponse } from '../model';
// @ts-ignore
import { WebhookUpdateRequest } from '../model';
/**
 * WebhooksApi - axios parameter creator
 * @export
 */
export const WebhooksApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * What we do at Conekta translates into events. For example, an event of interest to us occurs at the time a payment is successfully processed. At that moment we will be interested in doing several things: Send an email to the buyer, generate an invoice, start the process of shipping the product, etc.
         * @summary Create Webhook
         * @param {WebhookRequest} webhookRequest requested field for webhook
         * @param {CreateWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createWebhook: async (webhookRequest: WebhookRequest, acceptLanguage?: CreateWebhookAcceptLanguageEnum, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'webhookRequest' is not null or undefined
            assertParamExists('createWebhook', 'webhookRequest', webhookRequest)
            const localVarPath = `/webhooks`;
            // 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 bearerAuth required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            if (acceptLanguage != null) {
                localVarHeaderParameter['Accept-Language'] = String(acceptLanguage);
            }


    
            localVarHeaderParameter['Content-Type'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            localVarRequestOptions.data = serializeDataIfNeeded(webhookRequest, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Delete Webhook
         * @param {string} id Identifier of the resource
         * @param {DeleteWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteWebhook: async (id: string, acceptLanguage?: DeleteWebhookAcceptLanguageEnum, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('deleteWebhook', 'id', id)
            const localVarPath = `/webhooks/{id}`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            // 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 bearerAuth required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            if (acceptLanguage != null) {
                localVarHeaderParameter['Accept-Language'] = String(acceptLanguage);
            }


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * 
         * @summary Get Webhook
         * @param {string} id Identifier of the resource
         * @param {GetWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getWebhook: async (id: string, acceptLanguage?: GetWebhookAcceptLanguageEnum, xChildCompanyId?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('getWebhook', 'id', id)
            const localVarPath = `/webhooks/{id}`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            // 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 bearerAuth required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            if (acceptLanguage != null) {
                localVarHeaderParameter['Accept-Language'] = String(acceptLanguage);
            }

            if (xChildCompanyId != null) {
                localVarHeaderParameter['X-Child-Company-Id'] = String(xChildCompanyId);
            }


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Consume the list of webhooks you have, each environment supports 10 webhooks (For production and testing)
         * @summary Get List of Webhooks
         * @param {GetWebhooksAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
         * @param {number} [limit] The numbers of items to return, the maximum value is 250
         * @param {string} [search] General order search, e.g. by mail, reference etc.
         * @param {string} [next] next page
         * @param {string} [previous] previous page
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getWebhooks: async (acceptLanguage?: GetWebhooksAcceptLanguageEnum, xChildCompanyId?: string, limit?: number, search?: string, next?: string, previous?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            const localVarPath = `/webhooks`;
            // 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 bearerAuth required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            if (limit !== undefined) {
                localVarQueryParameter['limit'] = limit;
            }

            if (search !== undefined) {
                localVarQueryParameter['search'] = search;
            }

            if (next !== undefined) {
                localVarQueryParameter['next'] = next;
            }

            if (previous !== undefined) {
                localVarQueryParameter['previous'] = previous;
            }

            if (acceptLanguage != null) {
                localVarHeaderParameter['Accept-Language'] = String(acceptLanguage);
            }

            if (xChildCompanyId != null) {
                localVarHeaderParameter['X-Child-Company-Id'] = String(xChildCompanyId);
            }


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Send a webhook.ping event
         * @summary Test Webhook
         * @param {string} id Identifier of the resource
         * @param {TestWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        testWebhook: async (id: string, acceptLanguage?: TestWebhookAcceptLanguageEnum, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('testWebhook', 'id', id)
            const localVarPath = `/webhooks/{id}/test`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            // 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 bearerAuth required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            if (acceptLanguage != null) {
                localVarHeaderParameter['Accept-Language'] = String(acceptLanguage);
            }


    
            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * updates an existing webhook
         * @summary Update Webhook
         * @param {string} id Identifier of the resource
         * @param {WebhookUpdateRequest} webhookUpdateRequest requested fields in order to update a webhook
         * @param {UpdateWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateWebhook: async (id: string, webhookUpdateRequest: WebhookUpdateRequest, acceptLanguage?: UpdateWebhookAcceptLanguageEnum, xChildCompanyId?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            assertParamExists('updateWebhook', 'id', id)
            // verify required parameter 'webhookUpdateRequest' is not null or undefined
            assertParamExists('updateWebhook', 'webhookUpdateRequest', webhookUpdateRequest)
            const localVarPath = `/webhooks/{id}`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            // 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: 'PUT', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication bearerAuth required
            // http bearer authentication required
            await setBearerAuthToObject(localVarHeaderParameter, configuration)

            if (acceptLanguage != null) {
                localVarHeaderParameter['Accept-Language'] = String(acceptLanguage);
            }

            if (xChildCompanyId != null) {
                localVarHeaderParameter['X-Child-Company-Id'] = String(xChildCompanyId);
            }


    
            localVarHeaderParameter['Content-Type'] = 'application/json';

            setSearchParams(localVarUrlObj, localVarQueryParameter);
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            localVarRequestOptions.data = serializeDataIfNeeded(webhookUpdateRequest, localVarRequestOptions, configuration)

            return {
                url: toPathString(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    }
};

/**
 * WebhooksApi - functional programming interface
 * @export
 */
export const WebhooksApiFp = function(configuration?: Configuration) {
    const localVarAxiosParamCreator = WebhooksApiAxiosParamCreator(configuration)
    return {
        /**
         * What we do at Conekta translates into events. For example, an event of interest to us occurs at the time a payment is successfully processed. At that moment we will be interested in doing several things: Send an email to the buyer, generate an invoice, start the process of shipping the product, etc.
         * @summary Create Webhook
         * @param {WebhookRequest} webhookRequest requested field for webhook
         * @param {CreateWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createWebhook(webhookRequest: WebhookRequest, acceptLanguage?: CreateWebhookAcceptLanguageEnum, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<WebhookResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.createWebhook(webhookRequest, acceptLanguage, options);
            const index = configuration?.serverIndex ?? 0;
            const operationBasePath = operationServerMap['WebhooksApi.createWebhook']?.[index]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
        },
        /**
         * 
         * @summary Delete Webhook
         * @param {string} id Identifier of the resource
         * @param {DeleteWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteWebhook(id: string, acceptLanguage?: DeleteWebhookAcceptLanguageEnum, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<WebhookResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.deleteWebhook(id, acceptLanguage, options);
            const index = configuration?.serverIndex ?? 0;
            const operationBasePath = operationServerMap['WebhooksApi.deleteWebhook']?.[index]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
        },
        /**
         * 
         * @summary Get Webhook
         * @param {string} id Identifier of the resource
         * @param {GetWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getWebhook(id: string, acceptLanguage?: GetWebhookAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<WebhookResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getWebhook(id, acceptLanguage, xChildCompanyId, options);
            const index = configuration?.serverIndex ?? 0;
            const operationBasePath = operationServerMap['WebhooksApi.getWebhook']?.[index]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
        },
        /**
         * Consume the list of webhooks you have, each environment supports 10 webhooks (For production and testing)
         * @summary Get List of Webhooks
         * @param {GetWebhooksAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
         * @param {number} [limit] The numbers of items to return, the maximum value is 250
         * @param {string} [search] General order search, e.g. by mail, reference etc.
         * @param {string} [next] next page
         * @param {string} [previous] previous page
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getWebhooks(acceptLanguage?: GetWebhooksAcceptLanguageEnum, xChildCompanyId?: string, limit?: number, search?: string, next?: string, previous?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetWebhooksResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.getWebhooks(acceptLanguage, xChildCompanyId, limit, search, next, previous, options);
            const index = configuration?.serverIndex ?? 0;
            const operationBasePath = operationServerMap['WebhooksApi.getWebhooks']?.[index]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
        },
        /**
         * Send a webhook.ping event
         * @summary Test Webhook
         * @param {string} id Identifier of the resource
         * @param {TestWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async testWebhook(id: string, acceptLanguage?: TestWebhookAcceptLanguageEnum, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<WebhookResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.testWebhook(id, acceptLanguage, options);
            const index = configuration?.serverIndex ?? 0;
            const operationBasePath = operationServerMap['WebhooksApi.testWebhook']?.[index]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
        },
        /**
         * updates an existing webhook
         * @summary Update Webhook
         * @param {string} id Identifier of the resource
         * @param {WebhookUpdateRequest} webhookUpdateRequest requested fields in order to update a webhook
         * @param {UpdateWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateWebhook(id: string, webhookUpdateRequest: WebhookUpdateRequest, acceptLanguage?: UpdateWebhookAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<WebhookResponse>> {
            const localVarAxiosArgs = await localVarAxiosParamCreator.updateWebhook(id, webhookUpdateRequest, acceptLanguage, xChildCompanyId, options);
            const index = configuration?.serverIndex ?? 0;
            const operationBasePath = operationServerMap['WebhooksApi.updateWebhook']?.[index]?.url;
            return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
        },
    }
};

/**
 * WebhooksApi - factory interface
 * @export
 */
export const WebhooksApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    const localVarFp = WebhooksApiFp(configuration)
    return {
        /**
         * What we do at Conekta translates into events. For example, an event of interest to us occurs at the time a payment is successfully processed. At that moment we will be interested in doing several things: Send an email to the buyer, generate an invoice, start the process of shipping the product, etc.
         * @summary Create Webhook
         * @param {WebhookRequest} webhookRequest requested field for webhook
         * @param {CreateWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createWebhook(webhookRequest: WebhookRequest, acceptLanguage?: CreateWebhookAcceptLanguageEnum, options?: any): AxiosPromise<WebhookResponse> {
            return localVarFp.createWebhook(webhookRequest, acceptLanguage, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Delete Webhook
         * @param {string} id Identifier of the resource
         * @param {DeleteWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteWebhook(id: string, acceptLanguage?: DeleteWebhookAcceptLanguageEnum, options?: any): AxiosPromise<WebhookResponse> {
            return localVarFp.deleteWebhook(id, acceptLanguage, options).then((request) => request(axios, basePath));
        },
        /**
         * 
         * @summary Get Webhook
         * @param {string} id Identifier of the resource
         * @param {GetWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getWebhook(id: string, acceptLanguage?: GetWebhookAcceptLanguageEnum, xChildCompanyId?: string, options?: any): AxiosPromise<WebhookResponse> {
            return localVarFp.getWebhook(id, acceptLanguage, xChildCompanyId, options).then((request) => request(axios, basePath));
        },
        /**
         * Consume the list of webhooks you have, each environment supports 10 webhooks (For production and testing)
         * @summary Get List of Webhooks
         * @param {GetWebhooksAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
         * @param {number} [limit] The numbers of items to return, the maximum value is 250
         * @param {string} [search] General order search, e.g. by mail, reference etc.
         * @param {string} [next] next page
         * @param {string} [previous] previous page
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getWebhooks(acceptLanguage?: GetWebhooksAcceptLanguageEnum, xChildCompanyId?: string, limit?: number, search?: string, next?: string, previous?: string, options?: any): AxiosPromise<GetWebhooksResponse> {
            return localVarFp.getWebhooks(acceptLanguage, xChildCompanyId, limit, search, next, previous, options).then((request) => request(axios, basePath));
        },
        /**
         * Send a webhook.ping event
         * @summary Test Webhook
         * @param {string} id Identifier of the resource
         * @param {TestWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        testWebhook(id: string, acceptLanguage?: TestWebhookAcceptLanguageEnum, options?: any): AxiosPromise<WebhookResponse> {
            return localVarFp.testWebhook(id, acceptLanguage, options).then((request) => request(axios, basePath));
        },
        /**
         * updates an existing webhook
         * @summary Update Webhook
         * @param {string} id Identifier of the resource
         * @param {WebhookUpdateRequest} webhookUpdateRequest requested fields in order to update a webhook
         * @param {UpdateWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
         * @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateWebhook(id: string, webhookUpdateRequest: WebhookUpdateRequest, acceptLanguage?: UpdateWebhookAcceptLanguageEnum, xChildCompanyId?: string, options?: any): AxiosPromise<WebhookResponse> {
            return localVarFp.updateWebhook(id, webhookUpdateRequest, acceptLanguage, xChildCompanyId, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * WebhooksApi - interface
 * @export
 * @interface WebhooksApi
 */
export interface WebhooksApiInterface {
    /**
     * What we do at Conekta translates into events. For example, an event of interest to us occurs at the time a payment is successfully processed. At that moment we will be interested in doing several things: Send an email to the buyer, generate an invoice, start the process of shipping the product, etc.
     * @summary Create Webhook
     * @param {WebhookRequest} webhookRequest requested field for webhook
     * @param {CreateWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof WebhooksApiInterface
     */
    createWebhook(webhookRequest: WebhookRequest, acceptLanguage?: CreateWebhookAcceptLanguageEnum, options?: RawAxiosRequestConfig): AxiosPromise<WebhookResponse>;

    /**
     * 
     * @summary Delete Webhook
     * @param {string} id Identifier of the resource
     * @param {DeleteWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof WebhooksApiInterface
     */
    deleteWebhook(id: string, acceptLanguage?: DeleteWebhookAcceptLanguageEnum, options?: RawAxiosRequestConfig): AxiosPromise<WebhookResponse>;

    /**
     * 
     * @summary Get Webhook
     * @param {string} id Identifier of the resource
     * @param {GetWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
     * @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof WebhooksApiInterface
     */
    getWebhook(id: string, acceptLanguage?: GetWebhookAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): AxiosPromise<WebhookResponse>;

    /**
     * Consume the list of webhooks you have, each environment supports 10 webhooks (For production and testing)
     * @summary Get List of Webhooks
     * @param {GetWebhooksAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
     * @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
     * @param {number} [limit] The numbers of items to return, the maximum value is 250
     * @param {string} [search] General order search, e.g. by mail, reference etc.
     * @param {string} [next] next page
     * @param {string} [previous] previous page
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof WebhooksApiInterface
     */
    getWebhooks(acceptLanguage?: GetWebhooksAcceptLanguageEnum, xChildCompanyId?: string, limit?: number, search?: string, next?: string, previous?: string, options?: RawAxiosRequestConfig): AxiosPromise<GetWebhooksResponse>;

    /**
     * Send a webhook.ping event
     * @summary Test Webhook
     * @param {string} id Identifier of the resource
     * @param {TestWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof WebhooksApiInterface
     */
    testWebhook(id: string, acceptLanguage?: TestWebhookAcceptLanguageEnum, options?: RawAxiosRequestConfig): AxiosPromise<WebhookResponse>;

    /**
     * updates an existing webhook
     * @summary Update Webhook
     * @param {string} id Identifier of the resource
     * @param {WebhookUpdateRequest} webhookUpdateRequest requested fields in order to update a webhook
     * @param {UpdateWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
     * @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof WebhooksApiInterface
     */
    updateWebhook(id: string, webhookUpdateRequest: WebhookUpdateRequest, acceptLanguage?: UpdateWebhookAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): AxiosPromise<WebhookResponse>;

}

/**
 * WebhooksApi - object-oriented interface
 * @export
 * @class WebhooksApi
 * @extends {BaseAPI}
 */
export class WebhooksApi extends BaseAPI implements WebhooksApiInterface {
    /**
     * What we do at Conekta translates into events. For example, an event of interest to us occurs at the time a payment is successfully processed. At that moment we will be interested in doing several things: Send an email to the buyer, generate an invoice, start the process of shipping the product, etc.
     * @summary Create Webhook
     * @param {WebhookRequest} webhookRequest requested field for webhook
     * @param {CreateWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof WebhooksApi
     */
    public createWebhook(webhookRequest: WebhookRequest, acceptLanguage?: CreateWebhookAcceptLanguageEnum, options?: RawAxiosRequestConfig) {
        return WebhooksApiFp(this.configuration).createWebhook(webhookRequest, acceptLanguage, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Delete Webhook
     * @param {string} id Identifier of the resource
     * @param {DeleteWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof WebhooksApi
     */
    public deleteWebhook(id: string, acceptLanguage?: DeleteWebhookAcceptLanguageEnum, options?: RawAxiosRequestConfig) {
        return WebhooksApiFp(this.configuration).deleteWebhook(id, acceptLanguage, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * 
     * @summary Get Webhook
     * @param {string} id Identifier of the resource
     * @param {GetWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
     * @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof WebhooksApi
     */
    public getWebhook(id: string, acceptLanguage?: GetWebhookAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig) {
        return WebhooksApiFp(this.configuration).getWebhook(id, acceptLanguage, xChildCompanyId, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Consume the list of webhooks you have, each environment supports 10 webhooks (For production and testing)
     * @summary Get List of Webhooks
     * @param {GetWebhooksAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
     * @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
     * @param {number} [limit] The numbers of items to return, the maximum value is 250
     * @param {string} [search] General order search, e.g. by mail, reference etc.
     * @param {string} [next] next page
     * @param {string} [previous] previous page
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof WebhooksApi
     */
    public getWebhooks(acceptLanguage?: GetWebhooksAcceptLanguageEnum, xChildCompanyId?: string, limit?: number, search?: string, next?: string, previous?: string, options?: RawAxiosRequestConfig) {
        return WebhooksApiFp(this.configuration).getWebhooks(acceptLanguage, xChildCompanyId, limit, search, next, previous, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Send a webhook.ping event
     * @summary Test Webhook
     * @param {string} id Identifier of the resource
     * @param {TestWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof WebhooksApi
     */
    public testWebhook(id: string, acceptLanguage?: TestWebhookAcceptLanguageEnum, options?: RawAxiosRequestConfig) {
        return WebhooksApiFp(this.configuration).testWebhook(id, acceptLanguage, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * updates an existing webhook
     * @summary Update Webhook
     * @param {string} id Identifier of the resource
     * @param {WebhookUpdateRequest} webhookUpdateRequest requested fields in order to update a webhook
     * @param {UpdateWebhookAcceptLanguageEnum} [acceptLanguage] Use for knowing which language to use
     * @param {string} [xChildCompanyId] In the case of a holding company, the company id of the child company to which will process the request.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof WebhooksApi
     */
    public updateWebhook(id: string, webhookUpdateRequest: WebhookUpdateRequest, acceptLanguage?: UpdateWebhookAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig) {
        return WebhooksApiFp(this.configuration).updateWebhook(id, webhookUpdateRequest, acceptLanguage, xChildCompanyId, options).then((request) => request(this.axios, this.basePath));
    }
}

/**
 * @export
 */
export const CreateWebhookAcceptLanguageEnum = {
    es: 'es',
    en: 'en'
} as const;
export type CreateWebhookAcceptLanguageEnum = typeof CreateWebhookAcceptLanguageEnum[keyof typeof CreateWebhookAcceptLanguageEnum];
/**
 * @export
 */
export const DeleteWebhookAcceptLanguageEnum = {
    es: 'es',
    en: 'en'
} as const;
export type DeleteWebhookAcceptLanguageEnum = typeof DeleteWebhookAcceptLanguageEnum[keyof typeof DeleteWebhookAcceptLanguageEnum];
/**
 * @export
 */
export const GetWebhookAcceptLanguageEnum = {
    es: 'es',
    en: 'en'
} as const;
export type GetWebhookAcceptLanguageEnum = typeof GetWebhookAcceptLanguageEnum[keyof typeof GetWebhookAcceptLanguageEnum];
/**
 * @export
 */
export const GetWebhooksAcceptLanguageEnum = {
    es: 'es',
    en: 'en'
} as const;
export type GetWebhooksAcceptLanguageEnum = typeof GetWebhooksAcceptLanguageEnum[keyof typeof GetWebhooksAcceptLanguageEnum];
/**
 * @export
 */
export const TestWebhookAcceptLanguageEnum = {
    es: 'es',
    en: 'en'
} as const;
export type TestWebhookAcceptLanguageEnum = typeof TestWebhookAcceptLanguageEnum[keyof typeof TestWebhookAcceptLanguageEnum];
/**
 * @export
 */
export const UpdateWebhookAcceptLanguageEnum = {
    es: 'es',
    en: 'en'
} as const;
export type UpdateWebhookAcceptLanguageEnum = typeof UpdateWebhookAcceptLanguageEnum[keyof typeof UpdateWebhookAcceptLanguageEnum];