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.11 kB
import { BaseService } from '../infrastructure'; /** * A service for manipulating a shops Locations API. */ export class Locations extends BaseService { constructor(shopDomain, accessToken) { super(shopDomain, accessToken, "locations"); } /** * Gets a location with the given id. * @param id Id of the location being retrieved. * @param options Options for filtering the result. */ get(id, options) { return this.createRequest("GET", `${id}.json`, "location", options); } /** * Lists up to 250 locations. * @param options Options for filtering the results. */ list(options) { return this.createRequest("GET", `.json`, "locations", options); } /** * Counts the amount of locations. */ count() { return this.createRequest("GET", `count.json`, "count"); } /** * Lists all the inventory levels on a location. */ inventoryLevels(locationId) { return this.createRequest("GET", `${locationId}/inventory_levels.json`, "inventory_levels"); } } export default Locations;