@parra/parra-js-sdk 0.2.30 → 0.2.34
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/ParraAPI.d.ts +54 -0
- package/dist/ParraAPI.js +33 -1
- package/package.json +1 -1
package/dist/ParraAPI.d.ts
CHANGED
|
@@ -1,4 +1,55 @@
|
|
|
1
1
|
import { HTTPClient } from "@parra/http-client";
|
|
2
|
+
export interface CreateCheckoutSessionRequestBody {
|
|
3
|
+
plan_id: string;
|
|
4
|
+
}
|
|
5
|
+
export interface CheckoutSession {
|
|
6
|
+
url: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CreateCustomerRequestBody {
|
|
9
|
+
name: string;
|
|
10
|
+
tenant_id: string;
|
|
11
|
+
}
|
|
12
|
+
export interface Customer {
|
|
13
|
+
id: string;
|
|
14
|
+
created_at: string;
|
|
15
|
+
updated_at: string;
|
|
16
|
+
deleted_at?: string | null;
|
|
17
|
+
name: string;
|
|
18
|
+
tenant_id: string;
|
|
19
|
+
stripe_customer_id: string;
|
|
20
|
+
}
|
|
21
|
+
export declare enum Currency {
|
|
22
|
+
usd = "usd"
|
|
23
|
+
}
|
|
24
|
+
export declare enum Interval {
|
|
25
|
+
monthly = "monthly",
|
|
26
|
+
annual = "annual"
|
|
27
|
+
}
|
|
28
|
+
export interface Price {
|
|
29
|
+
currency: Currency;
|
|
30
|
+
amount: number;
|
|
31
|
+
}
|
|
32
|
+
export interface UnitPrice {
|
|
33
|
+
currency: Currency;
|
|
34
|
+
amount: number;
|
|
35
|
+
interval?: Interval;
|
|
36
|
+
}
|
|
37
|
+
export interface Plan {
|
|
38
|
+
id: string;
|
|
39
|
+
created_at: string;
|
|
40
|
+
updated_at: string;
|
|
41
|
+
deleted_at?: string | null;
|
|
42
|
+
}
|
|
43
|
+
export interface Subscription {
|
|
44
|
+
id: string;
|
|
45
|
+
created_at: string;
|
|
46
|
+
updated_at: string;
|
|
47
|
+
deleted_at?: string | null;
|
|
48
|
+
}
|
|
49
|
+
export interface TenantPlansResponse {
|
|
50
|
+
plans?: Array<Plan>;
|
|
51
|
+
subscriptions?: Array<Subscription>;
|
|
52
|
+
}
|
|
2
53
|
export interface CreateTenantRequestBody {
|
|
3
54
|
name: string;
|
|
4
55
|
is_test: boolean;
|
|
@@ -292,6 +343,9 @@ declare class ParraAPI {
|
|
|
292
343
|
constructor(http: HTTPClient, options: {
|
|
293
344
|
baseUrl: string;
|
|
294
345
|
});
|
|
346
|
+
createCustomer: (body?: CreateCustomerRequestBody | undefined) => Promise<Customer>;
|
|
347
|
+
createCheckoutSession: (body?: CreateCheckoutSessionRequestBody | undefined) => Promise<CheckoutSession>;
|
|
348
|
+
getPlansForTenantById: (tenant_id: string) => Promise<TenantPlansResponse>;
|
|
295
349
|
getTenantById: (tenant_id: string) => Promise<Tenant>;
|
|
296
350
|
createTenantForUserById: (user_id: string, body?: CreateTenantRequestBody | undefined) => Promise<Tenant>;
|
|
297
351
|
getTenantsForUserById: (user_id: string) => Promise<TenantListResponse>;
|
package/dist/ParraAPI.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QuestionStatus = exports.QuestionKind = exports.QuestionType = exports.CardItemType = void 0;
|
|
3
|
+
exports.QuestionStatus = exports.QuestionKind = exports.QuestionType = exports.CardItemType = exports.Interval = exports.Currency = void 0;
|
|
4
|
+
var Currency;
|
|
5
|
+
(function (Currency) {
|
|
6
|
+
Currency["usd"] = "usd";
|
|
7
|
+
})(Currency = exports.Currency || (exports.Currency = {}));
|
|
8
|
+
var Interval;
|
|
9
|
+
(function (Interval) {
|
|
10
|
+
Interval["monthly"] = "monthly";
|
|
11
|
+
Interval["annual"] = "annual";
|
|
12
|
+
})(Interval = exports.Interval || (exports.Interval = {}));
|
|
4
13
|
var CardItemType;
|
|
5
14
|
(function (CardItemType) {
|
|
6
15
|
CardItemType["question"] = "question";
|
|
@@ -26,6 +35,29 @@ var ParraAPI = /** @class */ (function () {
|
|
|
26
35
|
var _this = this;
|
|
27
36
|
this.http = http;
|
|
28
37
|
this.options = options;
|
|
38
|
+
this.createCustomer = function (body) {
|
|
39
|
+
return _this.http.execute(_this.options.baseUrl + "/v1/customers", {
|
|
40
|
+
method: "post",
|
|
41
|
+
body: JSON.stringify(body),
|
|
42
|
+
headers: {
|
|
43
|
+
"content-type": "application/json",
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
this.createCheckoutSession = function (body) {
|
|
48
|
+
return _this.http.execute(_this.options.baseUrl + "/v1/checkout/sessions", {
|
|
49
|
+
method: "post",
|
|
50
|
+
body: JSON.stringify(body),
|
|
51
|
+
headers: {
|
|
52
|
+
"content-type": "application/json",
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
this.getPlansForTenantById = function (tenant_id) {
|
|
57
|
+
return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id + "/plans", {
|
|
58
|
+
method: "post",
|
|
59
|
+
});
|
|
60
|
+
};
|
|
29
61
|
this.getTenantById = function (tenant_id) {
|
|
30
62
|
return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id, {
|
|
31
63
|
method: "get",
|