UNPKG

shipstation-node

Version:
83 lines (82 loc) 2.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InventoryWarehouses = void 0; const BaseResource_1 = require("../../BaseResource"); /** * [Official Documentation](https://docs.shipstation.com/openapi/inventory) * * Manage inventory, adjust quantities, and handle warehouses and locations. */ class InventoryWarehouses extends BaseResource_1.BaseResource { constructor(shipstation) { super(shipstation, 'inventory_warehouses'); } /** * [Official Documentation](https://docs.shipstation.com/openapi/inventory/getinventorywarehouses) * * @param options Options for the request * * @returns List of inventory warehouses */ async list(options) { return this.shipstation.request({ url: this.baseUrl, method: 'GET', params: options }); } /** * [Official Documentation](https://docs.shipstation.com/openapi/inventory/addnewinventorywarehouse) * * @param name Name of the inventory warehouse * * @returns The newly created inventory warehouse */ async create(name) { return this.shipstation.request({ url: this.baseUrl, method: 'POST', data: { name } }); } /** * [Official Documentation](https://docs.shipstation.com/openapi/inventory/getinventorywarehousebyid) * * @param inventoryWarehouseId ID of the inventory warehouse to get * * @returns The inventory warehouse with the given ID */ async getById(inventoryWarehouseId) { return this.shipstation.request({ url: `${this.baseUrl}/${inventoryWarehouseId}`, method: 'GET' }); } /** * [Official Documentation](https://docs.shipstation.com/openapi/inventory/updateinventorywarehouse) * * @param inventoryWarehouseId ID of the inventory warehouse to update * @param name New name for the inventory warehouse * * @returns The updated inventory warehouse */ async update(inventoryWarehouseId, name) { return this.shipstation.request({ url: `${this.baseUrl}/${inventoryWarehouseId}`, method: 'PUT', data: { name } }); } /** * [Official Documentation](https://docs.shipstation.com/openapi/inventory/deleteinventorywarehouse) * * @param inventoryWarehouseId ID of the inventory warehouse to delete */ async delete(inventoryWarehouseId) { await this.shipstation.request({ url: `${this.baseUrl}/${inventoryWarehouseId}`, method: 'DELETE' }); } } exports.InventoryWarehouses = InventoryWarehouses;