UNPKG

@commercelayer/sdk

Version:
53 lines (51 loc) 2.37 kB
import { ApiResource } from './chunk-XKERR6OR.js'; // src/resources/customer_groups.ts var CustomerGroups = class _CustomerGroups extends 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; export { customer_groups_default }; //# sourceMappingURL=chunk-VEBN2D2K.js.map //# sourceMappingURL=chunk-VEBN2D2K.js.map