@parra/parra-js-sdk 0.2.28 → 0.2.32

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,23 @@
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
+ }
2
21
  export interface CreateTenantRequestBody {
3
22
  name: string;
4
23
  is_test: boolean;
@@ -90,7 +109,7 @@ export declare enum QuestionKind {
90
109
  checkbox = "checkbox",
91
110
  star = "star"
92
111
  }
93
- export interface CreateChoiceQuestionOption {
112
+ export interface MutableChoiceQuestionOption {
94
113
  title: string;
95
114
  value: string;
96
115
  is_other?: boolean | null;
@@ -104,15 +123,15 @@ export interface ChoiceQuestionOption {
104
123
  export interface ChoiceQuestionBody {
105
124
  options: Array<ChoiceQuestionOption>;
106
125
  }
107
- export interface CreateChoiceQuestionBody {
108
- options: Array<CreateChoiceQuestionOption>;
126
+ export interface MutableChoiceQuestionBody {
127
+ options: Array<MutableChoiceQuestionOption>;
109
128
  }
110
- export declare type CreateQuestionData = CreateChoiceQuestionBody;
129
+ export declare type MutableQuestionData = MutableChoiceQuestionBody;
111
130
  export declare type QuestionData = ChoiceQuestionBody;
112
131
  export interface UpdateQuestionRequestBody {
113
132
  title: string;
114
133
  subtitle?: string | null;
115
- data: CreateQuestionData;
134
+ data: MutableQuestionData;
116
135
  active?: boolean;
117
136
  expires_at?: string | null;
118
137
  answer_quota?: number | null;
@@ -120,7 +139,7 @@ export interface UpdateQuestionRequestBody {
120
139
  export interface CreateQuestionRequestBody {
121
140
  title: string;
122
141
  subtitle?: string | null;
123
- data: CreateQuestionData;
142
+ data: MutableQuestionData;
124
143
  active?: boolean;
125
144
  expires_at?: string | null;
126
145
  answer_quota?: number | null;
@@ -292,6 +311,8 @@ declare class ParraAPI {
292
311
  constructor(http: HTTPClient, options: {
293
312
  baseUrl: string;
294
313
  });
314
+ createCustomer: (body?: CreateCustomerRequestBody | undefined) => Promise<Customer>;
315
+ createCheckoutSession: (body?: CreateCheckoutSessionRequestBody | undefined) => Promise<CheckoutSession>;
295
316
  getTenantById: (tenant_id: string) => Promise<Tenant>;
296
317
  createTenantForUserById: (user_id: string, body?: CreateTenantRequestBody | undefined) => Promise<Tenant>;
297
318
  getTenantsForUserById: (user_id: string) => Promise<TenantListResponse>;
@@ -306,7 +327,7 @@ declare class ParraAPI {
306
327
  $select?: string | undefined;
307
328
  $top?: number | undefined;
308
329
  $skip?: number | undefined;
309
- $orderBy?: string | undefined;
330
+ $orderby?: string | undefined;
310
331
  $filter?: string | undefined;
311
332
  $expand?: string | undefined;
312
333
  $search?: string | undefined;
@@ -323,7 +344,7 @@ declare class ParraAPI {
323
344
  $select?: string | undefined;
324
345
  $top?: number | undefined;
325
346
  $skip?: number | undefined;
326
- $orderBy?: string | undefined;
347
+ $orderby?: string | undefined;
327
348
  $filter?: string | undefined;
328
349
  $expand?: string | undefined;
329
350
  $search?: string | undefined;
package/dist/ParraAPI.js CHANGED
@@ -26,6 +26,24 @@ var ParraAPI = /** @class */ (function () {
26
26
  var _this = this;
27
27
  this.http = http;
28
28
  this.options = options;
29
+ this.createCustomer = function (body) {
30
+ return _this.http.execute(_this.options.baseUrl + "/v1/customers", {
31
+ method: "post",
32
+ body: JSON.stringify(body),
33
+ headers: {
34
+ "content-type": "application/json",
35
+ },
36
+ });
37
+ };
38
+ this.createCheckoutSession = function (body) {
39
+ return _this.http.execute(_this.options.baseUrl + "/v1/checkout/sessions", {
40
+ method: "post",
41
+ body: JSON.stringify(body),
42
+ headers: {
43
+ "content-type": "application/json",
44
+ },
45
+ });
46
+ };
29
47
  this.getTenantById = function (tenant_id) {
30
48
  return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id, {
31
49
  method: "get",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.28",
3
+ "version": "0.2.32",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",