UNPKG

digitalfemsa

Version:
440 lines (401 loc) 27.2 kB
/* tslint:disable */ /* eslint-disable */ /** * Femsa API * Femsa sdk * * The version of the OpenAPI document: 2.1.0 * Contact: engineering@femsa.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 { CustomerShippingContacts } from '../model'; // @ts-ignore import { CustomerShippingContactsResponse } from '../model'; // @ts-ignore import { CustomerUpdateShippingContacts } from '../model'; // @ts-ignore import { ModelError } from '../model'; /** * ShippingContactsApi - axios parameter creator * @export */ export const ShippingContactsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Create a shipping contacts for a customer. * @summary Create a shipping contacts * @param {string} id Identifier of the resource * @param {CustomerShippingContacts} customerShippingContacts requested field for customer shippings contacts * @param {CreateCustomerShippingContactsAcceptLanguageEnum} [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} */ createCustomerShippingContacts: async (id: string, customerShippingContacts: CustomerShippingContacts, acceptLanguage?: CreateCustomerShippingContactsAcceptLanguageEnum, xChildCompanyId?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'id' is not null or undefined assertParamExists('createCustomerShippingContacts', 'id', id) // verify required parameter 'customerShippingContacts' is not null or undefined assertParamExists('createCustomerShippingContacts', 'customerShippingContacts', customerShippingContacts) const localVarPath = `/customers/{id}/shipping_contacts` .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); } 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(customerShippingContacts, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Delete shipping contact that corresponds to a customer ID. * @summary Delete shipping contacts * @param {string} id Identifier of the resource * @param {string} shippingContactsId identifier * @param {DeleteCustomerShippingContactsAcceptLanguageEnum} [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} */ deleteCustomerShippingContacts: async (id: string, shippingContactsId: string, acceptLanguage?: DeleteCustomerShippingContactsAcceptLanguageEnum, xChildCompanyId?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'id' is not null or undefined assertParamExists('deleteCustomerShippingContacts', 'id', id) // verify required parameter 'shippingContactsId' is not null or undefined assertParamExists('deleteCustomerShippingContacts', 'shippingContactsId', shippingContactsId) const localVarPath = `/customers/{id}/shipping_contacts/{shipping_contacts_id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))) .replace(`{${"shipping_contacts_id"}}`, encodeURIComponent(String(shippingContactsId))); // 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); } 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, }; }, /** * Update shipping contact that corresponds to a customer ID. * @summary Update shipping contacts * @param {string} id Identifier of the resource * @param {string} shippingContactsId identifier * @param {CustomerUpdateShippingContacts} customerUpdateShippingContacts requested field for customer update shippings contacts * @param {UpdateCustomerShippingContactsAcceptLanguageEnum} [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} */ updateCustomerShippingContacts: async (id: string, shippingContactsId: string, customerUpdateShippingContacts: CustomerUpdateShippingContacts, acceptLanguage?: UpdateCustomerShippingContactsAcceptLanguageEnum, xChildCompanyId?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'id' is not null or undefined assertParamExists('updateCustomerShippingContacts', 'id', id) // verify required parameter 'shippingContactsId' is not null or undefined assertParamExists('updateCustomerShippingContacts', 'shippingContactsId', shippingContactsId) // verify required parameter 'customerUpdateShippingContacts' is not null or undefined assertParamExists('updateCustomerShippingContacts', 'customerUpdateShippingContacts', customerUpdateShippingContacts) const localVarPath = `/customers/{id}/shipping_contacts/{shipping_contacts_id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))) .replace(`{${"shipping_contacts_id"}}`, encodeURIComponent(String(shippingContactsId))); // 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(customerUpdateShippingContacts, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * ShippingContactsApi - functional programming interface * @export */ export const ShippingContactsApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = ShippingContactsApiAxiosParamCreator(configuration) return { /** * Create a shipping contacts for a customer. * @summary Create a shipping contacts * @param {string} id Identifier of the resource * @param {CustomerShippingContacts} customerShippingContacts requested field for customer shippings contacts * @param {CreateCustomerShippingContactsAcceptLanguageEnum} [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 createCustomerShippingContacts(id: string, customerShippingContacts: CustomerShippingContacts, acceptLanguage?: CreateCustomerShippingContactsAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CustomerShippingContactsResponse>> { const localVarAxiosArgs = await localVarAxiosParamCreator.createCustomerShippingContacts(id, customerShippingContacts, acceptLanguage, xChildCompanyId, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['ShippingContactsApi.createCustomerShippingContacts']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Delete shipping contact that corresponds to a customer ID. * @summary Delete shipping contacts * @param {string} id Identifier of the resource * @param {string} shippingContactsId identifier * @param {DeleteCustomerShippingContactsAcceptLanguageEnum} [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 deleteCustomerShippingContacts(id: string, shippingContactsId: string, acceptLanguage?: DeleteCustomerShippingContactsAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CustomerShippingContactsResponse>> { const localVarAxiosArgs = await localVarAxiosParamCreator.deleteCustomerShippingContacts(id, shippingContactsId, acceptLanguage, xChildCompanyId, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['ShippingContactsApi.deleteCustomerShippingContacts']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Update shipping contact that corresponds to a customer ID. * @summary Update shipping contacts * @param {string} id Identifier of the resource * @param {string} shippingContactsId identifier * @param {CustomerUpdateShippingContacts} customerUpdateShippingContacts requested field for customer update shippings contacts * @param {UpdateCustomerShippingContactsAcceptLanguageEnum} [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 updateCustomerShippingContacts(id: string, shippingContactsId: string, customerUpdateShippingContacts: CustomerUpdateShippingContacts, acceptLanguage?: UpdateCustomerShippingContactsAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CustomerShippingContactsResponse>> { const localVarAxiosArgs = await localVarAxiosParamCreator.updateCustomerShippingContacts(id, shippingContactsId, customerUpdateShippingContacts, acceptLanguage, xChildCompanyId, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['ShippingContactsApi.updateCustomerShippingContacts']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, } }; /** * ShippingContactsApi - factory interface * @export */ export const ShippingContactsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = ShippingContactsApiFp(configuration) return { /** * Create a shipping contacts for a customer. * @summary Create a shipping contacts * @param {string} id Identifier of the resource * @param {CustomerShippingContacts} customerShippingContacts requested field for customer shippings contacts * @param {CreateCustomerShippingContactsAcceptLanguageEnum} [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} */ createCustomerShippingContacts(id: string, customerShippingContacts: CustomerShippingContacts, acceptLanguage?: CreateCustomerShippingContactsAcceptLanguageEnum, xChildCompanyId?: string, options?: any): AxiosPromise<CustomerShippingContactsResponse> { return localVarFp.createCustomerShippingContacts(id, customerShippingContacts, acceptLanguage, xChildCompanyId, options).then((request) => request(axios, basePath)); }, /** * Delete shipping contact that corresponds to a customer ID. * @summary Delete shipping contacts * @param {string} id Identifier of the resource * @param {string} shippingContactsId identifier * @param {DeleteCustomerShippingContactsAcceptLanguageEnum} [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} */ deleteCustomerShippingContacts(id: string, shippingContactsId: string, acceptLanguage?: DeleteCustomerShippingContactsAcceptLanguageEnum, xChildCompanyId?: string, options?: any): AxiosPromise<CustomerShippingContactsResponse> { return localVarFp.deleteCustomerShippingContacts(id, shippingContactsId, acceptLanguage, xChildCompanyId, options).then((request) => request(axios, basePath)); }, /** * Update shipping contact that corresponds to a customer ID. * @summary Update shipping contacts * @param {string} id Identifier of the resource * @param {string} shippingContactsId identifier * @param {CustomerUpdateShippingContacts} customerUpdateShippingContacts requested field for customer update shippings contacts * @param {UpdateCustomerShippingContactsAcceptLanguageEnum} [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} */ updateCustomerShippingContacts(id: string, shippingContactsId: string, customerUpdateShippingContacts: CustomerUpdateShippingContacts, acceptLanguage?: UpdateCustomerShippingContactsAcceptLanguageEnum, xChildCompanyId?: string, options?: any): AxiosPromise<CustomerShippingContactsResponse> { return localVarFp.updateCustomerShippingContacts(id, shippingContactsId, customerUpdateShippingContacts, acceptLanguage, xChildCompanyId, options).then((request) => request(axios, basePath)); }, }; }; /** * ShippingContactsApi - interface * @export * @interface ShippingContactsApi */ export interface ShippingContactsApiInterface { /** * Create a shipping contacts for a customer. * @summary Create a shipping contacts * @param {string} id Identifier of the resource * @param {CustomerShippingContacts} customerShippingContacts requested field for customer shippings contacts * @param {CreateCustomerShippingContactsAcceptLanguageEnum} [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 ShippingContactsApiInterface */ createCustomerShippingContacts(id: string, customerShippingContacts: CustomerShippingContacts, acceptLanguage?: CreateCustomerShippingContactsAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): AxiosPromise<CustomerShippingContactsResponse>; /** * Delete shipping contact that corresponds to a customer ID. * @summary Delete shipping contacts * @param {string} id Identifier of the resource * @param {string} shippingContactsId identifier * @param {DeleteCustomerShippingContactsAcceptLanguageEnum} [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 ShippingContactsApiInterface */ deleteCustomerShippingContacts(id: string, shippingContactsId: string, acceptLanguage?: DeleteCustomerShippingContactsAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): AxiosPromise<CustomerShippingContactsResponse>; /** * Update shipping contact that corresponds to a customer ID. * @summary Update shipping contacts * @param {string} id Identifier of the resource * @param {string} shippingContactsId identifier * @param {CustomerUpdateShippingContacts} customerUpdateShippingContacts requested field for customer update shippings contacts * @param {UpdateCustomerShippingContactsAcceptLanguageEnum} [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 ShippingContactsApiInterface */ updateCustomerShippingContacts(id: string, shippingContactsId: string, customerUpdateShippingContacts: CustomerUpdateShippingContacts, acceptLanguage?: UpdateCustomerShippingContactsAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): AxiosPromise<CustomerShippingContactsResponse>; } /** * ShippingContactsApi - object-oriented interface * @export * @class ShippingContactsApi * @extends {BaseAPI} */ export class ShippingContactsApi extends BaseAPI implements ShippingContactsApiInterface { /** * Create a shipping contacts for a customer. * @summary Create a shipping contacts * @param {string} id Identifier of the resource * @param {CustomerShippingContacts} customerShippingContacts requested field for customer shippings contacts * @param {CreateCustomerShippingContactsAcceptLanguageEnum} [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 ShippingContactsApi */ public createCustomerShippingContacts(id: string, customerShippingContacts: CustomerShippingContacts, acceptLanguage?: CreateCustomerShippingContactsAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig) { return ShippingContactsApiFp(this.configuration).createCustomerShippingContacts(id, customerShippingContacts, acceptLanguage, xChildCompanyId, options).then((request) => request(this.axios, this.basePath)); } /** * Delete shipping contact that corresponds to a customer ID. * @summary Delete shipping contacts * @param {string} id Identifier of the resource * @param {string} shippingContactsId identifier * @param {DeleteCustomerShippingContactsAcceptLanguageEnum} [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 ShippingContactsApi */ public deleteCustomerShippingContacts(id: string, shippingContactsId: string, acceptLanguage?: DeleteCustomerShippingContactsAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig) { return ShippingContactsApiFp(this.configuration).deleteCustomerShippingContacts(id, shippingContactsId, acceptLanguage, xChildCompanyId, options).then((request) => request(this.axios, this.basePath)); } /** * Update shipping contact that corresponds to a customer ID. * @summary Update shipping contacts * @param {string} id Identifier of the resource * @param {string} shippingContactsId identifier * @param {CustomerUpdateShippingContacts} customerUpdateShippingContacts requested field for customer update shippings contacts * @param {UpdateCustomerShippingContactsAcceptLanguageEnum} [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 ShippingContactsApi */ public updateCustomerShippingContacts(id: string, shippingContactsId: string, customerUpdateShippingContacts: CustomerUpdateShippingContacts, acceptLanguage?: UpdateCustomerShippingContactsAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig) { return ShippingContactsApiFp(this.configuration).updateCustomerShippingContacts(id, shippingContactsId, customerUpdateShippingContacts, acceptLanguage, xChildCompanyId, options).then((request) => request(this.axios, this.basePath)); } } /** * @export */ export const CreateCustomerShippingContactsAcceptLanguageEnum = { es: 'es', en: 'en' } as const; export type CreateCustomerShippingContactsAcceptLanguageEnum = typeof CreateCustomerShippingContactsAcceptLanguageEnum[keyof typeof CreateCustomerShippingContactsAcceptLanguageEnum]; /** * @export */ export const DeleteCustomerShippingContactsAcceptLanguageEnum = { es: 'es', en: 'en' } as const; export type DeleteCustomerShippingContactsAcceptLanguageEnum = typeof DeleteCustomerShippingContactsAcceptLanguageEnum[keyof typeof DeleteCustomerShippingContactsAcceptLanguageEnum]; /** * @export */ export const UpdateCustomerShippingContactsAcceptLanguageEnum = { es: 'es', en: 'en' } as const; export type UpdateCustomerShippingContactsAcceptLanguageEnum = typeof UpdateCustomerShippingContactsAcceptLanguageEnum[keyof typeof UpdateCustomerShippingContactsAcceptLanguageEnum];