@whitewall/blip-sdk 0.0.181 → 0.0.182
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/dist/cjs/namespaces/billing.js +20 -4
- package/dist/cjs/namespaces/billing.js.map +1 -1
- package/dist/esm/namespaces/billing.js +20 -4
- package/dist/esm/namespaces/billing.js.map +1 -1
- package/dist/types/namespaces/billing.d.ts +8 -1
- package/dist/types/namespaces/billing.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/namespaces/billing.ts +21 -5
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BillingNamespace = void 0;
|
|
4
|
+
const index_ts_1 = require("../index.js");
|
|
4
5
|
const uri_ts_1 = require("../utils/uri.js");
|
|
5
6
|
const namespace_ts_1 = require("./namespace.js");
|
|
6
7
|
class BillingNamespace extends namespace_ts_1.Namespace {
|
|
7
8
|
constructor(blipClient, defaultOptions) {
|
|
8
9
|
super(blipClient, 'billing', { ...defaultOptions, domain: 'blip.ai' });
|
|
9
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Gets the active plan for a tenant.
|
|
13
|
+
*
|
|
14
|
+
* @returns The tenant's plan, or `null` when the tenant doesn't exist or has
|
|
15
|
+
* no active plan. Note that the `standard` plan is also the free/no-active-plan
|
|
16
|
+
* tier, so a non-null result does not necessarily mean the tenant has a paid plan.
|
|
17
|
+
*/
|
|
10
18
|
async getPlan(tenantId) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
19
|
+
try {
|
|
20
|
+
return await this.sendCommand({
|
|
21
|
+
method: 'get',
|
|
22
|
+
uri: (0, uri_ts_1.uri) `/tenants/${tenantId}/subscription/plan`,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
if (err instanceof index_ts_1.BlipError && err.code === 67) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
throw err;
|
|
30
|
+
}
|
|
15
31
|
}
|
|
16
32
|
}
|
|
17
33
|
exports.BillingNamespace = BillingNamespace;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../../src/namespaces/billing.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../../src/namespaces/billing.ts"],"names":[],"mappings":";;;AACA,0CAAuC;AAEvC,4CAAqC;AACrC,iDAAmE;AAEnE,MAAa,gBAAiB,SAAQ,wBAAS;IAC3C,YAAY,UAAsB,EAAE,cAAmC;QACnE,KAAK,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,GAAG,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAA;IAC1E,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,OAAO,CAAC,QAAgB;QACjC,IAAI,CAAC;YACD,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC;gBAC1B,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,IAAA,YAAG,EAAA,YAAY,QAAQ,oBAAoB;aACnD,CAAC,CAAA;QACN,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,IAAI,GAAG,YAAY,oBAAS,IAAI,GAAG,CAAC,IAAI,KAAK,EAAE,EAAE,CAAC;gBAC9C,OAAO,IAAI,CAAA;YACf,CAAC;YAED,MAAM,GAAG,CAAA;QACb,CAAC;IACL,CAAC;CACJ;AA1BD,4CA0BC"}
|
|
@@ -1,14 +1,30 @@
|
|
|
1
|
+
import { BlipError } from "../index.js";
|
|
1
2
|
import { uri } from "../utils/uri.js";
|
|
2
3
|
import { Namespace } from "./namespace.js";
|
|
3
4
|
export class BillingNamespace extends Namespace {
|
|
4
5
|
constructor(blipClient, defaultOptions) {
|
|
5
6
|
super(blipClient, 'billing', { ...defaultOptions, domain: 'blip.ai' });
|
|
6
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Gets the active plan for a tenant.
|
|
10
|
+
*
|
|
11
|
+
* @returns The tenant's plan, or `null` when the tenant doesn't exist or has
|
|
12
|
+
* no active plan. Note that the `standard` plan is also the free/no-active-plan
|
|
13
|
+
* tier, so a non-null result does not necessarily mean the tenant has a paid plan.
|
|
14
|
+
*/
|
|
7
15
|
async getPlan(tenantId) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
16
|
+
try {
|
|
17
|
+
return await this.sendCommand({
|
|
18
|
+
method: 'get',
|
|
19
|
+
uri: uri `/tenants/${tenantId}/subscription/plan`,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
if (err instanceof BlipError && err.code === 67) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
throw err;
|
|
27
|
+
}
|
|
12
28
|
}
|
|
13
29
|
}
|
|
14
30
|
//# sourceMappingURL=billing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../../src/namespaces/billing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../../src/namespaces/billing.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;AACrC,OAAO,EAAE,SAAS,EAA2B,MAAM,gBAAgB,CAAA;AAEnE,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAC3C,YAAY,UAAsB,EAAE,cAAmC;QACnE,KAAK,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,GAAG,cAAc,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAA;IAC1E,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,OAAO,CAAC,QAAgB;QACjC,IAAI,CAAC;YACD,OAAO,MAAM,IAAI,CAAC,WAAW,CAAC;gBAC1B,MAAM,EAAE,KAAK;gBACb,GAAG,EAAE,GAAG,CAAA,YAAY,QAAQ,oBAAoB;aACnD,CAAC,CAAA;QACN,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,IAAI,GAAG,YAAY,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,EAAE,EAAE,CAAC;gBAC9C,OAAO,IAAI,CAAA;YACf,CAAC;YAED,MAAM,GAAG,CAAA;QACb,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -3,6 +3,13 @@ import type { Plan } from '../types/billing.ts';
|
|
|
3
3
|
import { Namespace, type SendCommandOptions } from './namespace.ts';
|
|
4
4
|
export declare class BillingNamespace extends Namespace {
|
|
5
5
|
constructor(blipClient: BlipClient, defaultOptions?: SendCommandOptions);
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Gets the active plan for a tenant.
|
|
8
|
+
*
|
|
9
|
+
* @returns The tenant's plan, or `null` when the tenant doesn't exist or has
|
|
10
|
+
* no active plan. Note that the `standard` plan is also the free/no-active-plan
|
|
11
|
+
* tier, so a non-null result does not necessarily mean the tenant has a paid plan.
|
|
12
|
+
*/
|
|
13
|
+
getPlan(tenantId: string): Promise<Plan | null>;
|
|
7
14
|
}
|
|
8
15
|
//# sourceMappingURL=billing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../../src/namespaces/billing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../../src/namespaces/billing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAE/C,OAAO,EAAE,SAAS,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAEnE,qBAAa,gBAAiB,SAAQ,SAAS;gBAC/B,UAAU,EAAE,UAAU,EAAE,cAAc,CAAC,EAAE,kBAAkB;IAIvE;;;;;;OAMG;IACU,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;CAc/D"}
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BlipClient } from '../client.ts'
|
|
2
|
+
import { BlipError } from '../index.ts'
|
|
2
3
|
import type { Plan } from '../types/billing.ts'
|
|
3
4
|
import { uri } from '../utils/uri.ts'
|
|
4
5
|
import { Namespace, type SendCommandOptions } from './namespace.ts'
|
|
@@ -8,10 +9,25 @@ export class BillingNamespace extends Namespace {
|
|
|
8
9
|
super(blipClient, 'billing', { ...defaultOptions, domain: 'blip.ai' })
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Gets the active plan for a tenant.
|
|
14
|
+
*
|
|
15
|
+
* @returns The tenant's plan, or `null` when the tenant doesn't exist or has
|
|
16
|
+
* no active plan. Note that the `standard` plan is also the free/no-active-plan
|
|
17
|
+
* tier, so a non-null result does not necessarily mean the tenant has a paid plan.
|
|
18
|
+
*/
|
|
19
|
+
public async getPlan(tenantId: string): Promise<Plan | null> {
|
|
20
|
+
try {
|
|
21
|
+
return await this.sendCommand({
|
|
22
|
+
method: 'get',
|
|
23
|
+
uri: uri`/tenants/${tenantId}/subscription/plan`,
|
|
24
|
+
})
|
|
25
|
+
} catch (err) {
|
|
26
|
+
if (err instanceof BlipError && err.code === 67) {
|
|
27
|
+
return null
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
throw err
|
|
31
|
+
}
|
|
16
32
|
}
|
|
17
33
|
}
|