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.

54 lines (53 loc) 1.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GiftCards = void 0; const infrastructure_1 = require("../infrastructure"); /** * A service for manipulating Shopify Gift Cards */ class GiftCards extends infrastructure_1.BaseService { constructor(shopDomain, accessToken) { super(shopDomain, accessToken, "gift_cards"); } /** * Creates a new Gift Card. */ create(giftCard) { return this.createRequest("POST", ".json", "gift_card", { gift_card: giftCard }); } /** * Deletes the Gift Card with the given id. */ count() { return this.createRequest("GET", `count.json`, "count"); } /** * Gets a paged list of up to 250 of the shop's Gift Cards * @param options Options for filtering the results. */ list(options) { return this.createRequest("GET", ".json", "gift_cards", options); } /** * Retrieves the Gift Card with the given id. * @param options Options for filtering the results. */ get(id) { return this.createRequest("GET", `${id}.json`, "gift_card"); } /** * Disable a Gift Card. */ disable(id) { return this.createRequest("POST", `${id}/disable.json`, "gift_card"); } /** * Search for Giftcards matching the specified criteria * @param options Options for filtering the results. */ search(options) { return this.createRequest("GET", "search.json", "gift_cards", options); } } exports.GiftCards = GiftCards; exports.default = GiftCards;