shipstation-client
Version:
ShipStation V2 SDK
824 lines (823 loc) • 49.9 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.BatchesApi = exports.BatchesApiFactory = exports.BatchesApiFp = exports.BatchesApiAxiosParamCreator = 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");
/**
* BatchesApi - axios parameter creator
* @export
*/
const BatchesApiAxiosParamCreator = function (configuration) {
return {
/**
* Add a shipment or rate to a batch.
* @summary Add to a batch
* @param {string} batchId Batch ID
* @param {CreateAndProcessBatchRequestBody} createAndProcessBatchRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
addToBatch: (batchId_1, createAndProcessBatchRequestBody_1, ...args_1) => __awaiter(this, [batchId_1, createAndProcessBatchRequestBody_1, ...args_1], void 0, function* (batchId, createAndProcessBatchRequestBody, options = {}) {
// verify required parameter 'batchId' is not null or undefined
(0, common_1.assertParamExists)('addToBatch', 'batchId', batchId);
// verify required parameter 'createAndProcessBatchRequestBody' is not null or undefined
(0, common_1.assertParamExists)('addToBatch', 'createAndProcessBatchRequestBody', createAndProcessBatchRequestBody);
const localVarPath = `/v2/batches/{batch_id}/add`
.replace(`{${"batch_id"}}`, encodeURIComponent(String(batchId)));
// 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)(createAndProcessBatchRequestBody, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Create a batch containing multiple labels.
* @summary Create a batch
* @param {CreateBatchRequest} createBatchRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createBatch: (createBatchRequest_1, ...args_1) => __awaiter(this, [createBatchRequest_1, ...args_1], void 0, function* (createBatchRequest, options = {}) {
// verify required parameter 'createBatchRequest' is not null or undefined
(0, common_1.assertParamExists)('createBatch', 'createBatchRequest', createBatchRequest);
const localVarPath = `/v2/batches`;
// 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)(createBatchRequest, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Delete a batch based on its batch id. Sets its status to \'archived\'.
* @summary Delete batch by id
* @param {string} batchId Batch ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteBatch: (batchId_1, ...args_1) => __awaiter(this, [batchId_1, ...args_1], void 0, function* (batchId, options = {}) {
// verify required parameter 'batchId' is not null or undefined
(0, common_1.assertParamExists)('deleteBatch', 'batchId', batchId);
const localVarPath = `/v2/batches/{batch_id}`
.replace(`{${"batch_id"}}`, encodeURIComponent(String(batchId)));
// 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,
};
}),
/**
* Retreive a batch using an external batch ID
* @summary Get batch by external id
* @param {string} externalBatchId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBatchByExternalId: (externalBatchId_1, ...args_1) => __awaiter(this, [externalBatchId_1, ...args_1], void 0, function* (externalBatchId, options = {}) {
// verify required parameter 'externalBatchId' is not null or undefined
(0, common_1.assertParamExists)('getBatchByExternalId', 'externalBatchId', externalBatchId);
const localVarPath = `/v2/batches/external_batch_id/{external_batch_id}`
.replace(`{${"external_batch_id"}}`, encodeURIComponent(String(externalBatchId)));
// 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,
};
}),
/**
* Get batch details for a specific batch id.
* @summary Get batch by id
* @param {string} batchId Batch ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBatchById: (batchId_1, ...args_1) => __awaiter(this, [batchId_1, ...args_1], void 0, function* (batchId, options = {}) {
// verify required parameter 'batchId' is not null or undefined
(0, common_1.assertParamExists)('getBatchById', 'batchId', batchId);
const localVarPath = `/v2/batches/{batch_id}`
.replace(`{${"batch_id"}}`, encodeURIComponent(String(batchId)));
// 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,
};
}),
/**
* Errors in batches must be handled differently from synchronous requests. You must retrieve the status of your batch by getting a batch and getting an overview of the statuses or by listing the batch errors.
* @summary Get batch errors
* @param {string} batchId Batch ID
* @param {number} [page] Return a specific page of results. Defaults to the first page. If set to a number that\'s greater than the number of pages of results, an empty page is returned.
* @param {number} [pagesize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listBatchErrors: (batchId_1, page_1, pagesize_1, ...args_1) => __awaiter(this, [batchId_1, page_1, pagesize_1, ...args_1], void 0, function* (batchId, page, pagesize, options = {}) {
// verify required parameter 'batchId' is not null or undefined
(0, common_1.assertParamExists)('listBatchErrors', 'batchId', batchId);
const localVarPath = `/v2/batches/{batch_id}/errors`
.replace(`{${"batch_id"}}`, encodeURIComponent(String(batchId)));
// 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);
if (page !== undefined) {
localVarQueryParameter['page'] = page;
}
if (pagesize !== undefined) {
localVarQueryParameter['pagesize'] = pagesize;
}
(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 batches associated with your ShipStation account.
* @summary List batches
* @param {BatchStatus} [status]
* @param {number} [page] Return a specific page of results. Defaults to the first page. If set to a number that\'s greater than the number of pages of results, an empty page is returned.
* @param {number} [pageSize] The number of results to return per response.
* @param {SortDir} [sortDir] Controls the sort order of the query.
* @param {string} [batchNumber] Batch Number
* @param {BatchesSortBy} [sortBy]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listBatches: (status_1, page_1, pageSize_1, sortDir_1, batchNumber_1, sortBy_1, ...args_1) => __awaiter(this, [status_1, page_1, pageSize_1, sortDir_1, batchNumber_1, sortBy_1, ...args_1], void 0, function* (status, page, pageSize, sortDir, batchNumber, sortBy, options = {}) {
const localVarPath = `/v2/batches`;
// 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);
if (status !== undefined) {
localVarQueryParameter['status'] = status;
}
if (page !== undefined) {
localVarQueryParameter['page'] = page;
}
if (pageSize !== undefined) {
localVarQueryParameter['page_size'] = pageSize;
}
if (sortDir !== undefined) {
localVarQueryParameter['sort_dir'] = sortDir;
}
if (batchNumber !== undefined) {
localVarQueryParameter['batch_number'] = batchNumber;
}
if (sortBy !== undefined) {
localVarQueryParameter['sort_by'] = sortBy;
}
(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,
};
}),
/**
* Create and purchase the labels for the shipments included in the batch.
* @summary Process batch id labels
* @param {string} batchId Batch ID
* @param {ProcessBatchRequestBody} processBatchRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
processBatch: (batchId_1, processBatchRequestBody_1, ...args_1) => __awaiter(this, [batchId_1, processBatchRequestBody_1, ...args_1], void 0, function* (batchId, processBatchRequestBody, options = {}) {
// verify required parameter 'batchId' is not null or undefined
(0, common_1.assertParamExists)('processBatch', 'batchId', batchId);
// verify required parameter 'processBatchRequestBody' is not null or undefined
(0, common_1.assertParamExists)('processBatch', 'processBatchRequestBody', processBatchRequestBody);
const localVarPath = `/v2/batches/{batch_id}/process/labels`
.replace(`{${"batch_id"}}`, encodeURIComponent(String(batchId)));
// 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)(processBatchRequestBody, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Remove specific shipment ids or rate ids from a batch.
* @summary Remove from batch
* @param {string} batchId Batch ID
* @param {RemoveFromBatchRequestBody} removeFromBatchRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
removeFromBatch: (batchId_1, removeFromBatchRequestBody_1, ...args_1) => __awaiter(this, [batchId_1, removeFromBatchRequestBody_1, ...args_1], void 0, function* (batchId, removeFromBatchRequestBody, options = {}) {
// verify required parameter 'batchId' is not null or undefined
(0, common_1.assertParamExists)('removeFromBatch', 'batchId', batchId);
// verify required parameter 'removeFromBatchRequestBody' is not null or undefined
(0, common_1.assertParamExists)('removeFromBatch', 'removeFromBatchRequestBody', removeFromBatchRequestBody);
const localVarPath = `/v2/batches/{batch_id}/remove`
.replace(`{${"batch_id"}}`, encodeURIComponent(String(batchId)));
// 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)(removeFromBatchRequestBody, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Update a batch by id setting its status to \'archived\'.
* @summary Update batch status to \'archived\' by id
* @param {string} batchId Batch ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateBatch: (batchId_1, ...args_1) => __awaiter(this, [batchId_1, ...args_1], void 0, function* (batchId, options = {}) {
// verify required parameter 'batchId' is not null or undefined
(0, common_1.assertParamExists)('updateBatch', 'batchId', batchId);
const localVarPath = `/v2/batches/{batch_id}`
.replace(`{${"batch_id"}}`, encodeURIComponent(String(batchId)));
// 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);
(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.BatchesApiAxiosParamCreator = BatchesApiAxiosParamCreator;
/**
* BatchesApi - functional programming interface
* @export
*/
const BatchesApiFp = function (configuration) {
const localVarAxiosParamCreator = (0, exports.BatchesApiAxiosParamCreator)(configuration);
return {
/**
* Add a shipment or rate to a batch.
* @summary Add to a batch
* @param {string} batchId Batch ID
* @param {CreateAndProcessBatchRequestBody} createAndProcessBatchRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
addToBatch(batchId, createAndProcessBatchRequestBody, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.addToBatch(batchId, createAndProcessBatchRequestBody, 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['BatchesApi.addToBatch']) === 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);
});
},
/**
* Create a batch containing multiple labels.
* @summary Create a batch
* @param {CreateBatchRequest} createBatchRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createBatch(createBatchRequest, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.createBatch(createBatchRequest, 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['BatchesApi.createBatch']) === 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 batch based on its batch id. Sets its status to \'archived\'.
* @summary Delete batch by id
* @param {string} batchId Batch ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteBatch(batchId, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.deleteBatch(batchId, 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['BatchesApi.deleteBatch']) === 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);
});
},
/**
* Retreive a batch using an external batch ID
* @summary Get batch by external id
* @param {string} externalBatchId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBatchByExternalId(externalBatchId, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getBatchByExternalId(externalBatchId, 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['BatchesApi.getBatchByExternalId']) === 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 batch details for a specific batch id.
* @summary Get batch by id
* @param {string} batchId Batch ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBatchById(batchId, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getBatchById(batchId, 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['BatchesApi.getBatchById']) === 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);
});
},
/**
* Errors in batches must be handled differently from synchronous requests. You must retrieve the status of your batch by getting a batch and getting an overview of the statuses or by listing the batch errors.
* @summary Get batch errors
* @param {string} batchId Batch ID
* @param {number} [page] Return a specific page of results. Defaults to the first page. If set to a number that\'s greater than the number of pages of results, an empty page is returned.
* @param {number} [pagesize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listBatchErrors(batchId, page, pagesize, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.listBatchErrors(batchId, page, pagesize, 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['BatchesApi.listBatchErrors']) === 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 batches associated with your ShipStation account.
* @summary List batches
* @param {BatchStatus} [status]
* @param {number} [page] Return a specific page of results. Defaults to the first page. If set to a number that\'s greater than the number of pages of results, an empty page is returned.
* @param {number} [pageSize] The number of results to return per response.
* @param {SortDir} [sortDir] Controls the sort order of the query.
* @param {string} [batchNumber] Batch Number
* @param {BatchesSortBy} [sortBy]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listBatches(status, page, pageSize, sortDir, batchNumber, sortBy, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.listBatches(status, page, pageSize, sortDir, batchNumber, sortBy, 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['BatchesApi.listBatches']) === 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);
});
},
/**
* Create and purchase the labels for the shipments included in the batch.
* @summary Process batch id labels
* @param {string} batchId Batch ID
* @param {ProcessBatchRequestBody} processBatchRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
processBatch(batchId, processBatchRequestBody, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.processBatch(batchId, processBatchRequestBody, 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['BatchesApi.processBatch']) === 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);
});
},
/**
* Remove specific shipment ids or rate ids from a batch.
* @summary Remove from batch
* @param {string} batchId Batch ID
* @param {RemoveFromBatchRequestBody} removeFromBatchRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
removeFromBatch(batchId, removeFromBatchRequestBody, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.removeFromBatch(batchId, removeFromBatchRequestBody, 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['BatchesApi.removeFromBatch']) === 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 a batch by id setting its status to \'archived\'.
* @summary Update batch status to \'archived\' by id
* @param {string} batchId Batch ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateBatch(batchId, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.updateBatch(batchId, 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['BatchesApi.updateBatch']) === 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.BatchesApiFp = BatchesApiFp;
/**
* BatchesApi - factory interface
* @export
*/
const BatchesApiFactory = function (configuration, basePath, axios) {
const localVarFp = (0, exports.BatchesApiFp)(configuration);
return {
/**
* Add a shipment or rate to a batch.
* @summary Add to a batch
* @param {string} batchId Batch ID
* @param {CreateAndProcessBatchRequestBody} createAndProcessBatchRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
addToBatch(batchId, createAndProcessBatchRequestBody, options) {
return localVarFp.addToBatch(batchId, createAndProcessBatchRequestBody, options).then((request) => request(axios, basePath));
},
/**
* Create a batch containing multiple labels.
* @summary Create a batch
* @param {CreateBatchRequest} createBatchRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createBatch(createBatchRequest, options) {
return localVarFp.createBatch(createBatchRequest, options).then((request) => request(axios, basePath));
},
/**
* Delete a batch based on its batch id. Sets its status to \'archived\'.
* @summary Delete batch by id
* @param {string} batchId Batch ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteBatch(batchId, options) {
return localVarFp.deleteBatch(batchId, options).then((request) => request(axios, basePath));
},
/**
* Retreive a batch using an external batch ID
* @summary Get batch by external id
* @param {string} externalBatchId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBatchByExternalId(externalBatchId, options) {
return localVarFp.getBatchByExternalId(externalBatchId, options).then((request) => request(axios, basePath));
},
/**
* Get batch details for a specific batch id.
* @summary Get batch by id
* @param {string} batchId Batch ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getBatchById(batchId, options) {
return localVarFp.getBatchById(batchId, options).then((request) => request(axios, basePath));
},
/**
* Errors in batches must be handled differently from synchronous requests. You must retrieve the status of your batch by getting a batch and getting an overview of the statuses or by listing the batch errors.
* @summary Get batch errors
* @param {string} batchId Batch ID
* @param {number} [page] Return a specific page of results. Defaults to the first page. If set to a number that\'s greater than the number of pages of results, an empty page is returned.
* @param {number} [pagesize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listBatchErrors(batchId, page, pagesize, options) {
return localVarFp.listBatchErrors(batchId, page, pagesize, options).then((request) => request(axios, basePath));
},
/**
* List the batches associated with your ShipStation account.
* @summary List batches
* @param {BatchStatus} [status]
* @param {number} [page] Return a specific page of results. Defaults to the first page. If set to a number that\'s greater than the number of pages of results, an empty page is returned.
* @param {number} [pageSize] The number of results to return per response.
* @param {SortDir} [sortDir] Controls the sort order of the query.
* @param {string} [batchNumber] Batch Number
* @param {BatchesSortBy} [sortBy]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listBatches(status, page, pageSize, sortDir, batchNumber, sortBy, options) {
return localVarFp.listBatches(status, page, pageSize, sortDir, batchNumber, sortBy, options).then((request) => request(axios, basePath));
},
/**
* Create and purchase the labels for the shipments included in the batch.
* @summary Process batch id labels
* @param {string} batchId Batch ID
* @param {ProcessBatchRequestBody} processBatchRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
processBatch(batchId, processBatchRequestBody, options) {
return localVarFp.processBatch(batchId, processBatchRequestBody, options).then((request) => request(axios, basePath));
},
/**
* Remove specific shipment ids or rate ids from a batch.
* @summary Remove from batch
* @param {string} batchId Batch ID
* @param {RemoveFromBatchRequestBody} removeFromBatchRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
removeFromBatch(batchId, removeFromBatchRequestBody, options) {
return localVarFp.removeFromBatch(batchId, removeFromBatchRequestBody, options).then((request) => request(axios, basePath));
},
/**
* Update a batch by id setting its status to \'archived\'.
* @summary Update batch status to \'archived\' by id
* @param {string} batchId Batch ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
updateBatch(batchId, options) {
return localVarFp.updateBatch(batchId, options).then((request) => request(axios, basePath));
},
};
};
exports.BatchesApiFactory = BatchesApiFactory;
/**
* BatchesApi - object-oriented interface
* @export
* @class BatchesApi
* @extends {BaseAPI}
*/
class BatchesApi extends base_1.BaseAPI {
/**
* Add a shipment or rate to a batch.
* @summary Add to a batch
* @param {string} batchId Batch ID
* @param {CreateAndProcessBatchRequestBody} createAndProcessBatchRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BatchesApi
*/
addToBatch(batchId, createAndProcessBatchRequestBody, options) {
return (0, exports.BatchesApiFp)(this.configuration).addToBatch(batchId, createAndProcessBatchRequestBody, options).then((request) => request(this.axios, this.basePath));
}
/**
* Create a batch containing multiple labels.
* @summary Create a batch
* @param {CreateBatchRequest} createBatchRequest
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BatchesApi
*/
createBatch(createBatchRequest, options) {
return (0, exports.BatchesApiFp)(this.configuration).createBatch(createBatchRequest, options).then((request) => request(this.axios, this.basePath));
}
/**
* Delete a batch based on its batch id. Sets its status to \'archived\'.
* @summary Delete batch by id
* @param {string} batchId Batch ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BatchesApi
*/
deleteBatch(batchId, options) {
return (0, exports.BatchesApiFp)(this.configuration).deleteBatch(batchId, options).then((request) => request(this.axios, this.basePath));
}
/**
* Retreive a batch using an external batch ID
* @summary Get batch by external id
* @param {string} externalBatchId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BatchesApi
*/
getBatchByExternalId(externalBatchId, options) {
return (0, exports.BatchesApiFp)(this.configuration).getBatchByExternalId(externalBatchId, options).then((request) => request(this.axios, this.basePath));
}
/**
* Get batch details for a specific batch id.
* @summary Get batch by id
* @param {string} batchId Batch ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BatchesApi
*/
getBatchById(batchId, options) {
return (0, exports.BatchesApiFp)(this.configuration).getBatchById(batchId, options).then((request) => request(this.axios, this.basePath));
}
/**
* Errors in batches must be handled differently from synchronous requests. You must retrieve the status of your batch by getting a batch and getting an overview of the statuses or by listing the batch errors.
* @summary Get batch errors
* @param {string} batchId Batch ID
* @param {number} [page] Return a specific page of results. Defaults to the first page. If set to a number that\'s greater than the number of pages of results, an empty page is returned.
* @param {number} [pagesize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BatchesApi
*/
listBatchErrors(batchId, page, pagesize, options) {
return (0, exports.BatchesApiFp)(this.configuration).listBatchErrors(batchId, page, pagesize, options).then((request) => request(this.axios, this.basePath));
}
/**
* List the batches associated with your ShipStation account.
* @summary List batches
* @param {BatchStatus} [status]
* @param {number} [page] Return a specific page of results. Defaults to the first page. If set to a number that\'s greater than the number of pages of results, an empty page is returned.
* @param {number} [pageSize] The number of results to return per response.
* @param {SortDir} [sortDir] Controls the sort order of the query.
* @param {string} [batchNumber] Batch Number
* @param {BatchesSortBy} [sortBy]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BatchesApi
*/
listBatches(status, page, pageSize, sortDir, batchNumber, sortBy, options) {
return (0, exports.BatchesApiFp)(this.configuration).listBatches(status, page, pageSize, sortDir, batchNumber, sortBy, options).then((request) => request(this.axios, this.basePath));
}
/**
* Create and purchase the labels for the shipments included in the batch.
* @summary Process batch id labels
* @param {string} batchId Batch ID
* @param {ProcessBatchRequestBody} processBatchRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BatchesApi
*/
processBatch(batchId, processBatchRequestBody, options) {
return (0, exports.BatchesApiFp)(this.configuration).processBatch(batchId, processBatchRequestBody, options).then((request) => request(this.axios, this.basePath));
}
/**
* Remove specific shipment ids or rate ids from a batch.
* @summary Remove from batch
* @param {string} batchId Batch ID
* @param {RemoveFromBatchRequestBody} removeFromBatchRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BatchesApi
*/
removeFromBatch(batchId, removeFromBatchRequestBody, options) {
return (0, exports.BatchesApiFp)(this.configuration).removeFromBatch(batchId, removeFromBatchRequestBody, options).then((request) => request(this.axios, this.basePath));
}
/**
* Update a batch by id setting its status to \'archived\'.
* @summary Update batch status to \'archived\' by id
* @param {string} batchId Batch ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof BatchesApi
*/
updateBatch(batchId, options) {
return (0, exports.BatchesApiFp)(this.configuration).updateBatch(batchId, options).then((request) => request(this.axios, this.basePath));
}
}
exports.BatchesApi = BatchesApi;