@tryvital/vital-node 3.1.427 → 3.1.429

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.
Files changed (114) hide show
  1. package/api/resources/activity/client/Client.js +2 -2
  2. package/api/resources/aggregate/client/Client.js +3 -3
  3. package/api/resources/body/client/Client.js +2 -2
  4. package/api/resources/devices/client/Client.js +1 -1
  5. package/api/resources/electrocardiogram/client/Client.js +1 -1
  6. package/api/resources/index.d.ts +2 -1
  7. package/api/resources/index.js +3 -2
  8. package/api/resources/insurance/client/Client.js +3 -3
  9. package/api/resources/introspect/client/Client.js +2 -2
  10. package/api/resources/labTests/client/Client.js +41 -41
  11. package/api/resources/link/client/Client.js +19 -19
  12. package/api/resources/meal/client/Client.js +1 -1
  13. package/api/resources/menstrualCycle/client/Client.js +1 -1
  14. package/api/resources/order/client/Client.js +1 -1
  15. package/api/resources/payor/client/Client.js +1 -1
  16. package/api/resources/profile/client/Client.js +2 -2
  17. package/api/resources/providers/client/Client.js +1 -1
  18. package/api/resources/sleep/client/Client.js +3 -3
  19. package/api/resources/sleepCycle/client/Client.js +1 -1
  20. package/api/resources/team/client/Client.js +7 -7
  21. package/api/resources/testkit/client/Client.js +2 -2
  22. package/api/resources/user/client/Client.d.ts +54 -43
  23. package/api/resources/user/client/Client.js +222 -159
  24. package/api/resources/user/client/requests/CreateUserPortalUrlBody.d.ts +24 -0
  25. package/api/resources/user/client/requests/CreateUserPortalUrlBody.js +5 -0
  26. package/api/resources/user/client/requests/index.d.ts +2 -1
  27. package/api/resources/user/index.d.ts +1 -0
  28. package/api/resources/user/index.js +1 -0
  29. package/api/resources/user/types/CreateUserPortalUrlBodyContext.d.ts +17 -0
  30. package/api/resources/user/types/CreateUserPortalUrlBodyContext.js +10 -0
  31. package/api/resources/user/types/index.d.ts +1 -0
  32. package/api/resources/user/types/index.js +17 -0
  33. package/api/resources/vitals/client/Client.js +78 -78
  34. package/api/resources/workouts/client/Client.js +3 -3
  35. package/api/types/CreateUserPortalUrlResponse.d.ts +7 -0
  36. package/api/types/CreateUserPortalUrlResponse.js +5 -0
  37. package/api/types/index.d.ts +1 -0
  38. package/api/types/index.js +1 -0
  39. package/dist/api/resources/activity/client/Client.js +2 -2
  40. package/dist/api/resources/aggregate/client/Client.js +3 -3
  41. package/dist/api/resources/body/client/Client.js +2 -2
  42. package/dist/api/resources/devices/client/Client.js +1 -1
  43. package/dist/api/resources/electrocardiogram/client/Client.js +1 -1
  44. package/dist/api/resources/index.d.ts +2 -1
  45. package/dist/api/resources/index.js +3 -2
  46. package/dist/api/resources/insurance/client/Client.js +3 -3
  47. package/dist/api/resources/introspect/client/Client.js +2 -2
  48. package/dist/api/resources/labTests/client/Client.js +41 -41
  49. package/dist/api/resources/link/client/Client.js +19 -19
  50. package/dist/api/resources/meal/client/Client.js +1 -1
  51. package/dist/api/resources/menstrualCycle/client/Client.js +1 -1
  52. package/dist/api/resources/order/client/Client.js +1 -1
  53. package/dist/api/resources/payor/client/Client.js +1 -1
  54. package/dist/api/resources/profile/client/Client.js +2 -2
  55. package/dist/api/resources/providers/client/Client.js +1 -1
  56. package/dist/api/resources/sleep/client/Client.js +3 -3
  57. package/dist/api/resources/sleepCycle/client/Client.js +1 -1
  58. package/dist/api/resources/team/client/Client.js +7 -7
  59. package/dist/api/resources/testkit/client/Client.js +2 -2
  60. package/dist/api/resources/user/client/Client.d.ts +54 -43
  61. package/dist/api/resources/user/client/Client.js +222 -159
  62. package/dist/api/resources/user/client/requests/CreateUserPortalUrlBody.d.ts +24 -0
  63. package/dist/api/resources/user/client/requests/CreateUserPortalUrlBody.js +5 -0
  64. package/dist/api/resources/user/client/requests/index.d.ts +2 -1
  65. package/dist/api/resources/user/index.d.ts +1 -0
  66. package/dist/api/resources/user/index.js +1 -0
  67. package/dist/api/resources/user/types/CreateUserPortalUrlBodyContext.d.ts +17 -0
  68. package/dist/api/resources/user/types/CreateUserPortalUrlBodyContext.js +10 -0
  69. package/dist/api/resources/user/types/index.d.ts +1 -0
  70. package/dist/api/resources/user/types/index.js +17 -0
  71. package/dist/api/resources/vitals/client/Client.js +78 -78
  72. package/dist/api/resources/workouts/client/Client.js +3 -3
  73. package/dist/api/types/CreateUserPortalUrlResponse.d.ts +7 -0
  74. package/dist/api/types/CreateUserPortalUrlResponse.js +5 -0
  75. package/dist/api/types/index.d.ts +1 -0
  76. package/dist/api/types/index.js +1 -0
  77. package/dist/serialization/resources/index.d.ts +2 -1
  78. package/dist/serialization/resources/index.js +3 -2
  79. package/dist/serialization/resources/user/client/requests/CreateUserPortalUrlBody.d.ts +14 -0
  80. package/dist/serialization/resources/user/client/requests/CreateUserPortalUrlBody.js +35 -0
  81. package/dist/serialization/resources/user/client/requests/index.d.ts +2 -1
  82. package/dist/serialization/resources/user/client/requests/index.js +5 -3
  83. package/dist/serialization/resources/user/index.d.ts +1 -0
  84. package/dist/serialization/resources/user/index.js +1 -0
  85. package/dist/serialization/resources/user/types/CreateUserPortalUrlBodyContext.d.ts +10 -0
  86. package/dist/serialization/resources/user/types/CreateUserPortalUrlBodyContext.js +31 -0
  87. package/dist/serialization/resources/user/types/index.d.ts +1 -0
  88. package/dist/serialization/resources/user/types/index.js +17 -0
  89. package/dist/serialization/types/CreateUserPortalUrlResponse.d.ts +13 -0
  90. package/dist/serialization/types/CreateUserPortalUrlResponse.js +34 -0
  91. package/dist/serialization/types/index.d.ts +1 -0
  92. package/dist/serialization/types/index.js +1 -0
  93. package/dist/version.d.ts +1 -1
  94. package/dist/version.js +1 -1
  95. package/package.json +1 -1
  96. package/reference.md +164 -121
  97. package/serialization/resources/index.d.ts +2 -1
  98. package/serialization/resources/index.js +3 -2
  99. package/serialization/resources/user/client/requests/CreateUserPortalUrlBody.d.ts +14 -0
  100. package/serialization/resources/user/client/requests/CreateUserPortalUrlBody.js +35 -0
  101. package/serialization/resources/user/client/requests/index.d.ts +2 -1
  102. package/serialization/resources/user/client/requests/index.js +5 -3
  103. package/serialization/resources/user/index.d.ts +1 -0
  104. package/serialization/resources/user/index.js +1 -0
  105. package/serialization/resources/user/types/CreateUserPortalUrlBodyContext.d.ts +10 -0
  106. package/serialization/resources/user/types/CreateUserPortalUrlBodyContext.js +31 -0
  107. package/serialization/resources/user/types/index.d.ts +1 -0
  108. package/serialization/resources/user/types/index.js +17 -0
  109. package/serialization/types/CreateUserPortalUrlResponse.d.ts +13 -0
  110. package/serialization/types/CreateUserPortalUrlResponse.js +34 -0
  111. package/serialization/types/index.d.ts +1 -0
  112. package/serialization/types/index.js +1 -0
  113. package/version.d.ts +1 -1
  114. package/version.js +1 -1
