digitalfemsa
Version:
OpenAPI client for digitalfemsa
363 lines (362 loc) • 21.3 kB
JavaScript
/* 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.
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setBearerAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, BaseAPI, operationServerMap } from '../base';
/**
* ProductsApi - axios parameter creator
* @export
*/
export const ProductsApiAxiosParamCreator = function (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_1, product_1, acceptLanguage_1, xChildCompanyId_1, ...args_1) => __awaiter(this, [id_1, product_1, acceptLanguage_1, xChildCompanyId_1, ...args_1], void 0, function* (id, product, acceptLanguage, xChildCompanyId, options = {}) {
// 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 = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication bearerAuth required
// http bearer authentication required
yield 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 = Object.assign(Object.assign(Object.assign({}, 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: (id_2, lineItemId_1, acceptLanguage_2, xChildCompanyId_2, ...args_2) => __awaiter(this, [id_2, lineItemId_1, acceptLanguage_2, xChildCompanyId_2, ...args_2], void 0, function* (id, lineItemId, acceptLanguage, xChildCompanyId, options = {}) {
// 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 = Object.assign(Object.assign({ method: 'DELETE' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication bearerAuth required
// http bearer authentication required
yield 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 = Object.assign(Object.assign(Object.assign({}, 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: (id_3, lineItemId_2, updateProduct_1, acceptLanguage_3, xChildCompanyId_3, ...args_3) => __awaiter(this, [id_3, lineItemId_2, updateProduct_1, acceptLanguage_3, xChildCompanyId_3, ...args_3], void 0, function* (id, lineItemId, updateProduct, acceptLanguage, xChildCompanyId, options = {}) {
// 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 = Object.assign(Object.assign({ method: 'PUT' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication bearerAuth required
// http bearer authentication required
yield 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 = Object.assign(Object.assign(Object.assign({}, 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) {
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}
*/
ordersCreateProduct(id, product, acceptLanguage, xChildCompanyId, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.ordersCreateProduct(id, product, acceptLanguage, xChildCompanyId, options);
const index = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const operationBasePath = (_c = (_b = operationServerMap['ProductsApi.ordersCreateProduct']) === null || _b === void 0 ? void 0 : _b[index]) === null || _c === void 0 ? void 0 : _c.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}
*/
ordersDeleteProduct(id, lineItemId, acceptLanguage, xChildCompanyId, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.ordersDeleteProduct(id, lineItemId, acceptLanguage, xChildCompanyId, options);
const index = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const operationBasePath = (_c = (_b = operationServerMap['ProductsApi.ordersDeleteProduct']) === null || _b === void 0 ? void 0 : _b[index]) === null || _c === void 0 ? void 0 : _c.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}
*/
ordersUpdateProduct(id, lineItemId, updateProduct, acceptLanguage, xChildCompanyId, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.ordersUpdateProduct(id, lineItemId, updateProduct, acceptLanguage, xChildCompanyId, options);
const index = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const operationBasePath = (_c = (_b = operationServerMap['ProductsApi.ordersUpdateProduct']) === null || _b === void 0 ? void 0 : _b[index]) === null || _c === void 0 ? void 0 : _c.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, operationBasePath || basePath);
});
},
};
};
/**
* ProductsApi - factory interface
* @export
*/
export const ProductsApiFactory = function (configuration, basePath, axios) {
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, product, acceptLanguage, xChildCompanyId, options) {
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, lineItemId, acceptLanguage, xChildCompanyId, options) {
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, lineItemId, updateProduct, acceptLanguage, xChildCompanyId, options) {
return localVarFp.ordersUpdateProduct(id, lineItemId, updateProduct, acceptLanguage, xChildCompanyId, options).then((request) => request(axios, basePath));
},
};
};
/**
* ProductsApi - object-oriented interface
* @export
* @class ProductsApi
* @extends {BaseAPI}
*/
export class ProductsApi extends BaseAPI {
/**
* 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
*/
ordersCreateProduct(id, product, acceptLanguage, xChildCompanyId, options) {
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
*/
ordersDeleteProduct(id, lineItemId, acceptLanguage, xChildCompanyId, options) {
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
*/
ordersUpdateProduct(id, lineItemId, updateProduct, acceptLanguage, xChildCompanyId, options) {
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'
};
/**
* @export
*/
export const OrdersDeleteProductAcceptLanguageEnum = {
es: 'es',
en: 'en'
};
/**
* @export
*/
export const OrdersUpdateProductAcceptLanguageEnum = {
es: 'es',
en: 'en'
};