UNPKG

shipstation-client

Version:
405 lines (404 loc) 22.9 kB
/* 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()); }); }; import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; // @ts-ignore import { BASE_PATH, BaseAPI, operationServerMap } from '../base'; /** * PackageTypesApi - axios parameter creator * @export */ export const PackageTypesApiAxiosParamCreator = function (configuration) { return { /** * Create a custom package type to better assist in getting accurate rate estimates * @summary Create custom package type * @param {CreatePackageTypeRequestBody} createPackageTypeRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ createPackageType: (createPackageTypeRequestBody_1, ...args_1) => __awaiter(this, [createPackageTypeRequestBody_1, ...args_1], void 0, function* (createPackageTypeRequestBody, options = {}) { // verify required parameter 'createPackageTypeRequestBody' is not null or undefined assertParamExists('createPackageType', 'createPackageTypeRequestBody', createPackageTypeRequestBody); const localVarPath = `/v2/packages`; // 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 api_keys required yield setApiKeyToObject(localVarHeaderParameter, "api-key", configuration); 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(createPackageTypeRequestBody, localVarRequestOptions, configuration); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), /** * Delete a custom package using the ID * @summary Delete a custom package by id * @param {string} packageId Package ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ deletePackageTyp: (packageId_1, ...args_1) => __awaiter(this, [packageId_1, ...args_1], void 0, function* (packageId, options = {}) { // verify required parameter 'packageId' is not null or undefined assertParamExists('deletePackageTyp', 'packageId', packageId); const localVarPath = `/v2/packages/{package_id}` .replace(`{${"package_id"}}`, encodeURIComponent(String(packageId))); // 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 api_keys required yield setApiKeyToObject(localVarHeaderParameter, "api-key", configuration); 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, }; }), /** * Get Custom Package Type by ID * @summary Get custom package type by id * @param {string} packageId Package ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPackageTypeById: (packageId_1, ...args_1) => __awaiter(this, [packageId_1, ...args_1], void 0, function* (packageId, options = {}) { // verify required parameter 'packageId' is not null or undefined assertParamExists('getPackageTypeById', 'packageId', packageId); const localVarPath = `/v2/packages/{package_id}` .replace(`{${"package_id"}}`, encodeURIComponent(String(packageId))); // 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 api_keys required yield setApiKeyToObject(localVarHeaderParameter, "api-key", configuration); 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, }; }), /** * List the custom package types associated with the account * @summary List custom package types * @param {*} [options] Override http request option. * @throws {RequiredError} */ listPackageTypes: (...args_1) => __awaiter(this, [...args_1], void 0, function* (options = {}) { const localVarPath = `/v2/packages`; // 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 api_keys required yield setApiKeyToObject(localVarHeaderParameter, "api-key", configuration); 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 the custom package type object by ID * @summary Update custom package type by id * @param {string} packageId Package ID * @param {UpdatePackageTypeRequestBody} updatePackageTypeRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ updatePackageType: (packageId_1, updatePackageTypeRequestBody_1, ...args_1) => __awaiter(this, [packageId_1, updatePackageTypeRequestBody_1, ...args_1], void 0, function* (packageId, updatePackageTypeRequestBody, options = {}) { // verify required parameter 'packageId' is not null or undefined assertParamExists('updatePackageType', 'packageId', packageId); // verify required parameter 'updatePackageTypeRequestBody' is not null or undefined assertParamExists('updatePackageType', 'updatePackageTypeRequestBody', updatePackageTypeRequestBody); const localVarPath = `/v2/packages/{package_id}` .replace(`{${"package_id"}}`, encodeURIComponent(String(packageId))); // 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 api_keys required yield setApiKeyToObject(localVarHeaderParameter, "api-key", configuration); 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(updatePackageTypeRequestBody, localVarRequestOptions, configuration); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), }; }; /** * PackageTypesApi - functional programming interface * @export */ export const PackageTypesApiFp = function (configuration) { const localVarAxiosParamCreator = PackageTypesApiAxiosParamCreator(configuration); return { /** * Create a custom package type to better assist in getting accurate rate estimates * @summary Create custom package type * @param {CreatePackageTypeRequestBody} createPackageTypeRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ createPackageType(createPackageTypeRequestBody, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.createPackageType(createPackageTypeRequestBody, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PackageTypesApi.createPackageType']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, /** * Delete a custom package using the ID * @summary Delete a custom package by id * @param {string} packageId Package ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ deletePackageTyp(packageId, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.deletePackageTyp(packageId, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PackageTypesApi.deletePackageTyp']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, /** * Get Custom Package Type by ID * @summary Get custom package type by id * @param {string} packageId Package ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPackageTypeById(packageId, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.getPackageTypeById(packageId, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PackageTypesApi.getPackageTypeById']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, /** * List the custom package types associated with the account * @summary List custom package types * @param {*} [options] Override http request option. * @throws {RequiredError} */ listPackageTypes(options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.listPackageTypes(options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PackageTypesApi.listPackageTypes']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, /** * Update the custom package type object by ID * @summary Update custom package type by id * @param {string} packageId Package ID * @param {UpdatePackageTypeRequestBody} updatePackageTypeRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ updatePackageType(packageId, updatePackageTypeRequestBody, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.updatePackageType(packageId, updatePackageTypeRequestBody, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['PackageTypesApi.updatePackageType']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, }; }; /** * PackageTypesApi - factory interface * @export */ export const PackageTypesApiFactory = function (configuration, basePath, axios) { const localVarFp = PackageTypesApiFp(configuration); return { /** * Create a custom package type to better assist in getting accurate rate estimates * @summary Create custom package type * @param {CreatePackageTypeRequestBody} createPackageTypeRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ createPackageType(createPackageTypeRequestBody, options) { return localVarFp.createPackageType(createPackageTypeRequestBody, options).then((request) => request(axios, basePath)); }, /** * Delete a custom package using the ID * @summary Delete a custom package by id * @param {string} packageId Package ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ deletePackageTyp(packageId, options) { return localVarFp.deletePackageTyp(packageId, options).then((request) => request(axios, basePath)); }, /** * Get Custom Package Type by ID * @summary Get custom package type by id * @param {string} packageId Package ID * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPackageTypeById(packageId, options) { return localVarFp.getPackageTypeById(packageId, options).then((request) => request(axios, basePath)); }, /** * List the custom package types associated with the account * @summary List custom package types * @param {*} [options] Override http request option. * @throws {RequiredError} */ listPackageTypes(options) { return localVarFp.listPackageTypes(options).then((request) => request(axios, basePath)); }, /** * Update the custom package type object by ID * @summary Update custom package type by id * @param {string} packageId Package ID * @param {UpdatePackageTypeRequestBody} updatePackageTypeRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ updatePackageType(packageId, updatePackageTypeRequestBody, options) { return localVarFp.updatePackageType(packageId, updatePackageTypeRequestBody, options).then((request) => request(axios, basePath)); }, }; }; /** * PackageTypesApi - object-oriented interface * @export * @class PackageTypesApi * @extends {BaseAPI} */ export class PackageTypesApi extends BaseAPI { /** * Create a custom package type to better assist in getting accurate rate estimates * @summary Create custom package type * @param {CreatePackageTypeRequestBody} createPackageTypeRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PackageTypesApi */ createPackageType(createPackageTypeRequestBody, options) { return PackageTypesApiFp(this.configuration).createPackageType(createPackageTypeRequestBody, options).then((request) => request(this.axios, this.basePath)); } /** * Delete a custom package using the ID * @summary Delete a custom package by id * @param {string} packageId Package ID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PackageTypesApi */ deletePackageTyp(packageId, options) { return PackageTypesApiFp(this.configuration).deletePackageTyp(packageId, options).then((request) => request(this.axios, this.basePath)); } /** * Get Custom Package Type by ID * @summary Get custom package type by id * @param {string} packageId Package ID * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PackageTypesApi */ getPackageTypeById(packageId, options) { return PackageTypesApiFp(this.configuration).getPackageTypeById(packageId, options).then((request) => request(this.axios, this.basePath)); } /** * List the custom package types associated with the account * @summary List custom package types * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PackageTypesApi */ listPackageTypes(options) { return PackageTypesApiFp(this.configuration).listPackageTypes(options).then((request) => request(this.axios, this.basePath)); } /** * Update the custom package type object by ID * @summary Update custom package type by id * @param {string} packageId Package ID * @param {UpdatePackageTypeRequestBody} updatePackageTypeRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof PackageTypesApi */ updatePackageType(packageId, updatePackageTypeRequestBody, options) { return PackageTypesApiFp(this.configuration).updatePackageType(packageId, updatePackageTypeRequestBody, options).then((request) => request(this.axios, this.basePath)); } }