UNPKG

digitalfemsa

Version:
440 lines (401 loc) 24.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 { ModelError } from '../model'; // @ts-ignore import { Product } from '../model'; // @ts-ignore import { ProductOrderResponse } from '../model'; // @ts-ignore import { UpdateProduct } from '../model'; /** * ProductsApi - axios parameter creator * @export */ export const ProductsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Create a new product for an existing order. * @summary Create Product * @param {string} id Identifier of the resource * @param {Product} product requested field for a product * @param {OrdersCreateProductAcceptLanguageEnum} [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} */ ordersCreateProduct: async (id: string, product: Product, acceptLanguage?: OrdersCreateProductAcceptLanguageEnum, xChildCompanyId?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'id' is not null or undefined assertParamExists('ordersCreateProduct', 'id', id) // verify required parameter 'product' is not null or undefined assertParamExists('ordersCreateProduct', 'product', product) const localVarPath = `/orders/{id}/line_items` .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(product, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * Delete product for an existing orden * @summary Delete Product * @param {string} id Identifier of the resource * @param {string} lineItemId identifier * @param {OrdersDeleteProductAcceptLanguageEnum} [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} */ ordersDeleteProduct: async (id: string, lineItemId: string, acceptLanguage?: OrdersDeleteProductAcceptLanguageEnum, xChildCompanyId?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'id' is not null or undefined assertParamExists('ordersDeleteProduct', 'id', id) // verify required parameter 'lineItemId' is not null or undefined assertParamExists('ordersDeleteProduct', 'lineItemId', lineItemId) const localVarPath = `/orders/{id}/line_items/{line_item_id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))) .replace(`{${"line_item_id"}}`, encodeURIComponent(String(lineItemId))); // 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 an existing product for an existing orden * @summary Update Product * @param {string} id Identifier of the resource * @param {string} lineItemId identifier * @param {UpdateProduct} updateProduct requested field for products * @param {OrdersUpdateProductAcceptLanguageEnum} [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} */ ordersUpdateProduct: async (id: string, lineItemId: string, updateProduct: UpdateProduct, acceptLanguage?: OrdersUpdateProductAcceptLanguageEnum, xChildCompanyId?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => { // verify required parameter 'id' is not null or undefined assertParamExists('ordersUpdateProduct', 'id', id) // verify required parameter 'lineItemId' is not null or undefined assertParamExists('ordersUpdateProduct', 'lineItemId', lineItemId) // verify required parameter 'updateProduct' is not null or undefined assertParamExists('ordersUpdateProduct', 'updateProduct', updateProduct) const localVarPath = `/orders/{id}/line_items/{line_item_id}` .replace(`{${"id"}}`, encodeURIComponent(String(id))) .replace(`{${"line_item_id"}}`, encodeURIComponent(String(lineItemId))); // 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(updateProduct, localVarRequestOptions, configuration) return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * ProductsApi - functional programming interface * @export */ export const ProductsApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = ProductsApiAxiosParamCreator(configuration) return { /** * Create a new product for an existing order. * @summary Create Product * @param {string} id Identifier of the resource * @param {Product} product requested field for a product * @param {OrdersCreateProductAcceptLanguageEnum} [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 ordersCreateProduct(id: string, product: Product, acceptLanguage?: OrdersCreateProductAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ProductOrderResponse>> { const localVarAxiosArgs = await localVarAxiosParamCreator.ordersCreateProduct(id, product, acceptLanguage, xChildCompanyId, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['ProductsApi.ordersCreateProduct']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Delete product for an existing orden * @summary Delete Product * @param {string} id Identifier of the resource * @param {string} lineItemId identifier * @param {OrdersDeleteProductAcceptLanguageEnum} [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 ordersDeleteProduct(id: string, lineItemId: string, acceptLanguage?: OrdersDeleteProductAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ProductOrderResponse>> { const localVarAxiosArgs = await localVarAxiosParamCreator.ordersDeleteProduct(id, lineItemId, acceptLanguage, xChildCompanyId, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['ProductsApi.ordersDeleteProduct']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, /** * Update an existing product for an existing orden * @summary Update Product * @param {string} id Identifier of the resource * @param {string} lineItemId identifier * @param {UpdateProduct} updateProduct requested field for products * @param {OrdersUpdateProductAcceptLanguageEnum} [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 ordersUpdateProduct(id: string, lineItemId: string, updateProduct: UpdateProduct, acceptLanguage?: OrdersUpdateProductAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ProductOrderResponse>> { const localVarAxiosArgs = await localVarAxiosParamCreator.ordersUpdateProduct(id, lineItemId, updateProduct, acceptLanguage, xChildCompanyId, options); const index = configuration?.serverIndex ?? 0; const operationBasePath = operationServerMap['ProductsApi.ordersUpdateProduct']?.[index]?.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath); }, } }; /** * ProductsApi - factory interface * @export */ export const ProductsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = ProductsApiFp(configuration) return { /** * Create a new product for an existing order. * @summary Create Product * @param {string} id Identifier of the resource * @param {Product} product requested field for a product * @param {OrdersCreateProductAcceptLanguageEnum} [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} */ ordersCreateProduct(id: string, product: Product, acceptLanguage?: OrdersCreateProductAcceptLanguageEnum, xChildCompanyId?: string, options?: any): AxiosPromise<ProductOrderResponse> { return localVarFp.ordersCreateProduct(id, product, acceptLanguage, xChildCompanyId, options).then((request) => request(axios, basePath)); }, /** * Delete product for an existing orden * @summary Delete Product * @param {string} id Identifier of the resource * @param {string} lineItemId identifier * @param {OrdersDeleteProductAcceptLanguageEnum} [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} */ ordersDeleteProduct(id: string, lineItemId: string, acceptLanguage?: OrdersDeleteProductAcceptLanguageEnum, xChildCompanyId?: string, options?: any): AxiosPromise<ProductOrderResponse> { return localVarFp.ordersDeleteProduct(id, lineItemId, acceptLanguage, xChildCompanyId, options).then((request) => request(axios, basePath)); }, /** * Update an existing product for an existing orden * @summary Update Product * @param {string} id Identifier of the resource * @param {string} lineItemId identifier * @param {UpdateProduct} updateProduct requested field for products * @param {OrdersUpdateProductAcceptLanguageEnum} [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} */ ordersUpdateProduct(id: string, lineItemId: string, updateProduct: UpdateProduct, acceptLanguage?: OrdersUpdateProductAcceptLanguageEnum, xChildCompanyId?: string, options?: any): AxiosPromise<ProductOrderResponse> { return localVarFp.ordersUpdateProduct(id, lineItemId, updateProduct, acceptLanguage, xChildCompanyId, options).then((request) => request(axios, basePath)); }, }; }; /** * ProductsApi - interface * @export * @interface ProductsApi */ export interface ProductsApiInterface { /** * Create a new product for an existing order. * @summary Create Product * @param {string} id Identifier of the resource * @param {Product} product requested field for a product * @param {OrdersCreateProductAcceptLanguageEnum} [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 ProductsApiInterface */ ordersCreateProduct(id: string, product: Product, acceptLanguage?: OrdersCreateProductAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): AxiosPromise<ProductOrderResponse>; /** * Delete product for an existing orden * @summary Delete Product * @param {string} id Identifier of the resource * @param {string} lineItemId identifier * @param {OrdersDeleteProductAcceptLanguageEnum} [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 ProductsApiInterface */ ordersDeleteProduct(id: string, lineItemId: string, acceptLanguage?: OrdersDeleteProductAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): AxiosPromise<ProductOrderResponse>; /** * Update an existing product for an existing orden * @summary Update Product * @param {string} id Identifier of the resource * @param {string} lineItemId identifier * @param {UpdateProduct} updateProduct requested field for products * @param {OrdersUpdateProductAcceptLanguageEnum} [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 ProductsApiInterface */ ordersUpdateProduct(id: string, lineItemId: string, updateProduct: UpdateProduct, acceptLanguage?: OrdersUpdateProductAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig): AxiosPromise<ProductOrderResponse>; } /** * ProductsApi - object-oriented interface * @export * @class ProductsApi * @extends {BaseAPI} */ export class ProductsApi extends BaseAPI implements ProductsApiInterface { /** * Create a new product for an existing order. * @summary Create Product * @param {string} id Identifier of the resource * @param {Product} product requested field for a product * @param {OrdersCreateProductAcceptLanguageEnum} [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 ProductsApi */ public ordersCreateProduct(id: string, product: Product, acceptLanguage?: OrdersCreateProductAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig) { return ProductsApiFp(this.configuration).ordersCreateProduct(id, product, acceptLanguage, xChildCompanyId, options).then((request) => request(this.axios, this.basePath)); } /** * Delete product for an existing orden * @summary Delete Product * @param {string} id Identifier of the resource * @param {string} lineItemId identifier * @param {OrdersDeleteProductAcceptLanguageEnum} [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 ProductsApi */ public ordersDeleteProduct(id: string, lineItemId: string, acceptLanguage?: OrdersDeleteProductAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig) { return ProductsApiFp(this.configuration).ordersDeleteProduct(id, lineItemId, acceptLanguage, xChildCompanyId, options).then((request) => request(this.axios, this.basePath)); } /** * Update an existing product for an existing orden * @summary Update Product * @param {string} id Identifier of the resource * @param {string} lineItemId identifier * @param {UpdateProduct} updateProduct requested field for products * @param {OrdersUpdateProductAcceptLanguageEnum} [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 ProductsApi */ public ordersUpdateProduct(id: string, lineItemId: string, updateProduct: UpdateProduct, acceptLanguage?: OrdersUpdateProductAcceptLanguageEnum, xChildCompanyId?: string, options?: RawAxiosRequestConfig) { return ProductsApiFp(this.configuration).ordersUpdateProduct(id, lineItemId, updateProduct, acceptLanguage, xChildCompanyId, options).then((request) => request(this.axios, this.basePath)); } } /** * @export */ export const OrdersCreateProductAcceptLanguageEnum = { es: 'es', en: 'en' } as const; export type OrdersCreateProductAcceptLanguageEnum = typeof OrdersCreateProductAcceptLanguageEnum[keyof typeof OrdersCreateProductAcceptLanguageEnum]; /** * @export */ export const OrdersDeleteProductAcceptLanguageEnum = { es: 'es', en: 'en' } as const; export type OrdersDeleteProductAcceptLanguageEnum = typeof OrdersDeleteProductAcceptLanguageEnum[keyof typeof OrdersDeleteProductAcceptLanguageEnum]; /** * @export */ export const OrdersUpdateProductAcceptLanguageEnum = { es: 'es', en: 'en' } as const; export type OrdersUpdateProductAcceptLanguageEnum = typeof OrdersUpdateProductAcceptLanguageEnum[keyof typeof OrdersUpdateProductAcceptLanguageEnum];