UNPKG

@commercelayer/sdk

Version:
103 lines (101 loc) 6.04 kB
import { ApiResource } from './chunk-XKERR6OR.js'; // src/resources/order_subscriptions.ts var OrderSubscriptions = class _OrderSubscriptions extends ApiResource { static TYPE = "order_subscriptions"; async create(resource, params, options) { return this.resources.create({ ...resource, type: _OrderSubscriptions.TYPE }, params, options); } async update(resource, params, options) { return this.resources.update({ ...resource, type: _OrderSubscriptions.TYPE }, params, options); } async delete(id, options) { await this.resources.delete(typeof id === "string" ? { id, type: _OrderSubscriptions.TYPE } : id, options); } async market(orderSubscriptionId, params, options) { const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId; return this.resources.fetch({ type: "markets" }, `order_subscriptions/${_orderSubscriptionId}/market`, params, options); } async subscription_model(orderSubscriptionId, params, options) { const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId; return this.resources.fetch({ type: "subscription_models" }, `order_subscriptions/${_orderSubscriptionId}/subscription_model`, params, options); } async source_order(orderSubscriptionId, params, options) { const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId; return this.resources.fetch({ type: "orders" }, `order_subscriptions/${_orderSubscriptionId}/source_order`, params, options); } async customer(orderSubscriptionId, params, options) { const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId; return this.resources.fetch({ type: "customers" }, `order_subscriptions/${_orderSubscriptionId}/customer`, params, options); } async customer_payment_source(orderSubscriptionId, params, options) { const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId; return this.resources.fetch({ type: "customer_payment_sources" }, `order_subscriptions/${_orderSubscriptionId}/customer_payment_source`, params, options); } async order_subscription_items(orderSubscriptionId, params, options) { const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId; return this.resources.fetch({ type: "order_subscription_items" }, `order_subscriptions/${_orderSubscriptionId}/order_subscription_items`, params, options); } async order_factories(orderSubscriptionId, params, options) { const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId; return this.resources.fetch({ type: "order_factories" }, `order_subscriptions/${_orderSubscriptionId}/order_factories`, params, options); } async recurring_order_copies(orderSubscriptionId, params, options) { const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId; return this.resources.fetch({ type: "recurring_order_copies" }, `order_subscriptions/${_orderSubscriptionId}/recurring_order_copies`, params, options); } async orders(orderSubscriptionId, params, options) { const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId; return this.resources.fetch({ type: "orders" }, `order_subscriptions/${_orderSubscriptionId}/orders`, params, options); } async events(orderSubscriptionId, params, options) { const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId; return this.resources.fetch({ type: "events" }, `order_subscriptions/${_orderSubscriptionId}/events`, params, options); } async tags(orderSubscriptionId, params, options) { const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId; return this.resources.fetch({ type: "tags" }, `order_subscriptions/${_orderSubscriptionId}/tags`, params, options); } async versions(orderSubscriptionId, params, options) { const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId; return this.resources.fetch({ type: "versions" }, `order_subscriptions/${_orderSubscriptionId}/versions`, params, options); } async event_stores(orderSubscriptionId, params, options) { const _orderSubscriptionId = orderSubscriptionId.id || orderSubscriptionId; return this.resources.fetch({ type: "event_stores" }, `order_subscriptions/${_orderSubscriptionId}/event_stores`, params, options); } async _activate(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _OrderSubscriptions.TYPE, _activate: true }, params, options); } async _deactivate(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _OrderSubscriptions.TYPE, _deactivate: true }, params, options); } async _cancel(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _OrderSubscriptions.TYPE, _cancel: true }, params, options); } async _convert(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _OrderSubscriptions.TYPE, _convert: true }, params, options); } async _add_tags(id, triggerValue, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _OrderSubscriptions.TYPE, _add_tags: triggerValue }, params, options); } async _remove_tags(id, triggerValue, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _OrderSubscriptions.TYPE, _remove_tags: triggerValue }, params, options); } isOrderSubscription(resource) { return resource.type && resource.type === _OrderSubscriptions.TYPE; } relationship(id) { return super.relationshipOneToOne(id); } relationshipToMany(...ids) { return super.relationshipOneToMany(...ids); } type() { return _OrderSubscriptions.TYPE; } }; var instance = new OrderSubscriptions(); var order_subscriptions_default = instance; export { order_subscriptions_default }; //# sourceMappingURL=chunk-KAZKQXUO.js.map //# sourceMappingURL=chunk-KAZKQXUO.js.map