@bunnyapp/api-client 1.0.12 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -44,7 +44,8 @@ const bunny = new BunnyClient({
44
44
  This SDK wrappers several of the common Bunny API requests.
45
45
 
46
46
  ```js
47
- bunny.createSubscription("productPlanCode", {
47
+ // Create a new subscription
48
+ bunny.createSubscription("priceListCode", {
48
49
  trial: true,
49
50
  accountName: "accountName",
50
51
  firstName: "firstName",
@@ -52,7 +53,11 @@ bunny.createSubscription("productPlanCode", {
52
53
  email: "email",
53
54
  tenantCode: "remoteId",
54
55
  });
55
- bunny.createTenant(name, code, platformCode, subscriptionId);
56
+
57
+ // Get a session token for the Bunny customer portal
58
+ bunny.createPortalSession("tenantCode");
59
+
60
+ // Track usage for billing
56
61
  bunny.trackUsage(featureCode, quantity, tenantCode, usageAt);
57
62
  ```
58
63
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bunnyapp/api-client",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Node.js client for Bunny CRM",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -0,0 +1,13 @@
1
+ const query = `mutation portalSessionCreate ($tenantCode: String!) {
2
+ portalSessionCreate (tenantCode: $tenantCode) {
3
+ token
4
+ errors
5
+ }
6
+ }`;
7
+
8
+ module.exports = async function (tenantCode) {
9
+ let variables = {
10
+ tenantCode: tenantCode,
11
+ };
12
+ return this.query(query, variables);
13
+ };
@@ -34,10 +34,10 @@ const query = `mutation subscriptionCreate ($attributes: SubscriptionAttributes!
34
34
  }
35
35
  }`;
36
36
 
37
- module.exports = async function (productPlanCode, options = {}) {
37
+ module.exports = async function (priceListCode, options = {}) {
38
38
  let variables = {
39
39
  attributes: {
40
- productPlanCode: productPlanCode,
40
+ priceListCode: priceListCode,
41
41
  trial: options["trial"] || false,
42
42
  },
43
43
  };
package/src/index.js CHANGED
@@ -88,5 +88,6 @@ Bunny.prototype.createSubscription = require("./helpers/create-subscription.js")
88
88
  Bunny.prototype.createTenant = require("./helpers/create-tenant.js");
89
89
  Bunny.prototype.updateTenant = require("./helpers/update-tenant.js");
90
90
  Bunny.prototype.trackUsage = require("./helpers/track-usage.js");
91
+ Bunny.prototype.createPortalSession = require("./helpers/create-portal-session.js");
91
92
 
92
93
  module.exports = Bunny;