UNPKG

pancake-client-sdk

Version:
74 lines 2.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProductResource = void 0; const base_1 = require("./base"); class ProductResource extends base_1.BaseResource { /** * Get list of products */ async list(params) { return this.client.get(this.getShopPath('/products'), params); } /** * Get product by ID */ async getById(productId) { return this.client.get(this.getShopPath(`/products/${productId}`)); } /** * Create new product */ async create(data) { return this.client.post(this.getShopPath('/products'), data); } /** * Update product */ async update(productId, data) { return this.client.put(this.getShopPath(`/products/${productId}`), data); } /** * Update product stock */ async updateStock(productId, data) { return this.client.put(this.getShopPath(`/products/${productId}/stock`), data); } /** * Update multiple variation stocks */ async updateBulkStock(productId, variations) { return this.client.put(this.getShopPath(`/products/${productId}/variations/stock`), { variations }); } /** * Get product categories */ async listCategories() { return this.client.get(this.getShopPath('/product-categories')); } /** * Create product category */ async createCategory(data) { return this.client.post(this.getShopPath('/product-categories'), data); } /** * Update product category */ async updateCategory(categoryId, data) { return this.client.put(this.getShopPath(`/product-categories/${categoryId}`), data); } /** * Delete product category */ async deleteCategory(categoryId) { return this.client.delete(this.getShopPath(`/product-categories/${categoryId}`)); } /** * Get product inventory history */ async getInventoryHistory(productId, params) { return this.client.get(this.getShopPath(`/products/${productId}/inventory-history`), params); } } exports.ProductResource = ProductResource; //# sourceMappingURL=product.js.map