UNPKG

shipstation-node

Version:
113 lines (112 loc) 4.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Warehouses = void 0; const BaseResource_1 = require("../../BaseResource"); class Warehouses extends BaseResource_1.BaseResource { constructor(shipstation) { super(shipstation, 'warehouses'); } /** * [Official Documentation](https://www.shipstation.com/docs/api/warehouses/get/) * * Returns a list of active Ship From Locations (formerly known as warehouses) on the ShipStation account. * * **NOTE:** In the API, the endpoint is called warehouse, but the process actually affects Ship From locations in the * UI on the application side of operations. * * @param warehouseId A unique ID generated by ShipStation and assigned to each Ship From Location * (formerly known as warehouse). * * @returns The warehouse details. */ async get(warehouseId) { return this.shipstation.request({ url: `${this.baseUrl}/${warehouseId}`, method: 'GET' }); } /** * [Official Documentation](https://www.shipstation.com/docs/api/warehouses/list/) * * Retrieves a list of your Ship From Locations (formerly known as warehouses). * * **NOTE:** In the API, the endpoint is called warehouse, but the process actually affects Ship From locations in the * UI on the application side of operations. * * @returns A list of warehouses. */ async list() { return this.shipstation.request({ url: this.baseUrl, method: 'GET' }); } /** * [Official Documentation](https://www.shipstation.com/docs/api/warehouses/create/) * * Adds a Ship From Location (formerly known as warehouse) to your account. * * **NOTE:** In the API, the endpoint is called warehouse, but the process actually affects Ship From locations on the * application side of operations. * * @param data The data for the request. * * @returns The created warehouse. */ async create(data) { return this.shipstation.request({ url: `${this.baseUrl}/createwarehouse`, method: 'POST', data }); } /** * [Official Documentation](https://www.shipstation.com/docs/api/warehouses/update/) * * Updates an existing Ship From Location (formerly known as a warehouse). This call does not currently support * partial updates. * * The entire resource must be provided in the body of the request. If a `returnAddress` object is not specified, your * `originAddress` will be used as your `returnAddress`. * * **NOTE:** In the API, the endpoint is called `warehouse`, but the process actually affects Ship From locations in * the UI on the application side of operations. * * @param warehouseId A unique ID generated by ShipStation and assigned to each Ship From Location * (formerly known as warehouse). * * @returns The updated warehouse. */ async update(warehouseId, data) { return this.shipstation.request({ url: `${this.baseUrl}/${warehouseId}`, method: 'PUT', data }); } /** * [Official Documentation](https://www.shipstation.com/docs/api/warehouses/delete/) * * Removes a warehouse from ShipStation's UI and sets it to Inactive status. * * **NOTE:** * * In the API, the endpoint is called warehouse, but the process actually affects Ship From locations in the UI on the * application side of operations. * * This is a "soft" delete action, so the warehouse (or Ship From location) will still exist in the database, but this * action will set it to Inactive status. * * @param warehouseId A unique ID generated by ShipStation and assigned to each Ship From Location * (formerly known as warehouse). * * @returns Status of the delete operation. */ async delete(warehouseId) { return this.shipstation.request({ url: `${this.baseUrl}/${warehouseId}`, method: 'DELETE' }); } } exports.Warehouses = Warehouses;