UNPKG

@commercelayer/sdk

Version:
72 lines (69 loc) 3.54 kB
'use strict'; var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs'); // src/resources/stock_line_items.ts var StockLineItems = class _StockLineItems extends chunkU22VLCMN_cjs.ApiResource { static TYPE = "stock_line_items"; async create(resource, params, options) { return this.resources.create({ ...resource, type: _StockLineItems.TYPE }, params, options); } async update(resource, params, options) { return this.resources.update({ ...resource, type: _StockLineItems.TYPE }, params, options); } async delete(id, options) { await this.resources.delete(typeof id === "string" ? { id, type: _StockLineItems.TYPE } : id, options); } async shipment(stockLineItemId, params, options) { const _stockLineItemId = stockLineItemId.id || stockLineItemId; return this.resources.fetch({ type: "shipments" }, `stock_line_items/${_stockLineItemId}/shipment`, params, options); } async line_item(stockLineItemId, params, options) { const _stockLineItemId = stockLineItemId.id || stockLineItemId; return this.resources.fetch({ type: "line_items" }, `stock_line_items/${_stockLineItemId}/line_item`, params, options); } async stock_item(stockLineItemId, params, options) { const _stockLineItemId = stockLineItemId.id || stockLineItemId; return this.resources.fetch({ type: "stock_items" }, `stock_line_items/${_stockLineItemId}/stock_item`, params, options); } async sku(stockLineItemId, params, options) { const _stockLineItemId = stockLineItemId.id || stockLineItemId; return this.resources.fetch({ type: "skus" }, `stock_line_items/${_stockLineItemId}/sku`, params, options); } async stock_reservation(stockLineItemId, params, options) { const _stockLineItemId = stockLineItemId.id || stockLineItemId; return this.resources.fetch({ type: "stock_reservations" }, `stock_line_items/${_stockLineItemId}/stock_reservation`, params, options); } async versions(stockLineItemId, params, options) { const _stockLineItemId = stockLineItemId.id || stockLineItemId; return this.resources.fetch({ type: "versions" }, `stock_line_items/${_stockLineItemId}/versions`, params, options); } async event_stores(stockLineItemId, params, options) { const _stockLineItemId = stockLineItemId.id || stockLineItemId; return this.resources.fetch({ type: "event_stores" }, `stock_line_items/${_stockLineItemId}/event_stores`, params, options); } async _reserve_stock(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _StockLineItems.TYPE, _reserve_stock: true }, params, options); } async _release_stock(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _StockLineItems.TYPE, _release_stock: true }, params, options); } async _decrement_stock(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _StockLineItems.TYPE, _decrement_stock: true }, params, options); } isStockLineItem(resource) { return resource.type && resource.type === _StockLineItems.TYPE; } relationship(id) { return super.relationshipOneToOne(id); } relationshipToMany(...ids) { return super.relationshipOneToMany(...ids); } type() { return _StockLineItems.TYPE; } }; var instance = new StockLineItems(); var stock_line_items_default = instance; exports.stock_line_items_default = stock_line_items_default; //# sourceMappingURL=chunk-67U7A4FV.cjs.map //# sourceMappingURL=chunk-67U7A4FV.cjs.map