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.

44 lines (43 loc) 1.39 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Collects = void 0; const infrastructure_1 = require("../infrastructure"); /** * A service for manipulating Shopify's Collect API. */ class Collects extends infrastructure_1.BaseService { constructor(shopDomain, accessToken) { super(shopDomain, accessToken, "collects"); } /** * Creates a new collect object, connecting a product to a custom collection. */ create(collect) { return this.createRequest("POST", ".json", "collect", { collect }); } /** * Gets a count of collects * @param id The id of the collect to get. * @param options Options for filtering the result. */ count(options) { return this.createRequest("GET", "count.json", "count", options); } /** * Gets a collect with the given id. * @param id The id of the collect to get. * @param options Options for filtering the result. */ get(id, options) { return this.createRequest("GET", `${id}.json`, "collect", options); } /** * Retrieves a list of up to 250 collects. * @param options Options for pagination and filtering the result. */ list(options) { return this.createRequest("GET", ".json", "collects", options); } } exports.Collects = Collects; exports.default = Collects;