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.

58 lines (57 loc) 1.88 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const base_service_1 = __importDefault(require("../infrastructure/base_service")); class Countries extends base_service_1.default { constructor(shopDomain, accessToken) { super(shopDomain, accessToken, "countries"); } /** * Gets a count of all of the shop's countries. * @param options Options for filtering the results. */ count() { return this.createRequest("GET", "count.json", "count"); } /** * Gets a list of up to 250 of the shop's countries. * @param options Options for filtering the results. */ list(options) { return this.createRequest("GET", ".json", "countries", options); } /** * Gets the country with the given id. * @param countryId The country's id. * @param options Options for filtering the results. */ get(countryId, options) { return this.createRequest("GET", `${countryId}.json`, "country", options); } /** * Creates an country. * @param country The country being created. * @param options Options for creating the country. */ create(country) { return this.createRequest("POST", ".json", "country", { country }); } /** * Updates an country with the given id. * @param id The country's id. * @param country The updated country. */ update(id, country) { return this.createRequest("PUT", `${id}.json`, "country", { country }); } /** * Deletes an country with the given id. * @param id The country's id. */ delete(id) { return this.createRequest("DELETE", `${id}.json`); } } exports.default = Countries;