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.
55 lines (54 loc) • 1.64 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Redirects = void 0;
const infrastructure_1 = require("../infrastructure");
/**
* A service for manipulating Shopify redirects.
*/
class Redirects extends infrastructure_1.BaseService {
constructor(shopDomain, accessToken) {
super(shopDomain, accessToken, "redirects");
}
/**
* Gets a count of all of the shop's redirects.
* @param options Options for filtering the results.
*/
count(options) {
return this.createRequest("GET", "count.json", "count", options);
}
/**
* Gets a list of up to 250 of the shop's redirects.
* @param options Options for filtering the results.
*/
list(options) {
return this.createRequest("GET", ".json", "redirects", options);
}
/**
* Retrieves the redirect with the given id.
* @param options Options for filtering the results.
*/
get(id, options) {
return this.createRequest("GET", `${id}.json`, "redirect", options);
}
/**
* Creates a new redirect.
*/
create(redirect) {
return this.createRequest("POST", ".json", "redirect", { redirect });
}
/**
* Updates the redirect with the given id.
* @param tag The updated redirect.
*/
update(id, redirect) {
return this.createRequest("PUT", `${id}.json`, "redirect", { redirect });
}
/**
* Deletes the redirect with the given id.
*/
delete(id) {
return this.createRequest("DELETE", `${id}.json`);
}
}
exports.Redirects = Redirects;
exports.default = Redirects;