UNPKG

@commercelayer/sdk

Version:
55 lines (52 loc) 2.3 kB
'use strict'; var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs'); // src/resources/order_copies.ts var OrderCopies = class _OrderCopies extends chunkU22VLCMN_cjs.ApiResource { static TYPE = "order_copies"; async create(resource, params, options) { return this.resources.create({ ...resource, type: _OrderCopies.TYPE }, params, options); } async update(resource, params, options) { return this.resources.update({ ...resource, type: _OrderCopies.TYPE }, params, options); } async delete(id, options) { await this.resources.delete(typeof id === "string" ? { id, type: _OrderCopies.TYPE } : id, options); } async source_order(orderCopyId, params, options) { const _orderCopyId = orderCopyId.id || orderCopyId; return this.resources.fetch({ type: "orders" }, `order_copies/${_orderCopyId}/source_order`, params, options); } async target_order(orderCopyId, params, options) { const _orderCopyId = orderCopyId.id || orderCopyId; return this.resources.fetch({ type: "orders" }, `order_copies/${_orderCopyId}/target_order`, params, options); } async events(orderCopyId, params, options) { const _orderCopyId = orderCopyId.id || orderCopyId; return this.resources.fetch({ type: "events" }, `order_copies/${_orderCopyId}/events`, params, options); } async event_stores(orderCopyId, params, options) { const _orderCopyId = orderCopyId.id || orderCopyId; return this.resources.fetch({ type: "event_stores" }, `order_copies/${_orderCopyId}/event_stores`, params, options); } async order_subscription(orderCopyId, params, options) { const _orderCopyId = orderCopyId.id || orderCopyId; return this.resources.fetch({ type: "order_subscriptions" }, `order_copies/${_orderCopyId}/order_subscription`, params, options); } isOrderCopy(resource) { return resource.type && resource.type === _OrderCopies.TYPE; } relationship(id) { return super.relationshipOneToOne(id); } relationshipToMany(...ids) { return super.relationshipOneToMany(...ids); } type() { return _OrderCopies.TYPE; } }; var instance = new OrderCopies(); var order_copies_default = instance; exports.order_copies_default = order_copies_default; //# sourceMappingURL=chunk-ESGRB4YB.cjs.map //# sourceMappingURL=chunk-ESGRB4YB.cjs.map