@pfantato/printful-ts
Version:
Typescript SDK to integrate with Printful
28 lines (27 loc) • 1.6 kB
JavaScript
;
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.WarehouseProductsService = 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 WarehouseProductsService extends printful_api_service_1.PrintfulApiService {
async listWarehouseProducts(params, options = {}) {
const _a = schemas_1.ListWarehouseProductsSearchParams.parse(params), { store_id } = _a, searchParams = __rest(_a, ["store_id"]);
return await this.request(constants_1.WAREHOUSE_PRODUCTS_SERVICE, Object.assign(Object.assign({}, options), { store_id, searchParams }), schemas_1.ListWarehouseProductsResponse);
}
async getWarehouseProduct(warehouse_product_id, store_id, options = {}) {
return await this.request(`${constants_1.WAREHOUSE_PRODUCTS_SERVICE}/${warehouse_product_id}`, Object.assign(Object.assign({}, options), { store_id }), schemas_1.GetWarehouseProductResponse);
}
}
exports.WarehouseProductsService = WarehouseProductsService;