UNPKG

@commercelayer/sdk

Version:
55 lines (52 loc) 2.43 kB
'use strict'; var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs'); // src/resources/customer_groups.ts var CustomerGroups = class _CustomerGroups extends chunkU22VLCMN_cjs.ApiResource { static TYPE = "customer_groups"; async create(resource, params, options) { return this.resources.create({ ...resource, type: _CustomerGroups.TYPE }, params, options); } async update(resource, params, options) { return this.resources.update({ ...resource, type: _CustomerGroups.TYPE }, params, options); } async delete(id, options) { await this.resources.delete(typeof id === "string" ? { id, type: _CustomerGroups.TYPE } : id, options); } async customers(customerGroupId, params, options) { const _customerGroupId = customerGroupId.id || customerGroupId; return this.resources.fetch({ type: "customers" }, `customer_groups/${_customerGroupId}/customers`, params, options); } async markets(customerGroupId, params, options) { const _customerGroupId = customerGroupId.id || customerGroupId; return this.resources.fetch({ type: "markets" }, `customer_groups/${_customerGroupId}/markets`, params, options); } async attachments(customerGroupId, params, options) { const _customerGroupId = customerGroupId.id || customerGroupId; return this.resources.fetch({ type: "attachments" }, `customer_groups/${_customerGroupId}/attachments`, params, options); } async versions(customerGroupId, params, options) { const _customerGroupId = customerGroupId.id || customerGroupId; return this.resources.fetch({ type: "versions" }, `customer_groups/${_customerGroupId}/versions`, params, options); } async event_stores(customerGroupId, params, options) { const _customerGroupId = customerGroupId.id || customerGroupId; return this.resources.fetch({ type: "event_stores" }, `customer_groups/${_customerGroupId}/event_stores`, params, options); } isCustomerGroup(resource) { return resource.type && resource.type === _CustomerGroups.TYPE; } relationship(id) { return super.relationshipOneToOne(id); } relationshipToMany(...ids) { return super.relationshipOneToMany(...ids); } type() { return _CustomerGroups.TYPE; } }; var instance = new CustomerGroups(); var customer_groups_default = instance; exports.customer_groups_default = customer_groups_default; //# sourceMappingURL=chunk-FDW7JX5A.cjs.map //# sourceMappingURL=chunk-FDW7JX5A.cjs.map