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) • 1.72 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Blogs = void 0;
const infrastructure_1 = require("../infrastructure");
/**
* A service for manipulating a Shopify shop's blogs. For manipulating a blog's posts, use the Articles class instead.
*/
class Blogs extends infrastructure_1.BaseService {
constructor(shopDomain, accessToken) {
super(shopDomain, accessToken, "blogs");
}
/**
* Creates a new blog.
* @param blog The Blog being created.
*/
create(blog) {
return this.createRequest("POST", `.json`, "blog", { blog });
}
/**
* Gets a blog with the given id.
* @param id Id of the blog to retrieve.
* @param options Options for filtering the result.
*/
get(id, options) {
return this.createRequest("GET", `${id}.json`, "blog", options);
}
/**
* Updates the blog with the given id.
* @param id Id of the blog being updated.
* @param blog The updated blog.
*/
update(id, blog) {
return this.createRequest("PUT", `${id}.json`, "blog", { blog });
}
/**
* Gets a list of all blogs on the shop.
* @param options Options for filtering the results.
*/
list(options) {
return this.createRequest("GET", `.json`, "blogs", options);
}
/**
* Gets a count of all blogs on the shop.
*/
count(options) {
return this.createRequest("GET", "count.json", "count");
}
/**
* Deletes the blog with the given id.
* @param id Id of the blog being deleted.
*/
delete(id) {
return this.createRequest("DELETE", `${id}.json`);
}
}
exports.Blogs = Blogs;
exports.default = Blogs;