shipstation-client
Version:
ShipStation V2 SDK
382 lines (381 loc) • 22.6 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.PackagePickupsApi = exports.PackagePickupsApiFactory = exports.PackagePickupsApiFp = exports.PackagePickupsApiAxiosParamCreator = 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");
/**
* PackagePickupsApi - axios parameter creator
* @export
*/
const PackagePickupsApiAxiosParamCreator = function (configuration) {
return {
/**
* Delete a previously-scheduled pickup by ID
* @summary Delete a scheduled pickup
* @param {string} pickupId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteScheduledPickup: (pickupId_1, ...args_1) => __awaiter(this, [pickupId_1, ...args_1], void 0, function* (pickupId, options = {}) {
// verify required parameter 'pickupId' is not null or undefined
(0, common_1.assertParamExists)('deleteScheduledPickup', 'pickupId', pickupId);
const localVarPath = `/v2/pickups/{pickup_id}`
.replace(`{${"pickup_id"}}`, encodeURIComponent(String(pickupId)));
// 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 Pickup By ID
* @summary Get pickup by id
* @param {string} pickupId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getPickupById: (pickupId_1, ...args_1) => __awaiter(this, [pickupId_1, ...args_1], void 0, function* (pickupId, options = {}) {
// verify required parameter 'pickupId' is not null or undefined
(0, common_1.assertParamExists)('getPickupById', 'pickupId', pickupId);
const localVarPath = `/v2/pickups/{pickup_id}`
.replace(`{${"pickup_id"}}`, encodeURIComponent(String(pickupId)));
// 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 all pickups that have been scheduled for this carrier
* @summary List scheduled pickups
* @param {string} [carrierId] Carrier ID
* @param {string} [warehouseId] Warehouse ID
* @param {string} [createdAtStart] Used to create a filter for when a resource was created (ex. A shipment that was created after a certain time)
* @param {string} [createdAtEnd] Used to create a filter for when a resource was created, (ex. A shipment that was created before a certain time)
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
listScheduledPickups: (carrierId_1, warehouseId_1, createdAtStart_1, createdAtEnd_1, page_1, pageSize_1, ...args_1) => __awaiter(this, [carrierId_1, warehouseId_1, createdAtStart_1, createdAtEnd_1, page_1, pageSize_1, ...args_1], void 0, function* (carrierId, warehouseId, createdAtStart, createdAtEnd, page, pageSize, options = {}) {
const localVarPath = `/v2/pickups`;
// 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 (carrierId !== undefined) {
localVarQueryParameter['carrier_id'] = carrierId;
}
if (warehouseId !== undefined) {
localVarQueryParameter['warehouse_id'] = warehouseId;
}
if (createdAtStart !== undefined) {
localVarQueryParameter['created_at_start'] = (createdAtStart instanceof Date) ?
createdAtStart.toISOString() :
createdAtStart;
}
if (createdAtEnd !== undefined) {
localVarQueryParameter['created_at_end'] = (createdAtEnd instanceof Date) ?
createdAtEnd.toISOString() :
createdAtEnd;
}
if (page !== undefined) {
localVarQueryParameter['page'] = page;
}
if (pageSize !== undefined) {
localVarQueryParameter['page_size'] = 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,
};
}),
/**
* Schedule a package pickup with a carrier
* @summary Schedule a pickup
* @param {SchedulePickupRequestBody} schedulePickupRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
schedulePickup: (schedulePickupRequestBody_1, ...args_1) => __awaiter(this, [schedulePickupRequestBody_1, ...args_1], void 0, function* (schedulePickupRequestBody, options = {}) {
// verify required parameter 'schedulePickupRequestBody' is not null or undefined
(0, common_1.assertParamExists)('schedulePickup', 'schedulePickupRequestBody', schedulePickupRequestBody);
const localVarPath = `/v2/pickups`;
// 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)(schedulePickupRequestBody, localVarRequestOptions, configuration);
return {
url: (0, common_1.toPathString)(localVarUrlObj),
options: localVarRequestOptions,
};
}),
};
};
exports.PackagePickupsApiAxiosParamCreator = PackagePickupsApiAxiosParamCreator;
/**
* PackagePickupsApi - functional programming interface
* @export
*/
const PackagePickupsApiFp = function (configuration) {
const localVarAxiosParamCreator = (0, exports.PackagePickupsApiAxiosParamCreator)(configuration);
return {
/**
* Delete a previously-scheduled pickup by ID
* @summary Delete a scheduled pickup
* @param {string} pickupId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteScheduledPickup(pickupId, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.deleteScheduledPickup(pickupId, 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['PackagePickupsApi.deleteScheduledPickup']) === 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 Pickup By ID
* @summary Get pickup by id
* @param {string} pickupId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getPickupById(pickupId, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.getPickupById(pickupId, 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['PackagePickupsApi.getPickupById']) === 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 all pickups that have been scheduled for this carrier
* @summary List scheduled pickups
* @param {string} [carrierId] Carrier ID
* @param {string} [warehouseId] Warehouse ID
* @param {string} [createdAtStart] Used to create a filter for when a resource was created (ex. A shipment that was created after a certain time)
* @param {string} [createdAtEnd] Used to create a filter for when a resource was created, (ex. A shipment that was created before a certain time)
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
listScheduledPickups(carrierId, warehouseId, createdAtStart, createdAtEnd, page, pageSize, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.listScheduledPickups(carrierId, warehouseId, createdAtStart, createdAtEnd, 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['PackagePickupsApi.listScheduledPickups']) === 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);
});
},
/**
* Schedule a package pickup with a carrier
* @summary Schedule a pickup
* @param {SchedulePickupRequestBody} schedulePickupRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
schedulePickup(schedulePickupRequestBody, options) {
return __awaiter(this, void 0, void 0, function* () {
var _a, _b, _c;
const localVarAxiosArgs = yield localVarAxiosParamCreator.schedulePickup(schedulePickupRequestBody, 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['PackagePickupsApi.schedulePickup']) === 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.PackagePickupsApiFp = PackagePickupsApiFp;
/**
* PackagePickupsApi - factory interface
* @export
*/
const PackagePickupsApiFactory = function (configuration, basePath, axios) {
const localVarFp = (0, exports.PackagePickupsApiFp)(configuration);
return {
/**
* Delete a previously-scheduled pickup by ID
* @summary Delete a scheduled pickup
* @param {string} pickupId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
deleteScheduledPickup(pickupId, options) {
return localVarFp.deleteScheduledPickup(pickupId, options).then((request) => request(axios, basePath));
},
/**
* Get Pickup By ID
* @summary Get pickup by id
* @param {string} pickupId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getPickupById(pickupId, options) {
return localVarFp.getPickupById(pickupId, options).then((request) => request(axios, basePath));
},
/**
* List all pickups that have been scheduled for this carrier
* @summary List scheduled pickups
* @param {string} [carrierId] Carrier ID
* @param {string} [warehouseId] Warehouse ID
* @param {string} [createdAtStart] Used to create a filter for when a resource was created (ex. A shipment that was created after a certain time)
* @param {string} [createdAtEnd] Used to create a filter for when a resource was created, (ex. A shipment that was created before a certain time)
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
listScheduledPickups(carrierId, warehouseId, createdAtStart, createdAtEnd, page, pageSize, options) {
return localVarFp.listScheduledPickups(carrierId, warehouseId, createdAtStart, createdAtEnd, page, pageSize, options).then((request) => request(axios, basePath));
},
/**
* Schedule a package pickup with a carrier
* @summary Schedule a pickup
* @param {SchedulePickupRequestBody} schedulePickupRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
schedulePickup(schedulePickupRequestBody, options) {
return localVarFp.schedulePickup(schedulePickupRequestBody, options).then((request) => request(axios, basePath));
},
};
};
exports.PackagePickupsApiFactory = PackagePickupsApiFactory;
/**
* PackagePickupsApi - object-oriented interface
* @export
* @class PackagePickupsApi
* @extends {BaseAPI}
*/
class PackagePickupsApi extends base_1.BaseAPI {
/**
* Delete a previously-scheduled pickup by ID
* @summary Delete a scheduled pickup
* @param {string} pickupId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PackagePickupsApi
*/
deleteScheduledPickup(pickupId, options) {
return (0, exports.PackagePickupsApiFp)(this.configuration).deleteScheduledPickup(pickupId, options).then((request) => request(this.axios, this.basePath));
}
/**
* Get Pickup By ID
* @summary Get pickup by id
* @param {string} pickupId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PackagePickupsApi
*/
getPickupById(pickupId, options) {
return (0, exports.PackagePickupsApiFp)(this.configuration).getPickupById(pickupId, options).then((request) => request(this.axios, this.basePath));
}
/**
* List all pickups that have been scheduled for this carrier
* @summary List scheduled pickups
* @param {string} [carrierId] Carrier ID
* @param {string} [warehouseId] Warehouse ID
* @param {string} [createdAtStart] Used to create a filter for when a resource was created (ex. A shipment that was created after a certain time)
* @param {string} [createdAtEnd] Used to create a filter for when a resource was created, (ex. A shipment that was created before a certain time)
* @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 {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PackagePickupsApi
*/
listScheduledPickups(carrierId, warehouseId, createdAtStart, createdAtEnd, page, pageSize, options) {
return (0, exports.PackagePickupsApiFp)(this.configuration).listScheduledPickups(carrierId, warehouseId, createdAtStart, createdAtEnd, page, pageSize, options).then((request) => request(this.axios, this.basePath));
}
/**
* Schedule a package pickup with a carrier
* @summary Schedule a pickup
* @param {SchedulePickupRequestBody} schedulePickupRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PackagePickupsApi
*/
schedulePickup(schedulePickupRequestBody, options) {
return (0, exports.PackagePickupsApiFp)(this.configuration).schedulePickup(schedulePickupRequestBody, options).then((request) => request(this.axios, this.basePath));
}
}
exports.PackagePickupsApi = PackagePickupsApi;