UNPKG

crisp-api

Version:

Crisp API wrapper for Node - official, maintained by Crisp

88 lines (87 loc) 2.85 kB
"use strict"; /* * This file is part of node-crisp-api * * Copyright (c) 2026 Crisp IM SAS * All rights belong to Crisp IM SAS */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); /************************************************************************** * IMPORTS ***************************************************************************/ // PROJECT: RESOURCES const BaseResource_1 = __importDefault(require("./BaseResource")); /************************************************************************** * CLASSES ***************************************************************************/ /** * Crisp PlanSubscription Resource */ class PlanSubscriptionService extends BaseResource_1.default { /** * List All Active Plan Subscriptions */ listAllActiveSubscriptions() { return this.crisp.get(this.crisp.prepareRestUrl(["plans", "subscription"])); } ; /** * Get Plan Subscription For A Website */ getPlanSubscriptionForWebsite(websiteID) { return this.crisp.get(this.crisp.prepareRestUrl(["plans", "subscription", websiteID])); } ; /** * Subscribe Website To Plan */ subscribeWebsiteToPlan(websiteID, planID) { return this.crisp.post(this.crisp.prepareRestUrl(["plans", "subscription", websiteID]), null, { plan_id: planID }); } ; /** * Unsubscribe Plan From Website */ unsubscribePlanFromWebsite(websiteID) { return this.crisp.delete(this.crisp.prepareRestUrl(["plans", "subscription", websiteID])); } ; /** * Change Bill Period For Website Plan Subscription */ changeBillPeriodForWebsitePlanSubscription(websiteID, period) { return this.crisp.patch(this.crisp.prepareRestUrl([ "plans", "subscription", websiteID, "bill", "period" ]), null, { period }); } ; /** * Check Coupon Availability For Website Plan Subscription */ checkCouponAvailabilityForWebsitePlanSubscription(websiteID, code) { return this.crisp.get(this.crisp.prepareRestUrl(["plans", "subscription", websiteID, "coupon"]), { code }); } ; /** * Redeem Coupon For Website Plan Subscription */ redeemCouponForWebsitePlanSubscription(websiteID, code) { return this.crisp.patch(this.crisp.prepareRestUrl(["plans", "subscription", websiteID, "coupon"]), null, { code }); } ; } /************************************************************************** * EXPORTS ***************************************************************************/ exports.default = PlanSubscriptionService;