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.

38 lines (37 loc) 1.32 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.InventoryItems = void 0; const infrastructure_1 = require("../infrastructure"); /** * A service for manipulating Shopify's InventoryItems API. */ class InventoryItems extends infrastructure_1.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 }); } } exports.InventoryItems = InventoryItems; exports.default = InventoryItems;