UNPKG

@commercelayer/sdk

Version:
99 lines (96 loc) 5.94 kB
'use strict'; var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs'); // src/resources/fixed_price_promotions.ts var FixedPricePromotions = class _FixedPricePromotions extends chunkU22VLCMN_cjs.ApiResource { static TYPE = "fixed_price_promotions"; async create(resource, params, options) { return this.resources.create({ ...resource, type: _FixedPricePromotions.TYPE }, params, options); } async update(resource, params, options) { return this.resources.update({ ...resource, type: _FixedPricePromotions.TYPE }, params, options); } async delete(id, options) { await this.resources.delete(typeof id === "string" ? { id, type: _FixedPricePromotions.TYPE } : id, options); } async market(fixedPricePromotionId, params, options) { const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId; return this.resources.fetch({ type: "markets" }, `fixed_price_promotions/${_fixedPricePromotionId}/market`, params, options); } async order_amount_promotion_rule(fixedPricePromotionId, params, options) { const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId; return this.resources.fetch({ type: "order_amount_promotion_rules" }, `fixed_price_promotions/${_fixedPricePromotionId}/order_amount_promotion_rule`, params, options); } async sku_list_promotion_rule(fixedPricePromotionId, params, options) { const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId; return this.resources.fetch({ type: "sku_list_promotion_rules" }, `fixed_price_promotions/${_fixedPricePromotionId}/sku_list_promotion_rule`, params, options); } async coupon_codes_promotion_rule(fixedPricePromotionId, params, options) { const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId; return this.resources.fetch({ type: "coupon_codes_promotion_rules" }, `fixed_price_promotions/${_fixedPricePromotionId}/coupon_codes_promotion_rule`, params, options); } async custom_promotion_rule(fixedPricePromotionId, params, options) { const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId; return this.resources.fetch({ type: "custom_promotion_rules" }, `fixed_price_promotions/${_fixedPricePromotionId}/custom_promotion_rule`, params, options); } async sku_list(fixedPricePromotionId, params, options) { const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId; return this.resources.fetch({ type: "sku_lists" }, `fixed_price_promotions/${_fixedPricePromotionId}/sku_list`, params, options); } async coupons(fixedPricePromotionId, params, options) { const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId; return this.resources.fetch({ type: "coupons" }, `fixed_price_promotions/${_fixedPricePromotionId}/coupons`, params, options); } async attachments(fixedPricePromotionId, params, options) { const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId; return this.resources.fetch({ type: "attachments" }, `fixed_price_promotions/${_fixedPricePromotionId}/attachments`, params, options); } async events(fixedPricePromotionId, params, options) { const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId; return this.resources.fetch({ type: "events" }, `fixed_price_promotions/${_fixedPricePromotionId}/events`, params, options); } async tags(fixedPricePromotionId, params, options) { const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId; return this.resources.fetch({ type: "tags" }, `fixed_price_promotions/${_fixedPricePromotionId}/tags`, params, options); } async versions(fixedPricePromotionId, params, options) { const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId; return this.resources.fetch({ type: "versions" }, `fixed_price_promotions/${_fixedPricePromotionId}/versions`, params, options); } async event_stores(fixedPricePromotionId, params, options) { const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId; return this.resources.fetch({ type: "event_stores" }, `fixed_price_promotions/${_fixedPricePromotionId}/event_stores`, params, options); } async skus(fixedPricePromotionId, params, options) { const _fixedPricePromotionId = fixedPricePromotionId.id || fixedPricePromotionId; return this.resources.fetch({ type: "skus" }, `fixed_price_promotions/${_fixedPricePromotionId}/skus`, params, options); } async _disable(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _FixedPricePromotions.TYPE, _disable: true }, params, options); } async _enable(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _FixedPricePromotions.TYPE, _enable: true }, params, options); } async _add_tags(id, triggerValue, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _FixedPricePromotions.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: _FixedPricePromotions.TYPE, _remove_tags: triggerValue }, params, options); } isFixedPricePromotion(resource) { return resource.type && resource.type === _FixedPricePromotions.TYPE; } relationship(id) { return super.relationshipOneToOne(id); } relationshipToMany(...ids) { return super.relationshipOneToMany(...ids); } type() { return _FixedPricePromotions.TYPE; } }; var instance = new FixedPricePromotions(); var fixed_price_promotions_default = instance; exports.fixed_price_promotions_default = fixed_price_promotions_default; //# sourceMappingURL=chunk-RLZV6AKT.cjs.map //# sourceMappingURL=chunk-RLZV6AKT.cjs.map