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.

49 lines (48 loc) 1.58 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Checkouts = void 0; const infrastructure_1 = require("../infrastructure"); /** * A service for manipulating Shopify's Checkout API. * If the app is not a Sales Channel app, only the GET methods are available. PUT, and POST requests will return `422 unprocessable entity` errors. */ class Checkouts extends infrastructure_1.BaseService { constructor(shopDomain, accessToken) { super(shopDomain, accessToken, "checkouts"); } /** * Creates a new checkout. */ create(checkout) { return this.createRequest("POST", ".json", "checkout", { checkout }); } /** * Updates a checkout. */ update(token, checkout) { return this.createRequest("PUT", `${token}.json`, "checkout", { checkout }); } /** * Completes a checkout. */ complete(token) { return this.createRequest("PUT", `${token}/complete.json`, "checkout", {}); } /** * Gets a checkout with the given token. * @param token The token of the checkout to get. * @param options Options for filtering the result. */ get(token, options) { return this.createRequest("GET", `${token}.json`, "checkout", options); } /** * Retrieves a list of up to 250 checkouts. * @param options Options for pagination and filtering the result. */ list(options) { return this.createRequest("GET", ".json", "checkouts", options); } } exports.Checkouts = Checkouts; exports.default = Checkouts;