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.
57 lines (56 loc) • 1.61 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Pages = void 0;
const infrastructure_1 = require("../infrastructure");
/**
* A service for manipulating Shopify pages.
*/
class Pages extends infrastructure_1.BaseService {
constructor(shopDomain, accessToken) {
super(shopDomain, accessToken, "pages");
}
/**
* Creates a new page.
* @param page The page being created.
*/
create(page) {
return this.createRequest("POST", `.json`, "page", { page });
}
/**
* Retrieves a single page by its ID.
* @param id Id of the page to retrieve.
* @param options Options for filtering the result.
*/
get(id, options) {
return this.createRequest("GET", `${id}.json`, "page", options);
}
/**
* Updates a page with the given id.
* @param id Id of the page being updated.
* @param page The updated page.
*/
update(id, page) {
return this.createRequest("PUT", `${id}.json`, "page", { page });
}
/**
* Retrieve a list of all pages.
* @param options Options for filtering the results.
*/
list(options) {
return this.createRequest("GET", `.json`, "pages", options);
}
/**
* Retrieves a page count.
*/
count(options) {
return this.createRequest("GET", "count.json", "count", options);
}
/**
* Deletes a page with the given id.
* @param id Id of the page being deleted.
*/
delete(id) {
return this.createRequest("DELETE", `${id}.json`);
}
}
exports.Pages = Pages;