shipstation-client
Version:
ShipStation V2 SDK
412 lines (411 loc) • 23.8 kB
JavaScript
;
/* 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.PackageTypesApi = exports.PackageTypesApiFactory = exports.PackageTypesApiFp = exports.PackageTypesApiAxiosParamCreator = 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");
/**
* PackageTypesApi - axios parameter creator
* @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
(0, common_1.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, 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)(createPackageTypeRequestBody, localVarRequestOptions, configuration);
return {
url: (0, common_1.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
(0, common_1.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, common_1.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 (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,
};
}),
/**
* 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
(0, common_1.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, 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,
};
}),
/**
* 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, 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,
};
}),
/**
* 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
(0, common_1.assertParamExists)('updatePackageType', 'packageId', packageId);
// verify required parameter 'updatePackageTypeRequestBody' is not null or undefined
(0, common_1.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, common_1.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 (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)(updatePackageTypeRequestBody, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
};
};
exports.PackageTypesApiAxiosParamCreator = PackageTypesApiAxiosParamCreator;
/**
* PackageTypesApi - functional programming interface
* @export
*/
const PackageTypesApiFp = function (configuration) {
const localVarAxiosParamCreator = (0, exports.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 = base_1.operationServerMap['PackageTypesApi.createPackageType']) === 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);
});
},
/**
* 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 = base_1.operationServerMap['PackageTypesApi.deletePackageTyp']) === 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 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 = base_1.operationServerMap['PackageTypesApi.getPackageTypeById']) === 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);
});
},
/**
* 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 = base_1.operationServerMap['PackageTypesApi.listPackageTypes']) === 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);
});
},
/**
* 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 = base_1.operationServerMap['PackageTypesApi.updatePackageType']) === 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.PackageTypesApiFp = PackageTypesApiFp;
/**
* PackageTypesApi - factory interface
* @export
*/
const PackageTypesApiFactory = function (configuration, basePath, axios) {
const localVarFp = (0, exports.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));
},
};
};
exports.PackageTypesApiFactory = PackageTypesApiFactory;
/**
* PackageTypesApi - object-oriented interface
* @export
* @class PackageTypesApi
* @extends {BaseAPI}
*/
class PackageTypesApi extends base_1.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 (0, exports.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 (0, exports.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 (0, exports.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 (0, exports.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 (0, exports.PackageTypesApiFp)(this.configuration).updatePackageType(packageId, updatePackageTypeRequestBody, options).then((request) => request(this.axios, this.basePath));
}
}
exports.PackageTypesApi = PackageTypesApi;