UNPKG

@commercelayer/sdk

Version:
77 lines (75 loc) 3.45 kB
import { ApiResource } from './chunk-XKERR6OR.js'; // src/resources/bundles.ts var Bundles = class _Bundles extends ApiResource { static TYPE = "bundles"; async create(resource, params, options) { return this.resources.create({ ...resource, type: _Bundles.TYPE }, params, options); } async update(resource, params, options) { return this.resources.update({ ...resource, type: _Bundles.TYPE }, params, options); } async delete(id, options) { await this.resources.delete(typeof id === "string" ? { id, type: _Bundles.TYPE } : id, options); } async market(bundleId, params, options) { const _bundleId = bundleId.id || bundleId; return this.resources.fetch({ type: "markets" }, `bundles/${_bundleId}/market`, params, options); } async sku_list(bundleId, params, options) { const _bundleId = bundleId.id || bundleId; return this.resources.fetch({ type: "sku_lists" }, `bundles/${_bundleId}/sku_list`, params, options); } async skus(bundleId, params, options) { const _bundleId = bundleId.id || bundleId; return this.resources.fetch({ type: "skus" }, `bundles/${_bundleId}/skus`, params, options); } async attachments(bundleId, params, options) { const _bundleId = bundleId.id || bundleId; return this.resources.fetch({ type: "attachments" }, `bundles/${_bundleId}/attachments`, params, options); } async events(bundleId, params, options) { const _bundleId = bundleId.id || bundleId; return this.resources.fetch({ type: "events" }, `bundles/${_bundleId}/events`, params, options); } async tags(bundleId, params, options) { const _bundleId = bundleId.id || bundleId; return this.resources.fetch({ type: "tags" }, `bundles/${_bundleId}/tags`, params, options); } async versions(bundleId, params, options) { const _bundleId = bundleId.id || bundleId; return this.resources.fetch({ type: "versions" }, `bundles/${_bundleId}/versions`, params, options); } async event_stores(bundleId, params, options) { const _bundleId = bundleId.id || bundleId; return this.resources.fetch({ type: "event_stores" }, `bundles/${_bundleId}/event_stores`, params, options); } async _compute_price_amount(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Bundles.TYPE, _compute_price_amount: true }, params, options); } async _compute_compare_at_amount(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Bundles.TYPE, _compute_compare_at_amount: true }, params, options); } async _add_tags(id, triggerValue, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Bundles.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: _Bundles.TYPE, _remove_tags: triggerValue }, params, options); } isBundle(resource) { return resource.type && resource.type === _Bundles.TYPE; } relationship(id) { return super.relationshipOneToOne(id); } relationshipToMany(...ids) { return super.relationshipOneToMany(...ids); } type() { return _Bundles.TYPE; } }; var instance = new Bundles(); var bundles_default = instance; export { bundles_default }; //# sourceMappingURL=chunk-H6AQZ5TP.js.map //# sourceMappingURL=chunk-H6AQZ5TP.js.map