shipstation-node
Version:
Unofficial Node.js wrapper for the ShipStation API
83 lines (82 loc) • 2.73 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.InventoryLocations = 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 InventoryLocations extends BaseResource_1.BaseResource {
constructor(shipstation) {
super(shipstation, 'inventory_locations');
}
/**
* [Official Documentation](https://docs.shipstation.com/openapi/inventory/listinventorylocations)
*
* @param options Options for the request
*
* @returns List of inventory locations
*/
async list(options) {
return this.shipstation.request({
url: this.baseUrl,
method: 'GET',
params: options
});
}
/**
* [Official Documentation](https://docs.shipstation.com/openapi/inventory/createinventorylocation)
*
* @param data Data for creating the inventory location
*
* @returns The newly created inventory location
*/
async create(data) {
return this.shipstation.request({
url: this.baseUrl,
method: 'POST',
data
});
}
/**
* [Official Documentation](https://docs.shipstation.com/openapi/inventory/getinventorylocationbyid)
*
* @param inventoryLocationId ID of the inventory location to get
*
* @returns The inventory location with the given ID
*/
async getById(inventoryLocationId) {
return this.shipstation.request({
url: `${this.baseUrl}/${inventoryLocationId}`,
method: 'GET'
});
}
/**
* [Official Documentation](https://docs.shipstation.com/openapi/inventory/updateinventorylocation)
*
* @param inventoryLocationId ID of the inventory location to update
* @param name New name for the inventory location
*/
async update(inventoryLocationId, name) {
await this.shipstation.request({
url: `${this.baseUrl}/${inventoryLocationId}`,
method: 'PUT',
data: { name }
});
}
/**
* [Official Documentation](https://docs.shipstation.com/openapi/inventory/deleteinventorylocation)
*
* @param inventoryLocationId ID of the inventory location to delete
* @param options Options for the request
*/
async delete(inventoryLocationId, options) {
await this.shipstation.request({
url: `${this.baseUrl}/${inventoryLocationId}`,
method: 'DELETE',
params: options
});
}
}
exports.InventoryLocations = InventoryLocations;