@@ -74,7 +74,7 @@ class User {
74
74
  const _response = yield core.fetcher({
75
75
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, "v2/user"),
76
76
  method: "GET",
77
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
77
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
78
78
  contentType: "application/json",
79
79
  queryParameters: _queryParams,
80
80
  requestType: "json",
@@ -141,7 +141,7 @@ class User {
141
141
  const _response = yield core.fetcher({
142
142
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, "v2/user"),
143
143
  method: "POST",
144
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
144
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
145
145
  contentType: "application/json",
146
146
  requestType: "json",
147
147
  body: serializers.UserCreateBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
@@ -204,7 +204,7 @@ class User {
204
204
  const _response = yield core.fetcher({
205
205
  url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, "v2/user/metrics"),
206
206
  method: "GET",
207
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
207
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
208
208
  contentType: "application/json",
209
209
  requestType: "json",
210
210
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -241,21 +241,23 @@ class User {
241
241
  });
242
242
  }
243
243
  /**
244
+ * GET Users connected providers
245
+ *
244
246
  * @param {string} userId
245
247
  * @param {User.RequestOptions} requestOptions - Request-specific configuration.
246
248
  *
247
249
  * @throws {@link Vital.UnprocessableEntityError}
248
250
  *
249
251
  * @example
250
- * await client.user.getUserSignInToken("user_id")
252
+ * await client.user.getConnectedProviders("user_id")
251
253
  */
252
- getUserSignInToken(userId, requestOptions) {
254
+ getConnectedProviders(userId, requestOptions) {
253
255
  var _a;
254
256
  return __awaiter(this, void 0, void 0, function* () {
255
257
  const _response = yield core.fetcher({
256
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}/sign_in_token`),
257
- method: "POST",
258
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
258
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/providers/${encodeURIComponent(userId)}`),
259
+ method: "GET",
260
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
259
261
  contentType: "application/json",
260
262
  requestType: "json",
261
263
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -263,7 +265,7 @@ class User {
263
265
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
264
266
  });
265
267
  if (_response.ok) {
266
- return serializers.UserSignInTokenResponse.parseOrThrow(_response.body, {
268
+ return serializers.user.getConnectedProviders.Response.parseOrThrow(_response.body, {
267
269
  unrecognizedObjectKeys: "passthrough",
268
270
  allowUnrecognizedUnionMembers: true,
269
271
  allowUnrecognizedEnumValues: true,
@@ -302,23 +304,21 @@ class User {
302
304
  });
303
305
  }
304
306
  /**
305
- * GET Users connected providers
306
- *
307
307
  * @param {string} userId
308
308
  * @param {User.RequestOptions} requestOptions - Request-specific configuration.
309
309
  *
310
310
  * @throws {@link Vital.UnprocessableEntityError}
311
311
  *
312
312
  * @example
313
- * await client.user.getConnectedProviders("user_id")
313
+ * await client.user.getLatestUserInfo("user_id")
314
314
  */
315
- getConnectedProviders(userId, requestOptions) {
315
+ getLatestUserInfo(userId, requestOptions) {
316
316
  var _a;
317
317
  return __awaiter(this, void 0, void 0, function* () {
318
318
  const _response = yield core.fetcher({
319
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/providers/${encodeURIComponent(userId)}`),
319
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}/info/latest`),
320
320
  method: "GET",
321
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
321
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
322
322
  contentType: "application/json",
323
323
  requestType: "json",
324
324
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -326,7 +326,7 @@ class User {
326
326
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
327
327
  });
328
328
  if (_response.ok) {
329
- return serializers.user.getConnectedProviders.Response.parseOrThrow(_response.body, {
329
+ return serializers.UserInfo.parseOrThrow(_response.body, {
330
330
  unrecognizedObjectKeys: "passthrough",
331
331
  allowUnrecognizedUnionMembers: true,
332
332
  allowUnrecognizedEnumValues: true,
@@ -365,31 +365,50 @@ class User {
365
365
  });
366
366
  }
367
367
  /**
368
- * GET User details given the user_id.
369
- *
370
368
  * @param {string} userId
369
+ * @param {Vital.CreateInsuranceRequest} request
371
370
  * @param {User.RequestOptions} requestOptions - Request-specific configuration.
372
371
  *
373
372
  * @throws {@link Vital.UnprocessableEntityError}
374
373
  *
375
374
  * @example
376
- * await client.user.get("user_id")
375
+ * await client.user.createInsurance("user_id", {
376
+ * payorCode: "payor_code",
377
+ * memberId: "member_id",
378
+ * relationship: "Self",
379
+ * insured: {
380
+ * firstName: "first_name",
381
+ * lastName: "last_name",
382
+ * gender: "female",
383
+ * address: {
384
+ * firstLine: "first_line",
385
+ * country: "country",
386
+ * zip: "zip",
387
+ * city: "city",
388
+ * state: "state"
389
+ * },
390
+ * dob: "dob",
391
+ * email: "email",
392
+ * phoneNumber: "phone_number"
393
+ * }
394
+ * })
377
395
  */
378
- get(userId, requestOptions) {
396
+ createInsurance(userId, request, requestOptions) {
379
397
  var _a;
380
398
  return __awaiter(this, void 0, void 0, function* () {
381
399
  const _response = yield core.fetcher({
382
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}`),
383
- method: "GET",
384
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
400
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}/insurance`),
401
+ method: "POST",
402
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
385
403
  contentType: "application/json",
386
404
  requestType: "json",
405
+ body: serializers.CreateInsuranceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
387
406
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
388
407
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
389
408
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
390
409
  });
391
410
  if (_response.ok) {
392
- return serializers.ClientFacingUser.parseOrThrow(_response.body, {
411
+ return serializers.ClientFacingInsurance.parseOrThrow(_response.body, {
393
412
  unrecognizedObjectKeys: "passthrough",
394
413
  allowUnrecognizedUnionMembers: true,
395
414
  allowUnrecognizedEnumValues: true,
@@ -434,15 +453,15 @@ class User {
434
453
  * @throws {@link Vital.UnprocessableEntityError}
435
454
  *
436
455
  * @example
437
- * await client.user.delete("user_id")
456
+ * await client.user.getLatestInsurance("user_id")
438
457
  */
439
- delete(userId, requestOptions) {
458
+ getLatestInsurance(userId, requestOptions) {
440
459
  var _a;
441
460
  return __awaiter(this, void 0, void 0, function* () {
442
461
  const _response = yield core.fetcher({
443
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}`),
444
- method: "DELETE",
445
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
462
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}/insurance/latest`),
463
+ method: "GET",
464
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
446
465
  contentType: "application/json",
447
466
  requestType: "json",
448
467
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -450,7 +469,7 @@ class User {
450
469
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
451
470
  });
452
471
  if (_response.ok) {
453
- return serializers.UserSuccessResponse.parseOrThrow(_response.body, {
472
+ return serializers.ClientFacingInsurance.parseOrThrow(_response.body, {
454
473
  unrecognizedObjectKeys: "passthrough",
455
474
  allowUnrecognizedUnionMembers: true,
456
475
  allowUnrecognizedEnumValues: true,
@@ -490,30 +509,49 @@ class User {
490
509
  }
491
510
  /**
492
511
  * @param {string} userId
493
- * @param {Vital.UserPatchBody} request
512
+ * @param {Vital.UserInfoCreateRequest} request
494
513
  * @param {User.RequestOptions} requestOptions - Request-specific configuration.
495
514
  *
496
515
  * @throws {@link Vital.UnprocessableEntityError}
497
516
  *
498
517
  * @example
499
- * await client.user.patch("user_id")
518
+ * await client.user.upsertUserInfo("user_id", {
519
+ * firstName: "first_name",
520
+ * lastName: "last_name",
521
+ * email: "email",
522
+ * phoneNumber: "phone_number",
523
+ * gender: "gender",
524
+ * dob: "dob",
525
+ * address: {
526
+ * firstLine: "first_line",
527
+ * country: "country",
528
+ * zip: "zip",
529
+ * city: "city",
530
+ * state: "state"
531
+ * }
532
+ * })
500
533
  */
501
- patch(userId, request = {}, requestOptions) {
534
+ upsertUserInfo(userId, request, requestOptions) {
502
535
  var _a;
503
536
  return __awaiter(this, void 0, void 0, function* () {
504
537
  const _response = yield core.fetcher({
505
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}`),
538
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}/info`),
506
539
  method: "PATCH",
507
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
540
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
508
541
  contentType: "application/json",
509
542
  requestType: "json",
510
- body: serializers.UserPatchBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
543
+ body: serializers.UserInfoCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
511
544
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
512
545
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
513
546
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
514
547
  });
515
548
  if (_response.ok) {
516
- return;
549
+ return serializers.UserInfo.parseOrThrow(_response.body, {
550
+ unrecognizedObjectKeys: "passthrough",
551
+ allowUnrecognizedUnionMembers: true,
552
+ allowUnrecognizedEnumValues: true,
553
+ breadcrumbsPrefix: ["response"],
554
+ });
517
555
  }
518
556
  if (_response.error.reason === "status-code") {
519
557
  switch (_response.error.statusCode) {
@@ -547,21 +585,23 @@ class User {
547
585
  });
548
586
  }
549
587
  /**
550
- * @param {string} userId
588
+ * GET user_id from client_user_id.
589
+ *
590
+ * @param {string} clientUserId - A unique ID representing the end user. Typically this will be a user ID number from your application. Personally identifiable information, such as an email address or phone number, should not be used in the client_user_id.
551
591
  * @param {User.RequestOptions} requestOptions - Request-specific configuration.
552
592
  *
553
593
  * @throws {@link Vital.UnprocessableEntityError}
554
594
  *
555
595
  * @example
556
- * await client.user.getLatestUserInfo("user_id")
596
+ * await client.user.getByClientUserId("client_user_id")
557
597
  */
558
- getLatestUserInfo(userId, requestOptions) {
598
+ getByClientUserId(clientUserId, requestOptions) {
559
599
  var _a;
560
600
  return __awaiter(this, void 0, void 0, function* () {
561
601
  const _response = yield core.fetcher({
562
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}/info/latest`),
602
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/resolve/${encodeURIComponent(clientUserId)}`),
563
603
  method: "GET",
564
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
604
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
565
605
  contentType: "application/json",
566
606
  requestType: "json",
567
607
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -569,7 +609,7 @@ class User {
569
609
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
570
610
  });
571
611
  if (_response.ok) {
572
- return serializers.UserInfo.parseOrThrow(_response.body, {
612
+ return serializers.ClientFacingUser.parseOrThrow(_response.body, {
573
613
  unrecognizedObjectKeys: "passthrough",
574
614
  allowUnrecognizedUnionMembers: true,
575
615
  allowUnrecognizedEnumValues: true,
@@ -609,49 +649,29 @@ class User {
609
649
  }
610
650
  /**
611
651
  * @param {string} userId
612
- * @param {Vital.CreateInsuranceRequest} request
652
+ * @param {Vital.Providers} provider - Provider slug. e.g., `oura`, `fitbit`, `garmin`.
613
653
  * @param {User.RequestOptions} requestOptions - Request-specific configuration.
614
654
  *
615
655
  * @throws {@link Vital.UnprocessableEntityError}
616
656
  *
617
657
  * @example
618
- * await client.user.createInsurance("user_id", {
619
- * payorCode: "payor_code",
620
- * memberId: "member_id",
621
- * relationship: "Self",
622
- * insured: {
623
- * firstName: "first_name",
624
- * lastName: "last_name",
625
- * gender: "female",
626
- * address: {
627
- * firstLine: "first_line",
628
- * country: "country",
629
- * zip: "zip",
630
- * city: "city",
631
- * state: "state"
632
- * },
633
- * dob: "dob",
634
- * email: "email",
635
- * phoneNumber: "phone_number"
636
- * }
637
- * })
658
+ * await client.user.deregisterProvider("user_id", "oura")
638
659
  */
639
- createInsurance(userId, request, requestOptions) {
660
+ deregisterProvider(userId, provider, requestOptions) {
640
661
  var _a;
641
662
  return __awaiter(this, void 0, void 0, function* () {
642
663
  const _response = yield core.fetcher({
643
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}/insurance`),
644
- method: "POST",
645
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
664
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}/${encodeURIComponent(serializers.Providers.jsonOrThrow(provider))}`),
665
+ method: "DELETE",
666
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
646
667
  contentType: "application/json",
647
668
  requestType: "json",
648
- body: serializers.CreateInsuranceRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
649
669
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
650
670
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
651
671
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
652
672
  });
653
673
  if (_response.ok) {
654
- return serializers.ClientFacingInsurance.parseOrThrow(_response.body, {
674
+ return serializers.UserSuccessResponse.parseOrThrow(_response.body, {
655
675
  unrecognizedObjectKeys: "passthrough",
656
676
  allowUnrecognizedUnionMembers: true,
657
677
  allowUnrecognizedEnumValues: true,
@@ -696,15 +716,15 @@ class User {
696
716
  * @throws {@link Vital.UnprocessableEntityError}
697
717
  *
698
718
  * @example
699
- * await client.user.getLatestInsurance("user_id")
719
+ * await client.user.get("user_id")
700
720
  */
701
- getLatestInsurance(userId, requestOptions) {
721
+ get(userId, requestOptions) {
702
722
  var _a;
703
723
  return __awaiter(this, void 0, void 0, function* () {
704
724
  const _response = yield core.fetcher({
705
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}/insurance/latest`),
725
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}`),
706
726
  method: "GET",
707
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
727
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
708
728
  contentType: "application/json",
709
729
  requestType: "json",
710
730
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -712,7 +732,7 @@ class User {
712
732
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
713
733
  });
714
734
  if (_response.ok) {
715
- return serializers.ClientFacingInsurance.parseOrThrow(_response.body, {
735
+ return serializers.ClientFacingUser.parseOrThrow(_response.body, {
716
736
  unrecognizedObjectKeys: "passthrough",
717
737
  allowUnrecognizedUnionMembers: true,
718
738
  allowUnrecognizedEnumValues: true,
@@ -752,44 +772,28 @@ class User {
752
772
  }
753
773
  /**
754
774
  * @param {string} userId
755
- * @param {Vital.UserInfoCreateRequest} request
756
775
  * @param {User.RequestOptions} requestOptions - Request-specific configuration.
757
776
  *
758
777
  * @throws {@link Vital.UnprocessableEntityError}
759
778
  *
760
779
  * @example
761
- * await client.user.upsertUserInfo("user_id", {
762
- * firstName: "first_name",
763
- * lastName: "last_name",
764
- * email: "email",
765
- * phoneNumber: "phone_number",
766
- * gender: "gender",
767
- * dob: "dob",
768
- * address: {
769
- * firstLine: "first_line",
770
- * country: "country",
771
- * zip: "zip",
772
- * city: "city",
773
- * state: "state"
774
- * }
775
- * })
780
+ * await client.user.delete("user_id")
776
781
  */
777
- upsertUserInfo(userId, request, requestOptions) {
782
+ delete(userId, requestOptions) {
778
783
  var _a;
779
784
  return __awaiter(this, void 0, void 0, function* () {
780
785
  const _response = yield core.fetcher({
781
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}/info`),
782
- method: "PATCH",
783
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
786
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}`),
787
+ method: "DELETE",
788
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
784
789
  contentType: "application/json",
785
790
  requestType: "json",
786
- body: serializers.UserInfoCreateRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
787
791
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
788
792
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
789
793
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
790
794
  });
791
795
  if (_response.ok) {
792
- return serializers.UserInfo.parseOrThrow(_response.body, {
796
+ return serializers.UserSuccessResponse.parseOrThrow(_response.body, {
793
797
  unrecognizedObjectKeys: "passthrough",
794
798
  allowUnrecognizedUnionMembers: true,
795
799
  allowUnrecognizedEnumValues: true,
@@ -828,31 +832,96 @@ class User {
828
832
  });
829
833
  }
830
834
  /**
831
- * GET user_id from client_user_id.
835
+ * @param {string} userId
836
+ * @param {Vital.UserPatchBody} request
837
+ * @param {User.RequestOptions} requestOptions - Request-specific configuration.
832
838
  *
833
- * @param {string} clientUserId - A unique ID representing the end user. Typically this will be a user ID number from your application. Personally identifiable information, such as an email address or phone number, should not be used in the client_user_id.
839
+ * @throws {@link Vital.UnprocessableEntityError}
840
+ *
841
+ * @example
842
+ * await client.user.patch("user_id")
843
+ */
844
+ patch(userId, request = {}, requestOptions) {
845
+ var _a;
846
+ return __awaiter(this, void 0, void 0, function* () {
847
+ const _response = yield core.fetcher({
848
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}`),
849
+ method: "PATCH",
850
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
851
+ contentType: "application/json",
852
+ requestType: "json",
853
+ body: serializers.UserPatchBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
854
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
855
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
856
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
857
+ });
858
+ if (_response.ok) {
859
+ return;
860
+ }
861
+ if (_response.error.reason === "status-code") {
862
+ switch (_response.error.statusCode) {
863
+ case 422:
864
+ throw new Vital.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
865
+ unrecognizedObjectKeys: "passthrough",
866
+ allowUnrecognizedUnionMembers: true,
867
+ allowUnrecognizedEnumValues: true,
868
+ breadcrumbsPrefix: ["response"],
869
+ }));
870
+ default:
871
+ throw new errors.VitalError({
872
+ statusCode: _response.error.statusCode,
873
+ body: _response.error.body,
874
+ });
875
+ }
876
+ }
877
+ switch (_response.error.reason) {
878
+ case "non-json":
879
+ throw new errors.VitalError({
880
+ statusCode: _response.error.statusCode,
881
+ body: _response.error.rawBody,
882
+ });
883
+ case "timeout":
884
+ throw new errors.VitalTimeoutError();
885
+ case "unknown":
886
+ throw new errors.VitalError({
887
+ message: _response.error.errorMessage,
888
+ });
889
+ }
890
+ });
891
+ }
892
+ /**
893
+ * @param {Vital.UserUndoDeleteRequest} request
834
894
  * @param {User.RequestOptions} requestOptions - Request-specific configuration.
835
895
  *
836
896
  * @throws {@link Vital.UnprocessableEntityError}
837
897
  *
838
898
  * @example
839
- * await client.user.getByClientUserId("client_user_id")
899
+ * await client.user.undoDelete()
840
900
  */
841
- getByClientUserId(clientUserId, requestOptions) {
901
+ undoDelete(request = {}, requestOptions) {
842
902
  var _a;
843
903
  return __awaiter(this, void 0, void 0, function* () {
904
+ const { userId, clientUserId } = request;
905
+ const _queryParams = {};
906
+ if (userId != null) {
907
+ _queryParams["user_id"] = userId;
908
+ }
909
+ if (clientUserId != null) {
910
+ _queryParams["client_user_id"] = clientUserId;
911
+ }
844
912
  const _response = yield core.fetcher({
845
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/resolve/${encodeURIComponent(clientUserId)}`),
846
- method: "GET",
847
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
913
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, "v2/user/undo_delete"),
914
+ method: "POST",
915
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
848
916
  contentType: "application/json",
917
+ queryParameters: _queryParams,
849
918
  requestType: "json",
850
919
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
851
920
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
852
921
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
853
922
  });
854
923
  if (_response.ok) {
855
- return serializers.ClientFacingUser.parseOrThrow(_response.body, {
924
+ return serializers.UserSuccessResponse.parseOrThrow(_response.body, {
856
925
  unrecognizedObjectKeys: "passthrough",
857
926
  allowUnrecognizedUnionMembers: true,
858
927
  allowUnrecognizedEnumValues: true,
@@ -891,30 +960,39 @@ class User {
891
960
  });
892
961
  }
893
962
  /**
963
+ * Trigger a manual refresh for a specific user
964
+ *
894
965
  * @param {string} userId
895
- * @param {Vital.Providers} provider - Provider slug. e.g., `oura`, `fitbit`, `garmin`.
966
+ * @param {Vital.UserRefreshRequest} request
896
967
  * @param {User.RequestOptions} requestOptions - Request-specific configuration.
897
968
  *
969
+ * @throws {@link Vital.BadRequestError}
898
970
  * @throws {@link Vital.UnprocessableEntityError}
899
971
  *
900
972
  * @example
901
- * await client.user.deregisterProvider("user_id", "oura")
973
+ * await client.user.refresh("user_id")
902
974
  */
903
- deregisterProvider(userId, provider, requestOptions) {
975
+ refresh(userId, request = {}, requestOptions) {
904
976
  var _a;
905
977
  return __awaiter(this, void 0, void 0, function* () {
978
+ const { timeout } = request;
979
+ const _queryParams = {};
980
+ if (timeout != null) {
981
+ _queryParams["timeout"] = timeout.toString();
982
+ }
906
983
  const _response = yield core.fetcher({
907
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}/${encodeURIComponent(serializers.Providers.jsonOrThrow(provider))}`),
908
- method: "DELETE",
909
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
984
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/refresh/${encodeURIComponent(userId)}`),
985
+ method: "POST",
986
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
910
987
  contentType: "application/json",
988
+ queryParameters: _queryParams,
911
989
  requestType: "json",
912
990
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
913
991
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
914
992
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
915
993
  });
916
994
  if (_response.ok) {
917
- return serializers.UserSuccessResponse.parseOrThrow(_response.body, {
995
+ return serializers.UserRefreshSuccessResponse.parseOrThrow(_response.body, {
918
996
  unrecognizedObjectKeys: "passthrough",
919
997
  allowUnrecognizedUnionMembers: true,
920
998
  allowUnrecognizedEnumValues: true,
@@ -923,6 +1001,8 @@ class User {
923
1001
  }
924
1002
  if (_response.error.reason === "status-code") {
925
1003
  switch (_response.error.statusCode) {
1004
+ case 400:
1005
+ throw new Vital.BadRequestError(_response.error.body);
926
1006
  case 422:
927
1007
  throw new Vital.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
928
1008
  unrecognizedObjectKeys: "passthrough",
@@ -953,38 +1033,29 @@ class User {
953
1033
  });
954
1034
  }
955
1035
  /**
956
- * @param {Vital.UserUndoDeleteRequest} request
1036
+ * @param {string} userId
957
1037
  * @param {User.RequestOptions} requestOptions - Request-specific configuration.
958
1038
  *
959
1039
  * @throws {@link Vital.UnprocessableEntityError}
960
1040
  *
961
1041
  * @example
962
- * await client.user.undoDelete()
1042
+ * await client.user.getDevices("user_id")
963
1043
  */
964
- undoDelete(request = {}, requestOptions) {
1044
+ getDevices(userId, requestOptions) {
965
1045
  var _a;
966
1046
  return __awaiter(this, void 0, void 0, function* () {
967
- const { userId, clientUserId } = request;
968
- const _queryParams = {};
969
- if (userId != null) {
970
- _queryParams["user_id"] = userId;
971
- }
972
- if (clientUserId != null) {
973
- _queryParams["client_user_id"] = clientUserId;
974
- }
975
1047
  const _response = yield core.fetcher({
976
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, "v2/user/undo_delete"),
977
- method: "POST",
978
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
1048
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}/device`),
1049
+ method: "GET",
1050
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
979
1051
  contentType: "application/json",
980
- queryParameters: _queryParams,
981
1052
  requestType: "json",
982
1053
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
983
1054
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
984
1055
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
985
1056
  });
986
1057
  if (_response.ok) {
987
- return serializers.UserSuccessResponse.parseOrThrow(_response.body, {
1058
+ return serializers.user.getDevices.Response.parseOrThrow(_response.body, {
988
1059
  unrecognizedObjectKeys: "passthrough",
989
1060
  allowUnrecognizedUnionMembers: true,
990
1061
  allowUnrecognizedEnumValues: true,
@@ -1023,39 +1094,30 @@ class User {
1023
1094
  });
1024
1095
  }
1025
1096
  /**
1026
- * Trigger a manual refresh for a specific user
1027
- *
1028
1097
  * @param {string} userId
1029
- * @param {Vital.UserRefreshRequest} request
1098
+ * @param {string} deviceId
1030
1099
  * @param {User.RequestOptions} requestOptions - Request-specific configuration.
1031
1100
  *
1032
- * @throws {@link Vital.BadRequestError}
1033
1101
  * @throws {@link Vital.UnprocessableEntityError}
1034
1102
  *
1035
1103
  * @example
1036
- * await client.user.refresh("user_id")
1104
+ * await client.user.getDevice("user_id", "device_id")
1037
1105
  */
1038
- refresh(userId, request = {}, requestOptions) {
1106
+ getDevice(userId, deviceId, requestOptions) {
1039
1107
  var _a;
1040
1108
  return __awaiter(this, void 0, void 0, function* () {
1041
- const { timeout } = request;
1042
- const _queryParams = {};
1043
- if (timeout != null) {
1044
- _queryParams["timeout"] = timeout.toString();
1045
- }
1046
1109
  const _response = yield core.fetcher({
1047
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/refresh/${encodeURIComponent(userId)}`),
1048
- method: "POST",
1049
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
1110
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}/device/${encodeURIComponent(deviceId)}`),
1111
+ method: "GET",
1112
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
1050
1113
  contentType: "application/json",
1051
- queryParameters: _queryParams,
1052
1114
  requestType: "json",
1053
1115
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
1054
1116
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
1055
1117
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1056
1118
  });
1057
1119
  if (_response.ok) {
1058
- return serializers.UserRefreshSuccessResponse.parseOrThrow(_response.body, {
1120
+ return serializers.ClientFacingDevice.parseOrThrow(_response.body, {
1059
1121
  unrecognizedObjectKeys: "passthrough",
1060
1122
  allowUnrecognizedUnionMembers: true,
1061
1123
  allowUnrecognizedEnumValues: true,
@@ -1064,8 +1126,6 @@ class User {
1064
1126
  }
1065
1127
  if (_response.error.reason === "status-code") {
1066
1128
  switch (_response.error.statusCode) {
1067
- case 400:
1068
- throw new Vital.BadRequestError(_response.error.body);
1069
1129
  case 422:
1070
1130
  throw new Vital.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
1071
1131
  unrecognizedObjectKeys: "passthrough",
@@ -1102,15 +1162,15 @@ class User {
1102
1162
  * @throws {@link Vital.UnprocessableEntityError}
1103
1163
  *
1104
1164
  * @example
1105
- * await client.user.getDevices("user_id")
1165
+ * await client.user.getUserSignInToken("user_id")
1106
1166
  */
1107
- getDevices(userId, requestOptions) {
1167
+ getUserSignInToken(userId, requestOptions) {
1108
1168
  var _a;
1109
1169
  return __awaiter(this, void 0, void 0, function* () {
1110
1170
  const _response = yield core.fetcher({
1111
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}/device`),
1112
- method: "GET",
1113
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
1171
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}/sign_in_token`),
1172
+ method: "POST",
1173
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
1114
1174
  contentType: "application/json",
1115
1175
  requestType: "json",
1116
1176
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -1118,7 +1178,7 @@ class User {
1118
1178
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1119
1179
  });
1120
1180
  if (_response.ok) {
1121
- return serializers.user.getDevices.Response.parseOrThrow(_response.body, {
1181
+ return serializers.UserSignInTokenResponse.parseOrThrow(_response.body, {
1122
1182
  unrecognizedObjectKeys: "passthrough",
1123
1183
  allowUnrecognizedUnionMembers: true,
1124
1184
  allowUnrecognizedEnumValues: true,
@@ -1158,29 +1218,32 @@ class User {
1158
1218
  }
1159
1219
  /**
1160
1220
  * @param {string} userId
1161
- * @param {string} deviceId
1221
+ * @param {Vital.CreateUserPortalUrlBody} request
1162
1222
  * @param {User.RequestOptions} requestOptions - Request-specific configuration.
1163
1223
  *
1164
1224
  * @throws {@link Vital.UnprocessableEntityError}
1165
1225
  *
1166
1226
  * @example
1167
- * await client.user.getDevice("user_id", "device_id")
1227
+ * await client.user.createPortalUrl("user_id", {
1228
+ * context: "launch"
1229
+ * })
1168
1230
  */
1169
- getDevice(userId, deviceId, requestOptions) {
1231
+ createPortalUrl(userId, request, requestOptions) {
1170
1232
  var _a;
1171
1233
  return __awaiter(this, void 0, void 0, function* () {
1172
1234
  const _response = yield core.fetcher({
1173
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}/device/${encodeURIComponent(deviceId)}`),
1174
- method: "GET",
1175
- headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.427", "User-Agent": "@tryvital/vital-node/3.1.427", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
1235
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/user/${encodeURIComponent(userId)}/create_portal_url`),
1236
+ method: "POST",
1237
+ headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", "X-Fern-SDK-Version": "3.1.429", "User-Agent": "@tryvital/vital-node/3.1.429", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
1176
1238
  contentType: "application/json",
1177
1239
  requestType: "json",
1240
+ body: serializers.CreateUserPortalUrlBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
1178
1241
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
1179
1242
  maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
1180
1243
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
1181
1244
  });
1182
1245
  if (_response.ok) {
1183
- return serializers.ClientFacingDevice.parseOrThrow(_response.body, {
1246
+ return serializers.CreateUserPortalUrlResponse.parseOrThrow(_response.body, {
1184
1247
  unrecognizedObjectKeys: "passthrough",
1185
1248
  allowUnrecognizedUnionMembers: true,
1186
1249
  allowUnrecognizedEnumValues: true,