UNPKG

shipstation-client

Version:
748 lines (747 loc) 49.9 kB
"use strict"; /* tslint:disable */ /* eslint-disable */ /** * ShipStation API v2 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 2.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ListLabelsSortByEnum = exports.LabelsApi = exports.LabelsApiFactory = exports.LabelsApiFp = exports.LabelsApiAxiosParamCreator = void 0; const axios_1 = require("axios"); // Some imports not used depending on template conditions // @ts-ignore const common_1 = require("../common"); // @ts-ignore const base_1 = require("../base"); /** * LabelsApi - axios parameter creator * @export */ const LabelsApiAxiosParamCreator = function (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_1, ...args_1) => __awaiter(this, [createLabelRequestBody_1, ...args_1], void 0, function* (createLabelRequestBody, options = {}) { // verify required parameter 'createLabelRequestBody' is not null or undefined (0, common_1.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, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication api_keys required yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "api-key", configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(createLabelRequestBody, localVarRequestOptions, configuration); return { url: (0, common_1.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: (rateId_1, createLabelFromRateRequestBody_1, ...args_1) => __awaiter(this, [rateId_1, createLabelFromRateRequestBody_1, ...args_1], void 0, function* (rateId, createLabelFromRateRequestBody, options = {}) { // verify required parameter 'rateId' is not null or undefined (0, common_1.assertParamExists)('createLabelFromRate', 'rateId', rateId); // verify required parameter 'createLabelFromRateRequestBody' is not null or undefined (0, common_1.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, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication api_keys required yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "api-key", configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(createLabelFromRateRequestBody, localVarRequestOptions, configuration); return { url: (0, common_1.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: (shipmentId_1, createLabelFromShipmentRequestBody_1, ...args_1) => __awaiter(this, [shipmentId_1, createLabelFromShipmentRequestBody_1, ...args_1], void 0, function* (shipmentId, createLabelFromShipmentRequestBody, options = {}) { // verify required parameter 'shipmentId' is not null or undefined (0, common_1.assertParamExists)('createLabelFromShipment', 'shipmentId', shipmentId); // verify required parameter 'createLabelFromShipmentRequestBody' is not null or undefined (0, common_1.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, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication api_keys required yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "api-key", configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(createLabelFromShipmentRequestBody, localVarRequestOptions, configuration); return { url: (0, common_1.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: (labelId_1, createReturnLabelRequestBody_1, ...args_1) => __awaiter(this, [labelId_1, createReturnLabelRequestBody_1, ...args_1], void 0, function* (labelId, createReturnLabelRequestBody, options = {}) { // verify required parameter 'labelId' is not null or undefined (0, common_1.assertParamExists)('createReturnLabel', 'labelId', labelId); // verify required parameter 'createReturnLabelRequestBody' is not null or undefined (0, common_1.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, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication api_keys required yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "api-key", configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(createReturnLabelRequestBody, localVarRequestOptions, configuration); return { url: (0, common_1.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: (labelId_1, labelDownloadType_1, ...args_1) => __awaiter(this, [labelId_1, labelDownloadType_1, ...args_1], void 0, function* (labelId, labelDownloadType, options = {}) { // verify required parameter 'labelId' is not null or undefined (0, common_1.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, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication api_keys required yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "api-key", configuration); if (labelDownloadType !== undefined) { localVarQueryParameter['label_download_type'] = labelDownloadType; } (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * 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_1, ...args_1) => __awaiter(this, [labelId_1, ...args_1], void 0, function* (labelId, options = {}) { // verify required parameter 'labelId' is not null or undefined (0, common_1.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, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication api_keys required yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "api-key", configuration); (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * 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_1, serviceCode_1, carrierId_1, trackingNumber_1, batchId_1, rateId_1, shipmentId_1, warehouseId_1, createdAtStart_1, createdAtEnd_1, page_1, pageSize_1, sortDir_1, sortBy_1, ...args_1) => __awaiter(this, [labelStatus_1, serviceCode_1, carrierId_1, trackingNumber_1, batchId_1, rateId_1, shipmentId_1, warehouseId_1, createdAtStart_1, createdAtEnd_1, page_1, pageSize_1, sortDir_1, sortBy_1, ...args_1], void 0, function* (labelStatus, serviceCode, carrierId, trackingNumber, batchId, rateId, shipmentId, warehouseId, createdAtStart, createdAtEnd, page, pageSize, sortDir, sortBy, options = {}) { const localVarPath = `/v2/labels`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication api_keys required yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "api-key", configuration); if (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 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; } if (sortDir !== undefined) { localVarQueryParameter['sort_dir'] = sortDir; } if (sortBy !== undefined) { localVarQueryParameter['sort_by'] = sortBy; } (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), /** * 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_1, ...args_1) => __awaiter(this, [labelId_1, ...args_1], void 0, function* (labelId, options = {}) { // verify required parameter 'labelId' is not null or undefined (0, common_1.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, common_1.DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'PUT' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication api_keys required yield (0, common_1.setApiKeyToObject)(localVarHeaderParameter, "api-key", configuration); (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: (0, common_1.toPathString)(localVarUrlObj), options: localVarRequestOptions, }; }), }; }; exports.LabelsApiAxiosParamCreator = LabelsApiAxiosParamCreator; /** * LabelsApi - functional programming interface * @export */ const LabelsApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.LabelsApiAxiosParamCreator)(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, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.createLabel(createLabelRequestBody, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['LabelsApi.createLabel']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, /** * 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, createLabelFromRateRequestBody, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.createLabelFromRate(rateId, createLabelFromRateRequestBody, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['LabelsApi.createLabelFromRate']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, /** * 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, createLabelFromShipmentRequestBody, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.createLabelFromShipment(shipmentId, createLabelFromShipmentRequestBody, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['LabelsApi.createLabelFromShipment']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, /** * Create a 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, createReturnLabelRequestBody, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.createReturnLabel(labelId, createReturnLabelRequestBody, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['LabelsApi.createReturnLabel']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, /** * 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, labelDownloadType, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.getLabelById(labelId, labelDownloadType, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['LabelsApi.getLabelById']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, /** * 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, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.getTrackingLogFromLabel(labelId, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['LabelsApi.getTrackingLogFromLabel']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, /** * 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, serviceCode, carrierId, trackingNumber, batchId, rateId, shipmentId, warehouseId, createdAtStart, createdAtEnd, page, pageSize, sortDir, sortBy, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.listLabels(labelStatus, serviceCode, carrierId, trackingNumber, batchId, rateId, shipmentId, warehouseId, createdAtStart, createdAtEnd, page, pageSize, sortDir, sortBy, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['LabelsApi.listLabels']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, /** * 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, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.voidLabel(labelId, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = base_1.operationServerMap['LabelsApi.voidLabel']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, }; }; exports.LabelsApiFp = LabelsApiFp; /** * LabelsApi - factory interface * @export */ const LabelsApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.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, options) { 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, createLabelFromRateRequestBody, options) { 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, createLabelFromShipmentRequestBody, options) { 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, createReturnLabelRequestBody, options) { 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, labelDownloadType, options) { 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, options) { 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, serviceCode, carrierId, trackingNumber, batchId, rateId, shipmentId, warehouseId, createdAtStart, createdAtEnd, page, pageSize, sortDir, sortBy, options) { 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, options) { return localVarFp.voidLabel(labelId, options).then((request) => request(axios, basePath)); }, }; }; exports.LabelsApiFactory = LabelsApiFactory; /** * LabelsApi - object-oriented interface * @export * @class LabelsApi * @extends {BaseAPI} */ class LabelsApi extends base_1.BaseAPI { /** * Purchase and print a label for shipment. * @summary Purchase label * @param {CreateLabelRequestBody} createLabelRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LabelsApi */ createLabel(createLabelRequestBody, options) { return (0, exports.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 */ createLabelFromRate(rateId, createLabelFromRateRequestBody, options) { return (0, exports.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 */ createLabelFromShipment(shipmentId, createLabelFromShipmentRequestBody, options) { return (0, exports.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 */ createReturnLabel(labelId, createReturnLabelRequestBody, options) { return (0, exports.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 */ getLabelById(labelId, labelDownloadType, options) { return (0, exports.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 */ getTrackingLogFromLabel(labelId, options) { return (0, exports.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 */ listLabels(labelStatus, serviceCode, carrierId, trackingNumber, batchId, rateId, shipmentId, warehouseId, createdAtStart, createdAtEnd, page, pageSize, sortDir, sortBy, options) { return (0, exports.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 */ voidLabel(labelId, options) { return (0, exports.LabelsApiFp)(this.configuration).voidLabel(labelId, options).then((request) => request(this.axios, this.basePath)); } } exports.LabelsApi = LabelsApi; /** * @export */ exports.ListLabelsSortByEnum = { ModifiedAt: 'modified_at', CreatedAt: 'created_at' };