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