UNPKG

@commercelayer/sdk

Version:
91 lines (89 loc) 4.79 kB
import { ApiResource } from './chunk-XKERR6OR.js'; // src/resources/stock_transfers.ts var StockTransfers = class _StockTransfers extends ApiResource { static TYPE = "stock_transfers"; async create(resource, params, options) { return this.resources.create({ ...resource, type: _StockTransfers.TYPE }, params, options); } async update(resource, params, options) { return this.resources.update({ ...resource, type: _StockTransfers.TYPE }, params, options); } async delete(id, options) { await this.resources.delete(typeof id === "string" ? { id, type: _StockTransfers.TYPE } : id, options); } async sku(stockTransferId, params, options) { const _stockTransferId = stockTransferId.id || stockTransferId; return this.resources.fetch({ type: "skus" }, `stock_transfers/${_stockTransferId}/sku`, params, options); } async origin_stock_location(stockTransferId, params, options) { const _stockTransferId = stockTransferId.id || stockTransferId; return this.resources.fetch({ type: "stock_locations" }, `stock_transfers/${_stockTransferId}/origin_stock_location`, params, options); } async destination_stock_location(stockTransferId, params, options) { const _stockTransferId = stockTransferId.id || stockTransferId; return this.resources.fetch({ type: "stock_locations" }, `stock_transfers/${_stockTransferId}/destination_stock_location`, params, options); } async shipment(stockTransferId, params, options) { const _stockTransferId = stockTransferId.id || stockTransferId; return this.resources.fetch({ type: "shipments" }, `stock_transfers/${_stockTransferId}/shipment`, params, options); } async line_item(stockTransferId, params, options) { const _stockTransferId = stockTransferId.id || stockTransferId; return this.resources.fetch({ type: "line_items" }, `stock_transfers/${_stockTransferId}/line_item`, params, options); } async stock_reservation(stockTransferId, params, options) { const _stockTransferId = stockTransferId.id || stockTransferId; return this.resources.fetch({ type: "stock_reservations" }, `stock_transfers/${_stockTransferId}/stock_reservation`, params, options); } async attachments(stockTransferId, params, options) { const _stockTransferId = stockTransferId.id || stockTransferId; return this.resources.fetch({ type: "attachments" }, `stock_transfers/${_stockTransferId}/attachments`, params, options); } async events(stockTransferId, params, options) { const _stockTransferId = stockTransferId.id || stockTransferId; return this.resources.fetch({ type: "events" }, `stock_transfers/${_stockTransferId}/events`, params, options); } async versions(stockTransferId, params, options) { const _stockTransferId = stockTransferId.id || stockTransferId; return this.resources.fetch({ type: "versions" }, `stock_transfers/${_stockTransferId}/versions`, params, options); } async event_stores(stockTransferId, params, options) { const _stockTransferId = stockTransferId.id || stockTransferId; return this.resources.fetch({ type: "event_stores" }, `stock_transfers/${_stockTransferId}/event_stores`, params, options); } async _upcoming(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _StockTransfers.TYPE, _upcoming: true }, params, options); } async _on_hold(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _StockTransfers.TYPE, _on_hold: true }, params, options); } async _picking(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _StockTransfers.TYPE, _picking: true }, params, options); } async _in_transit(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _StockTransfers.TYPE, _in_transit: true }, params, options); } async _complete(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _StockTransfers.TYPE, _complete: true }, params, options); } async _cancel(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _StockTransfers.TYPE, _cancel: true }, params, options); } isStockTransfer(resource) { return resource.type && resource.type === _StockTransfers.TYPE; } relationship(id) { return super.relationshipOneToOne(id); } relationshipToMany(...ids) { return super.relationshipOneToMany(...ids); } type() { return _StockTransfers.TYPE; } }; var instance = new StockTransfers(); var stock_transfers_default = instance; export { stock_transfers_default }; //# sourceMappingURL=chunk-HBDXHKBE.js.map //# sourceMappingURL=chunk-HBDXHKBE.js.map