UNPKG

shipstation-client

Version:
332 lines (331 loc) 20.6 kB
/* tslint:disable */ /* eslint-disable */ /** * ShipStation API v2 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 2.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; // @ts-ignore import { BASE_PATH, BaseAPI, operationServerMap } from '../base'; /** * ManifestsApi - axios parameter creator * @export */ export const ManifestsApiAxiosParamCreator = function (configuration) { return { /** * Each ShipStation manifest is created for a specific warehouse, so you\'ll need to provide the warehouse_id rather than the ship_from address. You can create a warehouse for each location that you want to create manifests for. * @summary Create manifest * @param {CreateManifestRequestBody} createManifestRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ createManifest: (createManifestRequestBody_1, ...args_1) => __awaiter(this, [createManifestRequestBody_1, ...args_1], void 0, function* (createManifestRequestBody, options = {}) { // verify required parameter 'createManifestRequestBody' is not null or undefined assertParamExists('createManifest', 'createManifestRequestBody', createManifestRequestBody); const localVarPath = `/v2/manifests`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication api_keys required yield setApiKeyToObject(localVarHeaderParameter, "api-key", configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); localVarRequestOptions.data = serializeDataIfNeeded(createManifestRequestBody, localVarRequestOptions, configuration); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), /** * Get Manifest By Id * @summary Get manifest by id * @param {string} manifestId The Manifest Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ getManifestById: (manifestId_1, ...args_1) => __awaiter(this, [manifestId_1, ...args_1], void 0, function* (manifestId, options = {}) { // verify required parameter 'manifestId' is not null or undefined assertParamExists('getManifestById', 'manifestId', manifestId); const localVarPath = `/v2/manifests/{manifest_id}` .replace(`{${"manifest_id"}}`, encodeURIComponent(String(manifestId))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication api_keys required yield setApiKeyToObject(localVarHeaderParameter, "api-key", configuration); setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), /** * Similar to querying shipments, we allow you to query manifests since there will likely be a large number over a long period of time. * @summary List manifests * @param {string} [warehouseId] Warehouse ID * @param {string} [shipDateStart] ship date start range * @param {string} [shipDateEnd] ship date end range * @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} [carrierId] Carrier ID * @param {number} [page] Return a specific page of results. Defaults to the first page. If set to a number that\&#39;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 {Array<string>} [labelIds] * @param {*} [options] Override http request option. * @throws {RequiredError} */ listManifests: (warehouseId_1, shipDateStart_1, shipDateEnd_1, createdAtStart_1, createdAtEnd_1, carrierId_1, page_1, pageSize_1, labelIds_1, ...args_1) => __awaiter(this, [warehouseId_1, shipDateStart_1, shipDateEnd_1, createdAtStart_1, createdAtEnd_1, carrierId_1, page_1, pageSize_1, labelIds_1, ...args_1], void 0, function* (warehouseId, shipDateStart, shipDateEnd, createdAtStart, createdAtEnd, carrierId, page, pageSize, labelIds, options = {}) { const localVarPath = `/v2/manifests`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication api_keys required yield setApiKeyToObject(localVarHeaderParameter, "api-key", configuration); if (warehouseId !== undefined) { localVarQueryParameter['warehouse_id'] = warehouseId; } if (shipDateStart !== undefined) { localVarQueryParameter['ship_date_start'] = (shipDateStart instanceof Date) ? shipDateStart.toISOString() : shipDateStart; } if (shipDateEnd !== undefined) { localVarQueryParameter['ship_date_end'] = (shipDateEnd instanceof Date) ? shipDateEnd.toISOString() : shipDateEnd; } 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 (carrierId !== undefined) { localVarQueryParameter['carrier_id'] = carrierId; } if (page !== undefined) { localVarQueryParameter['page'] = page; } if (pageSize !== undefined) { localVarQueryParameter['page_size'] = pageSize; } if (labelIds) { localVarQueryParameter['label_ids'] = labelIds; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), }; }; /** * ManifestsApi - functional programming interface * @export */ export const ManifestsApiFp = function (configuration) { const localVarAxiosParamCreator = ManifestsApiAxiosParamCreator(configuration); return { /** * Each ShipStation manifest is created for a specific warehouse, so you\'ll need to provide the warehouse_id rather than the ship_from address. You can create a warehouse for each location that you want to create manifests for. * @summary Create manifest * @param {CreateManifestRequestBody} createManifestRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ createManifest(createManifestRequestBody, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.createManifest(createManifestRequestBody, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['ManifestsApi.createManifest']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, /** * Get Manifest By Id * @summary Get manifest by id * @param {string} manifestId The Manifest Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ getManifestById(manifestId, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.getManifestById(manifestId, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['ManifestsApi.getManifestById']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, /** * Similar to querying shipments, we allow you to query manifests since there will likely be a large number over a long period of time. * @summary List manifests * @param {string} [warehouseId] Warehouse ID * @param {string} [shipDateStart] ship date start range * @param {string} [shipDateEnd] ship date end range * @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} [carrierId] Carrier ID * @param {number} [page] Return a specific page of results. Defaults to the first page. If set to a number that\&#39;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 {Array<string>} [labelIds] * @param {*} [options] Override http request option. * @throws {RequiredError} */ listManifests(warehouseId, shipDateStart, shipDateEnd, createdAtStart, createdAtEnd, carrierId, page, pageSize, labelIds, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.listManifests(warehouseId, shipDateStart, shipDateEnd, createdAtStart, createdAtEnd, carrierId, page, pageSize, labelIds, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['ManifestsApi.listManifests']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, }; }; /** * ManifestsApi - factory interface * @export */ export const ManifestsApiFactory = function (configuration, basePath, axios) { const localVarFp = ManifestsApiFp(configuration); return { /** * Each ShipStation manifest is created for a specific warehouse, so you\'ll need to provide the warehouse_id rather than the ship_from address. You can create a warehouse for each location that you want to create manifests for. * @summary Create manifest * @param {CreateManifestRequestBody} createManifestRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} */ createManifest(createManifestRequestBody, options) { return localVarFp.createManifest(createManifestRequestBody, options).then((request) => request(axios, basePath)); }, /** * Get Manifest By Id * @summary Get manifest by id * @param {string} manifestId The Manifest Id * @param {*} [options] Override http request option. * @throws {RequiredError} */ getManifestById(manifestId, options) { return localVarFp.getManifestById(manifestId, options).then((request) => request(axios, basePath)); }, /** * Similar to querying shipments, we allow you to query manifests since there will likely be a large number over a long period of time. * @summary List manifests * @param {string} [warehouseId] Warehouse ID * @param {string} [shipDateStart] ship date start range * @param {string} [shipDateEnd] ship date end range * @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} [carrierId] Carrier ID * @param {number} [page] Return a specific page of results. Defaults to the first page. If set to a number that\&#39;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 {Array<string>} [labelIds] * @param {*} [options] Override http request option. * @throws {RequiredError} */ listManifests(warehouseId, shipDateStart, shipDateEnd, createdAtStart, createdAtEnd, carrierId, page, pageSize, labelIds, options) { return localVarFp.listManifests(warehouseId, shipDateStart, shipDateEnd, createdAtStart, createdAtEnd, carrierId, page, pageSize, labelIds, options).then((request) => request(axios, basePath)); }, }; }; /** * ManifestsApi - object-oriented interface * @export * @class ManifestsApi * @extends {BaseAPI} */ export class ManifestsApi extends BaseAPI { /** * Each ShipStation manifest is created for a specific warehouse, so you\'ll need to provide the warehouse_id rather than the ship_from address. You can create a warehouse for each location that you want to create manifests for. * @summary Create manifest * @param {CreateManifestRequestBody} createManifestRequestBody * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ManifestsApi */ createManifest(createManifestRequestBody, options) { return ManifestsApiFp(this.configuration).createManifest(createManifestRequestBody, options).then((request) => request(this.axios, this.basePath)); } /** * Get Manifest By Id * @summary Get manifest by id * @param {string} manifestId The Manifest Id * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ManifestsApi */ getManifestById(manifestId, options) { return ManifestsApiFp(this.configuration).getManifestById(manifestId, options).then((request) => request(this.axios, this.basePath)); } /** * Similar to querying shipments, we allow you to query manifests since there will likely be a large number over a long period of time. * @summary List manifests * @param {string} [warehouseId] Warehouse ID * @param {string} [shipDateStart] ship date start range * @param {string} [shipDateEnd] ship date end range * @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} [carrierId] Carrier ID * @param {number} [page] Return a specific page of results. Defaults to the first page. If set to a number that\&#39;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 {Array<string>} [labelIds] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ManifestsApi */ listManifests(warehouseId, shipDateStart, shipDateEnd, createdAtStart, createdAtEnd, carrierId, page, pageSize, labelIds, options) { return ManifestsApiFp(this.configuration).listManifests(warehouseId, shipDateStart, shipDateEnd, createdAtStart, createdAtEnd, carrierId, page, pageSize, labelIds, options).then((request) => request(this.axios, this.basePath)); } }