@tryvital/vital-node 3.0.0-beta.0 → 3.0.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.
Files changed (196) hide show
  1. package/Client.d.ts +0 -3
  2. package/Client.js +14 -19
  3. package/README.md +91 -0
  4. package/api/resources/activity/client/Client.js +2 -2
  5. package/api/resources/body/client/Client.js +2 -2
  6. package/api/resources/devices/client/Client.js +1 -1
  7. package/api/resources/index.d.ts +0 -1
  8. package/api/resources/index.js +1 -2
  9. package/api/resources/insurance/client/Client.js +2 -2
  10. package/api/resources/labTests/client/Client.d.ts +10 -1
  11. package/api/resources/labTests/client/Client.js +136 -21
  12. package/api/resources/link/client/Client.d.ts +1 -1
  13. package/api/resources/link/client/Client.js +16 -16
  14. package/api/resources/meal/client/Client.js +1 -1
  15. package/api/resources/profile/client/Client.js +2 -2
  16. package/api/resources/providers/client/Client.d.ts +1 -1
  17. package/api/resources/providers/client/Client.js +3 -3
  18. package/api/resources/sleep/client/Client.d.ts +5 -0
  19. package/api/resources/sleep/client/Client.js +61 -3
  20. package/api/resources/team/client/Client.d.ts +6 -6
  21. package/api/resources/team/client/Client.js +13 -13
  22. package/api/resources/team/client/requests/{GetSourcePrioritiesV2TeamSourcePrioritiesGetRequest.d.ts → TeamGetSourcePrioritiesRequest.d.ts} +1 -1
  23. package/{dist/api/resources/team/client/requests/SearchTeamUsersByUuidOrClientUserIdV2TeamUsersSearchGetRequest.d.ts → api/resources/team/client/requests/TeamGetUserByIdRequest.d.ts} +1 -1
  24. package/{dist/api/resources/team/client/requests/UpdateSourcePrioritiesV2TeamSourcePrioritiesPatchRequest.d.ts → api/resources/team/client/requests/TeamUpdateSourcePrioritiesRequest.d.ts} +1 -1
  25. package/api/resources/team/client/requests/index.d.ts +3 -3
  26. package/api/resources/testkit/client/Client.js +2 -2
  27. package/api/resources/user/client/Client.js +11 -11
  28. package/api/resources/vitals/client/Client.d.ts +5 -0
  29. package/api/resources/vitals/client/Client.js +90 -22
  30. package/api/resources/vitals/client/requests/VitalsElectrocardiogramVoltageRequest.d.ts +17 -0
  31. package/api/resources/vitals/client/requests/index.d.ts +1 -0
  32. package/api/resources/workouts/client/Client.d.ts +4 -0
  33. package/api/resources/workouts/client/Client.js +59 -2
  34. package/api/types/BiomarkerResult.d.ts +2 -0
  35. package/api/types/ClientFacingElectrocardiogramVoltageTimeseries.d.ts +17 -0
  36. package/api/types/ClientFacingLoinc.d.ts +10 -0
  37. package/api/types/ClientFacingMarkerComplete.d.ts +16 -0
  38. package/api/types/ClientFacingMarkerComplete.js +5 -0
  39. package/api/types/ClientFacingResult.d.ts +12 -0
  40. package/api/types/ClientFacingResult.js +5 -0
  41. package/api/types/ClientFacingSleep.d.ts +1 -1
  42. package/api/types/GetMarkersResponse.d.ts +1 -1
  43. package/api/types/Region.d.ts +2 -1
  44. package/api/types/Region.js +1 -0
  45. package/api/types/index.d.ts +4 -0
  46. package/api/types/index.js +4 -0
  47. package/dist/Client.d.ts +0 -3
  48. package/dist/Client.js +14 -19
  49. package/dist/api/resources/activity/client/Client.js +2 -2
  50. package/dist/api/resources/body/client/Client.js +2 -2
  51. package/dist/api/resources/devices/client/Client.js +1 -1
  52. package/dist/api/resources/index.d.ts +0 -1
  53. package/dist/api/resources/index.js +1 -2
  54. package/dist/api/resources/insurance/client/Client.js +2 -2
  55. package/dist/api/resources/labTests/client/Client.d.ts +10 -1
  56. package/dist/api/resources/labTests/client/Client.js +136 -21
  57. package/dist/api/resources/link/client/Client.d.ts +1 -1
  58. package/dist/api/resources/link/client/Client.js +16 -16
  59. package/dist/api/resources/meal/client/Client.js +1 -1
  60. package/dist/api/resources/profile/client/Client.js +2 -2
  61. package/dist/api/resources/providers/client/Client.d.ts +1 -1
  62. package/dist/api/resources/providers/client/Client.js +3 -3
  63. package/dist/api/resources/sleep/client/Client.d.ts +5 -0
  64. package/dist/api/resources/sleep/client/Client.js +61 -3
  65. package/dist/api/resources/team/client/Client.d.ts +6 -6
  66. package/dist/api/resources/team/client/Client.js +13 -13
  67. package/dist/api/resources/team/client/requests/{GetSourcePrioritiesV2TeamSourcePrioritiesGetRequest.d.ts → TeamGetSourcePrioritiesRequest.d.ts} +1 -1
  68. package/dist/api/resources/team/client/requests/TeamGetSourcePrioritiesRequest.js +5 -0
  69. package/{api/resources/team/client/requests/SearchTeamUsersByUuidOrClientUserIdV2TeamUsersSearchGetRequest.d.ts → dist/api/resources/team/client/requests/TeamGetUserByIdRequest.d.ts} +1 -1
  70. package/dist/api/resources/team/client/requests/TeamGetUserByIdRequest.js +5 -0
  71. package/{api/resources/team/client/requests/UpdateSourcePrioritiesV2TeamSourcePrioritiesPatchRequest.d.ts → dist/api/resources/team/client/requests/TeamUpdateSourcePrioritiesRequest.d.ts} +1 -1
  72. package/dist/api/resources/team/client/requests/TeamUpdateSourcePrioritiesRequest.js +5 -0
  73. package/dist/api/resources/team/client/requests/index.d.ts +3 -3
  74. package/dist/api/resources/testkit/client/Client.js +2 -2
  75. package/dist/api/resources/user/client/Client.js +11 -11
  76. package/dist/api/resources/vitals/client/Client.d.ts +5 -0
  77. package/dist/api/resources/vitals/client/Client.js +90 -22
  78. package/dist/api/resources/vitals/client/requests/VitalsElectrocardiogramVoltageRequest.d.ts +17 -0
  79. package/dist/api/resources/vitals/client/requests/VitalsElectrocardiogramVoltageRequest.js +5 -0
  80. package/dist/api/resources/vitals/client/requests/index.d.ts +1 -0
  81. package/dist/api/resources/workouts/client/Client.d.ts +4 -0
  82. package/dist/api/resources/workouts/client/Client.js +59 -2
  83. package/dist/api/types/BiomarkerResult.d.ts +2 -0
  84. package/dist/api/types/ClientFacingElectrocardiogramVoltageTimeseries.d.ts +17 -0
  85. package/dist/api/types/ClientFacingElectrocardiogramVoltageTimeseries.js +5 -0
  86. package/dist/api/types/ClientFacingLoinc.d.ts +10 -0
  87. package/dist/api/types/ClientFacingLoinc.js +5 -0
  88. package/dist/api/types/ClientFacingMarkerComplete.d.ts +16 -0
  89. package/dist/api/types/ClientFacingMarkerComplete.js +5 -0
  90. package/dist/api/types/ClientFacingResult.d.ts +12 -0
  91. package/dist/api/types/ClientFacingResult.js +5 -0
  92. package/dist/api/types/ClientFacingSleep.d.ts +1 -1
  93. package/dist/api/types/GetMarkersResponse.d.ts +1 -1
  94. package/dist/api/types/Region.d.ts +2 -1
  95. package/dist/api/types/Region.js +1 -0
  96. package/dist/api/types/index.d.ts +4 -0
  97. package/dist/api/types/index.js +4 -0
  98. package/dist/serialization/resources/labTests/client/getMarkersForLabTest.d.ts +10 -0
  99. package/dist/serialization/resources/labTests/client/getMarkersForLabTest.js +40 -0
  100. package/dist/serialization/resources/labTests/client/index.d.ts +1 -0
  101. package/dist/serialization/resources/labTests/client/index.js +2 -1
  102. package/dist/serialization/resources/link/client/{getProviders.d.ts → getAllProviders.d.ts} +1 -1
  103. package/dist/serialization/resources/link/client/index.d.ts +1 -1
  104. package/dist/serialization/resources/link/client/index.js +2 -2
  105. package/{serialization/resources/providers/client/getListOfProviders.d.ts → dist/serialization/resources/providers/client/getAll.d.ts} +1 -1
  106. package/dist/serialization/resources/providers/client/index.d.ts +1 -1
  107. package/dist/serialization/resources/providers/client/index.js +2 -2
  108. package/{serialization/resources/team/client/getTeamConfig.d.ts → dist/serialization/resources/team/client/getLinkConfig.d.ts} +1 -1
  109. package/dist/serialization/resources/team/client/{getTeamConfig.d.ts → getSvixUrl.d.ts} +1 -1
  110. package/{serialization/resources/team/client/searchTeamUsersByUuidOrClientUserId.d.ts → dist/serialization/resources/team/client/getUserById.d.ts} +1 -1
  111. package/dist/serialization/resources/team/client/index.d.ts +3 -3
  112. package/dist/serialization/resources/team/client/index.js +4 -4
  113. package/dist/serialization/resources/vitals/client/electrocardiogramVoltage.d.ts +10 -0
  114. package/dist/serialization/resources/vitals/client/electrocardiogramVoltage.js +40 -0
  115. package/dist/serialization/resources/vitals/client/index.d.ts +1 -0
  116. package/dist/serialization/resources/vitals/client/index.js +2 -1
  117. package/dist/serialization/types/BiomarkerResult.d.ts +2 -0
  118. package/dist/serialization/types/BiomarkerResult.js +2 -0
  119. package/dist/serialization/types/ClientFacingElectrocardiogramVoltageTimeseries.d.ts +17 -0
  120. package/dist/serialization/types/ClientFacingElectrocardiogramVoltageTimeseries.js +38 -0
  121. package/dist/serialization/types/ClientFacingLoinc.d.ts +16 -0
  122. package/dist/serialization/types/ClientFacingLoinc.js +37 -0
  123. package/dist/serialization/types/ClientFacingMarkerComplete.d.ts +21 -0
  124. package/dist/serialization/types/ClientFacingMarkerComplete.js +51 -0
  125. package/dist/serialization/types/ClientFacingResult.d.ts +17 -0
  126. package/dist/serialization/types/ClientFacingResult.js +47 -0
  127. package/dist/serialization/types/GetMarkersResponse.d.ts +1 -1
  128. package/dist/serialization/types/GetMarkersResponse.js +1 -1
  129. package/dist/serialization/types/Region.d.ts +1 -1
  130. package/dist/serialization/types/Region.js +1 -0
  131. package/dist/serialization/types/index.d.ts +4 -0
  132. package/dist/serialization/types/index.js +4 -0
  133. package/package.json +1 -1
  134. package/serialization/resources/labTests/client/getMarkersForLabTest.d.ts +10 -0
  135. package/serialization/resources/labTests/client/getMarkersForLabTest.js +40 -0
  136. package/serialization/resources/labTests/client/index.d.ts +1 -0
  137. package/serialization/resources/labTests/client/index.js +2 -1
  138. package/serialization/resources/link/client/{getProviders.d.ts → getAllProviders.d.ts} +1 -1
  139. package/serialization/resources/link/client/index.d.ts +1 -1
  140. package/serialization/resources/link/client/index.js +2 -2
  141. package/{dist/serialization/resources/providers/client/getListOfProviders.d.ts → serialization/resources/providers/client/getAll.d.ts} +1 -1
  142. package/serialization/resources/providers/client/index.d.ts +1 -1
  143. package/serialization/resources/providers/client/index.js +2 -2
  144. package/serialization/resources/team/client/{getSvixWebhookUrl.d.ts → getLinkConfig.d.ts} +1 -1
  145. package/{dist/serialization/resources/team/client/getSvixWebhookUrl.d.ts → serialization/resources/team/client/getSvixUrl.d.ts} +1 -1
  146. package/{dist/serialization/resources/team/client/searchTeamUsersByUuidOrClientUserId.d.ts → serialization/resources/team/client/getUserById.d.ts} +1 -1
  147. package/serialization/resources/team/client/index.d.ts +3 -3
  148. package/serialization/resources/team/client/index.js +4 -4
  149. package/serialization/resources/vitals/client/electrocardiogramVoltage.d.ts +10 -0
  150. package/serialization/resources/vitals/client/electrocardiogramVoltage.js +40 -0
  151. package/serialization/resources/vitals/client/index.d.ts +1 -0
  152. package/serialization/resources/vitals/client/index.js +2 -1
  153. package/serialization/types/BiomarkerResult.d.ts +2 -0
  154. package/serialization/types/BiomarkerResult.js +2 -0
  155. package/serialization/types/ClientFacingElectrocardiogramVoltageTimeseries.d.ts +17 -0
  156. package/serialization/types/ClientFacingElectrocardiogramVoltageTimeseries.js +38 -0
  157. package/serialization/types/ClientFacingLoinc.d.ts +16 -0
  158. package/serialization/types/ClientFacingLoinc.js +37 -0
  159. package/serialization/types/ClientFacingMarkerComplete.d.ts +21 -0
  160. package/serialization/types/ClientFacingMarkerComplete.js +51 -0
  161. package/serialization/types/ClientFacingResult.d.ts +17 -0
  162. package/serialization/types/ClientFacingResult.js +47 -0
  163. package/serialization/types/GetMarkersResponse.d.ts +1 -1
  164. package/serialization/types/GetMarkersResponse.js +1 -1
  165. package/serialization/types/Region.d.ts +1 -1
  166. package/serialization/types/Region.js +1 -0
  167. package/serialization/types/index.d.ts +4 -0
  168. package/serialization/types/index.js +4 -0
  169. package/api/resources/timeseries/client/Client.d.ts +0 -28
  170. package/api/resources/timeseries/client/Client.js +0 -168
  171. package/api/resources/timeseries/client/index.d.ts +0 -1
  172. package/api/resources/timeseries/client/index.js +0 -2
  173. package/api/resources/timeseries/index.d.ts +0 -1
  174. package/api/resources/timeseries/index.js +0 -17
  175. package/dist/api/resources/timeseries/client/Client.d.ts +0 -28
  176. package/dist/api/resources/timeseries/client/Client.js +0 -168
  177. package/dist/api/resources/timeseries/client/index.d.ts +0 -1
  178. package/dist/api/resources/timeseries/client/index.js +0 -2
  179. package/dist/api/resources/timeseries/index.d.ts +0 -1
  180. package/dist/api/resources/timeseries/index.js +0 -17
  181. /package/api/resources/team/client/requests/{GetSourcePrioritiesV2TeamSourcePrioritiesGetRequest.js → TeamGetSourcePrioritiesRequest.js} +0 -0
  182. /package/api/resources/team/client/requests/{SearchTeamUsersByUuidOrClientUserIdV2TeamUsersSearchGetRequest.js → TeamGetUserByIdRequest.js} +0 -0
  183. /package/api/resources/team/client/requests/{UpdateSourcePrioritiesV2TeamSourcePrioritiesPatchRequest.js → TeamUpdateSourcePrioritiesRequest.js} +0 -0
  184. /package/{dist/api/resources/team/client/requests/GetSourcePrioritiesV2TeamSourcePrioritiesGetRequest.js → api/resources/vitals/client/requests/VitalsElectrocardiogramVoltageRequest.js} +0 -0
  185. /package/{dist/api/resources/team/client/requests/SearchTeamUsersByUuidOrClientUserIdV2TeamUsersSearchGetRequest.js → api/types/ClientFacingElectrocardiogramVoltageTimeseries.js} +0 -0
  186. /package/{dist/api/resources/team/client/requests/UpdateSourcePrioritiesV2TeamSourcePrioritiesPatchRequest.js → api/types/ClientFacingLoinc.js} +0 -0
  187. /package/dist/serialization/resources/link/client/{getProviders.js → getAllProviders.js} +0 -0
  188. /package/dist/serialization/resources/providers/client/{getListOfProviders.js → getAll.js} +0 -0
  189. /package/dist/serialization/resources/team/client/{getSvixWebhookUrl.js → getLinkConfig.js} +0 -0
  190. /package/dist/serialization/resources/team/client/{getTeamConfig.js → getSvixUrl.js} +0 -0
  191. /package/dist/serialization/resources/team/client/{searchTeamUsersByUuidOrClientUserId.js → getUserById.js} +0 -0
  192. /package/serialization/resources/link/client/{getProviders.js → getAllProviders.js} +0 -0
  193. /package/serialization/resources/providers/client/{getListOfProviders.js → getAll.js} +0 -0
  194. /package/serialization/resources/team/client/{getSvixWebhookUrl.js → getLinkConfig.js} +0 -0
  195. /package/serialization/resources/team/client/{getTeamConfig.js → getSvixUrl.js} +0 -0
  196. /package/serialization/resources/team/client/{searchTeamUsersByUuidOrClientUserId.js → getUserById.js} +0 -0
