UNPKG

@commercelayer/sdk

Version:
43 lines (40 loc) 1.85 kB
'use strict'; var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs'); // src/resources/custom_promotion_rules.ts var CustomPromotionRules = class _CustomPromotionRules extends chunkU22VLCMN_cjs.ApiResource { static TYPE = "custom_promotion_rules"; async create(resource, params, options) { return this.resources.create({ ...resource, type: _CustomPromotionRules.TYPE }, params, options); } async update(resource, params, options) { return this.resources.update({ ...resource, type: _CustomPromotionRules.TYPE }, params, options); } async delete(id, options) { await this.resources.delete(typeof id === "string" ? { id, type: _CustomPromotionRules.TYPE } : id, options); } async versions(customPromotionRuleId, params, options) { const _customPromotionRuleId = customPromotionRuleId.id || customPromotionRuleId; return this.resources.fetch({ type: "versions" }, `custom_promotion_rules/${_customPromotionRuleId}/versions`, params, options); } async event_stores(customPromotionRuleId, params, options) { const _customPromotionRuleId = customPromotionRuleId.id || customPromotionRuleId; return this.resources.fetch({ type: "event_stores" }, `custom_promotion_rules/${_customPromotionRuleId}/event_stores`, params, options); } isCustomPromotionRule(resource) { return resource.type && resource.type === _CustomPromotionRules.TYPE; } relationship(id) { return super.relationshipOneToOne(id); } relationshipToMany(...ids) { return super.relationshipOneToMany(...ids); } type() { return _CustomPromotionRules.TYPE; } }; var instance = new CustomPromotionRules(); var custom_promotion_rules_default = instance; exports.custom_promotion_rules_default = custom_promotion_rules_default; //# sourceMappingURL=chunk-LTCWS2HF.cjs.map //# sourceMappingURL=chunk-LTCWS2HF.cjs.map