@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
99 lines (96 loc) • 6.03 kB
JavaScript
var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs');
// src/resources/fixed_amount_promotions.ts
var FixedAmountPromotions = class _FixedAmountPromotions extends chunkU22VLCMN_cjs.ApiResource {
static TYPE = "fixed_amount_promotions";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _FixedAmountPromotions.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _FixedAmountPromotions.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _FixedAmountPromotions.TYPE } : id, options);
}
async market(fixedAmountPromotionId, params, options) {
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
return this.resources.fetch({ type: "markets" }, `fixed_amount_promotions/${_fixedAmountPromotionId}/market`, params, options);
}
async order_amount_promotion_rule(fixedAmountPromotionId, params, options) {
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
return this.resources.fetch({ type: "order_amount_promotion_rules" }, `fixed_amount_promotions/${_fixedAmountPromotionId}/order_amount_promotion_rule`, params, options);
}
async sku_list_promotion_rule(fixedAmountPromotionId, params, options) {
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
return this.resources.fetch({ type: "sku_list_promotion_rules" }, `fixed_amount_promotions/${_fixedAmountPromotionId}/sku_list_promotion_rule`, params, options);
}
async coupon_codes_promotion_rule(fixedAmountPromotionId, params, options) {
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
return this.resources.fetch({ type: "coupon_codes_promotion_rules" }, `fixed_amount_promotions/${_fixedAmountPromotionId}/coupon_codes_promotion_rule`, params, options);
}
async custom_promotion_rule(fixedAmountPromotionId, params, options) {
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
return this.resources.fetch({ type: "custom_promotion_rules" }, `fixed_amount_promotions/${_fixedAmountPromotionId}/custom_promotion_rule`, params, options);
}
async sku_list(fixedAmountPromotionId, params, options) {
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
return this.resources.fetch({ type: "sku_lists" }, `fixed_amount_promotions/${_fixedAmountPromotionId}/sku_list`, params, options);
}
async coupons(fixedAmountPromotionId, params, options) {
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
return this.resources.fetch({ type: "coupons" }, `fixed_amount_promotions/${_fixedAmountPromotionId}/coupons`, params, options);
}
async attachments(fixedAmountPromotionId, params, options) {
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
return this.resources.fetch({ type: "attachments" }, `fixed_amount_promotions/${_fixedAmountPromotionId}/attachments`, params, options);
}
async events(fixedAmountPromotionId, params, options) {
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
return this.resources.fetch({ type: "events" }, `fixed_amount_promotions/${_fixedAmountPromotionId}/events`, params, options);
}
async tags(fixedAmountPromotionId, params, options) {
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
return this.resources.fetch({ type: "tags" }, `fixed_amount_promotions/${_fixedAmountPromotionId}/tags`, params, options);
}
async versions(fixedAmountPromotionId, params, options) {
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
return this.resources.fetch({ type: "versions" }, `fixed_amount_promotions/${_fixedAmountPromotionId}/versions`, params, options);
}
async event_stores(fixedAmountPromotionId, params, options) {
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
return this.resources.fetch({ type: "event_stores" }, `fixed_amount_promotions/${_fixedAmountPromotionId}/event_stores`, params, options);
}
async skus(fixedAmountPromotionId, params, options) {
const _fixedAmountPromotionId = fixedAmountPromotionId.id || fixedAmountPromotionId;
return this.resources.fetch({ type: "skus" }, `fixed_amount_promotions/${_fixedAmountPromotionId}/skus`, params, options);
}
async _disable(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _FixedAmountPromotions.TYPE, _disable: true }, params, options);
}
async _enable(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _FixedAmountPromotions.TYPE, _enable: true }, params, options);
}
async _add_tags(id, triggerValue, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _FixedAmountPromotions.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: _FixedAmountPromotions.TYPE, _remove_tags: triggerValue }, params, options);
}
isFixedAmountPromotion(resource) {
return resource.type && resource.type === _FixedAmountPromotions.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _FixedAmountPromotions.TYPE;
}
};
var instance = new FixedAmountPromotions();
var fixed_amount_promotions_default = instance;
exports.fixed_amount_promotions_default = fixed_amount_promotions_default;
//# sourceMappingURL=chunk-W6KL6Q4Z.cjs.map
//# sourceMappingURL=chunk-W6KL6Q4Z.cjs.map
;