UNPKG

@commercelayer/sdk

Version:
49 lines (47 loc) 2.37 kB
import { ApiResource } from './chunk-XKERR6OR.js'; // src/resources/customer_subscriptions.ts var CustomerSubscriptions = class _CustomerSubscriptions extends ApiResource { static TYPE = "customer_subscriptions"; async create(resource, params, options) { return this.resources.create({ ...resource, type: _CustomerSubscriptions.TYPE }, params, options); } async update(resource, params, options) { return this.resources.update({ ...resource, type: _CustomerSubscriptions.TYPE }, params, options); } async delete(id, options) { await this.resources.delete(typeof id === "string" ? { id, type: _CustomerSubscriptions.TYPE } : id, options); } async customer(customerSubscriptionId, params, options) { const _customerSubscriptionId = customerSubscriptionId.id || customerSubscriptionId; return this.resources.fetch({ type: "customers" }, `customer_subscriptions/${_customerSubscriptionId}/customer`, params, options); } async events(customerSubscriptionId, params, options) { const _customerSubscriptionId = customerSubscriptionId.id || customerSubscriptionId; return this.resources.fetch({ type: "events" }, `customer_subscriptions/${_customerSubscriptionId}/events`, params, options); } async versions(customerSubscriptionId, params, options) { const _customerSubscriptionId = customerSubscriptionId.id || customerSubscriptionId; return this.resources.fetch({ type: "versions" }, `customer_subscriptions/${_customerSubscriptionId}/versions`, params, options); } async event_stores(customerSubscriptionId, params, options) { const _customerSubscriptionId = customerSubscriptionId.id || customerSubscriptionId; return this.resources.fetch({ type: "event_stores" }, `customer_subscriptions/${_customerSubscriptionId}/event_stores`, params, options); } isCustomerSubscription(resource) { return resource.type && resource.type === _CustomerSubscriptions.TYPE; } relationship(id) { return super.relationshipOneToOne(id); } relationshipToMany(...ids) { return super.relationshipOneToMany(...ids); } type() { return _CustomerSubscriptions.TYPE; } }; var instance = new CustomerSubscriptions(); var customer_subscriptions_default = instance; export { customer_subscriptions_default }; //# sourceMappingURL=chunk-SDGSOWXI.js.map //# sourceMappingURL=chunk-SDGSOWXI.js.map