UNPKG

shipstation-client

Version:
276 lines (275 loc) 15.7 kB
"use strict"; /* tslint:disable */ /* eslint-disable */ /** * ShipStation API v2 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 2.0.0 * * * 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()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.RatesApi = exports.RatesApiFactory = exports.RatesApiFp = exports.RatesApiAxiosParamCreator = void 0; const axios_1 = require("axios"); // Some imports not used depending on template conditions // @ts-ignore const common_1 = require("../common"); // @ts-ignore const base_1 = require("../base"); /** * RatesApi - axios parameter creator * @export */ const RatesApiAxiosParamCreator = function (configuration) { return { /** * It\'s not uncommon that you want to give your customer the choice between whether they want to ship the fastest, cheapest, or the most trusted route. Most companies don\'t solely ship things using a single shipping option; so we provide functionality to show you all your options! * @summary Get shipping rates * @param {CalculateRatesRequestBody} calculateRatesRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ calculateRates: (calculateRatesRequestBody_1, ...args_1) => __awaiter(this, [calculateRatesRequestBody_1, ...args_1], void 0, function* (calculateRatesRequestBody, options = {}) { // verify required parameter 'calculateRatesRequestBody' is not null or undefined (0, common_1.assertParamExists)('calculateRates', 'calculateRatesRequestBody', calculateRatesRequestBody); const localVarPath = `/v2/rates`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.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 api_keys required yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "api-key", configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(calculateRatesRequestBody, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * Get Rate Estimates * @summary Estimate rates * @param {EstimateRatesRequestBody} estimateRatesRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ estimateRates: (estimateRatesRequestBody_1, ...args_1) => __awaiter(this, [estimateRatesRequestBody_1, ...args_1], void 0, function* (estimateRatesRequestBody, options = {}) { // verify required parameter 'estimateRatesRequestBody' is not null or undefined (0, common_1.assertParamExists)('estimateRates', 'estimateRatesRequestBody', estimateRatesRequestBody); const localVarPath = `/v2/rates/estimate`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.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 api_keys required yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "api-key", configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(estimateRatesRequestBody, localVarRequestOptions, configuration); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * Retrieve a previously queried rate by its ID * @summary Get rate by id * @param {string} rateId Rate ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getRateById: (rateId_1, ...args_1) => __awaiter(this, [rateId_1, ...args_1], void 0, function* (rateId, options = {}) { // verify required parameter 'rateId' is not null or undefined (0, common_1.assertParamExists)('getRateById', 'rateId', rateId); const localVarPath = `/v2/rates/{rate_id}` .replace(`{${"rate_id"}}`, encodeURIComponent(String(rateId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.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 api_keys required yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "api-key", configuration); (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), }; }; exports.RatesApiAxiosParamCreator = RatesApiAxiosParamCreator; /** * RatesApi - functional programming interface * @export */ const RatesApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.RatesApiAxiosParamCreator)(configuration); return { /** * It\'s not uncommon that you want to give your customer the choice between whether they want to ship the fastest, cheapest, or the most trusted route. Most companies don\'t solely ship things using a single shipping option; so we provide functionality to show you all your options! * @summary Get shipping rates * @param {CalculateRatesRequestBody} calculateRatesRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ calculateRates(calculateRatesRequestBody, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.calculateRates(calculateRatesRequestBody, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['RatesApi.calculateRates']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, /** * Get Rate Estimates * @summary Estimate rates * @param {EstimateRatesRequestBody} estimateRatesRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ estimateRates(estimateRatesRequestBody, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.estimateRates(estimateRatesRequestBody, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['RatesApi.estimateRates']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, /** * Retrieve a previously queried rate by its ID * @summary Get rate by id * @param {string} rateId Rate ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getRateById(rateId, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.getRateById(rateId, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['RatesApi.getRateById']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, }; }; exports.RatesApiFp = RatesApiFp; /** * RatesApi - factory interface * @export */ const RatesApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.RatesApiFp)(configuration); return { /** * It\'s not uncommon that you want to give your customer the choice between whether they want to ship the fastest, cheapest, or the most trusted route. Most companies don\'t solely ship things using a single shipping option; so we provide functionality to show you all your options! * @summary Get shipping rates * @param {CalculateRatesRequestBody} calculateRatesRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ calculateRates(calculateRatesRequestBody, options) { return localVarFp.calculateRates(calculateRatesRequestBody, options).then((request) => request(axios, basePath)); }, /** * Get Rate Estimates * @summary Estimate rates * @param {EstimateRatesRequestBody} estimateRatesRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ estimateRates(estimateRatesRequestBody, options) { return localVarFp.estimateRates(estimateRatesRequestBody, options).then((request) => request(axios, basePath)); }, /** * Retrieve a previously queried rate by its ID * @summary Get rate by id * @param {string} rateId Rate ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getRateById(rateId, options) { return localVarFp.getRateById(rateId, options).then((request) => request(axios, basePath)); }, }; }; exports.RatesApiFactory = RatesApiFactory; /** * RatesApi - object-oriented interface * @export * @class RatesApi * @extends {BaseAPI} */ class RatesApi extends base_1.BaseAPI { /** * It\'s not uncommon that you want to give your customer the choice between whether they want to ship the fastest, cheapest, or the most trusted route. Most companies don\'t solely ship things using a single shipping option; so we provide functionality to show you all your options! * @summary Get shipping rates * @param {CalculateRatesRequestBody} calculateRatesRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof RatesApi */ calculateRates(calculateRatesRequestBody, options) { return (0, exports.RatesApiFp)(this.configuration).calculateRates(calculateRatesRequestBody, options).then((request) => request(this.axios, this.basePath)); } /** * Get Rate Estimates * @summary Estimate rates * @param {EstimateRatesRequestBody} estimateRatesRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof RatesApi */ estimateRates(estimateRatesRequestBody, options) { return (0, exports.RatesApiFp)(this.configuration).estimateRates(estimateRatesRequestBody, options).then((request) => request(this.axios, this.basePath)); } /** * Retrieve a previously queried rate by its ID * @summary Get rate by id * @param {string} rateId Rate ID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof RatesApi */ getRateById(rateId, options) { return (0, exports.RatesApiFp)(this.configuration).getRateById(rateId, options).then((request) => request(this.axios, this.basePath)); } } exports.RatesApi = RatesApi;