@parra/parra-js-sdk 0.2.41 → 0.2.44

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
  }
@@ -90,6 +99,21 @@ export interface TenantPlansResponse {
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
+ }
93
117
  export interface Entitlement {
94
118
  }
95
119
  export declare type Entitlements = Array<Entitlement>;
@@ -98,6 +122,16 @@ export interface CreateTenantRequestBody {
98
122
  name: string;
99
123
  is_test: boolean;
100
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
+ }
101
135
  export interface Tenant {
102
136
  id: string;
103
137
  created_at: string;
@@ -147,6 +181,9 @@ export interface ApiKeyCollectionResponse {
147
181
  }
148
182
  export interface AnswerData {
149
183
  }
184
+ export interface FeedbackMetrics {
185
+ questions_created_this_month: number;
186
+ }
150
187
  export interface Answer {
151
188
  id: string;
152
189
  created_at: string;
@@ -379,6 +416,15 @@ export interface UserCollectionResponse {
379
416
  total_count: number;
380
417
  data: Array<UserResponse>;
381
418
  }
419
+ export interface CheckAuthorizationRequestBody {
420
+ scope: string;
421
+ }
422
+ export interface AuthToken {
423
+ access_token: boolean;
424
+ }
425
+ export interface CheckAuthorization {
426
+ allowed: boolean;
427
+ }
382
428
  export interface UserInfoResponse {
383
429
  user?: UserResponse | null;
384
430
  }
@@ -393,10 +439,11 @@ declare class ParraAPI {
393
439
  createBillingPortalSession: (tenant_id: string) => Promise<BillingPortalSession>;
394
440
  createCheckoutSession: (body?: CreateCheckoutSessionRequestBody | undefined) => Promise<CheckoutSession>;
395
441
  getPlansForTenantById: (tenant_id: string) => Promise<TenantPlansResponse>;
442
+ createAudience: (body?: CreateAudienceRequestBody | undefined) => Promise<Audience>;
443
+ createSubscriberForAudienceById: (audience_id: string, body?: CreateSubscriberRequestBody | undefined) => Promise<Response>;
396
444
  getTenantById: (tenant_id: string) => Promise<Tenant>;
397
445
  createTenantForUserById: (user_id: string, body?: CreateTenantRequestBody | undefined) => Promise<Tenant>;
398
446
  getTenantsForUserById: (user_id: string) => Promise<TenantListResponse>;
399
- getTenantByUserIdAndTenantId: (user_id: string, tenant_id: string) => Promise<Tenant>;
400
447
  createApiKeyForTenantById: (tenant_id: string, body?: CreateApiKeyRequestBody | undefined) => Promise<ApiKeyWithSecretResponse>;
401
448
  getApiKeysForTenantById: (tenant_id: string) => Promise<ApiKeyCollectionResponse>;
402
449
  deleteApiKeyForTenantById: (tenant_id: string, api_key_id: string) => Promise<Response>;
@@ -435,6 +482,8 @@ declare class ParraAPI {
435
482
  createIdentityForUserById: (user_id: string, body: CreateIdentityRequestBody) => Promise<IdentityResponse>;
436
483
  listIdentitiesForUserById: (user_id: string) => Promise<Array<IdentityResponse>>;
437
484
  getUserByProviderAndProviderUserId: (provider: string, provider_user_id: string) => Promise<UserResponse>;
485
+ checkAuthorization: (body?: CheckAuthorizationRequestBody | undefined) => Promise<CheckAuthorization>;
438
486
  getUserInfo: () => Promise<UserInfoResponse>;
487
+ getParraAuthToken: () => Promise<AuthToken>;
439
488
  }
440
489
  export default ParraAPI;
package/dist/ParraAPI.js CHANGED
@@ -78,6 +78,24 @@ var ParraAPI = /** @class */ (function () {
78
78
  method: "post",
79
79
  });
80
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
+ };
81
99
  this.getTenantById = function (tenant_id) {
82
100
  return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id, {
83
101
  method: "get",
@@ -97,11 +115,6 @@ var ParraAPI = /** @class */ (function () {
97
115
  method: "get",
98
116
  });
99
117
  };
100
- this.getTenantByUserIdAndTenantId = function (user_id, tenant_id) {
101
- return _this.http.execute(_this.options.baseUrl + "/v1/users/" + user_id + "/tenants/" + tenant_id, {
102
- method: "get",
103
- });
104
- };
105
118
  this.createApiKeyForTenantById = function (tenant_id, body) {
106
119
  return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id + "/api-keys", {
107
120
  method: "post",
@@ -246,11 +259,25 @@ var ParraAPI = /** @class */ (function () {
246
259
  method: "get",
247
260
  });
248
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
+ };
249
271
  this.getUserInfo = function () {
250
272
  return _this.http.execute(_this.options.baseUrl + "/v1/user-info", {
251
273
  method: "get",
252
274
  });
253
275
  };
276
+ this.getParraAuthToken = function () {
277
+ return _this.http.execute(_this.options.baseUrl + "/v1/parra/auth/token", {
278
+ method: "post",
279
+ });
280
+ };
254
281
  }
255
282
  return ParraAPI;
256
283
  }());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.41",
3
+ "version": "0.2.44",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",