UNPKG

shopify-admin-api

Version:

Shopify Admin API is a NodeJS library built to help developers easily authenticate and make calls against the Shopify API. It was inspired by and borrows heavily from ShopifySharp.

34 lines (33 loc) 1.15 kB
import { BaseService } from '../infrastructure'; /** * A service for manipulating Shopify's InventoryItems API. */ export class InventoryItems extends BaseService { constructor(shopDomain, accessToken) { super(shopDomain, accessToken, 'inventory_items'); } /** * Gets a inventory item with the given id. * @param id Id of the inventory item being retrieved. * @param options Options for filtering the result. */ get(id, options) { return this.createRequest('GET', `${id}.json`, 'inventory_item', options); } /** * Gets a list of up to 250 of the shop's inventory items. * @param options Options for filtering the result. */ list(options) { return this.createRequest('GET', '.json', 'inventory_items', options); } /** * Updates an inventory item with the given id. * @param id The inventory items's id. * @param inventoryItem The updated inventory item. */ update(id, inventoryItem) { return this.createRequest('PUT', `${id}.json`, 'inventory_item', { inventory_item: inventoryItem }); } } export default InventoryItems;