shipstation-client
Version:
ShipStation V2 SDK
375 lines (374 loc) • 21.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());
});
};
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';
/**
* PackagePickupsApi - axios parameter creator
* @export
*/
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
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, 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 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
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, 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 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, 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);
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;
}
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,
};
}),
/**
* 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
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, 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(schedulePickupRequestBody, localVarRequestOptions, configuration);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
};
};
/**
* PackagePickupsApi - functional programming interface
* @export
*/
export const PackagePickupsApiFp = function (configuration) {
const localVarAxiosParamCreator = 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 = operationServerMap['PackagePickupsApi.deleteScheduledPickup']) === 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 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 = operationServerMap['PackagePickupsApi.getPickupById']) === 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 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 = operationServerMap['PackagePickupsApi.listScheduledPickups']) === 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);
});
},
/**
* 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 = operationServerMap['PackagePickupsApi.schedulePickup']) === 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);
});
},
};
};
/**
* PackagePickupsApi - factory interface
* @export
*/
export const PackagePickupsApiFactory = function (configuration, basePath, axios) {
const localVarFp = 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));
},
};
};
/**
* PackagePickupsApi - object-oriented interface
* @export
* @class PackagePickupsApi
* @extends {BaseAPI}
*/
export class PackagePickupsApi extends 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 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 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 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 PackagePickupsApiFp(this.configuration).schedulePickup(schedulePickupRequestBody, options).then((request) => request(this.axios, this.basePath));
}
}