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.

51 lines (50 loc) 1.48 kB
import { BaseService } from '../infrastructure'; /** * A service for manipulating Shopify redirects. */ export class Redirects extends 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`); } } export default Redirects;