UNPKG

inventora-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.

65 lines (64 loc) 2.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Products = void 0; const infrastructure_1 = require("../infrastructure"); class Products extends infrastructure_1.BaseService { constructor(shopDomain, accessToken) { super(shopDomain, accessToken, "products"); } /** * Gets a count of all of the shop's Products. * @param options Options for filtering the results. * @see https://help.shopify.com/api/reference/product#count */ count(options) { return this.createRequest("GET", "count.json", "count", options); } /** * Gets a list of up to 250 of the shop's Products. * @param options Options for filtering the results. */ list(options) { return this.createRequest("GET", ".json", "products", options); } /** * Gets the Product with the given id. * @param id The Product's id. * @param options Options for filtering the results. */ get(id, options) { return this.createRequest("GET", `${id}.json`, "product", options); } /** * Creates an Product. * @param product The Product being created. * @param options Options for creating the Product. */ create(product) { return this.createRequest("POST", ".json", "product", { product }); } /** * Updates an Product with the given id. * @param id The Product's id. * @param product The updated Product. */ update(id, product) { return this.createRequest("PUT", `${id}.json`, "product", { product }); } /** * Deletes an Product with the given id. * @param id The Product's id. */ delete(id) { return this.createRequest("DELETE", `${id}.json`); } /** * Gets a list of all of the shop's Products. * @param options Options for filtering the results. */ listAll(options) { return this.createPaginatedRequest(".json", "products", options); } } exports.Products = Products; exports.default = Products;