@@ -1,168 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = { enumerable: true, get: function() { return m[k]; } };
10
- }
11
- Object.defineProperty(o, k2, desc);
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
- return new (P || (P = Promise))(function (resolve, reject) {
31
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
- step((generator = generator.apply(thisArg, _arguments || [])).next());
35
- });
36
- };
37
- var __importDefault = (this && this.__importDefault) || function (mod) {
38
- return (mod && mod.__esModule) ? mod : { "default": mod };
39
- };
40
- Object.defineProperty(exports, "__esModule", { value: true });
41
- exports.Timeseries = void 0;
42
- const environments = __importStar(require("../../../../environments"));
43
- const core = __importStar(require("../../../../core"));
44
- const Vital = __importStar(require("../../.."));
45
- const url_join_1 = __importDefault(require("url-join"));
46
- const serializers = __importStar(require("../../../../serialization"));
47
- const errors = __importStar(require("../../../../errors"));
48
- class Timeseries {
49
- constructor(_options) {
50
- this._options = _options;
51
- }
52
- /**
53
- * Get Sleep stream for a user_id
54
- * @throws {@link Vital.UnprocessableEntityError}
55
- */
56
- getUserSleepStream(sleepId, requestOptions) {
57
- var _a;
58
- return __awaiter(this, void 0, void 0, function* () {
59
- const _response = yield core.fetcher({
60
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/timeseries/sleep/${sleepId}/stream`),
61
- method: "GET",
62
- headers: {
63
- "x-vital-api-key": yield core.Supplier.get(this._options.apiKey),
64
- "X-Fern-Language": "JavaScript",
65
- "X-Fern-SDK-Name": "@tryvital/vital-node",
66
- "X-Fern-SDK-Version": "3.0.0-beta.0",
67
- },
68
- contentType: "application/json",
69
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
70
- });
71
- if (_response.ok) {
72
- return yield serializers.ClientFacingSleepStream.parseOrThrow(_response.body, {
73
- unrecognizedObjectKeys: "passthrough",
74
- allowUnrecognizedUnionMembers: true,
75
- allowUnrecognizedEnumValues: true,
76
- breadcrumbsPrefix: ["response"],
77
- });
78
- }
79
- if (_response.error.reason === "status-code") {
80
- switch (_response.error.statusCode) {
81
- case 422:
82
- throw new Vital.UnprocessableEntityError(yield serializers.HttpValidationError.parseOrThrow(_response.error.body, {
83
- unrecognizedObjectKeys: "passthrough",
84
- allowUnrecognizedUnionMembers: true,
85
- allowUnrecognizedEnumValues: true,
86
- breadcrumbsPrefix: ["response"],
87
- }));
88
- default:
89
- throw new errors.VitalError({
90
- statusCode: _response.error.statusCode,
91
- body: _response.error.body,
92
- });
93
- }
94
- }
95
- switch (_response.error.reason) {
96
- case "non-json":
97
- throw new errors.VitalError({
98
- statusCode: _response.error.statusCode,
99
- body: _response.error.rawBody,
100
- });
101
- case "timeout":
102
- throw new errors.VitalTimeoutError();
103
- case "unknown":
104
- throw new errors.VitalError({
105
- message: _response.error.errorMessage,
106
- });
107
- }
108
- });
109
- }
110
- /**
111
- * @throws {@link Vital.UnprocessableEntityError}
112
- */
113
- getUserWorkouts(workoutId, requestOptions) {
114
- var _a;
115
- return __awaiter(this, void 0, void 0, function* () {
116
- const _response = yield core.fetcher({
117
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/timeseries/workouts/${workoutId}/stream`),
118
- method: "GET",
119
- headers: {
120
- "x-vital-api-key": yield core.Supplier.get(this._options.apiKey),
121
- "X-Fern-Language": "JavaScript",
122
- "X-Fern-SDK-Name": "@tryvital/vital-node",
123
- "X-Fern-SDK-Version": "3.0.0-beta.0",
124
- },
125
- contentType: "application/json",
126
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
127
- });
128
- if (_response.ok) {
129
- return yield serializers.ClientFacingStream.parseOrThrow(_response.body, {
130
- unrecognizedObjectKeys: "passthrough",
131
- allowUnrecognizedUnionMembers: true,
132
- allowUnrecognizedEnumValues: true,
133
- breadcrumbsPrefix: ["response"],
134
- });
135
- }
136
- if (_response.error.reason === "status-code") {
137
- switch (_response.error.statusCode) {
138
- case 422:
139
- throw new Vital.UnprocessableEntityError(yield serializers.HttpValidationError.parseOrThrow(_response.error.body, {
140
- unrecognizedObjectKeys: "passthrough",
141
- allowUnrecognizedUnionMembers: true,
142
- allowUnrecognizedEnumValues: true,
143
- breadcrumbsPrefix: ["response"],
144
- }));
145
- default:
146
- throw new errors.VitalError({
147
- statusCode: _response.error.statusCode,
148
- body: _response.error.body,
149
- });
150
- }
151
- }
152
- switch (_response.error.reason) {
153
- case "non-json":
154
- throw new errors.VitalError({
155
- statusCode: _response.error.statusCode,
156
- body: _response.error.rawBody,
157
- });
158
- case "timeout":
159
- throw new errors.VitalTimeoutError();
160
- case "unknown":
161
- throw new errors.VitalError({
162
- message: _response.error.errorMessage,
163
- });
164
- }
165
- });
166
- }
167
- }
168
- exports.Timeseries = Timeseries;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- export * from "./client";
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = 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);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./client"), exports);
@@ -1,28 +0,0 @@
1
- /**
2
- * This file was auto-generated by Fern from our API Definition.
3
- */
4
- import * as environments from "../../../../environments";
5
- import * as core from "../../../../core";
6
- import * as Vital from "../../..";
7
- export declare namespace Timeseries {
8
- interface Options {
9
- environment?: core.Supplier<environments.VitalEnvironment | string>;
10
- apiKey: core.Supplier<string>;
11
- }
12
- interface RequestOptions {
13
- timeoutInSeconds?: number;
14
- }
15
- }
16
- export declare class Timeseries {
17
- protected readonly _options: Timeseries.Options;
18
- constructor(_options: Timeseries.Options);
19
- /**
20
- * Get Sleep stream for a user_id
21
- * @throws {@link Vital.UnprocessableEntityError}
22
- */
23
- getUserSleepStream(sleepId: string, requestOptions?: Timeseries.RequestOptions): Promise<Vital.ClientFacingSleepStream>;
24
- /**
25
- * @throws {@link Vital.UnprocessableEntityError}
26
- */
27
- getUserWorkouts(workoutId: string, requestOptions?: Timeseries.RequestOptions): Promise<Vital.ClientFacingStream>;
28
- }
@@ -1,168 +0,0 @@
1
- "use strict";
2
- /**
3
- * This file was auto-generated by Fern from our API Definition.
4
- */
5
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- var desc = Object.getOwnPropertyDescriptor(m, k);
8
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
- desc = { enumerable: true, get: function() { return m[k]; } };
10
- }
11
- Object.defineProperty(o, k2, desc);
12
- }) : (function(o, m, k, k2) {
13
- if (k2 === undefined) k2 = k;
14
- o[k2] = m[k];
15
- }));
16
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
- Object.defineProperty(o, "default", { enumerable: true, value: v });
18
- }) : function(o, v) {
19
- o["default"] = v;
20
- });
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
- return new (P || (P = Promise))(function (resolve, reject) {
31
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
- step((generator = generator.apply(thisArg, _arguments || [])).next());
35
- });
36
- };
37
- var __importDefault = (this && this.__importDefault) || function (mod) {
38
- return (mod && mod.__esModule) ? mod : { "default": mod };
39
- };
40
- Object.defineProperty(exports, "__esModule", { value: true });
41
- exports.Timeseries = void 0;
42
- const environments = __importStar(require("../../../../environments"));
43
- const core = __importStar(require("../../../../core"));
44
- const Vital = __importStar(require("../../.."));
45
- const url_join_1 = __importDefault(require("url-join"));
46
- const serializers = __importStar(require("../../../../serialization"));
47
- const errors = __importStar(require("../../../../errors"));
48
- class Timeseries {
49
- constructor(_options) {
50
- this._options = _options;
51
- }
52
- /**
53
- * Get Sleep stream for a user_id
54
- * @throws {@link Vital.UnprocessableEntityError}
55
- */
56
- getUserSleepStream(sleepId, requestOptions) {
57
- var _a;
58
- return __awaiter(this, void 0, void 0, function* () {
59
- const _response = yield core.fetcher({
60
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/timeseries/sleep/${sleepId}/stream`),
61
- method: "GET",
62
- headers: {
63
- "x-vital-api-key": yield core.Supplier.get(this._options.apiKey),
64
- "X-Fern-Language": "JavaScript",
65
- "X-Fern-SDK-Name": "@tryvital/vital-node",
66
- "X-Fern-SDK-Version": "3.0.0-beta.0",
67
- },
68
- contentType: "application/json",
69
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
70
- });
71
- if (_response.ok) {
72
- return yield serializers.ClientFacingSleepStream.parseOrThrow(_response.body, {
73
- unrecognizedObjectKeys: "passthrough",
74
- allowUnrecognizedUnionMembers: true,
75
- allowUnrecognizedEnumValues: true,
76
- breadcrumbsPrefix: ["response"],
77
- });
78
- }
79
- if (_response.error.reason === "status-code") {
80
- switch (_response.error.statusCode) {
81
- case 422:
82
- throw new Vital.UnprocessableEntityError(yield serializers.HttpValidationError.parseOrThrow(_response.error.body, {
83
- unrecognizedObjectKeys: "passthrough",
84
- allowUnrecognizedUnionMembers: true,
85
- allowUnrecognizedEnumValues: true,
86
- breadcrumbsPrefix: ["response"],
87
- }));
88
- default:
89
- throw new errors.VitalError({
90
- statusCode: _response.error.statusCode,
91
- body: _response.error.body,
92
- });
93
- }
94
- }
95
- switch (_response.error.reason) {
96
- case "non-json":
97
- throw new errors.VitalError({
98
- statusCode: _response.error.statusCode,
99
- body: _response.error.rawBody,
100
- });
101
- case "timeout":
102
- throw new errors.VitalTimeoutError();
103
- case "unknown":
104
- throw new errors.VitalError({
105
- message: _response.error.errorMessage,
106
- });
107
- }
108
- });
109
- }
110
- /**
111
- * @throws {@link Vital.UnprocessableEntityError}
112
- */
113
- getUserWorkouts(workoutId, requestOptions) {
114
- var _a;
115
- return __awaiter(this, void 0, void 0, function* () {
116
- const _response = yield core.fetcher({
117
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.VitalEnvironment.Production, `v2/timeseries/workouts/${workoutId}/stream`),
118
- method: "GET",
119
- headers: {
120
- "x-vital-api-key": yield core.Supplier.get(this._options.apiKey),
121
- "X-Fern-Language": "JavaScript",
122
- "X-Fern-SDK-Name": "@tryvital/vital-node",
123
- "X-Fern-SDK-Version": "3.0.0-beta.0",
124
- },
125
- contentType: "application/json",
126
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
127
- });
128
- if (_response.ok) {
129
- return yield serializers.ClientFacingStream.parseOrThrow(_response.body, {
130
- unrecognizedObjectKeys: "passthrough",
131
- allowUnrecognizedUnionMembers: true,
132
- allowUnrecognizedEnumValues: true,
133
- breadcrumbsPrefix: ["response"],
134
- });
135
- }
136
- if (_response.error.reason === "status-code") {
137
- switch (_response.error.statusCode) {
138
- case 422:
139
- throw new Vital.UnprocessableEntityError(yield serializers.HttpValidationError.parseOrThrow(_response.error.body, {
140
- unrecognizedObjectKeys: "passthrough",
141
- allowUnrecognizedUnionMembers: true,
142
- allowUnrecognizedEnumValues: true,
143
- breadcrumbsPrefix: ["response"],
144
- }));
145
- default:
146
- throw new errors.VitalError({
147
- statusCode: _response.error.statusCode,
148
- body: _response.error.body,
149
- });
150
- }
151
- }
152
- switch (_response.error.reason) {
153
- case "non-json":
154
- throw new errors.VitalError({
155
- statusCode: _response.error.statusCode,
156
- body: _response.error.rawBody,
157
- });
158
- case "timeout":
159
- throw new errors.VitalTimeoutError();
160
- case "unknown":
161
- throw new errors.VitalError({
162
- message: _response.error.errorMessage,
163
- });
164
- }
165
- });
166
- }
167
- }
168
- exports.Timeseries = Timeseries;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- export * from "./client";
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = 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);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./client"), exports);