UNPKG

@pfantato/printful-ts

Version:

Typescript SDK to integrate with Printful

27 lines (26 loc) 1.32 kB
"use strict"; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ShippingRateService = void 0; const constants_1 = require("@printful-ts/constants"); const schemas_1 = require("@printful-ts/schemas"); const printful_api_service_1 = require("./printful-api.service"); class ShippingRateService extends printful_api_service_1.PrintfulApiService { async calculateShippingRates(body, options = {}) { const _a = schemas_1.CalculateShippingRatesBody.parse(body), { store_id, locale } = _a, json = __rest(_a, ["store_id", "locale"]); return await this.request(constants_1.SHIPPING_RATES_RESOURCE, Object.assign(Object.assign({}, options), { locale, store_id, json }), schemas_1.CalculateShippingRatesResponse); } } exports.ShippingRateService = ShippingRateService;