digitalfemsa
Version:
OpenAPI client for digitalfemsa
370 lines (369 loc) • 21.1 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';
/**
* ChargesApi - axios parameter creator
* @export
*/
export const ChargesApiAxiosParamCreator = function (configuration) {
return {
/**
*
* @summary Get A List of Charges
* @param {GetChargesAcceptLanguageEnum} [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}
*/
getCharges: (acceptLanguage_1, xChildCompanyId_1, limit_1, search_1, next_1, previous_1, ...args_1) => __awaiter(this, [acceptLanguage_1, xChildCompanyId_1, limit_1, search_1, next_1, previous_1, ...args_1], void 0, function* (acceptLanguage, xChildCompanyId, limit, search, next, previous, options = {}) {
const localVarPath = `/charges`;
// 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: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication bearerAuth required
// http bearer authentication required
yield 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 = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Create charge for an existing orden
* @summary Create charge
* @param {string} id Identifier of the resource
* @param {ChargeRequest} chargeRequest requested field for a charge
* @param {OrdersCreateChargeAcceptLanguageEnum} [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}
*/
ordersCreateCharge: (id_1, chargeRequest_1, acceptLanguage_2, xChildCompanyId_2, ...args_2) => __awaiter(this, [id_1, chargeRequest_1, acceptLanguage_2, xChildCompanyId_2, ...args_2], void 0, function* (id, chargeRequest, acceptLanguage, xChildCompanyId, options = {}) {
// verify required parameter 'id' is not null or undefined
assertParamExists('ordersCreateCharge', 'id', id);
// verify required parameter 'chargeRequest' is not null or undefined
assertParamExists('ordersCreateCharge', 'chargeRequest', chargeRequest);
const localVarPath = `/orders/{id}/charges`
.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(chargeRequest, localVarRequestOptions, configuration);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
*
* @summary Update a charge
* @param {string} id Identifier of the resource
* @param {ChargeUpdateRequest} chargeUpdateRequest requested field for update a charge
* @param {UpdateChargeAcceptLanguageEnum} [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}
*/
updateCharge: (id_2, chargeUpdateRequest_1, acceptLanguage_3, xChildCompanyId_3, ...args_3) => __awaiter(this, [id_2, chargeUpdateRequest_1, acceptLanguage_3, xChildCompanyId_3, ...args_3], void 0, function* (id, chargeUpdateRequest, acceptLanguage, xChildCompanyId, options = {}) {
// verify required parameter 'id' is not null or undefined
assertParamExists('updateCharge', 'id', id);
// verify required parameter 'chargeUpdateRequest' is not null or undefined
assertParamExists('updateCharge', 'chargeUpdateRequest', chargeUpdateRequest);
const localVarPath = `/charges/{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 = 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(chargeUpdateRequest, localVarRequestOptions, configuration);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
};
};
/**
* ChargesApi - functional programming interface
* @export
*/
export const ChargesApiFp = function (configuration) {
const localVarAxiosParamCreator = ChargesApiAxiosParamCreator(configuration);
return {
/**
*
* @summary Get A List of Charges
* @param {GetChargesAcceptLanguageEnum} [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}
*/
getCharges(acceptLanguage, xChildCompanyId, limit, search, next, previous, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getCharges(acceptLanguage, xChildCompanyId, limit, search, next, previous, options);
const index = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const operationBasePath = (_c = (_b = operationServerMap['ChargesApi.getCharges']) === 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);
});
},
/**
* Create charge for an existing orden
* @summary Create charge
* @param {string} id Identifier of the resource
* @param {ChargeRequest} chargeRequest requested field for a charge
* @param {OrdersCreateChargeAcceptLanguageEnum} [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}
*/
ordersCreateCharge(id, chargeRequest, acceptLanguage, xChildCompanyId, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.ordersCreateCharge(id, chargeRequest, 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['ChargesApi.ordersCreateCharge']) === 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);
});
},
/**
*
* @summary Update a charge
* @param {string} id Identifier of the resource
* @param {ChargeUpdateRequest} chargeUpdateRequest requested field for update a charge
* @param {UpdateChargeAcceptLanguageEnum} [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}
*/
updateCharge(id, chargeUpdateRequest, acceptLanguage, xChildCompanyId, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.updateCharge(id, chargeUpdateRequest, 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['ChargesApi.updateCharge']) === 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);
});
},
};
};
/**
* ChargesApi - factory interface
* @export
*/
export const ChargesApiFactory = function (configuration, basePath, axios) {
const localVarFp = ChargesApiFp(configuration);
return {
/**
*
* @summary Get A List of Charges
* @param {GetChargesAcceptLanguageEnum} [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}
*/
getCharges(acceptLanguage, xChildCompanyId, limit, search, next, previous, options) {
return localVarFp.getCharges(acceptLanguage, xChildCompanyId, limit, search, next, previous, options).then((request) => request(axios, basePath));
},
/**
* Create charge for an existing orden
* @summary Create charge
* @param {string} id Identifier of the resource
* @param {ChargeRequest} chargeRequest requested field for a charge
* @param {OrdersCreateChargeAcceptLanguageEnum} [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}
*/
ordersCreateCharge(id, chargeRequest, acceptLanguage, xChildCompanyId, options) {
return localVarFp.ordersCreateCharge(id, chargeRequest, acceptLanguage, xChildCompanyId, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Update a charge
* @param {string} id Identifier of the resource
* @param {ChargeUpdateRequest} chargeUpdateRequest requested field for update a charge
* @param {UpdateChargeAcceptLanguageEnum} [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}
*/
updateCharge(id, chargeUpdateRequest, acceptLanguage, xChildCompanyId, options) {
return localVarFp.updateCharge(id, chargeUpdateRequest, acceptLanguage, xChildCompanyId, options).then((request) => request(axios, basePath));
},
};
};
/**
* ChargesApi - object-oriented interface
* @export
* @class ChargesApi
* @extends {BaseAPI}
*/
export class ChargesApi extends BaseAPI {
/**
*
* @summary Get A List of Charges
* @param {GetChargesAcceptLanguageEnum} [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 ChargesApi
*/
getCharges(acceptLanguage, xChildCompanyId, limit, search, next, previous, options) {
return ChargesApiFp(this.configuration).getCharges(acceptLanguage, xChildCompanyId, limit, search, next, previous, options).then((request) => request(this.axios, this.basePath));
}
/**
* Create charge for an existing orden
* @summary Create charge
* @param {string} id Identifier of the resource
* @param {ChargeRequest} chargeRequest requested field for a charge
* @param {OrdersCreateChargeAcceptLanguageEnum} [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 ChargesApi
*/
ordersCreateCharge(id, chargeRequest, acceptLanguage, xChildCompanyId, options) {
return ChargesApiFp(this.configuration).ordersCreateCharge(id, chargeRequest, acceptLanguage, xChildCompanyId, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Update a charge
* @param {string} id Identifier of the resource
* @param {ChargeUpdateRequest} chargeUpdateRequest requested field for update a charge
* @param {UpdateChargeAcceptLanguageEnum} [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 ChargesApi
*/
updateCharge(id, chargeUpdateRequest, acceptLanguage, xChildCompanyId, options) {
return ChargesApiFp(this.configuration).updateCharge(id, chargeUpdateRequest, acceptLanguage, xChildCompanyId, options).then((request) => request(this.axios, this.basePath));
}
}
/**
* @export
*/
export const GetChargesAcceptLanguageEnum = {
es: 'es',
en: 'en'
};
/**
* @export
*/
export const OrdersCreateChargeAcceptLanguageEnum = {
es: 'es',
en: 'en'
};
/**
* @export
*/
export const UpdateChargeAcceptLanguageEnum = {
es: 'es',
en: 'en'
};