@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
53 lines (51 loc) • 2.64 kB
JavaScript
import { ApiResource } from './chunk-XKERR6OR.js';
// src/resources/recurring_order_copies.ts
var RecurringOrderCopies = class _RecurringOrderCopies extends ApiResource {
static TYPE = "recurring_order_copies";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _RecurringOrderCopies.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _RecurringOrderCopies.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _RecurringOrderCopies.TYPE } : id, options);
}
async source_order(recurringOrderCopyId, params, options) {
const _recurringOrderCopyId = recurringOrderCopyId.id || recurringOrderCopyId;
return this.resources.fetch({ type: "orders" }, `recurring_order_copies/${_recurringOrderCopyId}/source_order`, params, options);
}
async target_order(recurringOrderCopyId, params, options) {
const _recurringOrderCopyId = recurringOrderCopyId.id || recurringOrderCopyId;
return this.resources.fetch({ type: "orders" }, `recurring_order_copies/${_recurringOrderCopyId}/target_order`, params, options);
}
async events(recurringOrderCopyId, params, options) {
const _recurringOrderCopyId = recurringOrderCopyId.id || recurringOrderCopyId;
return this.resources.fetch({ type: "events" }, `recurring_order_copies/${_recurringOrderCopyId}/events`, params, options);
}
async event_stores(recurringOrderCopyId, params, options) {
const _recurringOrderCopyId = recurringOrderCopyId.id || recurringOrderCopyId;
return this.resources.fetch({ type: "event_stores" }, `recurring_order_copies/${_recurringOrderCopyId}/event_stores`, params, options);
}
async order_subscription(recurringOrderCopyId, params, options) {
const _recurringOrderCopyId = recurringOrderCopyId.id || recurringOrderCopyId;
return this.resources.fetch({ type: "order_subscriptions" }, `recurring_order_copies/${_recurringOrderCopyId}/order_subscription`, params, options);
}
isRecurringOrderCopy(resource) {
return resource.type && resource.type === _RecurringOrderCopies.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _RecurringOrderCopies.TYPE;
}
};
var instance = new RecurringOrderCopies();
var recurring_order_copies_default = instance;
export { recurring_order_copies_default };
//# sourceMappingURL=chunk-MOKBZVUU.js.map
//# sourceMappingURL=chunk-MOKBZVUU.js.map