@parra/parra-js-sdk 0.2.29 → 0.2.33

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.
@@ -1,4 +1,39 @@
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
+ }
2
37
  export interface CreateTenantRequestBody {
3
38
  name: string;
4
39
  is_test: boolean;
@@ -292,6 +327,8 @@ declare class ParraAPI {
292
327
  constructor(http: HTTPClient, options: {
293
328
  baseUrl: string;
294
329
  });
330
+ createCustomer: (body?: CreateCustomerRequestBody | undefined) => Promise<Customer>;
331
+ createCheckoutSession: (body?: CreateCheckoutSessionRequestBody | undefined) => Promise<CheckoutSession>;
295
332
  getTenantById: (tenant_id: string) => Promise<Tenant>;
296
333
  createTenantForUserById: (user_id: string, body?: CreateTenantRequestBody | undefined) => Promise<Tenant>;
297
334
  getTenantsForUserById: (user_id: string) => Promise<TenantListResponse>;
@@ -306,7 +343,7 @@ declare class ParraAPI {
306
343
  $select?: string | undefined;
307
344
  $top?: number | undefined;
308
345
  $skip?: number | undefined;
309
- $orderBy?: string | undefined;
346
+ $orderby?: string | undefined;
310
347
  $filter?: string | undefined;
311
348
  $expand?: string | undefined;
312
349
  $search?: string | undefined;
@@ -323,7 +360,7 @@ declare class ParraAPI {
323
360
  $select?: string | undefined;
324
361
  $top?: number | undefined;
325
362
  $skip?: number | undefined;
326
- $orderBy?: string | undefined;
363
+ $orderby?: string | undefined;
327
364
  $filter?: string | undefined;
328
365
  $expand?: string | undefined;
329
366
  $search?: string | undefined;
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,24 @@ 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
+ };
29
56
  this.getTenantById = function (tenant_id) {
30
57
  return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id, {
31
58
  method: "get",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.29",
3
+ "version": "0.2.33",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",