UNPKG

@commercelayer/sdk

Version:
51 lines (48 loc) 2.44 kB
'use strict'; var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs'); // src/resources/customer_subscriptions.ts var CustomerSubscriptions = class _CustomerSubscriptions extends chunkU22VLCMN_cjs.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; exports.customer_subscriptions_default = customer_subscriptions_default; //# sourceMappingURL=chunk-ZSG25S6U.cjs.map //# sourceMappingURL=chunk-ZSG25S6U.cjs.map