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.
58 lines (57 loc) • 2.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SmartCollections = void 0;
const infrastructure_1 = require("../infrastructure");
class SmartCollections extends infrastructure_1.BaseService {
constructor(shopDomain, accessToken) {
super(shopDomain, accessToken, "smart_collections");
}
/**
* Get a count of all smart collections that contain a given product
* @param options Options for filtering the results.
* @see https://help.shopify.com/api/reference/smartcollection#count
*/
count(options) {
return this.createRequest("GET", "count.json", "count", options);
}
/**
* Get a list of all smart collections that contain a given product
* @param options Options for filtering the results.
*/
list(options) {
return this.createRequest("GET", ".json", "smart_collections", options);
}
/**
* Get a single collection
* @param id The collection's id.
* @param options Options for filtering the results.
*/
get(id, options) {
return this.createRequest("GET", `${id}.json`, "smart_collection", options);
}
/**
* Create a new smart collection.
* @param collection The collection being created.
* @param options Options for creating the collection.
*/
create(collection) {
return this.createRequest("POST", ".json", "smart_collection", { smart_collection: collection });
}
/**
* Updates an collection with the given id.
* @param id The collection's id.
* @param collection The updated collection.
*/
update(id, collection) {
return this.createRequest("PUT", `${id}.json`, "smart_collection", { smart_collection: collection });
}
/**
* Deletes an collection with the given id.
* @param id The collection's id.
*/
delete(id) {
return this.createRequest("DELETE", `${id}.json`);
}
}
exports.SmartCollections = SmartCollections;
exports.default = SmartCollections;