UNPKG

shipstation-client

Version:
339 lines (338 loc) 21.2 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.ManifestsApi = exports.ManifestsApiFactory = exports.ManifestsApiFp = exports.ManifestsApiAxiosParamCreator = 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"); /** * ManifestsApi - axios parameter creator * @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 (0, common_1.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, 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)(createManifestRequestBody, localVarRequestOptions, configuration); return { url: (0, common_1.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 (0, common_1.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, 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, }; }), /** * 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, 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 (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; } (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.ManifestsApiAxiosParamCreator = ManifestsApiAxiosParamCreator; /** * ManifestsApi - functional programming interface * @export */ const ManifestsApiFp = function (configuration) { const localVarAxiosParamCreator = (0, exports.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 = base_1.operationServerMap['ManifestsApi.createManifest']) === 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); }); }, /** * 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 = base_1.operationServerMap['ManifestsApi.getManifestById']) === 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); }); }, /** * 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 = base_1.operationServerMap['ManifestsApi.listManifests']) === 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.ManifestsApiFp = ManifestsApiFp; /** * ManifestsApi - factory interface * @export */ const ManifestsApiFactory = function (configuration, basePath, axios) { const localVarFp = (0, exports.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)); }, }; }; exports.ManifestsApiFactory = ManifestsApiFactory; /** * ManifestsApi - object-oriented interface * @export * @class ManifestsApi * @extends {BaseAPI} */ class ManifestsApi extends base_1.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 (0, exports.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 (0, exports.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 (0, exports.ManifestsApiFp)(this.configuration).listManifests(warehouseId, shipDateStart, shipDateEnd, createdAtStart, createdAtEnd, carrierId, page, pageSize, labelIds, options).then((request) => request(this.axios, this.basePath)); } } exports.ManifestsApi = ManifestsApi;