UNPKG

@commercelayer/sdk

Version:
97 lines (95 loc) 6.63 kB
import { ApiResource } from './chunk-XKERR6OR.js'; // src/resources/percentage_discount_promotions.ts var PercentageDiscountPromotions = class _PercentageDiscountPromotions extends ApiResource { static TYPE = "percentage_discount_promotions"; async create(resource, params, options) { return this.resources.create({ ...resource, type: _PercentageDiscountPromotions.TYPE }, params, options); } async update(resource, params, options) { return this.resources.update({ ...resource, type: _PercentageDiscountPromotions.TYPE }, params, options); } async delete(id, options) { await this.resources.delete(typeof id === "string" ? { id, type: _PercentageDiscountPromotions.TYPE } : id, options); } async market(percentageDiscountPromotionId, params, options) { const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId; return this.resources.fetch({ type: "markets" }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/market`, params, options); } async order_amount_promotion_rule(percentageDiscountPromotionId, params, options) { const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId; return this.resources.fetch({ type: "order_amount_promotion_rules" }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/order_amount_promotion_rule`, params, options); } async sku_list_promotion_rule(percentageDiscountPromotionId, params, options) { const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId; return this.resources.fetch({ type: "sku_list_promotion_rules" }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/sku_list_promotion_rule`, params, options); } async coupon_codes_promotion_rule(percentageDiscountPromotionId, params, options) { const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId; return this.resources.fetch({ type: "coupon_codes_promotion_rules" }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/coupon_codes_promotion_rule`, params, options); } async custom_promotion_rule(percentageDiscountPromotionId, params, options) { const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId; return this.resources.fetch({ type: "custom_promotion_rules" }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/custom_promotion_rule`, params, options); } async sku_list(percentageDiscountPromotionId, params, options) { const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId; return this.resources.fetch({ type: "sku_lists" }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/sku_list`, params, options); } async coupons(percentageDiscountPromotionId, params, options) { const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId; return this.resources.fetch({ type: "coupons" }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/coupons`, params, options); } async attachments(percentageDiscountPromotionId, params, options) { const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId; return this.resources.fetch({ type: "attachments" }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/attachments`, params, options); } async events(percentageDiscountPromotionId, params, options) { const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId; return this.resources.fetch({ type: "events" }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/events`, params, options); } async tags(percentageDiscountPromotionId, params, options) { const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId; return this.resources.fetch({ type: "tags" }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/tags`, params, options); } async versions(percentageDiscountPromotionId, params, options) { const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId; return this.resources.fetch({ type: "versions" }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/versions`, params, options); } async event_stores(percentageDiscountPromotionId, params, options) { const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId; return this.resources.fetch({ type: "event_stores" }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/event_stores`, params, options); } async skus(percentageDiscountPromotionId, params, options) { const _percentageDiscountPromotionId = percentageDiscountPromotionId.id || percentageDiscountPromotionId; return this.resources.fetch({ type: "skus" }, `percentage_discount_promotions/${_percentageDiscountPromotionId}/skus`, params, options); } async _disable(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _PercentageDiscountPromotions.TYPE, _disable: true }, params, options); } async _enable(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _PercentageDiscountPromotions.TYPE, _enable: true }, params, options); } async _add_tags(id, triggerValue, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _PercentageDiscountPromotions.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: _PercentageDiscountPromotions.TYPE, _remove_tags: triggerValue }, params, options); } isPercentageDiscountPromotion(resource) { return resource.type && resource.type === _PercentageDiscountPromotions.TYPE; } relationship(id) { return super.relationshipOneToOne(id); } relationshipToMany(...ids) { return super.relationshipOneToMany(...ids); } type() { return _PercentageDiscountPromotions.TYPE; } }; var instance = new PercentageDiscountPromotions(); var percentage_discount_promotions_default = instance; export { percentage_discount_promotions_default }; //# sourceMappingURL=chunk-EZQ3QHF2.js.map //# sourceMappingURL=chunk-EZQ3QHF2.js.map