adapty 0.1.0 → 0.1.1
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.
- package/dist/lib/api-client.js +6 -3
- package/oclif.manifest.json +121 -121
- package/package.json +1 -1
package/dist/lib/api-client.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ApiError, NetworkError, parseApiError } from './errors.js';
|
|
2
2
|
const DEFAULT_API_URL = 'https://api.adapty.io/api/v1/developer';
|
|
3
|
+
function ensureTrailingSlash(path) {
|
|
4
|
+
return path.endsWith('/') ? path : `${path}/`;
|
|
5
|
+
}
|
|
3
6
|
export class ApiClient {
|
|
4
7
|
baseUrl;
|
|
5
8
|
token;
|
|
@@ -13,7 +16,7 @@ export class ApiClient {
|
|
|
13
16
|
this.userAgent = opts.userAgent ?? 'adapty-cli';
|
|
14
17
|
}
|
|
15
18
|
async get(path, params) {
|
|
16
|
-
let url = `${this.baseUrl}${path}`;
|
|
19
|
+
let url = `${this.baseUrl}${ensureTrailingSlash(path)}`;
|
|
17
20
|
if (params) {
|
|
18
21
|
const qs = new URLSearchParams(params);
|
|
19
22
|
url += `?${qs.toString()}`;
|
|
@@ -21,13 +24,13 @@ export class ApiClient {
|
|
|
21
24
|
return this.request(url, { method: 'GET' });
|
|
22
25
|
}
|
|
23
26
|
async post(path, body) {
|
|
24
|
-
return this.request(`${this.baseUrl}${path}`, {
|
|
27
|
+
return this.request(`${this.baseUrl}${ensureTrailingSlash(path)}`, {
|
|
25
28
|
body: body ? JSON.stringify(body) : undefined,
|
|
26
29
|
method: 'POST',
|
|
27
30
|
});
|
|
28
31
|
}
|
|
29
32
|
async put(path, body) {
|
|
30
|
-
return this.request(`${this.baseUrl}${path}`, {
|
|
33
|
+
return this.request(`${this.baseUrl}${ensureTrailingSlash(path)}`, {
|
|
31
34
|
body: body ? JSON.stringify(body) : undefined,
|
|
32
35
|
method: 'PUT',
|
|
33
36
|
});
|
package/oclif.manifest.json
CHANGED
|
@@ -212,6 +212,126 @@
|
|
|
212
212
|
"update.js"
|
|
213
213
|
]
|
|
214
214
|
},
|
|
215
|
+
"auth:login": {
|
|
216
|
+
"aliases": [],
|
|
217
|
+
"args": {},
|
|
218
|
+
"description": "Authenticate with Adapty via browser",
|
|
219
|
+
"examples": [
|
|
220
|
+
"<%= config.bin %> auth login"
|
|
221
|
+
],
|
|
222
|
+
"flags": {},
|
|
223
|
+
"hasDynamicHelp": false,
|
|
224
|
+
"hiddenAliases": [],
|
|
225
|
+
"id": "auth:login",
|
|
226
|
+
"pluginAlias": "adapty",
|
|
227
|
+
"pluginName": "adapty",
|
|
228
|
+
"pluginType": "core",
|
|
229
|
+
"strict": true,
|
|
230
|
+
"enableJsonFlag": false,
|
|
231
|
+
"isESM": true,
|
|
232
|
+
"relativePath": [
|
|
233
|
+
"dist",
|
|
234
|
+
"commands",
|
|
235
|
+
"auth",
|
|
236
|
+
"login.js"
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
"auth:logout": {
|
|
240
|
+
"aliases": [],
|
|
241
|
+
"args": {},
|
|
242
|
+
"description": "Remove stored authentication token",
|
|
243
|
+
"examples": [
|
|
244
|
+
"<%= config.bin %> auth logout"
|
|
245
|
+
],
|
|
246
|
+
"flags": {
|
|
247
|
+
"json": {
|
|
248
|
+
"description": "Format output as json.",
|
|
249
|
+
"helpGroup": "GLOBAL",
|
|
250
|
+
"name": "json",
|
|
251
|
+
"allowNo": false,
|
|
252
|
+
"type": "boolean"
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
"hasDynamicHelp": false,
|
|
256
|
+
"hiddenAliases": [],
|
|
257
|
+
"id": "auth:logout",
|
|
258
|
+
"pluginAlias": "adapty",
|
|
259
|
+
"pluginName": "adapty",
|
|
260
|
+
"pluginType": "core",
|
|
261
|
+
"strict": true,
|
|
262
|
+
"enableJsonFlag": true,
|
|
263
|
+
"isESM": true,
|
|
264
|
+
"relativePath": [
|
|
265
|
+
"dist",
|
|
266
|
+
"commands",
|
|
267
|
+
"auth",
|
|
268
|
+
"logout.js"
|
|
269
|
+
]
|
|
270
|
+
},
|
|
271
|
+
"auth:status": {
|
|
272
|
+
"aliases": [],
|
|
273
|
+
"args": {},
|
|
274
|
+
"description": "Show current authentication state (local only)",
|
|
275
|
+
"examples": [
|
|
276
|
+
"<%= config.bin %> auth status"
|
|
277
|
+
],
|
|
278
|
+
"flags": {
|
|
279
|
+
"json": {
|
|
280
|
+
"description": "Format output as json.",
|
|
281
|
+
"helpGroup": "GLOBAL",
|
|
282
|
+
"name": "json",
|
|
283
|
+
"allowNo": false,
|
|
284
|
+
"type": "boolean"
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
"hasDynamicHelp": false,
|
|
288
|
+
"hiddenAliases": [],
|
|
289
|
+
"id": "auth:status",
|
|
290
|
+
"pluginAlias": "adapty",
|
|
291
|
+
"pluginName": "adapty",
|
|
292
|
+
"pluginType": "core",
|
|
293
|
+
"strict": true,
|
|
294
|
+
"enableJsonFlag": true,
|
|
295
|
+
"isESM": true,
|
|
296
|
+
"relativePath": [
|
|
297
|
+
"dist",
|
|
298
|
+
"commands",
|
|
299
|
+
"auth",
|
|
300
|
+
"status.js"
|
|
301
|
+
]
|
|
302
|
+
},
|
|
303
|
+
"auth:whoami": {
|
|
304
|
+
"aliases": [],
|
|
305
|
+
"args": {},
|
|
306
|
+
"description": "Show current user info from server (verifies token)",
|
|
307
|
+
"examples": [
|
|
308
|
+
"<%= config.bin %> auth whoami"
|
|
309
|
+
],
|
|
310
|
+
"flags": {
|
|
311
|
+
"json": {
|
|
312
|
+
"description": "Format output as json.",
|
|
313
|
+
"helpGroup": "GLOBAL",
|
|
314
|
+
"name": "json",
|
|
315
|
+
"allowNo": false,
|
|
316
|
+
"type": "boolean"
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
"hasDynamicHelp": false,
|
|
320
|
+
"hiddenAliases": [],
|
|
321
|
+
"id": "auth:whoami",
|
|
322
|
+
"pluginAlias": "adapty",
|
|
323
|
+
"pluginName": "adapty",
|
|
324
|
+
"pluginType": "core",
|
|
325
|
+
"strict": true,
|
|
326
|
+
"enableJsonFlag": true,
|
|
327
|
+
"isESM": true,
|
|
328
|
+
"relativePath": [
|
|
329
|
+
"dist",
|
|
330
|
+
"commands",
|
|
331
|
+
"auth",
|
|
332
|
+
"whoami.js"
|
|
333
|
+
]
|
|
334
|
+
},
|
|
215
335
|
"apps:create": {
|
|
216
336
|
"aliases": [],
|
|
217
337
|
"args": {},
|
|
@@ -425,126 +545,6 @@
|
|
|
425
545
|
"update.js"
|
|
426
546
|
]
|
|
427
547
|
},
|
|
428
|
-
"auth:login": {
|
|
429
|
-
"aliases": [],
|
|
430
|
-
"args": {},
|
|
431
|
-
"description": "Authenticate with Adapty via browser",
|
|
432
|
-
"examples": [
|
|
433
|
-
"<%= config.bin %> auth login"
|
|
434
|
-
],
|
|
435
|
-
"flags": {},
|
|
436
|
-
"hasDynamicHelp": false,
|
|
437
|
-
"hiddenAliases": [],
|
|
438
|
-
"id": "auth:login",
|
|
439
|
-
"pluginAlias": "adapty",
|
|
440
|
-
"pluginName": "adapty",
|
|
441
|
-
"pluginType": "core",
|
|
442
|
-
"strict": true,
|
|
443
|
-
"enableJsonFlag": false,
|
|
444
|
-
"isESM": true,
|
|
445
|
-
"relativePath": [
|
|
446
|
-
"dist",
|
|
447
|
-
"commands",
|
|
448
|
-
"auth",
|
|
449
|
-
"login.js"
|
|
450
|
-
]
|
|
451
|
-
},
|
|
452
|
-
"auth:logout": {
|
|
453
|
-
"aliases": [],
|
|
454
|
-
"args": {},
|
|
455
|
-
"description": "Remove stored authentication token",
|
|
456
|
-
"examples": [
|
|
457
|
-
"<%= config.bin %> auth logout"
|
|
458
|
-
],
|
|
459
|
-
"flags": {
|
|
460
|
-
"json": {
|
|
461
|
-
"description": "Format output as json.",
|
|
462
|
-
"helpGroup": "GLOBAL",
|
|
463
|
-
"name": "json",
|
|
464
|
-
"allowNo": false,
|
|
465
|
-
"type": "boolean"
|
|
466
|
-
}
|
|
467
|
-
},
|
|
468
|
-
"hasDynamicHelp": false,
|
|
469
|
-
"hiddenAliases": [],
|
|
470
|
-
"id": "auth:logout",
|
|
471
|
-
"pluginAlias": "adapty",
|
|
472
|
-
"pluginName": "adapty",
|
|
473
|
-
"pluginType": "core",
|
|
474
|
-
"strict": true,
|
|
475
|
-
"enableJsonFlag": true,
|
|
476
|
-
"isESM": true,
|
|
477
|
-
"relativePath": [
|
|
478
|
-
"dist",
|
|
479
|
-
"commands",
|
|
480
|
-
"auth",
|
|
481
|
-
"logout.js"
|
|
482
|
-
]
|
|
483
|
-
},
|
|
484
|
-
"auth:status": {
|
|
485
|
-
"aliases": [],
|
|
486
|
-
"args": {},
|
|
487
|
-
"description": "Show current authentication state (local only)",
|
|
488
|
-
"examples": [
|
|
489
|
-
"<%= config.bin %> auth status"
|
|
490
|
-
],
|
|
491
|
-
"flags": {
|
|
492
|
-
"json": {
|
|
493
|
-
"description": "Format output as json.",
|
|
494
|
-
"helpGroup": "GLOBAL",
|
|
495
|
-
"name": "json",
|
|
496
|
-
"allowNo": false,
|
|
497
|
-
"type": "boolean"
|
|
498
|
-
}
|
|
499
|
-
},
|
|
500
|
-
"hasDynamicHelp": false,
|
|
501
|
-
"hiddenAliases": [],
|
|
502
|
-
"id": "auth:status",
|
|
503
|
-
"pluginAlias": "adapty",
|
|
504
|
-
"pluginName": "adapty",
|
|
505
|
-
"pluginType": "core",
|
|
506
|
-
"strict": true,
|
|
507
|
-
"enableJsonFlag": true,
|
|
508
|
-
"isESM": true,
|
|
509
|
-
"relativePath": [
|
|
510
|
-
"dist",
|
|
511
|
-
"commands",
|
|
512
|
-
"auth",
|
|
513
|
-
"status.js"
|
|
514
|
-
]
|
|
515
|
-
},
|
|
516
|
-
"auth:whoami": {
|
|
517
|
-
"aliases": [],
|
|
518
|
-
"args": {},
|
|
519
|
-
"description": "Show current user info from server (verifies token)",
|
|
520
|
-
"examples": [
|
|
521
|
-
"<%= config.bin %> auth whoami"
|
|
522
|
-
],
|
|
523
|
-
"flags": {
|
|
524
|
-
"json": {
|
|
525
|
-
"description": "Format output as json.",
|
|
526
|
-
"helpGroup": "GLOBAL",
|
|
527
|
-
"name": "json",
|
|
528
|
-
"allowNo": false,
|
|
529
|
-
"type": "boolean"
|
|
530
|
-
}
|
|
531
|
-
},
|
|
532
|
-
"hasDynamicHelp": false,
|
|
533
|
-
"hiddenAliases": [],
|
|
534
|
-
"id": "auth:whoami",
|
|
535
|
-
"pluginAlias": "adapty",
|
|
536
|
-
"pluginName": "adapty",
|
|
537
|
-
"pluginType": "core",
|
|
538
|
-
"strict": true,
|
|
539
|
-
"enableJsonFlag": true,
|
|
540
|
-
"isESM": true,
|
|
541
|
-
"relativePath": [
|
|
542
|
-
"dist",
|
|
543
|
-
"commands",
|
|
544
|
-
"auth",
|
|
545
|
-
"whoami.js"
|
|
546
|
-
]
|
|
547
|
-
},
|
|
548
548
|
"paywalls:create": {
|
|
549
549
|
"aliases": [],
|
|
550
550
|
"args": {},
|
|
@@ -1280,5 +1280,5 @@
|
|
|
1280
1280
|
]
|
|
1281
1281
|
}
|
|
1282
1282
|
},
|
|
1283
|
-
"version": "0.1.
|
|
1283
|
+
"version": "0.1.1"
|
|
1284
1284
|
}
|