@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
53 lines (51 loc) • 2.24 kB
JavaScript
import { ApiResource } from './chunk-XKERR6OR.js';
// src/resources/order_copies.ts
var OrderCopies = class _OrderCopies extends 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;
export { order_copies_default };
//# sourceMappingURL=chunk-A4MUL4NB.js.map
//# sourceMappingURL=chunk-A4MUL4NB.js.map