@parra/parra-js-sdk 0.2.39 → 0.2.43

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,13 @@
1
1
  import { HTTPClient } from "@parra/http-client";
2
+ export interface AuthorizationCheckRequestBody {
3
+ namespace: string;
4
+ subject: string;
5
+ scope: string;
6
+ context?: Map<string, any>;
7
+ }
8
+ export interface AuthorizationCheck {
9
+ allowed: boolean;
10
+ }
2
11
  export interface CreateCheckoutSessionRequestBody {
3
12
  plan_id: string;
4
13
  }
@@ -35,18 +44,18 @@ export interface Price {
35
44
  export interface UnitPrice {
36
45
  currency: Currency;
37
46
  amount: number;
38
- interval?: Interval;
47
+ interval?: Interval | null;
39
48
  }
40
49
  export interface Plan {
41
50
  id: string;
42
51
  created_at: string;
43
52
  updated_at: string;
44
53
  deleted_at?: string | null;
45
- tier: string;
46
- interval: string;
47
- price: UnitPrice;
48
- discounted_price?: Price;
49
- unit_price: UnitPrice;
54
+ tier: string | null;
55
+ interval: string | null;
56
+ price: UnitPrice | null;
57
+ discounted_price?: Price | null;
58
+ unit_price: UnitPrice | null;
50
59
  context?: string | null;
51
60
  }
52
61
  export declare enum SubscriptionStatus {
@@ -72,7 +81,7 @@ export interface Subscription {
72
81
  updated_at: string;
73
82
  deleted_at?: string | null;
74
83
  customer_id: string;
75
- status: SubscriptionStatus;
84
+ status: SubscriptionStatus | null;
76
85
  cancel_at?: string | null;
77
86
  cancel_at_period_end?: boolean | null;
78
87
  canceled_at?: string | null;
@@ -82,18 +91,47 @@ export interface Subscription {
82
91
  ended_at?: string | null;
83
92
  trial_start?: string | null;
84
93
  trial_end?: string | null;
85
- items: Array<SubscriptionItem>;
94
+ items: Array<SubscriptionItem> | null;
86
95
  }
87
96
  export interface TenantPlansResponse {
88
- plans?: Array<Plan>;
89
- subscriptions?: Array<Subscription>;
97
+ plans?: Array<Plan> | null;
98
+ subscriptions?: Array<Subscription> | null;
90
99
  }
91
100
  export interface StripeEvent {
92
101
  }
102
+ export interface CreateAudienceRequestBody {
103
+ tenant_id: string;
104
+ name: string;
105
+ }
106
+ export interface Audience {
107
+ id: string;
108
+ created_at: string;
109
+ updated_at: string;
110
+ deleted_at?: string | null;
111
+ tenant_id: string;
112
+ name: string;
113
+ }
114
+ export interface CreateSubscriberRequestBody {
115
+ email: string;
116
+ }
117
+ export interface Entitlement {
118
+ }
119
+ export declare type Entitlements = Array<Entitlement>;
120
+ export declare type UpdateEntitlementsRequestBody = Array<Entitlement>;
93
121
  export interface CreateTenantRequestBody {
94
122
  name: string;
95
123
  is_test: boolean;
96
124
  }
125
+ export interface TenantUser {
126
+ id: string;
127
+ created_at: string;
128
+ updated_at: string;
129
+ deleted_at?: string | null;
130
+ name: string;
131
+ is_test: boolean;
132
+ entitlements?: Array<Entitlement> | null;
133
+ scopes: Array<string>;
134
+ }
97
135
  export interface Tenant {
98
136
  id: string;
99
137
  created_at: string;
@@ -101,6 +139,7 @@ export interface Tenant {
101
139
  deleted_at?: string | null;
102
140
  name: string;
103
141
  is_test: boolean;
142
+ entitlements?: Array<Entitlement> | null;
104
143
  }
105
144
  export declare type TenantListResponse = Array<Tenant>;
106
145
  export interface TenantCollectionResponse {
@@ -142,6 +181,9 @@ export interface ApiKeyCollectionResponse {
142
181
  }
143
182
  export interface AnswerData {
144
183
  }
184
+ export interface FeedbackMetrics {
185
+ questions_created_this_month: number;
186
+ }
145
187
  export interface Answer {
146
188
  id: string;
147
189
  created_at: string;
@@ -165,12 +207,12 @@ export declare enum CardItemType {
165
207
  question = "question"
166
208
  }
167
209
  export interface CardItem {
168
- type: CardItemType;
169
- version: string;
170
- data: CardItemData;
210
+ type: CardItemType | null;
211
+ version: string | null;
212
+ data: CardItemData | null;
171
213
  }
172
214
  export interface CardsResponse {
173
- items: Array<CardItem>;
215
+ items: Array<CardItem> | null;
174
216
  }
175
217
  export declare enum QuestionType {
176
218
  choice = "choice",
@@ -182,28 +224,28 @@ export declare enum QuestionKind {
182
224
  star = "star"
183
225
  }
184
226
  export interface MutableChoiceQuestionOption {
185
- title: string;
186
- value: string;
227
+ title: string | null;
228
+ value: string | null;
187
229
  is_other?: boolean | null;
188
230
  }
189
231
  export interface ChoiceQuestionOption {
190
- title: string;
191
- value: string;
232
+ title: string | null;
233
+ value: string | null;
192
234
  is_other?: boolean | null;
193
- id: string;
235
+ id: string | null;
194
236
  }
195
237
  export interface ChoiceQuestionBody {
196
- options: Array<ChoiceQuestionOption>;
238
+ options: Array<ChoiceQuestionOption> | null;
197
239
  }
198
240
  export interface MutableChoiceQuestionBody {
199
- options: Array<MutableChoiceQuestionOption>;
241
+ options: Array<MutableChoiceQuestionOption> | null;
200
242
  }
201
243
  export declare type MutableQuestionData = MutableChoiceQuestionBody;
202
244
  export declare type QuestionData = ChoiceQuestionBody;
203
245
  export interface UpdateQuestionRequestBody {
204
246
  title: string;
205
247
  subtitle?: string | null;
206
- data: MutableQuestionData;
248
+ data: MutableQuestionData | null;
207
249
  active?: boolean;
208
250
  expires_at?: string | null;
209
251
  answer_quota?: number | null;
@@ -211,12 +253,12 @@ export interface UpdateQuestionRequestBody {
211
253
  export interface CreateQuestionRequestBody {
212
254
  title: string;
213
255
  subtitle?: string | null;
214
- data: MutableQuestionData;
256
+ data: MutableQuestionData | null;
215
257
  active?: boolean;
216
258
  expires_at?: string | null;
217
259
  answer_quota?: number | null;
218
- type: QuestionType;
219
- kind: QuestionKind;
260
+ type: QuestionType | null;
261
+ kind: QuestionKind | null;
220
262
  }
221
263
  export declare enum QuestionStatus {
222
264
  open = "open",
@@ -227,20 +269,20 @@ export interface Question {
227
269
  created_at: string;
228
270
  updated_at: string;
229
271
  deleted_at?: string | null;
230
- status: QuestionStatus;
272
+ status: QuestionStatus | null;
231
273
  tenant_id: string;
232
274
  title: string;
233
275
  subtitle?: string | null;
234
- type: QuestionType;
235
- kind: QuestionKind;
236
- data: QuestionData;
276
+ type: QuestionType | null;
277
+ kind: QuestionKind | null;
278
+ data: QuestionData | null;
237
279
  active?: boolean;
238
280
  answer_quota?: number | null;
239
281
  answer_count?: number;
240
282
  expires_at?: string | null;
241
283
  closed_at?: string | null;
242
- answer?: Answer;
243
- metrics?: QuestionMetrics;
284
+ answer?: Answer | null;
285
+ metrics?: QuestionMetrics | null;
244
286
  }
245
287
  export interface QuestionCollectionResponse {
246
288
  page: number;
@@ -256,18 +298,18 @@ export interface QuestionMetrics {
256
298
  deleted_at?: string | null;
257
299
  question_id: string;
258
300
  answer_count: number;
259
- type: QuestionType;
260
- data: QuestionMetricsData;
301
+ type: QuestionType | null;
302
+ data: QuestionMetricsData | null;
261
303
  }
262
304
  export declare type QuestionMetricsData = ChoiceQuestionMetricsBody;
263
305
  export interface ChoiceQuestionMetricsBody {
264
- options: Array<ChoiceQuestionMetricsOption>;
306
+ options: Array<ChoiceQuestionMetricsOption> | null;
265
307
  }
266
308
  export interface ChoiceQuestionMetricsOption {
267
- title: string;
268
- value: string;
309
+ title: string | null;
310
+ value: string | null;
269
311
  is_other?: boolean | null;
270
- id: string;
312
+ id: string | null;
271
313
  answer_count: number;
272
314
  }
273
315
  export interface NotificationRecipient {
@@ -287,7 +329,7 @@ export interface CreateNotificationRequestBody {
287
329
  silent?: boolean;
288
330
  content_available?: boolean;
289
331
  expires_at?: string | null;
290
- recipients: Array<NotificationRecipient>;
332
+ recipients: Array<NotificationRecipient> | null;
291
333
  }
292
334
  export interface NotificationResponse {
293
335
  type?: string;
@@ -360,7 +402,7 @@ export interface CreateUserRequestBody {
360
402
  avatar_url?: string | null;
361
403
  locale?: string | null;
362
404
  type: string;
363
- identities?: Array<CreateIdentityRequestBody>;
405
+ identities?: Array<CreateIdentityRequestBody> | null;
364
406
  }
365
407
  export interface UpdateUserRequestBody {
366
408
  first_name: string;
@@ -374,6 +416,12 @@ export interface UserCollectionResponse {
374
416
  total_count: number;
375
417
  data: Array<UserResponse>;
376
418
  }
419
+ export interface CheckAuthorizationRequestBody {
420
+ scope: string;
421
+ }
422
+ export interface CheckAuthorization {
423
+ allowed: boolean;
424
+ }
377
425
  export interface UserInfoResponse {
378
426
  user?: UserResponse | null;
379
427
  }
@@ -384,13 +432,15 @@ declare class ParraAPI {
384
432
  baseUrl: string;
385
433
  });
386
434
  createCustomer: (body?: CreateCustomerRequestBody | undefined) => Promise<Customer>;
435
+ updateEntitlementsForCustomerById: (customer_id: string) => Promise<Response>;
387
436
  createBillingPortalSession: (tenant_id: string) => Promise<BillingPortalSession>;
388
437
  createCheckoutSession: (body?: CreateCheckoutSessionRequestBody | undefined) => Promise<CheckoutSession>;
389
438
  getPlansForTenantById: (tenant_id: string) => Promise<TenantPlansResponse>;
439
+ createAudience: (body?: CreateAudienceRequestBody | undefined) => Promise<Audience>;
440
+ createSubscriberForAudienceById: (audience_id: string, body?: CreateSubscriberRequestBody | undefined) => Promise<Response>;
390
441
  getTenantById: (tenant_id: string) => Promise<Tenant>;
391
442
  createTenantForUserById: (user_id: string, body?: CreateTenantRequestBody | undefined) => Promise<Tenant>;
392
443
  getTenantsForUserById: (user_id: string) => Promise<TenantListResponse>;
393
- getTenantByUserIdAndTenantId: (user_id: string, tenant_id: string) => Promise<Tenant>;
394
444
  createApiKeyForTenantById: (tenant_id: string, body?: CreateApiKeyRequestBody | undefined) => Promise<ApiKeyWithSecretResponse>;
395
445
  getApiKeysForTenantById: (tenant_id: string) => Promise<ApiKeyCollectionResponse>;
396
446
  deleteApiKeyForTenantById: (tenant_id: string, api_key_id: string) => Promise<Response>;
@@ -429,6 +479,7 @@ declare class ParraAPI {
429
479
  createIdentityForUserById: (user_id: string, body: CreateIdentityRequestBody) => Promise<IdentityResponse>;
430
480
  listIdentitiesForUserById: (user_id: string) => Promise<Array<IdentityResponse>>;
431
481
  getUserByProviderAndProviderUserId: (provider: string, provider_user_id: string) => Promise<UserResponse>;
482
+ checkAuthorization: (body?: CheckAuthorizationRequestBody | undefined) => Promise<CheckAuthorization>;
432
483
  getUserInfo: () => Promise<UserInfoResponse>;
433
484
  }
434
485
  export default ParraAPI;
package/dist/ParraAPI.js CHANGED
@@ -54,6 +54,11 @@ var ParraAPI = /** @class */ (function () {
54
54
  },
55
55
  });
56
56
  };
57
+ this.updateEntitlementsForCustomerById = function (customer_id) {
58
+ return _this.http.execute(_this.options.baseUrl + "/v1/customers/" + customer_id + "/entitlements", {
59
+ method: "post",
60
+ });
61
+ };
57
62
  this.createBillingPortalSession = function (tenant_id) {
58
63
  return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id + "/billing-portal/sessions", {
59
64
  method: "post",
@@ -73,6 +78,24 @@ var ParraAPI = /** @class */ (function () {
73
78
  method: "post",
74
79
  });
75
80
  };
81
+ this.createAudience = function (body) {
82
+ return _this.http.execute(_this.options.baseUrl + "/v1/email/audiences", {
83
+ method: "post",
84
+ body: JSON.stringify(body),
85
+ headers: {
86
+ "content-type": "application/json",
87
+ },
88
+ });
89
+ };
90
+ this.createSubscriberForAudienceById = function (audience_id, body) {
91
+ return _this.http.execute(_this.options.baseUrl + "/v1/email/audiences/" + audience_id + "/subscribers", {
92
+ method: "post",
93
+ body: JSON.stringify(body),
94
+ headers: {
95
+ "content-type": "application/json",
96
+ },
97
+ });
98
+ };
76
99
  this.getTenantById = function (tenant_id) {
77
100
  return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id, {
78
101
  method: "get",
@@ -92,11 +115,6 @@ var ParraAPI = /** @class */ (function () {
92
115
  method: "get",
93
116
  });
94
117
  };
95
- this.getTenantByUserIdAndTenantId = function (user_id, tenant_id) {
96
- return _this.http.execute(_this.options.baseUrl + "/v1/users/" + user_id + "/tenants/" + tenant_id, {
97
- method: "get",
98
- });
99
- };
100
118
  this.createApiKeyForTenantById = function (tenant_id, body) {
101
119
  return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id + "/api-keys", {
102
120
  method: "post",
@@ -241,6 +259,15 @@ var ParraAPI = /** @class */ (function () {
241
259
  method: "get",
242
260
  });
243
261
  };
262
+ this.checkAuthorization = function (body) {
263
+ return _this.http.execute(_this.options.baseUrl + "/v1/tenants/authorization/check", {
264
+ method: "post",
265
+ body: JSON.stringify(body),
266
+ headers: {
267
+ "content-type": "application/json",
268
+ },
269
+ });
270
+ };
244
271
  this.getUserInfo = function () {
245
272
  return _this.http.execute(_this.options.baseUrl + "/v1/user-info", {
246
273
  method: "get",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.39",
3
+ "version": "0.2.43",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",