@parra/parra-js-sdk 0.2.43 → 0.2.46

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.
@@ -419,6 +419,9 @@ export interface UserCollectionResponse {
419
419
  export interface CheckAuthorizationRequestBody {
420
420
  scope: string;
421
421
  }
422
+ export interface AuthToken {
423
+ access_token: string;
424
+ }
422
425
  export interface CheckAuthorization {
423
426
  allowed: boolean;
424
427
  }
@@ -481,5 +484,6 @@ declare class ParraAPI {
481
484
  getUserByProviderAndProviderUserId: (provider: string, provider_user_id: string) => Promise<UserResponse>;
482
485
  checkAuthorization: (body?: CheckAuthorizationRequestBody | undefined) => Promise<CheckAuthorization>;
483
486
  getUserInfo: () => Promise<UserInfoResponse>;
487
+ getParraAuthToken: () => Promise<AuthToken>;
484
488
  }
485
489
  export default ParraAPI;
package/dist/ParraAPI.js CHANGED
@@ -46,7 +46,7 @@ var ParraAPI = /** @class */ (function () {
46
46
  this.http = http;
47
47
  this.options = options;
48
48
  this.createCustomer = function (body) {
49
- return _this.http.execute(_this.options.baseUrl + "/v1/customers", {
49
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/customers"), {
50
50
  method: "post",
51
51
  body: JSON.stringify(body),
52
52
  headers: {
@@ -55,17 +55,17 @@ var ParraAPI = /** @class */ (function () {
55
55
  });
56
56
  };
57
57
  this.updateEntitlementsForCustomerById = function (customer_id) {
58
- return _this.http.execute(_this.options.baseUrl + "/v1/customers/" + customer_id + "/entitlements", {
58
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/customers/").concat(customer_id, "/entitlements"), {
59
59
  method: "post",
60
60
  });
61
61
  };
62
62
  this.createBillingPortalSession = function (tenant_id) {
63
- return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id + "/billing-portal/sessions", {
63
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/billing-portal/sessions"), {
64
64
  method: "post",
65
65
  });
66
66
  };
67
67
  this.createCheckoutSession = function (body) {
68
- return _this.http.execute(_this.options.baseUrl + "/v1/checkout/sessions", {
68
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/checkout/sessions"), {
69
69
  method: "post",
70
70
  body: JSON.stringify(body),
71
71
  headers: {
@@ -74,12 +74,12 @@ var ParraAPI = /** @class */ (function () {
74
74
  });
75
75
  };
76
76
  this.getPlansForTenantById = function (tenant_id) {
77
- return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id + "/plans", {
77
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/plans"), {
78
78
  method: "post",
79
79
  });
80
80
  };
81
81
  this.createAudience = function (body) {
82
- return _this.http.execute(_this.options.baseUrl + "/v1/email/audiences", {
82
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/email/audiences"), {
83
83
  method: "post",
84
84
  body: JSON.stringify(body),
85
85
  headers: {
@@ -88,7 +88,7 @@ var ParraAPI = /** @class */ (function () {
88
88
  });
89
89
  };
90
90
  this.createSubscriberForAudienceById = function (audience_id, body) {
91
- return _this.http.execute(_this.options.baseUrl + "/v1/email/audiences/" + audience_id + "/subscribers", {
91
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/email/audiences/").concat(audience_id, "/subscribers"), {
92
92
  method: "post",
93
93
  body: JSON.stringify(body),
94
94
  headers: {
@@ -97,12 +97,12 @@ var ParraAPI = /** @class */ (function () {
97
97
  });
98
98
  };
99
99
  this.getTenantById = function (tenant_id) {
100
- return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id, {
100
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id), {
101
101
  method: "get",
102
102
  });
103
103
  };
104
104
  this.createTenantForUserById = function (user_id, body) {
105
- return _this.http.execute(_this.options.baseUrl + "/v1/users/" + user_id + "/tenants", {
105
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/users/").concat(user_id, "/tenants"), {
106
106
  method: "post",
107
107
  body: JSON.stringify(body),
108
108
  headers: {
@@ -111,12 +111,12 @@ var ParraAPI = /** @class */ (function () {
111
111
  });
112
112
  };
113
113
  this.getTenantsForUserById = function (user_id) {
114
- return _this.http.execute(_this.options.baseUrl + "/v1/users/" + user_id + "/tenants", {
114
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/users/").concat(user_id, "/tenants"), {
115
115
  method: "get",
116
116
  });
117
117
  };
118
118
  this.createApiKeyForTenantById = function (tenant_id, body) {
119
- return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id + "/api-keys", {
119
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/api-keys"), {
120
120
  method: "post",
121
121
  body: JSON.stringify(body),
122
122
  headers: {
@@ -125,27 +125,27 @@ var ParraAPI = /** @class */ (function () {
125
125
  });
126
126
  };
127
127
  this.getApiKeysForTenantById = function (tenant_id) {
128
- return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id + "/api-keys", {
128
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/api-keys"), {
129
129
  method: "get",
130
130
  });
131
131
  };
132
132
  this.deleteApiKeyForTenantById = function (tenant_id, api_key_id) {
133
- return _this.http.execute(_this.options.baseUrl + "/v1/tenants/" + tenant_id + "/api-keys/" + api_key_id, {
133
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/").concat(tenant_id, "/api-keys/").concat(api_key_id), {
134
134
  method: "delete",
135
135
  });
136
136
  };
137
137
  this.getTenantForApiKeyById = function (api_key_id) {
138
- return _this.http.execute(_this.options.baseUrl + "/v1/api-keys/" + api_key_id + "/tenant", {
138
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/api-keys/").concat(api_key_id, "/tenant"), {
139
139
  method: "get",
140
140
  });
141
141
  };
142
142
  this.getCards = function () {
143
- return _this.http.execute(_this.options.baseUrl + "/v1/cards", {
143
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/cards"), {
144
144
  method: "get",
145
145
  });
146
146
  };
147
147
  this.createQuestion = function (body) {
148
- return _this.http.execute(_this.options.baseUrl + "/v1/questions", {
148
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/questions"), {
149
149
  method: "post",
150
150
  body: JSON.stringify(body),
151
151
  headers: {
@@ -154,18 +154,18 @@ var ParraAPI = /** @class */ (function () {
154
154
  });
155
155
  };
156
156
  this.paginateQuestions = function (query) {
157
- return _this.http.execute(_this.options.baseUrl + "/v1/questions", {
157
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/questions"), {
158
158
  method: "get",
159
159
  query: query,
160
160
  });
161
161
  };
162
162
  this.getQuestionById = function (question_id) {
163
- return _this.http.execute(_this.options.baseUrl + "/v1/questions/" + question_id, {
163
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/questions/").concat(question_id), {
164
164
  method: "get",
165
165
  });
166
166
  };
167
167
  this.updateQuestionById = function (question_id, body) {
168
- return _this.http.execute(_this.options.baseUrl + "/v1/questions/" + question_id, {
168
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/questions/").concat(question_id), {
169
169
  method: "put",
170
170
  body: JSON.stringify(body),
171
171
  headers: {
@@ -174,22 +174,22 @@ var ParraAPI = /** @class */ (function () {
174
174
  });
175
175
  };
176
176
  this.deleteQuestionById = function (question_id) {
177
- return _this.http.execute(_this.options.baseUrl + "/v1/questions/" + question_id, {
177
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/questions/").concat(question_id), {
178
178
  method: "delete",
179
179
  });
180
180
  };
181
181
  this.closeQuestionById = function (question_id) {
182
- return _this.http.execute(_this.options.baseUrl + "/v1/questions/" + question_id + "/close", {
182
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/questions/").concat(question_id, "/close"), {
183
183
  method: "post",
184
184
  });
185
185
  };
186
186
  this.createMetricsForQuestionById = function (question_id) {
187
- return _this.http.execute(_this.options.baseUrl + "/v1/questions/" + question_id + "/metrics", {
187
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/questions/").concat(question_id, "/metrics"), {
188
188
  method: "post",
189
189
  });
190
190
  };
191
191
  this.answerQuestionById = function (question_id, body) {
192
- return _this.http.execute(_this.options.baseUrl + "/v1/questions/" + question_id + "/answer", {
192
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/questions/").concat(question_id, "/answer"), {
193
193
  method: "put",
194
194
  body: JSON.stringify(body),
195
195
  headers: {
@@ -198,7 +198,7 @@ var ParraAPI = /** @class */ (function () {
198
198
  });
199
199
  };
200
200
  this.bulkAnswerQuestions = function (body) {
201
- return _this.http.execute(_this.options.baseUrl + "/v1/bulk/questions/answer", {
201
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/bulk/questions/answer"), {
202
202
  method: "post",
203
203
  body: JSON.stringify(body),
204
204
  headers: {
@@ -207,7 +207,7 @@ var ParraAPI = /** @class */ (function () {
207
207
  });
208
208
  };
209
209
  this.createUser = function (body) {
210
- return _this.http.execute(_this.options.baseUrl + "/v1/users", {
210
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/users"), {
211
211
  method: "post",
212
212
  body: JSON.stringify(body),
213
213
  headers: {
@@ -216,18 +216,18 @@ var ParraAPI = /** @class */ (function () {
216
216
  });
217
217
  };
218
218
  this.listUsers = function (query) {
219
- return _this.http.execute(_this.options.baseUrl + "/v1/users", {
219
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/users"), {
220
220
  method: "get",
221
221
  query: query,
222
222
  });
223
223
  };
224
224
  this.getUserById = function (user_id) {
225
- return _this.http.execute(_this.options.baseUrl + "/v1/users/" + user_id, {
225
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/users/").concat(user_id), {
226
226
  method: "get",
227
227
  });
228
228
  };
229
229
  this.updateUserById = function (user_id, body) {
230
- return _this.http.execute(_this.options.baseUrl + "/v1/users/" + user_id, {
230
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/users/").concat(user_id), {
231
231
  method: "put",
232
232
  body: JSON.stringify(body),
233
233
  headers: {
@@ -236,12 +236,12 @@ var ParraAPI = /** @class */ (function () {
236
236
  });
237
237
  };
238
238
  this.deleteUserById = function (user_id) {
239
- return _this.http.execute(_this.options.baseUrl + "/v1/users/" + user_id, {
239
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/users/").concat(user_id), {
240
240
  method: "delete",
241
241
  });
242
242
  };
243
243
  this.createIdentityForUserById = function (user_id, body) {
244
- return _this.http.execute(_this.options.baseUrl + "/v1/users/" + user_id + "/identities", {
244
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/users/").concat(user_id, "/identities"), {
245
245
  method: "post",
246
246
  body: JSON.stringify(body),
247
247
  headers: {
@@ -250,17 +250,17 @@ var ParraAPI = /** @class */ (function () {
250
250
  });
251
251
  };
252
252
  this.listIdentitiesForUserById = function (user_id) {
253
- return _this.http.execute(_this.options.baseUrl + "/v1/users/" + user_id + "/identities", {
253
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/users/").concat(user_id, "/identities"), {
254
254
  method: "get",
255
255
  });
256
256
  };
257
257
  this.getUserByProviderAndProviderUserId = function (provider, provider_user_id) {
258
- return _this.http.execute(_this.options.baseUrl + "/v1/providers/" + provider + "/identities/" + provider_user_id + "/user", {
258
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/providers/").concat(provider, "/identities/").concat(provider_user_id, "/user"), {
259
259
  method: "get",
260
260
  });
261
261
  };
262
262
  this.checkAuthorization = function (body) {
263
- return _this.http.execute(_this.options.baseUrl + "/v1/tenants/authorization/check", {
263
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/tenants/authorization/check"), {
264
264
  method: "post",
265
265
  body: JSON.stringify(body),
266
266
  headers: {
@@ -269,10 +269,15 @@ var ParraAPI = /** @class */ (function () {
269
269
  });
270
270
  };
271
271
  this.getUserInfo = function () {
272
- return _this.http.execute(_this.options.baseUrl + "/v1/user-info", {
272
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/user-info"), {
273
273
  method: "get",
274
274
  });
275
275
  };
276
+ this.getParraAuthToken = function () {
277
+ return _this.http.execute("".concat(_this.options.baseUrl, "/v1/parra/auth/token"), {
278
+ method: "post",
279
+ });
280
+ };
276
281
  }
277
282
  return ParraAPI;
278
283
  }());
package/dist/index.js CHANGED
@@ -1,13 +1,17 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
8
12
  }));
9
13
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
15
  };
12
16
  var __importDefault = (this && this.__importDefault) || function (mod) {
13
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parra/parra-js-sdk",
3
- "version": "0.2.43",
3
+ "version": "0.2.46",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,11 +18,11 @@
18
18
  "author": "Parra",
19
19
  "license": "ISC",
20
20
  "devDependencies": {
21
- "prettier": "^2.0.5",
22
- "typescript": "^3.9.7"
21
+ "prettier": "^2.6.2",
22
+ "typescript": "^4.6.3"
23
23
  },
24
24
  "dependencies": {
25
- "@parra/http-client": "0.1.0",
25
+ "@parra/http-client": "0.2.0",
26
26
  "isomorphic-fetch": "^3.0.0"
27
27
  }
28
28
  }