shipstation-client
Version:
ShipStation V2 SDK
823 lines (742 loc) • 49.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 { CreateLabelFromRateRequestBody } from '../models';
// @ts-ignore
import type { CreateLabelFromRateResponseBody } from '../models';
// @ts-ignore
import type { CreateLabelFromShipmentRequestBody } from '../models';
// @ts-ignore
import type { CreateLabelFromShipmentResponseBody } from '../models';
// @ts-ignore
import type { CreateLabelRequestBody } from '../models';
// @ts-ignore
import type { CreateLabelResponseBody } from '../models';
// @ts-ignore
import type { CreateReturnLabelRequestBody } from '../models';
// @ts-ignore
import type { CreateReturnLabelResponseBody } from '../models';
// @ts-ignore
import type { ErrorResponseBody } from '../models';
// @ts-ignore
import type { GetLabelByIdResponseBody } from '../models';
// @ts-ignore
import type { GetTrackingLogFromLabelResponseBody } from '../models';
// @ts-ignore
import type { LabelDownloadType } from '../models';
// @ts-ignore
import type { LabelStatus } from '../models';
// @ts-ignore
import type { ListLabelsResponseBody } from '../models';
// @ts-ignore
import type { SortDir } from '../models';
// @ts-ignore
import type { VoidLabelResponseBody } from '../models';
/**
* LabelsApi - axios parameter creator
* @export
*/
export const LabelsApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* Purchase and print a label for shipment.
* @summary Purchase label
* @param {CreateLabelRequestBody} createLabelRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createLabel: async (createLabelRequestBody: CreateLabelRequestBody, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'createLabelRequestBody' is not null or undefined
assertParamExists('createLabel', 'createLabelRequestBody', createLabelRequestBody)
const localVarPath = `/v2/labels`;
// 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)
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(createLabelRequestBody, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* When retrieving rates for shipments using the `/rates` endpoint, the returned information contains a `rate_id` property that can be used to generate a label without having to refill in the shipment information repeatedly.
* @summary Purchase label with rate id
* @param {string} rateId Rate ID
* @param {CreateLabelFromRateRequestBody} createLabelFromRateRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createLabelFromRate: async (rateId: string, createLabelFromRateRequestBody: CreateLabelFromRateRequestBody, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'rateId' is not null or undefined
assertParamExists('createLabelFromRate', 'rateId', rateId)
// verify required parameter 'createLabelFromRateRequestBody' is not null or undefined
assertParamExists('createLabelFromRate', 'createLabelFromRateRequestBody', createLabelFromRateRequestBody)
const localVarPath = `/v2/labels/rates/{rate_id}`
.replace(`{${"rate_id"}}`, encodeURIComponent(String(rateId)));
// 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)
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(createLabelFromRateRequestBody, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Purchase a label using a shipment ID that has already been created with the desired address and package info.
* @summary Purchase label with shipment id
* @param {string} shipmentId Shipment ID
* @param {CreateLabelFromShipmentRequestBody} createLabelFromShipmentRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createLabelFromShipment: async (shipmentId: string, createLabelFromShipmentRequestBody: CreateLabelFromShipmentRequestBody, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'shipmentId' is not null or undefined
assertParamExists('createLabelFromShipment', 'shipmentId', shipmentId)
// verify required parameter 'createLabelFromShipmentRequestBody' is not null or undefined
assertParamExists('createLabelFromShipment', 'createLabelFromShipmentRequestBody', createLabelFromShipmentRequestBody)
const localVarPath = `/v2/labels/shipment/{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: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
// authentication api_keys required
await setApiKeyToObject(localVarHeaderParameter, "api-key", configuration)
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(createLabelFromShipmentRequestBody, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Create a return label for a previously created outbound label. The return label will automatically swap the ship to and ship from addresses from the original label.
* @summary Create a return label
* @param {string} labelId Label ID
* @param {CreateReturnLabelRequestBody} createReturnLabelRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createReturnLabel: async (labelId: string, createReturnLabelRequestBody: CreateReturnLabelRequestBody, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'labelId' is not null or undefined
assertParamExists('createReturnLabel', 'labelId', labelId)
// verify required parameter 'createReturnLabelRequestBody' is not null or undefined
assertParamExists('createReturnLabel', 'createReturnLabelRequestBody', createReturnLabelRequestBody)
const localVarPath = `/v2/labels/{label_id}/return`
.replace(`{${"label_id"}}`, encodeURIComponent(String(labelId)));
// 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)
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(createReturnLabelRequestBody, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Retrieve a specific label by its label id.
* @summary Get label by id
* @param {string} labelId Label ID
* @param {LabelDownloadType} [labelDownloadType]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getLabelById: async (labelId: string, labelDownloadType?: LabelDownloadType, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'labelId' is not null or undefined
assertParamExists('getLabelById', 'labelId', labelId)
const localVarPath = `/v2/labels/{label_id}`
.replace(`{${"label_id"}}`, encodeURIComponent(String(labelId)));
// 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 (labelDownloadType !== undefined) {
localVarQueryParameter['label_download_type'] = labelDownloadType;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
* Retrieve the label\'s tracking details.
* @summary Get label tracking information
* @param {string} labelId Label ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getTrackingLogFromLabel: async (labelId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'labelId' is not null or undefined
assertParamExists('getTrackingLogFromLabel', 'labelId', labelId)
const localVarPath = `/v2/labels/{label_id}/track`
.replace(`{${"label_id"}}`, encodeURIComponent(String(labelId)));
// 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,
};
},
/**
* This method returns a list of labels that you\'ve created. You can optionally filter the results as well as control their sort order and the number of results returned at a time. By default all labels are returned 25 at a time, starting with the most recently created ones. You can combine multiple filter options to narrow-down the results. For example, if you only want your UPS labels for your east coast warehouse you could query by both `warehouse_id` and `carrier_id`.
* @summary List labels
* @param {LabelStatus} [labelStatus] Only return labels that are currently in the specified status.
* @param {string} [serviceCode] Only return labels for a specific carrier service.
* @param {string} [carrierId] Carrier ID
* @param {string} [trackingNumber] The tracking number associated with a shipment
* @param {string} [batchId] Batch ID
* @param {string} [rateId] Rate ID
* @param {string} [shipmentId] Shipment 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 {SortDir} [sortDir] Controls the sort order of the query.
* @param {ListLabelsSortByEnum} [sortBy] Controls which field the query is sorted by.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listLabels: async (labelStatus?: LabelStatus, serviceCode?: string, carrierId?: string, trackingNumber?: string, batchId?: string, rateId?: string, shipmentId?: string, warehouseId?: string, createdAtStart?: string, createdAtEnd?: string, page?: number, pageSize?: number, sortDir?: SortDir, sortBy?: ListLabelsSortByEnum, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/v2/labels`;
// 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 (labelStatus !== undefined) {
localVarQueryParameter['label_status'] = labelStatus;
}
if (serviceCode !== undefined) {
localVarQueryParameter['service_code'] = serviceCode;
}
if (carrierId !== undefined) {
localVarQueryParameter['carrier_id'] = carrierId;
}
if (trackingNumber !== undefined) {
localVarQueryParameter['tracking_number'] = trackingNumber;
}
if (batchId !== undefined) {
localVarQueryParameter['batch_id'] = batchId;
}
if (rateId !== undefined) {
localVarQueryParameter['rate_id'] = rateId;
}
if (shipmentId !== undefined) {
localVarQueryParameter['shipment_id'] = shipmentId;
}
if (warehouseId !== undefined) {
localVarQueryParameter['warehouse_id'] = warehouseId;
}
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 (page !== undefined) {
localVarQueryParameter['page'] = page;
}
if (pageSize !== undefined) {
localVarQueryParameter['page_size'] = pageSize;
}
if (sortDir !== undefined) {
localVarQueryParameter['sort_dir'] = sortDir;
}
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,
};
},
/**
* Void a specific label using its label id. For labels that are paid for at time of label creation, this will also request a refund from the carrier.
* @summary Void a label by id
* @param {string} labelId Label ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
voidLabel: async (labelId: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'labelId' is not null or undefined
assertParamExists('voidLabel', 'labelId', labelId)
const localVarPath = `/v2/labels/{label_id}/void`
.replace(`{${"label_id"}}`, encodeURIComponent(String(labelId)));
// 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,
};
},
}
};
/**
* LabelsApi - functional programming interface
* @export
*/
export const LabelsApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = LabelsApiAxiosParamCreator(configuration)
return {
/**
* Purchase and print a label for shipment.
* @summary Purchase label
* @param {CreateLabelRequestBody} createLabelRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createLabel(createLabelRequestBody: CreateLabelRequestBody, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateLabelResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.createLabel(createLabelRequestBody, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['LabelsApi.createLabel']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* When retrieving rates for shipments using the `/rates` endpoint, the returned information contains a `rate_id` property that can be used to generate a label without having to refill in the shipment information repeatedly.
* @summary Purchase label with rate id
* @param {string} rateId Rate ID
* @param {CreateLabelFromRateRequestBody} createLabelFromRateRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createLabelFromRate(rateId: string, createLabelFromRateRequestBody: CreateLabelFromRateRequestBody, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateLabelFromRateResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.createLabelFromRate(rateId, createLabelFromRateRequestBody, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['LabelsApi.createLabelFromRate']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Purchase a label using a shipment ID that has already been created with the desired address and package info.
* @summary Purchase label with shipment id
* @param {string} shipmentId Shipment ID
* @param {CreateLabelFromShipmentRequestBody} createLabelFromShipmentRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createLabelFromShipment(shipmentId: string, createLabelFromShipmentRequestBody: CreateLabelFromShipmentRequestBody, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateLabelFromShipmentResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.createLabelFromShipment(shipmentId, createLabelFromShipmentRequestBody, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['LabelsApi.createLabelFromShipment']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Create a return label for a previously created outbound label. The return label will automatically swap the ship to and ship from addresses from the original label.
* @summary Create a return label
* @param {string} labelId Label ID
* @param {CreateReturnLabelRequestBody} createReturnLabelRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createReturnLabel(labelId: string, createReturnLabelRequestBody: CreateReturnLabelRequestBody, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateReturnLabelResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.createReturnLabel(labelId, createReturnLabelRequestBody, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['LabelsApi.createReturnLabel']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Retrieve a specific label by its label id.
* @summary Get label by id
* @param {string} labelId Label ID
* @param {LabelDownloadType} [labelDownloadType]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getLabelById(labelId: string, labelDownloadType?: LabelDownloadType, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetLabelByIdResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getLabelById(labelId, labelDownloadType, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['LabelsApi.getLabelById']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Retrieve the label\'s tracking details.
* @summary Get label tracking information
* @param {string} labelId Label ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getTrackingLogFromLabel(labelId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<GetTrackingLogFromLabelResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getTrackingLogFromLabel(labelId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['LabelsApi.getTrackingLogFromLabel']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* This method returns a list of labels that you\'ve created. You can optionally filter the results as well as control their sort order and the number of results returned at a time. By default all labels are returned 25 at a time, starting with the most recently created ones. You can combine multiple filter options to narrow-down the results. For example, if you only want your UPS labels for your east coast warehouse you could query by both `warehouse_id` and `carrier_id`.
* @summary List labels
* @param {LabelStatus} [labelStatus] Only return labels that are currently in the specified status.
* @param {string} [serviceCode] Only return labels for a specific carrier service.
* @param {string} [carrierId] Carrier ID
* @param {string} [trackingNumber] The tracking number associated with a shipment
* @param {string} [batchId] Batch ID
* @param {string} [rateId] Rate ID
* @param {string} [shipmentId] Shipment 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 {SortDir} [sortDir] Controls the sort order of the query.
* @param {ListLabelsSortByEnum} [sortBy] Controls which field the query is sorted by.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async listLabels(labelStatus?: LabelStatus, serviceCode?: string, carrierId?: string, trackingNumber?: string, batchId?: string, rateId?: string, shipmentId?: string, warehouseId?: string, createdAtStart?: string, createdAtEnd?: string, page?: number, pageSize?: number, sortDir?: SortDir, sortBy?: ListLabelsSortByEnum, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListLabelsResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.listLabels(labelStatus, serviceCode, carrierId, trackingNumber, batchId, rateId, shipmentId, warehouseId, createdAtStart, createdAtEnd, page, pageSize, sortDir, sortBy, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['LabelsApi.listLabels']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
* Void a specific label using its label id. For labels that are paid for at time of label creation, this will also request a refund from the carrier.
* @summary Void a label by id
* @param {string} labelId Label ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async voidLabel(labelId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<VoidLabelResponseBody>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.voidLabel(labelId, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['LabelsApi.voidLabel']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};
/**
* LabelsApi - factory interface
* @export
*/
export const LabelsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = LabelsApiFp(configuration)
return {
/**
* Purchase and print a label for shipment.
* @summary Purchase label
* @param {CreateLabelRequestBody} createLabelRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createLabel(createLabelRequestBody: CreateLabelRequestBody, options?: RawAxiosRequestConfig): AxiosPromise<CreateLabelResponseBody> {
return localVarFp.createLabel(createLabelRequestBody, options).then((request) => request(axios, basePath));
},
/**
* When retrieving rates for shipments using the `/rates` endpoint, the returned information contains a `rate_id` property that can be used to generate a label without having to refill in the shipment information repeatedly.
* @summary Purchase label with rate id
* @param {string} rateId Rate ID
* @param {CreateLabelFromRateRequestBody} createLabelFromRateRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createLabelFromRate(rateId: string, createLabelFromRateRequestBody: CreateLabelFromRateRequestBody, options?: RawAxiosRequestConfig): AxiosPromise<CreateLabelFromRateResponseBody> {
return localVarFp.createLabelFromRate(rateId, createLabelFromRateRequestBody, options).then((request) => request(axios, basePath));
},
/**
* Purchase a label using a shipment ID that has already been created with the desired address and package info.
* @summary Purchase label with shipment id
* @param {string} shipmentId Shipment ID
* @param {CreateLabelFromShipmentRequestBody} createLabelFromShipmentRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createLabelFromShipment(shipmentId: string, createLabelFromShipmentRequestBody: CreateLabelFromShipmentRequestBody, options?: RawAxiosRequestConfig): AxiosPromise<CreateLabelFromShipmentResponseBody> {
return localVarFp.createLabelFromShipment(shipmentId, createLabelFromShipmentRequestBody, options).then((request) => request(axios, basePath));
},
/**
* Create a return label for a previously created outbound label. The return label will automatically swap the ship to and ship from addresses from the original label.
* @summary Create a return label
* @param {string} labelId Label ID
* @param {CreateReturnLabelRequestBody} createReturnLabelRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createReturnLabel(labelId: string, createReturnLabelRequestBody: CreateReturnLabelRequestBody, options?: RawAxiosRequestConfig): AxiosPromise<CreateReturnLabelResponseBody> {
return localVarFp.createReturnLabel(labelId, createReturnLabelRequestBody, options).then((request) => request(axios, basePath));
},
/**
* Retrieve a specific label by its label id.
* @summary Get label by id
* @param {string} labelId Label ID
* @param {LabelDownloadType} [labelDownloadType]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getLabelById(labelId: string, labelDownloadType?: LabelDownloadType, options?: RawAxiosRequestConfig): AxiosPromise<GetLabelByIdResponseBody> {
return localVarFp.getLabelById(labelId, labelDownloadType, options).then((request) => request(axios, basePath));
},
/**
* Retrieve the label\'s tracking details.
* @summary Get label tracking information
* @param {string} labelId Label ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getTrackingLogFromLabel(labelId: string, options?: RawAxiosRequestConfig): AxiosPromise<GetTrackingLogFromLabelResponseBody> {
return localVarFp.getTrackingLogFromLabel(labelId, options).then((request) => request(axios, basePath));
},
/**
* This method returns a list of labels that you\'ve created. You can optionally filter the results as well as control their sort order and the number of results returned at a time. By default all labels are returned 25 at a time, starting with the most recently created ones. You can combine multiple filter options to narrow-down the results. For example, if you only want your UPS labels for your east coast warehouse you could query by both `warehouse_id` and `carrier_id`.
* @summary List labels
* @param {LabelStatus} [labelStatus] Only return labels that are currently in the specified status.
* @param {string} [serviceCode] Only return labels for a specific carrier service.
* @param {string} [carrierId] Carrier ID
* @param {string} [trackingNumber] The tracking number associated with a shipment
* @param {string} [batchId] Batch ID
* @param {string} [rateId] Rate ID
* @param {string} [shipmentId] Shipment 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 {SortDir} [sortDir] Controls the sort order of the query.
* @param {ListLabelsSortByEnum} [sortBy] Controls which field the query is sorted by.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listLabels(labelStatus?: LabelStatus, serviceCode?: string, carrierId?: string, trackingNumber?: string, batchId?: string, rateId?: string, shipmentId?: string, warehouseId?: string, createdAtStart?: string, createdAtEnd?: string, page?: number, pageSize?: number, sortDir?: SortDir, sortBy?: ListLabelsSortByEnum, options?: RawAxiosRequestConfig): AxiosPromise<ListLabelsResponseBody> {
return localVarFp.listLabels(labelStatus, serviceCode, carrierId, trackingNumber, batchId, rateId, shipmentId, warehouseId, createdAtStart, createdAtEnd, page, pageSize, sortDir, sortBy, options).then((request) => request(axios, basePath));
},
/**
* Void a specific label using its label id. For labels that are paid for at time of label creation, this will also request a refund from the carrier.
* @summary Void a label by id
* @param {string} labelId Label ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
voidLabel(labelId: string, options?: RawAxiosRequestConfig): AxiosPromise<VoidLabelResponseBody> {
return localVarFp.voidLabel(labelId, options).then((request) => request(axios, basePath));
},
};
};
/**
* LabelsApi - object-oriented interface
* @export
* @class LabelsApi
* @extends {BaseAPI}
*/
export class LabelsApi extends BaseAPI {
/**
* Purchase and print a label for shipment.
* @summary Purchase label
* @param {CreateLabelRequestBody} createLabelRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof LabelsApi
*/
public createLabel(createLabelRequestBody: CreateLabelRequestBody, options?: RawAxiosRequestConfig) {
return LabelsApiFp(this.configuration).createLabel(createLabelRequestBody, options).then((request) => request(this.axios, this.basePath));
}
/**
* When retrieving rates for shipments using the `/rates` endpoint, the returned information contains a `rate_id` property that can be used to generate a label without having to refill in the shipment information repeatedly.
* @summary Purchase label with rate id
* @param {string} rateId Rate ID
* @param {CreateLabelFromRateRequestBody} createLabelFromRateRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof LabelsApi
*/
public createLabelFromRate(rateId: string, createLabelFromRateRequestBody: CreateLabelFromRateRequestBody, options?: RawAxiosRequestConfig) {
return LabelsApiFp(this.configuration).createLabelFromRate(rateId, createLabelFromRateRequestBody, options).then((request) => request(this.axios, this.basePath));
}
/**
* Purchase a label using a shipment ID that has already been created with the desired address and package info.
* @summary Purchase label with shipment id
* @param {string} shipmentId Shipment ID
* @param {CreateLabelFromShipmentRequestBody} createLabelFromShipmentRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof LabelsApi
*/
public createLabelFromShipment(shipmentId: string, createLabelFromShipmentRequestBody: CreateLabelFromShipmentRequestBody, options?: RawAxiosRequestConfig) {
return LabelsApiFp(this.configuration).createLabelFromShipment(shipmentId, createLabelFromShipmentRequestBody, options).then((request) => request(this.axios, this.basePath));
}
/**
* Create a return label for a previously created outbound label. The return label will automatically swap the ship to and ship from addresses from the original label.
* @summary Create a return label
* @param {string} labelId Label ID
* @param {CreateReturnLabelRequestBody} createReturnLabelRequestBody
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof LabelsApi
*/
public createReturnLabel(labelId: string, createReturnLabelRequestBody: CreateReturnLabelRequestBody, options?: RawAxiosRequestConfig) {
return LabelsApiFp(this.configuration).createReturnLabel(labelId, createReturnLabelRequestBody, options).then((request) => request(this.axios, this.basePath));
}
/**
* Retrieve a specific label by its label id.
* @summary Get label by id
* @param {string} labelId Label ID
* @param {LabelDownloadType} [labelDownloadType]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof LabelsApi
*/
public getLabelById(labelId: string, labelDownloadType?: LabelDownloadType, options?: RawAxiosRequestConfig) {
return LabelsApiFp(this.configuration).getLabelById(labelId, labelDownloadType, options).then((request) => request(this.axios, this.basePath));
}
/**
* Retrieve the label\'s tracking details.
* @summary Get label tracking information
* @param {string} labelId Label ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof LabelsApi
*/
public getTrackingLogFromLabel(labelId: string, options?: RawAxiosRequestConfig) {
return LabelsApiFp(this.configuration).getTrackingLogFromLabel(labelId, options).then((request) => request(this.axios, this.basePath));
}
/**
* This method returns a list of labels that you\'ve created. You can optionally filter the results as well as control their sort order and the number of results returned at a time. By default all labels are returned 25 at a time, starting with the most recently created ones. You can combine multiple filter options to narrow-down the results. For example, if you only want your UPS labels for your east coast warehouse you could query by both `warehouse_id` and `carrier_id`.
* @summary List labels
* @param {LabelStatus} [labelStatus] Only return labels that are currently in the specified status.
* @param {string} [serviceCode] Only return labels for a specific carrier service.
* @param {string} [carrierId] Carrier ID
* @param {string} [trackingNumber] The tracking number associated with a shipment
* @param {string} [batchId] Batch ID
* @param {string} [rateId] Rate ID
* @param {string} [shipmentId] Shipment 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 {SortDir} [sortDir] Controls the sort order of the query.
* @param {ListLabelsSortByEnum} [sortBy] Controls which field the query is sorted by.
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof LabelsApi
*/
public listLabels(labelStatus?: LabelStatus, serviceCode?: string, carrierId?: string, trackingNumber?: string, batchId?: string, rateId?: string, shipmentId?: string, warehouseId?: string, createdAtStart?: string, createdAtEnd?: string, page?: number, pageSize?: number, sortDir?: SortDir, sortBy?: ListLabelsSortByEnum, options?: RawAxiosRequestConfig) {
return LabelsApiFp(this.configuration).listLabels(labelStatus, serviceCode, carrierId, trackingNumber, batchId, rateId, shipmentId, warehouseId, createdAtStart, createdAtEnd, page, pageSize, sortDir, sortBy, options).then((request) => request(this.axios, this.basePath));
}
/**
* Void a specific label using its label id. For labels that are paid for at time of label creation, this will also request a refund from the carrier.
* @summary Void a label by id
* @param {string} labelId Label ID
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof LabelsApi
*/
public voidLabel(labelId: string, options?: RawAxiosRequestConfig) {
return LabelsApiFp(this.configuration).voidLabel(labelId, options).then((request) => request(this.axios, this.basePath));
}
}
/**
* @export
*/
export const ListLabelsSortByEnum = {
ModifiedAt: 'modified_at',
CreatedAt: 'created_at'
} as const;
export type ListLabelsSortByEnum = typeof ListLabelsSortByEnum[keyof typeof ListLabelsSortByEnum];