shipstation-client
Version:
ShipStation V2 SDK
766 lines (691 loc) • 45.1 kB
text/typescript
/* 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.
*/
import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { ErrorResponseBody } from '../models';
// @ts-ignore
import type { GetShipmentByExternalIdResponseBody } from '../models';
// @ts-ignore
import type { GetShipmentByIdResponseBody } from '../models';
// @ts-ignore
import type { ListShipmentRatesResponseBody } from '../models';
// @ts-ignore
import type { ListShipmentsResponseBody } from '../models';
// @ts-ignore
import type { ShipmentStatus } from '../models';
// @ts-ignore
import type { ShipmentsSortBy } from '../models';
// @ts-ignore
import type { SortDir } from '../models';
// @ts-ignore
import type { TagShipmentResponseBody } from '../models';
/**
* ShipmentsApi - axios parameter creator
* @export
*/
export const ShipmentsApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* Mark a shipment cancelled, if it is no longer needed or being used by your organized. Any label associated with the shipment needs to be voided first An example use case would be if a batch label creation job is going to run at a set time and only queries `pending` shipments. Marking a shipment as cancelled would remove it from this process
* @summary Cancel a shipment
* @param {string} shipmentId Shipment ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
cancelShipments: async (shipmentId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'shipmentId' is not null or undefined
assertParamExists('cancelShipments', 'shipmentId', shipmentId)
const localVarPath = `/v2/shipments/{shipment_id}/cancel`
.replace(`{${"shipment_id"}}`, encodeURIComponent(String(shipmentId)));
// 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 = { method: 'PUT', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_keys required
await setApiKeyToObject(localVarHeaderParameter, "api-key", configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Query Shipments created using your own custom ID convention using this endpoint
* @summary Get shipment by external id
* @param {string} externalShipmentId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getShipmentByExternalId: async (externalShipmentId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'externalShipmentId' is not null or undefined
assertParamExists('getShipmentByExternalId', 'externalShipmentId', externalShipmentId)
const localVarPath = `/v2/shipments/external_shipment_id/{external_shipment_id}`
.replace(`{${"external_shipment_id"}}`, encodeURIComponent(String(externalShipmentId)));
// 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 = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_keys required
await setApiKeyToObject(localVarHeaderParameter, "api-key", configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Get an individual shipment based on its ID
* @summary Get shipment by id
* @param {string} shipmentId Shipment ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getShipmentById: async (shipmentId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'shipmentId' is not null or undefined
assertParamExists('getShipmentById', 'shipmentId', shipmentId)
const localVarPath = `/v2/shipments/{shipment_id}`
.replace(`{${"shipment_id"}}`, encodeURIComponent(String(shipmentId)));
// 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 = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_keys required
await setApiKeyToObject(localVarHeaderParameter, "api-key", configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Get Rates for the shipment information associated with the shipment ID
* @summary Get shipment rates
* @param {string} shipmentId Shipment 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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
listShipmentRates: async (shipmentId: string, createdAtStart?: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'shipmentId' is not null or undefined
assertParamExists('listShipmentRates', 'shipmentId', shipmentId)
const localVarPath = `/v2/shipments/{shipment_id}/rates`
.replace(`{${"shipment_id"}}`, encodeURIComponent(String(shipmentId)));
// 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 = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_keys required
await setApiKeyToObject(localVarHeaderParameter, "api-key", configuration)
if (createdAtStart !== undefined) {
localVarQueryParameter['created_at_start'] = (createdAtStart as any instanceof Date) ?
(createdAtStart as any).toISOString() :
createdAtStart;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Get list of Shipments
* @summary List shipments
* @param {string} pickupId
* @param {ShipmentStatus} [shipmentStatus]
* @param {string} [batchId] Batch 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 {string} [modifiedAtStart] Used to create a filter for when a resource was modified (ex. A shipment that was modified after a certain time)
* @param {string} [modifiedAtEnd] Used to create a filter for when a resource was modified (ex. A shipment that was modified 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 {string} [salesOrderId] Sales Order ID
* @param {SortDir} [sortDir] Controls the sort order of the query.
* @param {string} [shipmentNumber] The user or order source defined shipment number
* @param {string} [shipToName] The name associated with the ship_to
* @param {string} [itemKeyword] Returns shipments that contain items that match the specified keyword. Fields searched are Sku, Description, and Options.
* @param {string} [paymentDateStart] Used to create a filter for resources based on the payment_date parameter after a certain time.
* @param {string} [paymentDateEnd] Used to create a filter for resources based on the payment_date parameter before a certain time.
* @param {string} [storeId] Store ID
* @param {string} [externalShipmentId]
* @param {ShipmentsSortBy} [sortBy]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listShipments: async (pickupId: string, shipmentStatus?: ShipmentStatus, batchId?: string, createdAtStart?: string, createdAtEnd?: string, modifiedAtStart?: string, modifiedAtEnd?: string, page?: number, pageSize?: number, salesOrderId?: string, sortDir?: SortDir, shipmentNumber?: string, shipToName?: string, itemKeyword?: string, paymentDateStart?: string, paymentDateEnd?: string, storeId?: string, externalShipmentId?: string, sortBy?: ShipmentsSortBy, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'pickupId' is not null or undefined
assertParamExists('listShipments', 'pickupId', pickupId)
const localVarPath = `/v2/shipments`;
// 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 = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_keys required
await setApiKeyToObject(localVarHeaderParameter, "api-key", configuration)
if (shipmentStatus !== undefined) {
localVarQueryParameter['shipment_status'] = shipmentStatus;
}
if (batchId !== undefined) {
localVarQueryParameter['batch_id'] = batchId;
}
if (pickupId !== undefined) {
localVarQueryParameter['pickup_id'] = pickupId;
}
if (createdAtStart !== undefined) {
localVarQueryParameter['created_at_start'] = (createdAtStart as any instanceof Date) ?
(createdAtStart as any).toISOString() :
createdAtStart;
}
if (createdAtEnd !== undefined) {
localVarQueryParameter['created_at_end'] = (createdAtEnd as any instanceof Date) ?
(createdAtEnd as any).toISOString() :
createdAtEnd;
}
if (modifiedAtStart !== undefined) {
localVarQueryParameter['modified_at_start'] = (modifiedAtStart as any instanceof Date) ?
(modifiedAtStart as any).toISOString() :
modifiedAtStart;
}
if (modifiedAtEnd !== undefined) {
localVarQueryParameter['modified_at_end'] = (modifiedAtEnd as any instanceof Date) ?
(modifiedAtEnd as any).toISOString() :
modifiedAtEnd;
}
if (page !== undefined) {
localVarQueryParameter['page'] = page;
}
if (pageSize !== undefined) {
localVarQueryParameter['page_size'] = pageSize;
}
if (salesOrderId !== undefined) {
localVarQueryParameter['sales_order_id'] = salesOrderId;
}
if (sortDir !== undefined) {
localVarQueryParameter['sort_dir'] = sortDir;
}
if (shipmentNumber !== undefined) {
localVarQueryParameter['shipment_number'] = shipmentNumber;
}
if (shipToName !== undefined) {
localVarQueryParameter['ship_to_name'] = shipToName;
}
if (itemKeyword !== undefined) {
localVarQueryParameter['item_keyword'] = itemKeyword;
}
if (paymentDateStart !== undefined) {
localVarQueryParameter['payment_date_start'] = (paymentDateStart as any instanceof Date) ?
(paymentDateStart as any).toISOString() :
paymentDateStart;
}
if (paymentDateEnd !== undefined) {
localVarQueryParameter['payment_date_end'] = (paymentDateEnd as any instanceof Date) ?
(paymentDateEnd as any).toISOString() :
paymentDateEnd;
}
if (storeId !== undefined) {
localVarQueryParameter['store_id'] = storeId;
}
if (externalShipmentId !== undefined) {
localVarQueryParameter['external_shipment_id'] = externalShipmentId;
}
if (sortBy !== undefined) {
localVarQueryParameter['sort_by'] = sortBy;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Add a tag to the shipment object
* @summary Add tag to shipment
* @param {string} shipmentId Shipment ID
* @param {string} tagName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
tagShipment: async (shipmentId: string, tagName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'shipmentId' is not null or undefined
assertParamExists('tagShipment', 'shipmentId', shipmentId)
// verify required parameter 'tagName' is not null or undefined
assertParamExists('tagShipment', 'tagName', tagName)
const localVarPath = `/v2/shipments/{shipment_id}/tags/{tag_name}`
.replace(`{${"shipment_id"}}`, encodeURIComponent(String(shipmentId)))
.replace(`{${"tag_name"}}`, encodeURIComponent(String(tagName)));
// 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 = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_keys required
await setApiKeyToObject(localVarHeaderParameter, "api-key", configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Remove an existing tag from the Shipment object
* @summary Remove tag from shipment
* @param {string} shipmentId Shipment ID
* @param {string} tagName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
untagShipment: async (shipmentId: string, tagName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'shipmentId' is not null or undefined
assertParamExists('untagShipment', 'shipmentId', shipmentId)
// verify required parameter 'tagName' is not null or undefined
assertParamExists('untagShipment', 'tagName', tagName)
const localVarPath = `/v2/shipments/{shipment_id}/tags/{tag_name}`
.replace(`{${"shipment_id"}}`, encodeURIComponent(String(shipmentId)))
.replace(`{${"tag_name"}}`, encodeURIComponent(String(tagName)));
// 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 = { method: 'DELETE', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_keys required
await setApiKeyToObject(localVarHeaderParameter, "api-key", configuration)
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* ShipmentsApi - functional programming interface
* @export
*/
export const ShipmentsApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = ShipmentsApiAxiosParamCreator(configuration)
return {
/**
* Mark a shipment cancelled, if it is no longer needed or being used by your organized. Any label associated with the shipment needs to be voided first An example use case would be if a batch label creation job is going to run at a set time and only queries `pending` shipments. Marking a shipment as cancelled would remove it from this process
* @summary Cancel a shipment
* @param {string} shipmentId Shipment ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async cancelShipments(shipmentId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.cancelShipments(shipmentId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['ShipmentsApi.cancelShipments']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Query Shipments created using your own custom ID convention using this endpoint
* @summary Get shipment by external id
* @param {string} externalShipmentId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getShipmentByExternalId(externalShipmentId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetShipmentByExternalIdResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getShipmentByExternalId(externalShipmentId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['ShipmentsApi.getShipmentByExternalId']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Get an individual shipment based on its ID
* @summary Get shipment by id
* @param {string} shipmentId Shipment ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getShipmentById(shipmentId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetShipmentByIdResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getShipmentById(shipmentId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['ShipmentsApi.getShipmentById']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Get Rates for the shipment information associated with the shipment ID
* @summary Get shipment rates
* @param {string} shipmentId Shipment 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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
async listShipmentRates(shipmentId: string, createdAtStart?: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListShipmentRatesResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.listShipmentRates(shipmentId, createdAtStart, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['ShipmentsApi.listShipmentRates']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Get list of Shipments
* @summary List shipments
* @param {string} pickupId
* @param {ShipmentStatus} [shipmentStatus]
* @param {string} [batchId] Batch 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 {string} [modifiedAtStart] Used to create a filter for when a resource was modified (ex. A shipment that was modified after a certain time)
* @param {string} [modifiedAtEnd] Used to create a filter for when a resource was modified (ex. A shipment that was modified 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 {string} [salesOrderId] Sales Order ID
* @param {SortDir} [sortDir] Controls the sort order of the query.
* @param {string} [shipmentNumber] The user or order source defined shipment number
* @param {string} [shipToName] The name associated with the ship_to
* @param {string} [itemKeyword] Returns shipments that contain items that match the specified keyword. Fields searched are Sku, Description, and Options.
* @param {string} [paymentDateStart] Used to create a filter for resources based on the payment_date parameter after a certain time.
* @param {string} [paymentDateEnd] Used to create a filter for resources based on the payment_date parameter before a certain time.
* @param {string} [storeId] Store ID
* @param {string} [externalShipmentId]
* @param {ShipmentsSortBy} [sortBy]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async listShipments(pickupId: string, shipmentStatus?: ShipmentStatus, batchId?: string, createdAtStart?: string, createdAtEnd?: string, modifiedAtStart?: string, modifiedAtEnd?: string, page?: number, pageSize?: number, salesOrderId?: string, sortDir?: SortDir, shipmentNumber?: string, shipToName?: string, itemKeyword?: string, paymentDateStart?: string, paymentDateEnd?: string, storeId?: string, externalShipmentId?: string, sortBy?: ShipmentsSortBy, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListShipmentsResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.listShipments(pickupId, shipmentStatus, batchId, createdAtStart, createdAtEnd, modifiedAtStart, modifiedAtEnd, page, pageSize, salesOrderId, sortDir, shipmentNumber, shipToName, itemKeyword, paymentDateStart, paymentDateEnd, storeId, externalShipmentId, sortBy, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['ShipmentsApi.listShipments']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Add a tag to the shipment object
* @summary Add tag to shipment
* @param {string} shipmentId Shipment ID
* @param {string} tagName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async tagShipment(shipmentId: string, tagName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<TagShipmentResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.tagShipment(shipmentId, tagName, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['ShipmentsApi.tagShipment']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Remove an existing tag from the Shipment object
* @summary Remove tag from shipment
* @param {string} shipmentId Shipment ID
* @param {string} tagName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async untagShipment(shipmentId: string, tagName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<string>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.untagShipment(shipmentId, tagName, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['ShipmentsApi.untagShipment']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};
/**
* ShipmentsApi - factory interface
* @export
*/
export const ShipmentsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = ShipmentsApiFp(configuration)
return {
/**
* Mark a shipment cancelled, if it is no longer needed or being used by your organized. Any label associated with the shipment needs to be voided first An example use case would be if a batch label creation job is going to run at a set time and only queries `pending` shipments. Marking a shipment as cancelled would remove it from this process
* @summary Cancel a shipment
* @param {string} shipmentId Shipment ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
cancelShipments(shipmentId: string, options?: RawAxiosRequestConfig): AxiosPromise<string> {
return localVarFp.cancelShipments(shipmentId, options).then((request) => request(axios, basePath));
},
/**
* Query Shipments created using your own custom ID convention using this endpoint
* @summary Get shipment by external id
* @param {string} externalShipmentId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getShipmentByExternalId(externalShipmentId: string, options?: RawAxiosRequestConfig): AxiosPromise<GetShipmentByExternalIdResponseBody> {
return localVarFp.getShipmentByExternalId(externalShipmentId, options).then((request) => request(axios, basePath));
},
/**
* Get an individual shipment based on its ID
* @summary Get shipment by id
* @param {string} shipmentId Shipment ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getShipmentById(shipmentId: string, options?: RawAxiosRequestConfig): AxiosPromise<GetShipmentByIdResponseBody> {
return localVarFp.getShipmentById(shipmentId, options).then((request) => request(axios, basePath));
},
/**
* Get Rates for the shipment information associated with the shipment ID
* @summary Get shipment rates
* @param {string} shipmentId Shipment 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 {*} [options] Override http request option.
* @throws {RequiredError}
*/
listShipmentRates(shipmentId: string, createdAtStart?: string, options?: RawAxiosRequestConfig): AxiosPromise<ListShipmentRatesResponseBody> {
return localVarFp.listShipmentRates(shipmentId, createdAtStart, options).then((request) => request(axios, basePath));
},
/**
* Get list of Shipments
* @summary List shipments
* @param {string} pickupId
* @param {ShipmentStatus} [shipmentStatus]
* @param {string} [batchId] Batch 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 {string} [modifiedAtStart] Used to create a filter for when a resource was modified (ex. A shipment that was modified after a certain time)
* @param {string} [modifiedAtEnd] Used to create a filter for when a resource was modified (ex. A shipment that was modified 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 {string} [salesOrderId] Sales Order ID
* @param {SortDir} [sortDir] Controls the sort order of the query.
* @param {string} [shipmentNumber] The user or order source defined shipment number
* @param {string} [shipToName] The name associated with the ship_to
* @param {string} [itemKeyword] Returns shipments that contain items that match the specified keyword. Fields searched are Sku, Description, and Options.
* @param {string} [paymentDateStart] Used to create a filter for resources based on the payment_date parameter after a certain time.
* @param {string} [paymentDateEnd] Used to create a filter for resources based on the payment_date parameter before a certain time.
* @param {string} [storeId] Store ID
* @param {string} [externalShipmentId]
* @param {ShipmentsSortBy} [sortBy]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listShipments(pickupId: string, shipmentStatus?: ShipmentStatus, batchId?: string, createdAtStart?: string, createdAtEnd?: string, modifiedAtStart?: string, modifiedAtEnd?: string, page?: number, pageSize?: number, salesOrderId?: string, sortDir?: SortDir, shipmentNumber?: string, shipToName?: string, itemKeyword?: string, paymentDateStart?: string, paymentDateEnd?: string, storeId?: string, externalShipmentId?: string, sortBy?: ShipmentsSortBy, options?: RawAxiosRequestConfig): AxiosPromise<ListShipmentsResponseBody> {
return localVarFp.listShipments(pickupId, shipmentStatus, batchId, createdAtStart, createdAtEnd, modifiedAtStart, modifiedAtEnd, page, pageSize, salesOrderId, sortDir, shipmentNumber, shipToName, itemKeyword, paymentDateStart, paymentDateEnd, storeId, externalShipmentId, sortBy, options).then((request) => request(axios, basePath));
},
/**
* Add a tag to the shipment object
* @summary Add tag to shipment
* @param {string} shipmentId Shipment ID
* @param {string} tagName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
tagShipment(shipmentId: string, tagName: string, options?: RawAxiosRequestConfig): AxiosPromise<TagShipmentResponseBody> {
return localVarFp.tagShipment(shipmentId, tagName, options).then((request) => request(axios, basePath));
},
/**
* Remove an existing tag from the Shipment object
* @summary Remove tag from shipment
* @param {string} shipmentId Shipment ID
* @param {string} tagName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
untagShipment(shipmentId: string, tagName: string, options?: RawAxiosRequestConfig): AxiosPromise<string> {
return localVarFp.untagShipment(shipmentId, tagName, options).then((request) => request(axios, basePath));
},
};
};
/**
* ShipmentsApi - object-oriented interface
* @export
* @class ShipmentsApi
* @extends {BaseAPI}
*/
export class ShipmentsApi extends BaseAPI {
/**
* Mark a shipment cancelled, if it is no longer needed or being used by your organized. Any label associated with the shipment needs to be voided first An example use case would be if a batch label creation job is going to run at a set time and only queries `pending` shipments. Marking a shipment as cancelled would remove it from this process
* @summary Cancel a shipment
* @param {string} shipmentId Shipment ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ShipmentsApi
*/
public cancelShipments(shipmentId: string, options?: RawAxiosRequestConfig) {
return ShipmentsApiFp(this.configuration).cancelShipments(shipmentId, options).then((request) => request(this.axios, this.basePath));
}
/**
* Query Shipments created using your own custom ID convention using this endpoint
* @summary Get shipment by external id
* @param {string} externalShipmentId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ShipmentsApi
*/
public getShipmentByExternalId(externalShipmentId: string, options?: RawAxiosRequestConfig) {
return ShipmentsApiFp(this.configuration).getShipmentByExternalId(externalShipmentId, options).then((request) => request(this.axios, this.basePath));
}
/**
* Get an individual shipment based on its ID
* @summary Get shipment by id
* @param {string} shipmentId Shipment ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ShipmentsApi
*/
public getShipmentById(shipmentId: string, options?: RawAxiosRequestConfig) {
return ShipmentsApiFp(this.configuration).getShipmentById(shipmentId, options).then((request) => request(this.axios, this.basePath));
}
/**
* Get Rates for the shipment information associated with the shipment ID
* @summary Get shipment rates
* @param {string} shipmentId Shipment 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 {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ShipmentsApi
*/
public listShipmentRates(shipmentId: string, createdAtStart?: string, options?: RawAxiosRequestConfig) {
return ShipmentsApiFp(this.configuration).listShipmentRates(shipmentId, createdAtStart, options).then((request) => request(this.axios, this.basePath));
}
/**
* Get list of Shipments
* @summary List shipments
* @param {string} pickupId
* @param {ShipmentStatus} [shipmentStatus]
* @param {string} [batchId] Batch 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 {string} [modifiedAtStart] Used to create a filter for when a resource was modified (ex. A shipment that was modified after a certain time)
* @param {string} [modifiedAtEnd] Used to create a filter for when a resource was modified (ex. A shipment that was modified 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 {string} [salesOrderId] Sales Order ID
* @param {SortDir} [sortDir] Controls the sort order of the query.
* @param {string} [shipmentNumber] The user or order source defined shipment number
* @param {string} [shipToName] The name associated with the ship_to
* @param {string} [itemKeyword] Returns shipments that contain items that match the specified keyword. Fields searched are Sku, Description, and Options.
* @param {string} [paymentDateStart] Used to create a filter for resources based on the payment_date parameter after a certain time.
* @param {string} [paymentDateEnd] Used to create a filter for resources based on the payment_date parameter before a certain time.
* @param {string} [storeId] Store ID
* @param {string} [externalShipmentId]
* @param {ShipmentsSortBy} [sortBy]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ShipmentsApi
*/
public listShipments(pickupId: string, shipmentStatus?: ShipmentStatus, batchId?: string, createdAtStart?: string, createdAtEnd?: string, modifiedAtStart?: string, modifiedAtEnd?: string, page?: number, pageSize?: number, salesOrderId?: string, sortDir?: SortDir, shipmentNumber?: string, shipToName?: string, itemKeyword?: string, paymentDateStart?: string, paymentDateEnd?: string, storeId?: string, externalShipmentId?: string, sortBy?: ShipmentsSortBy, options?: RawAxiosRequestConfig) {
return ShipmentsApiFp(this.configuration).listShipments(pickupId, shipmentStatus, batchId, createdAtStart, createdAtEnd, modifiedAtStart, modifiedAtEnd, page, pageSize, salesOrderId, sortDir, shipmentNumber, shipToName, itemKeyword, paymentDateStart, paymentDateEnd, storeId, externalShipmentId, sortBy, options).then((request) => request(this.axios, this.basePath));
}
/**
* Add a tag to the shipment object
* @summary Add tag to shipment
* @param {string} shipmentId Shipment ID
* @param {string} tagName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ShipmentsApi
*/
public tagShipment(shipmentId: string, tagName: string, options?: RawAxiosRequestConfig) {
return ShipmentsApiFp(this.configuration).tagShipment(shipmentId, tagName, options).then((request) => request(this.axios, this.basePath));
}
/**
* Remove an existing tag from the Shipment object
* @summary Remove tag from shipment
* @param {string} shipmentId Shipment ID
* @param {string} tagName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ShipmentsApi
*/
public untagShipment(shipmentId: string, tagName: string, options?: RawAxiosRequestConfig) {
return ShipmentsApiFp(this.configuration).untagShipment(shipmentId, tagName, options).then((request) => request(this.axios, this.basePath));
}
}