UNPKG

@commercelayer/sdk

Version:
105 lines (103 loc) 5.3 kB
import { ApiResource } from './chunk-XKERR6OR.js'; // src/resources/customers.ts var Customers = class _Customers extends ApiResource { static TYPE = "customers"; async create(resource, params, options) { return this.resources.create({ ...resource, type: _Customers.TYPE }, params, options); } async update(resource, params, options) { return this.resources.update({ ...resource, type: _Customers.TYPE }, params, options); } async delete(id, options) { await this.resources.delete(typeof id === "string" ? { id, type: _Customers.TYPE } : id, options); } async customer_group(customerId, params, options) { const _customerId = customerId.id || customerId; return this.resources.fetch({ type: "customer_groups" }, `customers/${_customerId}/customer_group`, params, options); } async customer_addresses(customerId, params, options) { const _customerId = customerId.id || customerId; return this.resources.fetch({ type: "customer_addresses" }, `customers/${_customerId}/customer_addresses`, params, options); } async customer_payment_sources(customerId, params, options) { const _customerId = customerId.id || customerId; return this.resources.fetch({ type: "customer_payment_sources" }, `customers/${_customerId}/customer_payment_sources`, params, options); } async customer_subscriptions(customerId, params, options) { const _customerId = customerId.id || customerId; return this.resources.fetch({ type: "customer_subscriptions" }, `customers/${_customerId}/customer_subscriptions`, params, options); } async orders(customerId, params, options) { const _customerId = customerId.id || customerId; return this.resources.fetch({ type: "orders" }, `customers/${_customerId}/orders`, params, options); } async order_subscriptions(customerId, params, options) { const _customerId = customerId.id || customerId; return this.resources.fetch({ type: "order_subscriptions" }, `customers/${_customerId}/order_subscriptions`, params, options); } async returns(customerId, params, options) { const _customerId = customerId.id || customerId; return this.resources.fetch({ type: "returns" }, `customers/${_customerId}/returns`, params, options); } async sku_lists(customerId, params, options) { const _customerId = customerId.id || customerId; return this.resources.fetch({ type: "sku_lists" }, `customers/${_customerId}/sku_lists`, params, options); } async attachments(customerId, params, options) { const _customerId = customerId.id || customerId; return this.resources.fetch({ type: "attachments" }, `customers/${_customerId}/attachments`, params, options); } async events(customerId, params, options) { const _customerId = customerId.id || customerId; return this.resources.fetch({ type: "events" }, `customers/${_customerId}/events`, params, options); } async tags(customerId, params, options) { const _customerId = customerId.id || customerId; return this.resources.fetch({ type: "tags" }, `customers/${_customerId}/tags`, params, options); } async jwt_customer(customerId, params, options) { const _customerId = customerId.id || customerId; return this.resources.fetch({ type: "customers" }, `customers/${_customerId}/jwt_customer`, params, options); } async jwt_markets(customerId, params, options) { const _customerId = customerId.id || customerId; return this.resources.fetch({ type: "markets" }, `customers/${_customerId}/jwt_markets`, params, options); } async jwt_stock_locations(customerId, params, options) { const _customerId = customerId.id || customerId; return this.resources.fetch({ type: "stock_locations" }, `customers/${_customerId}/jwt_stock_locations`, params, options); } async event_stores(customerId, params, options) { const _customerId = customerId.id || customerId; return this.resources.fetch({ type: "event_stores" }, `customers/${_customerId}/event_stores`, params, options); } async _add_tags(id, triggerValue, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Customers.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: _Customers.TYPE, _remove_tags: triggerValue }, params, options); } async _request_anonymization(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Customers.TYPE, _request_anonymization: true }, params, options); } async _cancel_anonymization(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Customers.TYPE, _cancel_anonymization: true }, params, options); } isCustomer(resource) { return resource.type && resource.type === _Customers.TYPE; } relationship(id) { return super.relationshipOneToOne(id); } relationshipToMany(...ids) { return super.relationshipOneToMany(...ids); } type() { return _Customers.TYPE; } }; var instance = new Customers(); var customers_default = instance; export { customers_default }; //# sourceMappingURL=chunk-DIE5NWNX.js.map //# sourceMappingURL=chunk-DIE5NWNX.js.map