UNPKG

@commercelayer/sdk

Version:
41 lines (39 loc) 1.78 kB
import { ApiResource } from './chunk-XKERR6OR.js'; // src/resources/custom_promotion_rules.ts var CustomPromotionRules = class _CustomPromotionRules extends 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; export { custom_promotion_rules_default }; //# sourceMappingURL=chunk-PLIS7EYD.js.map //# sourceMappingURL=chunk-PLIS7EYD.js.map