diff --git a/package.json b/package.json index 26cdbfd3..dff9634b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tryvital/vital-node", - "version": "3.0.7", + "version": "3.0.8", "private": false, "repository": "https://github.com/tryVital/vital-node", "main": "./index.js", @@ -12,11 +12,14 @@ }, "dependencies": { "url-join": "4.0.1", - "@types/url-join": "4.0.1", - "@ungap/url-search-params": "0.2.2", - "axios": "0.27.2" + "form-data": "4.0.0", + "node-fetch": "2.7.0", + "qs": "6.11.2" }, "devDependencies": { + "@types/url-join": "4.0.1", + "@types/qs": "6.9.8", + "@types/node-fetch": "2.6.9", "@types/node": "17.0.33", "prettier": "2.7.1", "typescript": "4.6.4" diff --git a/src/Client.ts b/src/Client.ts index 9f4c35d4..2225e65f 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -29,6 +29,7 @@ export declare namespace VitalClient { interface RequestOptions { timeoutInSeconds?: number; + maxRetries?: number; } } diff --git a/src/api/errors/BadRequestError.ts b/src/api/errors/BadRequestError.ts index 0c151265..643cd655 100644 --- a/src/api/errors/BadRequestError.ts +++ b/src/api/errors/BadRequestError.ts @@ -8,6 +8,7 @@ import * as Vital from ".."; export class BadRequestError extends errors.VitalError { constructor(body: Vital.UserRefreshErrorResponse) { super({ + message: "BadRequestError", statusCode: 400, body: body, }); diff --git a/src/api/errors/UnprocessableEntityError.ts b/src/api/errors/UnprocessableEntityError.ts index e903224f..f1682ebd 100644 --- a/src/api/errors/UnprocessableEntityError.ts +++ b/src/api/errors/UnprocessableEntityError.ts @@ -8,6 +8,7 @@ import * as Vital from ".."; export class UnprocessableEntityError extends errors.VitalError { constructor(body: Vital.HttpValidationError) { super({ + message: "UnprocessableEntityError", statusCode: 422, body: body, }); diff --git a/src/api/resources/activity/client/Client.ts b/src/api/resources/activity/client/Client.ts index 591f0f6e..3eae5bdf 100644 --- a/src/api/resources/activity/client/Client.ts +++ b/src/api/resources/activity/client/Client.ts @@ -5,7 +5,6 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Vital from "../../.."; -import { default as URLSearchParams } from "@ungap/url-search-params"; import urlJoin from "url-join"; import * as serializers from "../../../../serialization"; import * as errors from "../../../../errors"; @@ -18,6 +17,7 @@ export declare namespace Activity { interface RequestOptions { timeoutInSeconds?: number; + maxRetries?: number; } } @@ -27,6 +27,11 @@ export class Activity { /** * Get Daily Activity for user_id * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.activity.get("user-id", { + * startDate: "start-date" + * }) */ public async get( userId: string, @@ -34,14 +39,14 @@ export class Activity { requestOptions?: Activity.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -54,11 +59,12 @@ export class Activity { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientActivityResponse.parseOrThrow(_response.body, { @@ -106,6 +112,11 @@ export class Activity { /** * Get Daily Activity for user_id * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.activity.getRaw("user-id", { + * startDate: "start-date" + * }) */ public async getRaw( userId: string, @@ -113,14 +124,14 @@ export class Activity { requestOptions?: Activity.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -133,11 +144,12 @@ export class Activity { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.RawActivity.parseOrThrow(_response.body, { diff --git a/src/api/resources/activity/client/requests/ActivityGetRawRequest.ts b/src/api/resources/activity/client/requests/ActivityGetRawRequest.ts index 427a0d76..fed1fc92 100644 --- a/src/api/resources/activity/client/requests/ActivityGetRawRequest.ts +++ b/src/api/resources/activity/client/requests/ActivityGetRawRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface ActivityGetRawRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/activity/client/requests/ActivityGetRequest.ts b/src/api/resources/activity/client/requests/ActivityGetRequest.ts index b8f3568a..ada5aeff 100644 --- a/src/api/resources/activity/client/requests/ActivityGetRequest.ts +++ b/src/api/resources/activity/client/requests/ActivityGetRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface ActivityGetRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/body/client/Client.ts b/src/api/resources/body/client/Client.ts index 2577d90c..57b61d1c 100644 --- a/src/api/resources/body/client/Client.ts +++ b/src/api/resources/body/client/Client.ts @@ -5,7 +5,6 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Vital from "../../.."; -import { default as URLSearchParams } from "@ungap/url-search-params"; import urlJoin from "url-join"; import * as serializers from "../../../../serialization"; import * as errors from "../../../../errors"; @@ -18,6 +17,7 @@ export declare namespace Body { interface RequestOptions { timeoutInSeconds?: number; + maxRetries?: number; } } @@ -27,6 +27,11 @@ export class Body { /** * Get Daily Body data for user_id * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.body.get("user-id", { + * startDate: "start-date" + * }) */ public async get( userId: string, @@ -34,14 +39,14 @@ export class Body { requestOptions?: Body.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -54,11 +59,12 @@ export class Body { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientBodyResponse.parseOrThrow(_response.body, { @@ -106,6 +112,11 @@ export class Body { /** * Get Daily Body data for user_id * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.body.getRaw("user-id", { + * startDate: "start-date" + * }) */ public async getRaw( userId: string, @@ -113,14 +124,14 @@ export class Body { requestOptions?: Body.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -133,11 +144,12 @@ export class Body { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.RawBody.parseOrThrow(_response.body, { diff --git a/src/api/resources/body/client/requests/BodyGetRawRequest.ts b/src/api/resources/body/client/requests/BodyGetRawRequest.ts index 4cacb5e5..569d5e1f 100644 --- a/src/api/resources/body/client/requests/BodyGetRawRequest.ts +++ b/src/api/resources/body/client/requests/BodyGetRawRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface BodyGetRawRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/body/client/requests/BodyGetRequest.ts b/src/api/resources/body/client/requests/BodyGetRequest.ts index e52c1212..f9c08998 100644 --- a/src/api/resources/body/client/requests/BodyGetRequest.ts +++ b/src/api/resources/body/client/requests/BodyGetRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface BodyGetRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/devices/client/Client.ts b/src/api/resources/devices/client/Client.ts index e1d0432b..bf20d135 100644 --- a/src/api/resources/devices/client/Client.ts +++ b/src/api/resources/devices/client/Client.ts @@ -5,7 +5,6 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Vital from "../../.."; -import { default as URLSearchParams } from "@ungap/url-search-params"; import urlJoin from "url-join"; import * as serializers from "../../../../serialization"; import * as errors from "../../../../errors"; @@ -18,6 +17,7 @@ export declare namespace Devices { interface RequestOptions { timeoutInSeconds?: number; + maxRetries?: number; } } @@ -27,6 +27,9 @@ export class Devices { /** * Get Devices for user_id * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.devices.getRaw("user-id", {}) */ public async getRaw( userId: string, @@ -34,9 +37,9 @@ export class Devices { requestOptions?: Devices.RequestOptions ): Promise { const { provider } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } const _response = await core.fetcher({ @@ -49,11 +52,12 @@ export class Devices { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.RawDevices.parseOrThrow(_response.body, { diff --git a/src/api/resources/devices/client/requests/DevicesGetRawRequest.ts b/src/api/resources/devices/client/requests/DevicesGetRawRequest.ts index fba4aae6..d50411c7 100644 --- a/src/api/resources/devices/client/requests/DevicesGetRawRequest.ts +++ b/src/api/resources/devices/client/requests/DevicesGetRawRequest.ts @@ -2,6 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * {} + */ export interface DevicesGetRawRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/insurance/client/Client.ts b/src/api/resources/insurance/client/Client.ts index 10929041..161e0b50 100644 --- a/src/api/resources/insurance/client/Client.ts +++ b/src/api/resources/insurance/client/Client.ts @@ -8,7 +8,6 @@ import * as Vital from "../../.."; import * as serializers from "../../../../serialization"; import urlJoin from "url-join"; import * as errors from "../../../../errors"; -import { default as URLSearchParams } from "@ungap/url-search-params"; export declare namespace Insurance { interface Options { @@ -18,6 +17,7 @@ export declare namespace Insurance { interface RequestOptions { timeoutInSeconds?: number; + maxRetries?: number; } } @@ -41,11 +41,12 @@ export class Insurance { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", body: await serializers.PayorSearchRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.insurance.searchPayorInfo.Response.parseOrThrow(_response.body, { @@ -92,14 +93,19 @@ export class Insurance { /** * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.insurance.searchDiagnosis({ + * diagnosisQuery: "diagnosis-query" + * }) */ public async searchDiagnosis( request: Vital.InsuranceSearchDiagnosisRequest, requestOptions?: Insurance.RequestOptions ): Promise { const { diagnosisQuery } = request; - const _queryParams = new URLSearchParams(); - _queryParams.append("diagnosis_query", diagnosisQuery); + const _queryParams: Record = {}; + _queryParams["diagnosis_query"] = diagnosisQuery; const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.VitalEnvironment.Production, @@ -110,11 +116,12 @@ export class Insurance { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.insurance.searchDiagnosis.Response.parseOrThrow(_response.body, { diff --git a/src/api/resources/insurance/client/requests/InsuranceSearchDiagnosisRequest.ts b/src/api/resources/insurance/client/requests/InsuranceSearchDiagnosisRequest.ts index e06276b4..c2e0cf86 100644 --- a/src/api/resources/insurance/client/requests/InsuranceSearchDiagnosisRequest.ts +++ b/src/api/resources/insurance/client/requests/InsuranceSearchDiagnosisRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * diagnosisQuery: "diagnosis-query" + * } + */ export interface InsuranceSearchDiagnosisRequest { diagnosisQuery: string; } diff --git a/src/api/resources/introspect/client/Client.ts b/src/api/resources/introspect/client/Client.ts index 77207e0a..c835240a 100644 --- a/src/api/resources/introspect/client/Client.ts +++ b/src/api/resources/introspect/client/Client.ts @@ -5,7 +5,6 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Vital from "../../.."; -import { default as URLSearchParams } from "@ungap/url-search-params"; import urlJoin from "url-join"; import * as serializers from "../../../../serialization"; import * as errors from "../../../../errors"; @@ -18,6 +17,7 @@ export declare namespace Introspect { interface RequestOptions { timeoutInSeconds?: number; + maxRetries?: number; } } @@ -26,27 +26,32 @@ export class Introspect { /** * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.introspect.getUserResources({ + * provider: Vital.Providers.Oura + * }) */ public async getUserResources( request: Vital.IntrospectGetUserResourcesRequest = {}, requestOptions?: Introspect.RequestOptions ): Promise { const { userId, provider, userLimit, cursor } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (userId != null) { - _queryParams.append("user_id", userId); + _queryParams["user_id"] = userId; } if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } if (userLimit != null) { - _queryParams.append("user_limit", userLimit.toString()); + _queryParams["user_limit"] = userLimit.toString(); } if (cursor != null) { - _queryParams.append("cursor", cursor); + _queryParams["cursor"] = cursor; } const _response = await core.fetcher({ @@ -59,11 +64,12 @@ export class Introspect { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.UserResourcesResponse.parseOrThrow(_response.body, { @@ -110,27 +116,32 @@ export class Introspect { /** * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.introspect.getUserHistoricalPulls({ + * provider: Vital.Providers.Oura + * }) */ public async getUserHistoricalPulls( request: Vital.IntrospectGetUserHistoricalPullsRequest = {}, requestOptions?: Introspect.RequestOptions ): Promise { const { userId, provider, userLimit, cursor } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (userId != null) { - _queryParams.append("user_id", userId); + _queryParams["user_id"] = userId; } if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } if (userLimit != null) { - _queryParams.append("user_limit", userLimit.toString()); + _queryParams["user_limit"] = userLimit.toString(); } if (cursor != null) { - _queryParams.append("cursor", cursor); + _queryParams["cursor"] = cursor; } const _response = await core.fetcher({ @@ -143,11 +154,12 @@ export class Introspect { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.UserHistoricalPullsResponse.parseOrThrow(_response.body, { diff --git a/src/api/resources/introspect/client/requests/IntrospectGetUserHistoricalPullsRequest.ts b/src/api/resources/introspect/client/requests/IntrospectGetUserHistoricalPullsRequest.ts index 0e70c1e2..3c1efbfe 100644 --- a/src/api/resources/introspect/client/requests/IntrospectGetUserHistoricalPullsRequest.ts +++ b/src/api/resources/introspect/client/requests/IntrospectGetUserHistoricalPullsRequest.ts @@ -4,6 +4,12 @@ import * as Vital from "../../../.."; +/** + * @example + * { + * provider: Vital.Providers.Oura + * } + */ export interface IntrospectGetUserHistoricalPullsRequest { userId?: string; provider?: Vital.Providers; diff --git a/src/api/resources/introspect/client/requests/IntrospectGetUserResourcesRequest.ts b/src/api/resources/introspect/client/requests/IntrospectGetUserResourcesRequest.ts index 8e9ec5b9..0df3900b 100644 --- a/src/api/resources/introspect/client/requests/IntrospectGetUserResourcesRequest.ts +++ b/src/api/resources/introspect/client/requests/IntrospectGetUserResourcesRequest.ts @@ -4,6 +4,12 @@ import * as Vital from "../../../.."; +/** + * @example + * { + * provider: Vital.Providers.Oura + * } + */ export interface IntrospectGetUserResourcesRequest { userId?: string; provider?: Vital.Providers; diff --git a/src/api/resources/labTests/client/Client.ts b/src/api/resources/labTests/client/Client.ts index 02f06385..fc0cf791 100644 --- a/src/api/resources/labTests/client/Client.ts +++ b/src/api/resources/labTests/client/Client.ts @@ -8,7 +8,6 @@ import * as Vital from "../../.."; import urlJoin from "url-join"; import * as serializers from "../../../../serialization"; import * as errors from "../../../../errors"; -import { default as URLSearchParams } from "@ungap/url-search-params"; import * as stream from "stream"; export declare namespace LabTests { @@ -19,6 +18,7 @@ export declare namespace LabTests { interface RequestOptions { timeoutInSeconds?: number; + maxRetries?: number; } } @@ -27,6 +27,9 @@ export class LabTests { /** * GET all the lab tests the team has access to. + * + * @example + * await vital.labTests.get() */ public async get(requestOptions?: LabTests.RequestOptions): Promise { const _response = await core.fetcher({ @@ -39,10 +42,11 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.labTests.get.Response.parseOrThrow(_response.body, { @@ -92,11 +96,12 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", body: await serializers.CreateLabTestRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientFacingLabTest.parseOrThrow(_response.body, { @@ -144,33 +149,34 @@ export class LabTests { /** * GET all the markers for the given lab. * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.labTests.getMarkers({}) */ public async getMarkers( request: Vital.LabTestsGetMarkersRequest = {}, requestOptions?: LabTests.RequestOptions ): Promise { const { labId, name, page, size } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (labId != null) { if (Array.isArray(labId)) { - for (const _item of labId) { - _queryParams.append("lab_id", _item.toString()); - } + _queryParams["lab_id"] = labId.map((item) => item.toString()); } else { - _queryParams.append("lab_id", labId.toString()); + _queryParams["lab_id"] = labId.toString(); } } if (name != null) { - _queryParams.append("name", name); + _queryParams["name"] = name; } if (page != null) { - _queryParams.append("page", page.toString()); + _queryParams["page"] = page.toString(); } if (size != null) { - _queryParams.append("size", size.toString()); + _queryParams["size"] = size.toString(); } const _response = await core.fetcher({ @@ -183,11 +189,12 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.GetMarkersResponse.parseOrThrow(_response.body, { @@ -234,6 +241,9 @@ export class LabTests { /** * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.labTests.getMarkersForLabTest("lab-test-id", {}) */ public async getMarkersForLabTest( labTestId: string, @@ -241,13 +251,13 @@ export class LabTests { requestOptions?: LabTests.RequestOptions ): Promise { const { page, size } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (page != null) { - _queryParams.append("page", page.toString()); + _queryParams["page"] = page.toString(); } if (size != null) { - _queryParams.append("size", size.toString()); + _queryParams["size"] = size.toString(); } const _response = await core.fetcher({ @@ -260,11 +270,12 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.GetMarkersResponse.parseOrThrow(_response.body, { @@ -328,10 +339,11 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientFacingMarker.parseOrThrow(_response.body, { @@ -378,6 +390,9 @@ export class LabTests { /** * GET all the labs. + * + * @example + * await vital.labTests.getLabs() */ public async getLabs(requestOptions?: LabTests.RequestOptions): Promise { const _response = await core.fetcher({ @@ -390,10 +405,11 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.labTests.getLabs.Response.parseOrThrow(_response.body, { @@ -444,10 +460,11 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientFacingLabTest.parseOrThrow(_response.body, { @@ -511,11 +528,12 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", body: await serializers.UsAddress.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.AppointmentAvailabilitySlots.parseOrThrow(_response.body, { @@ -579,11 +597,12 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", body: await serializers.AppointmentBookingRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientFacingAppointment.parseOrThrow(_response.body, { @@ -647,11 +666,12 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", body: await serializers.RequestAppointmentRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientFacingAppointment.parseOrThrow(_response.body, { @@ -715,13 +735,14 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", body: await serializers.AppointmentRescheduleRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientFacingAppointment.parseOrThrow(_response.body, { @@ -785,11 +806,12 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", body: await serializers.AppointmentCancelRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientFacingAppointment.parseOrThrow(_response.body, { @@ -836,6 +858,9 @@ export class LabTests { /** * Get the list of reasons for cancelling an at-home phlebotomy appointment. + * + * @example + * await vital.labTests.getPhlebotomyAppointmentCancellationReason() */ public async getPhlebotomyAppointmentCancellationReason( requestOptions?: LabTests.RequestOptions @@ -850,10 +875,11 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.labTests.getPhlebotomyAppointmentCancellationReason.Response.parseOrThrow( @@ -907,10 +933,11 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientFacingAppointment.parseOrThrow(_response.body, { @@ -959,7 +986,8 @@ export class LabTests { * GET information about an area with respect to lab-testing. * * Information returned: - * * Whether a given zip code is served by our Phlebotomy network. + * + * - Whether a given zip code is served by our Phlebotomy network. * @throws {@link Vital.UnprocessableEntityError} */ public async getAreaInfo( @@ -967,8 +995,8 @@ export class LabTests { requestOptions?: LabTests.RequestOptions ): Promise { const { zipCode } = request; - const _queryParams = new URLSearchParams(); - _queryParams.append("zip_code", zipCode); + const _queryParams: Record = {}; + _queryParams["zip_code"] = zipCode; const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.VitalEnvironment.Production, @@ -979,11 +1007,12 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.AreaInfo.parseOrThrow(_response.body, { @@ -1032,7 +1061,7 @@ export class LabTests { * This endpoint returns the lab results for the order. */ public async getResultPdf(orderId: string, requestOptions?: LabTests.RequestOptions): Promise { - const _response = await core.streamingFetcher({ + const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.VitalEnvironment.Production, `v3/order/${orderId}/result/pdf` @@ -1042,16 +1071,37 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, + contentType: "application/json", + responseType: "streaming", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, - onError: (error) => { + maxRetries: requestOptions?.maxRetries, + }); + if (_response.ok) { + return _response.body; + } + + if (_response.error.reason === "status-code") { + throw new errors.VitalError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + }); + } + + switch (_response.error.reason) { + case "non-json": throw new errors.VitalError({ - message: (error as any)?.message, + statusCode: _response.error.statusCode, + body: _response.error.rawBody, }); - }, - }); - return _response.data; + case "timeout": + throw new errors.VitalTimeoutError(); + case "unknown": + throw new errors.VitalError({ + message: _response.error.errorMessage, + }); + } } /** @@ -1073,10 +1123,11 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.LabResultsMetadata.parseOrThrow(_response.body, { @@ -1136,10 +1187,11 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.LabResultsRaw.parseOrThrow(_response.body, { @@ -1199,10 +1251,11 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return _response.body; @@ -1257,10 +1310,11 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientFacingOrder.parseOrThrow(_response.body, { @@ -1323,13 +1377,14 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", body: await serializers.CreateOrderRequestCompatible.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.PostOrderResponse.parseOrThrow(_response.body, { @@ -1392,10 +1447,11 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.PostOrderResponse.parseOrThrow(_response.body, { @@ -1450,13 +1506,13 @@ export class LabTests { requestOptions?: LabTests.RequestOptions ): Promise { const { finalStatus, delay } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (finalStatus != null) { - _queryParams.append("final_status", finalStatus); + _queryParams["final_status"] = finalStatus; } if (delay != null) { - _queryParams.append("delay", delay.toString()); + _queryParams["delay"] = delay.toString(); } const _response = await core.fetcher({ @@ -1469,11 +1525,12 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return _response.body; @@ -1516,45 +1573,46 @@ export class LabTests { /** * GET many orders with filters. * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.labTests.getOrders({}) */ public async getOrders( request: Vital.LabTestsGetOrdersRequest = {}, requestOptions?: LabTests.RequestOptions ): Promise { const { startDate, endDate, userId, patientName, orderIds, page, size } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (startDate != null) { - _queryParams.append("start_date", startDate.toISOString()); + _queryParams["start_date"] = startDate.toISOString(); } if (endDate != null) { - _queryParams.append("end_date", endDate.toISOString()); + _queryParams["end_date"] = endDate.toISOString(); } if (userId != null) { - _queryParams.append("user_id", userId); + _queryParams["user_id"] = userId; } if (patientName != null) { - _queryParams.append("patient_name", patientName); + _queryParams["patient_name"] = patientName; } if (orderIds != null) { if (Array.isArray(orderIds)) { - for (const _item of orderIds) { - _queryParams.append("order_ids", _item); - } + _queryParams["order_ids"] = orderIds.map((item) => item); } else { - _queryParams.append("order_ids", orderIds); + _queryParams["order_ids"] = orderIds; } } if (page != null) { - _queryParams.append("page", page.toString()); + _queryParams["page"] = page.toString(); } if (size != null) { - _queryParams.append("size", size.toString()); + _queryParams["size"] = size.toString(); } const _response = await core.fetcher({ @@ -1567,11 +1625,12 @@ export class LabTests { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.GetOrdersResponse.parseOrThrow(_response.body, { diff --git a/src/api/resources/labTests/client/requests/CreateOrderRequestCompatible.ts b/src/api/resources/labTests/client/requests/CreateOrderRequestCompatible.ts index bc7b3db8..37b93f84 100644 --- a/src/api/resources/labTests/client/requests/CreateOrderRequestCompatible.ts +++ b/src/api/resources/labTests/client/requests/CreateOrderRequestCompatible.ts @@ -9,7 +9,7 @@ export interface CreateOrderRequestCompatible { labTestId: string; physician?: Vital.PhysicianCreateRequest; healthInsurance?: Vital.HealthInsuranceCreateRequest; - /** Defines whether order is priority or not. Only available for Labcorp. For Labcorp, this corresponds to a STAT order. */ + /** Defines whether order is priority or not. For some labs, this refers to a STAT order. */ priority?: boolean; consents?: Vital.Consent[]; patientDetails: Vital.PatientDetails; diff --git a/src/api/resources/labTests/client/requests/LabTestsGetMarkersForLabTestRequest.ts b/src/api/resources/labTests/client/requests/LabTestsGetMarkersForLabTestRequest.ts index da7a70f2..2f0513b1 100644 --- a/src/api/resources/labTests/client/requests/LabTestsGetMarkersForLabTestRequest.ts +++ b/src/api/resources/labTests/client/requests/LabTestsGetMarkersForLabTestRequest.ts @@ -2,6 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * {} + */ export interface LabTestsGetMarkersForLabTestRequest { page?: number; size?: number; diff --git a/src/api/resources/labTests/client/requests/LabTestsGetMarkersRequest.ts b/src/api/resources/labTests/client/requests/LabTestsGetMarkersRequest.ts index 7e367df6..ba2dd895 100644 --- a/src/api/resources/labTests/client/requests/LabTestsGetMarkersRequest.ts +++ b/src/api/resources/labTests/client/requests/LabTestsGetMarkersRequest.ts @@ -2,6 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * {} + */ export interface LabTestsGetMarkersRequest { /** * The identifier Vital assigned to a lab partner. diff --git a/src/api/resources/labTests/client/requests/LabTestsGetOrdersRequest.ts b/src/api/resources/labTests/client/requests/LabTestsGetOrdersRequest.ts index 35ffd580..e89c23c6 100644 --- a/src/api/resources/labTests/client/requests/LabTestsGetOrdersRequest.ts +++ b/src/api/resources/labTests/client/requests/LabTestsGetOrdersRequest.ts @@ -2,6 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * {} + */ export interface LabTestsGetOrdersRequest { /** * Date from in YYYY-MM-DD or ISO formatted date time. If a date is provided without a time, the time will be set to 00:00:00 diff --git a/src/api/resources/link/client/Client.ts b/src/api/resources/link/client/Client.ts index 3b599eef..1f0e2320 100644 --- a/src/api/resources/link/client/Client.ts +++ b/src/api/resources/link/client/Client.ts @@ -8,7 +8,6 @@ import * as Vital from "../../.."; import * as serializers from "../../../../serialization"; import urlJoin from "url-join"; import * as errors from "../../../../errors"; -import { default as URLSearchParams } from "@ungap/url-search-params"; export declare namespace Link { interface Options { @@ -18,6 +17,7 @@ export declare namespace Link { interface RequestOptions { timeoutInSeconds?: number; + maxRetries?: number; } } @@ -47,11 +47,12 @@ export class Link { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", body: await serializers.LinkTokenExchange.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.LinkTokenExchangeResponse.parseOrThrow(_response.body, { @@ -113,11 +114,12 @@ export class Link { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", body: await serializers.LinkTokenBase.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.link.isTokenValid.Response.parseOrThrow(_response.body, { @@ -171,10 +173,10 @@ export class Link { requestOptions?: Link.RequestOptions ): Promise { const { userId, expiresAt } = request; - const _queryParams = new URLSearchParams(); - _queryParams.append("user_id", userId); + const _queryParams: Record = {}; + _queryParams["user_id"] = userId; if (expiresAt != null) { - _queryParams.append("expires_at", expiresAt.toISOString()); + _queryParams["expires_at"] = expiresAt.toISOString(); } const _response = await core.fetcher({ @@ -187,11 +189,12 @@ export class Link { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.VitalTokenCreatedResponse.parseOrThrow(_response.body, { @@ -255,11 +258,12 @@ export class Link { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", body: await serializers.BeginLinkTokenRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.link.startConnect.Response.parseOrThrow(_response.body, { @@ -308,6 +312,9 @@ export class Link { * REQUEST_SOURCE: VITAL-LINK * Check link token state - can be hit continuously used as heartbeat * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.link.tokenState({}) */ public async tokenState( request: Vital.LinkTokenStateRequest = {}, @@ -324,11 +331,12 @@ export class Link { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", "x-vital-link-token": vitalLinkToken != null ? vitalLinkToken : undefined, }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.link.tokenState.Response.parseOrThrow(_response.body, { @@ -394,12 +402,13 @@ export class Link { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", "x-vital-link-token": vitalLinkToken != null ? vitalLinkToken : undefined, }, contentType: "application/json", body: await serializers.EmailAuthLink.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ConnectionStatus.parseOrThrow(_response.body, { @@ -465,13 +474,14 @@ export class Link { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", "x-vital-link-client-region": vitalLinkClientRegion != null ? vitalLinkClientRegion : undefined, "x-vital-link-token": vitalLinkToken != null ? vitalLinkToken : undefined, }, contentType: "application/json", body: await serializers.PasswordAuthLink.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ConnectionStatus.parseOrThrow(_response.body, { @@ -536,11 +546,12 @@ export class Link { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", "x-vital-link-token": vitalLinkToken != null ? vitalLinkToken : undefined, }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.Source.parseOrThrow(_response.body, { @@ -605,13 +616,14 @@ export class Link { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", "x-vital-link-client-region": vitalLinkClientRegion != null ? vitalLinkClientRegion : undefined, "x-vital-link-token": vitalLinkToken != null ? vitalLinkToken : undefined, }, contentType: "application/json", body: await serializers.IndividualProviderData.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ProviderLinkResponse.parseOrThrow(_response.body, { @@ -676,12 +688,13 @@ export class Link { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", "x-vital-link-token": vitalLinkToken != null ? vitalLinkToken : undefined, }, contentType: "application/json", body: await serializers.EmailProviderAuthLink.jsonOrThrow(_body, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ConnectionStatus.parseOrThrow(_response.body, { @@ -729,6 +742,9 @@ export class Link { /** * GET List of all available providers given the generated link token. * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.link.getAllProviders({}) */ public async getAllProviders( request: Vital.LinkGetAllProvidersRequest = {}, @@ -745,11 +761,12 @@ export class Link { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", "x-vital-link-token": vitalLinkToken != null ? vitalLinkToken : undefined, }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.link.getAllProviders.Response.parseOrThrow(_response.body, { @@ -815,11 +832,12 @@ export class Link { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", body: await serializers.ManualConnectionData.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.link.connectManualProvider.Response.parseOrThrow(_response.body, { @@ -882,13 +900,14 @@ export class Link { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", body: await serializers.DemoConnectionCreationPayload.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.DemoConnectionStatus.parseOrThrow(_response.body, { diff --git a/src/api/resources/link/client/requests/LinkGetAllProvidersRequest.ts b/src/api/resources/link/client/requests/LinkGetAllProvidersRequest.ts index 3eafa83c..7a8d4046 100644 --- a/src/api/resources/link/client/requests/LinkGetAllProvidersRequest.ts +++ b/src/api/resources/link/client/requests/LinkGetAllProvidersRequest.ts @@ -2,6 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * {} + */ export interface LinkGetAllProvidersRequest { vitalLinkToken?: string; } diff --git a/src/api/resources/link/client/requests/LinkTokenStateRequest.ts b/src/api/resources/link/client/requests/LinkTokenStateRequest.ts index 4e3f4a71..5fc181b1 100644 --- a/src/api/resources/link/client/requests/LinkTokenStateRequest.ts +++ b/src/api/resources/link/client/requests/LinkTokenStateRequest.ts @@ -2,6 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * {} + */ export interface LinkTokenStateRequest { vitalLinkToken?: string; } diff --git a/src/api/resources/meal/client/Client.ts b/src/api/resources/meal/client/Client.ts index ca6aadca..e3edbbf9 100644 --- a/src/api/resources/meal/client/Client.ts +++ b/src/api/resources/meal/client/Client.ts @@ -5,7 +5,6 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Vital from "../../.."; -import { default as URLSearchParams } from "@ungap/url-search-params"; import urlJoin from "url-join"; import * as serializers from "../../../../serialization"; import * as errors from "../../../../errors"; @@ -18,6 +17,7 @@ export declare namespace Meal { interface RequestOptions { timeoutInSeconds?: number; + maxRetries?: number; } } @@ -27,6 +27,11 @@ export class Meal { /** * Get user's meals * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.meal.get("user-id", { + * startDate: "start-date" + * }) */ public async get( userId: string, @@ -34,14 +39,14 @@ export class Meal { requestOptions?: Meal.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -54,11 +59,12 @@ export class Meal { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientFacingMealResponse.parseOrThrow(_response.body, { diff --git a/src/api/resources/meal/client/requests/MealGetRequest.ts b/src/api/resources/meal/client/requests/MealGetRequest.ts index f7567143..881b84a8 100644 --- a/src/api/resources/meal/client/requests/MealGetRequest.ts +++ b/src/api/resources/meal/client/requests/MealGetRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface MealGetRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/profile/client/Client.ts b/src/api/resources/profile/client/Client.ts index 97eb507c..191ad6b2 100644 --- a/src/api/resources/profile/client/Client.ts +++ b/src/api/resources/profile/client/Client.ts @@ -5,7 +5,6 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Vital from "../../.."; -import { default as URLSearchParams } from "@ungap/url-search-params"; import urlJoin from "url-join"; import * as serializers from "../../../../serialization"; import * as errors from "../../../../errors"; @@ -18,6 +17,7 @@ export declare namespace Profile { interface RequestOptions { timeoutInSeconds?: number; + maxRetries?: number; } } @@ -34,9 +34,9 @@ export class Profile { requestOptions?: Profile.RequestOptions ): Promise { const { provider } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } const _response = await core.fetcher({ @@ -49,11 +49,12 @@ export class Profile { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientFacingProfile.parseOrThrow(_response.body, { @@ -108,9 +109,9 @@ export class Profile { requestOptions?: Profile.RequestOptions ): Promise { const { provider } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } const _response = await core.fetcher({ @@ -123,11 +124,12 @@ export class Profile { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.RawProfile.parseOrThrow(_response.body, { diff --git a/src/api/resources/providers/client/Client.ts b/src/api/resources/providers/client/Client.ts index af23b531..840e208a 100644 --- a/src/api/resources/providers/client/Client.ts +++ b/src/api/resources/providers/client/Client.ts @@ -17,6 +17,7 @@ export declare namespace Providers { interface RequestOptions { timeoutInSeconds?: number; + maxRetries?: number; } } @@ -25,6 +26,9 @@ export class Providers { /** * Get Provider list + * + * @example + * await vital.providers.getAll() */ public async getAll(requestOptions?: Providers.RequestOptions): Promise { const _response = await core.fetcher({ @@ -37,10 +41,11 @@ export class Providers { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.providers.getAll.Response.parseOrThrow(_response.body, { diff --git a/src/api/resources/sleep/client/Client.ts b/src/api/resources/sleep/client/Client.ts index e7e9c3de..c0df7946 100644 --- a/src/api/resources/sleep/client/Client.ts +++ b/src/api/resources/sleep/client/Client.ts @@ -5,7 +5,6 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Vital from "../../.."; -import { default as URLSearchParams } from "@ungap/url-search-params"; import urlJoin from "url-join"; import * as serializers from "../../../../serialization"; import * as errors from "../../../../errors"; @@ -18,6 +17,7 @@ export declare namespace Sleep { interface RequestOptions { timeoutInSeconds?: number; + maxRetries?: number; } } @@ -27,6 +27,11 @@ export class Sleep { /** * Get Daily sleep for user_id * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.sleep.get("user-id", { + * startDate: "start-date" + * }) */ public async get( userId: string, @@ -34,14 +39,14 @@ export class Sleep { requestOptions?: Sleep.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -54,11 +59,12 @@ export class Sleep { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientSleepResponse.parseOrThrow(_response.body, { @@ -106,6 +112,11 @@ export class Sleep { /** * Get Daily sleep stream for user_id * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.sleep.getStream("user-id", { + * startDate: "start-date" + * }) */ public async getStream( userId: string, @@ -113,14 +124,14 @@ export class Sleep { requestOptions?: Sleep.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -133,11 +144,12 @@ export class Sleep { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientSleepResponse.parseOrThrow(_response.body, { @@ -185,6 +197,11 @@ export class Sleep { /** * Get Daily sleep for user_id * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.sleep.getRaw("user-id", { + * startDate: "start-date" + * }) */ public async getRaw( userId: string, @@ -192,14 +209,14 @@ export class Sleep { requestOptions?: Sleep.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -212,11 +229,12 @@ export class Sleep { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.RawSleep.parseOrThrow(_response.body, { @@ -264,6 +282,9 @@ export class Sleep { /** * Get Sleep stream for a user_id * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.sleep.getStreamBySleepId("sleep-id") */ public async getStreamBySleepId( sleepId: string, @@ -279,10 +300,11 @@ export class Sleep { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientFacingSleepStream.parseOrThrow(_response.body, { diff --git a/src/api/resources/sleep/client/requests/SleepGetRawRequest.ts b/src/api/resources/sleep/client/requests/SleepGetRawRequest.ts index a0456939..a7ab7038 100644 --- a/src/api/resources/sleep/client/requests/SleepGetRawRequest.ts +++ b/src/api/resources/sleep/client/requests/SleepGetRawRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface SleepGetRawRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/sleep/client/requests/SleepGetRequest.ts b/src/api/resources/sleep/client/requests/SleepGetRequest.ts index 1b31bab1..3bb2e6c6 100644 --- a/src/api/resources/sleep/client/requests/SleepGetRequest.ts +++ b/src/api/resources/sleep/client/requests/SleepGetRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface SleepGetRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/sleep/client/requests/SleepGetStreamRequest.ts b/src/api/resources/sleep/client/requests/SleepGetStreamRequest.ts index 1a1d7776..a126c543 100644 --- a/src/api/resources/sleep/client/requests/SleepGetStreamRequest.ts +++ b/src/api/resources/sleep/client/requests/SleepGetStreamRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface SleepGetStreamRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/team/client/Client.ts b/src/api/resources/team/client/Client.ts index c2746a5d..674f082a 100644 --- a/src/api/resources/team/client/Client.ts +++ b/src/api/resources/team/client/Client.ts @@ -8,7 +8,6 @@ import * as Vital from "../../.."; import urlJoin from "url-join"; import * as serializers from "../../../../serialization"; import * as errors from "../../../../errors"; -import { default as URLSearchParams } from "@ungap/url-search-params"; export declare namespace Team { interface Options { @@ -18,6 +17,7 @@ export declare namespace Team { interface RequestOptions { timeoutInSeconds?: number; + maxRetries?: number; } } @@ -27,6 +27,9 @@ export class Team { /** * Post teams. * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.team.getLinkConfig({}) */ public async getLinkConfig( request: Vital.TeamGetLinkConfigRequest = {}, @@ -43,11 +46,12 @@ export class Team { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", "x-vital-link-token": vitalLinkToken != null ? vitalLinkToken : undefined, }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.team.getLinkConfig.Response.parseOrThrow(_response.body, { @@ -107,10 +111,11 @@ export class Team { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientFacingTeam.parseOrThrow(_response.body, { @@ -158,15 +163,18 @@ export class Team { /** * Search team users by user_id * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.team.getUserById({}) */ public async getUserById( request: Vital.TeamGetUserByIdRequest = {}, requestOptions?: Team.RequestOptions ): Promise { const { queryId } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (queryId != null) { - _queryParams.append("query_id", queryId); + _queryParams["query_id"] = queryId; } const _response = await core.fetcher({ @@ -179,11 +187,12 @@ export class Team { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.team.getUserById.Response.parseOrThrow(_response.body, { @@ -239,10 +248,11 @@ export class Team { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.team.getSvixUrl.Response.parseOrThrow(_response.body, { @@ -278,15 +288,18 @@ export class Team { /** * GET source priorities. * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.team.getSourcePriorities({}) */ public async getSourcePriorities( request: Vital.TeamGetSourcePrioritiesRequest = {}, requestOptions?: Team.RequestOptions ): Promise[]> { const { dataType } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (dataType != null) { - _queryParams.append("data_type", dataType); + _queryParams["data_type"] = dataType; } const _response = await core.fetcher({ @@ -299,11 +312,12 @@ export class Team { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.team.getSourcePriorities.Response.parseOrThrow(_response.body, { @@ -351,14 +365,19 @@ export class Team { /** * Patch source priorities. * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.team.updateSourcePriorities({ + * teamId: "team-id" + * }) */ public async updateSourcePriorities( request: Vital.TeamUpdateSourcePrioritiesRequest, requestOptions?: Team.RequestOptions ): Promise[]> { const { teamId } = request; - const _queryParams = new URLSearchParams(); - _queryParams.append("team_id", teamId); + const _queryParams: Record = {}; + _queryParams["team_id"] = teamId; const _response = await core.fetcher({ url: urlJoin( (await core.Supplier.get(this._options.environment)) ?? environments.VitalEnvironment.Production, @@ -369,11 +388,12 @@ export class Team { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.team.updateSourcePriorities.Response.parseOrThrow(_response.body, { @@ -420,6 +440,9 @@ export class Team { /** * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.team.getPhysicians("team-id") */ public async getPhysicians( teamId: string, @@ -435,10 +458,11 @@ export class Team { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.team.getPhysicians.Response.parseOrThrow(_response.body, { diff --git a/src/api/resources/team/client/requests/TeamGetLinkConfigRequest.ts b/src/api/resources/team/client/requests/TeamGetLinkConfigRequest.ts index ac6f4f68..ade0c52f 100644 --- a/src/api/resources/team/client/requests/TeamGetLinkConfigRequest.ts +++ b/src/api/resources/team/client/requests/TeamGetLinkConfigRequest.ts @@ -2,6 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * {} + */ export interface TeamGetLinkConfigRequest { vitalLinkToken?: string; } diff --git a/src/api/resources/team/client/requests/TeamGetSourcePrioritiesRequest.ts b/src/api/resources/team/client/requests/TeamGetSourcePrioritiesRequest.ts index fc334f26..29ce8e61 100644 --- a/src/api/resources/team/client/requests/TeamGetSourcePrioritiesRequest.ts +++ b/src/api/resources/team/client/requests/TeamGetSourcePrioritiesRequest.ts @@ -2,6 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * {} + */ export interface TeamGetSourcePrioritiesRequest { dataType?: string; } diff --git a/src/api/resources/team/client/requests/TeamGetUserByIdRequest.ts b/src/api/resources/team/client/requests/TeamGetUserByIdRequest.ts index 6e54710f..93c670f4 100644 --- a/src/api/resources/team/client/requests/TeamGetUserByIdRequest.ts +++ b/src/api/resources/team/client/requests/TeamGetUserByIdRequest.ts @@ -2,6 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * {} + */ export interface TeamGetUserByIdRequest { queryId?: string; } diff --git a/src/api/resources/team/client/requests/TeamUpdateSourcePrioritiesRequest.ts b/src/api/resources/team/client/requests/TeamUpdateSourcePrioritiesRequest.ts index d6679fc4..c7c19114 100644 --- a/src/api/resources/team/client/requests/TeamUpdateSourcePrioritiesRequest.ts +++ b/src/api/resources/team/client/requests/TeamUpdateSourcePrioritiesRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * teamId: "team-id" + * } + */ export interface TeamUpdateSourcePrioritiesRequest { teamId: string; } diff --git a/src/api/resources/testkit/client/Client.ts b/src/api/resources/testkit/client/Client.ts index d86fe2ae..86ffead4 100644 --- a/src/api/resources/testkit/client/Client.ts +++ b/src/api/resources/testkit/client/Client.ts @@ -17,6 +17,7 @@ export declare namespace Testkit { interface RequestOptions { timeoutInSeconds?: number; + maxRetries?: number; } } @@ -40,11 +41,12 @@ export class Testkit { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", body: await serializers.RegisterTestkitRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.PostOrderResponse.parseOrThrow(_response.body, { @@ -107,13 +109,14 @@ export class Testkit { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", body: await serializers.CreateRegistrableTestkitOrderRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip", }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.PostOrderResponse.parseOrThrow(_response.body, { diff --git a/src/api/resources/user/client/Client.ts b/src/api/resources/user/client/Client.ts index 9449c810..465b5cf3 100644 --- a/src/api/resources/user/client/Client.ts +++ b/src/api/resources/user/client/Client.ts @@ -5,7 +5,6 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Vital from "../../.."; -import { default as URLSearchParams } from "@ungap/url-search-params"; import urlJoin from "url-join"; import * as serializers from "../../../../serialization"; import * as errors from "../../../../errors"; @@ -18,6 +17,7 @@ export declare namespace User { interface RequestOptions { timeoutInSeconds?: number; + maxRetries?: number; } } @@ -33,13 +33,13 @@ export class User { requestOptions?: User.RequestOptions ): Promise { const { offset, limit } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (offset != null) { - _queryParams.append("offset", offset.toString()); + _queryParams["offset"] = offset.toString(); } if (limit != null) { - _queryParams.append("limit", limit.toString()); + _queryParams["limit"] = limit.toString(); } const _response = await core.fetcher({ @@ -52,11 +52,12 @@ export class User { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.PaginatedUsersResponse.parseOrThrow(_response.body, { @@ -119,11 +120,12 @@ export class User { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", body: await serializers.UserCreateBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientFacingUserKey.parseOrThrow(_response.body, { @@ -182,10 +184,11 @@ export class User { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.MetricsResult.parseOrThrow(_response.body, { @@ -235,10 +238,11 @@ export class User { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.UserSignInTokenResponse.parseOrThrow(_response.body, { @@ -286,6 +290,9 @@ export class User { /** * GET Users connected providers * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.user.getConnectedProviders("user-id") */ public async getConnectedProviders( userId: string, @@ -301,10 +308,11 @@ export class User { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.user.getConnectedProviders.Response.parseOrThrow(_response.body, { @@ -364,10 +372,11 @@ export class User { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientFacingUser.parseOrThrow(_response.body, { @@ -426,10 +435,11 @@ export class User { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.UserSuccessResponse.parseOrThrow(_response.body, { @@ -476,6 +486,9 @@ export class User { /** * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.user.patch("user-id", {}) */ public async patch( userId: string, @@ -492,11 +505,12 @@ export class User { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", body: await serializers.UserPatchBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return; @@ -554,10 +568,11 @@ export class User { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientFacingUser.parseOrThrow(_response.body, { @@ -620,10 +635,11 @@ export class User { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.UserSuccessResponse.parseOrThrow(_response.body, { @@ -679,9 +695,9 @@ export class User { requestOptions?: User.RequestOptions ): Promise { const { timeout } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (timeout != null) { - _queryParams.append("timeout", timeout.toString()); + _queryParams["timeout"] = timeout.toString(); } const _response = await core.fetcher({ @@ -694,11 +710,12 @@ export class User { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.UserRefreshSuccessResponse.parseOrThrow(_response.body, { diff --git a/src/api/resources/user/client/requests/UserPatchBody.ts b/src/api/resources/user/client/requests/UserPatchBody.ts index e9518ac1..040a2f43 100644 --- a/src/api/resources/user/client/requests/UserPatchBody.ts +++ b/src/api/resources/user/client/requests/UserPatchBody.ts @@ -2,6 +2,10 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * {} + */ export interface UserPatchBody { /** * Fallback time zone of the user, in the form of a valid IANA tzdatabase identifier (e.g., `Europe/London` or `America/Los_Angeles`). diff --git a/src/api/resources/vitals/client/Client.ts b/src/api/resources/vitals/client/Client.ts index b024e77d..5d7edece 100644 --- a/src/api/resources/vitals/client/Client.ts +++ b/src/api/resources/vitals/client/Client.ts @@ -5,7 +5,6 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Vital from "../../.."; -import { default as URLSearchParams } from "@ungap/url-search-params"; import urlJoin from "url-join"; import * as serializers from "../../../../serialization"; import * as errors from "../../../../errors"; @@ -18,6 +17,7 @@ export declare namespace Vitals { interface RequestOptions { timeoutInSeconds?: number; + maxRetries?: number; } } @@ -27,6 +27,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.mindfulnessMinutes("user-id", { + * startDate: "start-date" + * }) */ public async mindfulnessMinutes( userId: string, @@ -34,14 +39,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -54,11 +59,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.mindfulnessMinutes.Response.parseOrThrow(_response.body, { @@ -106,6 +112,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.caffeine("user-id", { + * startDate: "start-date" + * }) */ public async caffeine( userId: string, @@ -113,14 +124,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -133,11 +144,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.caffeine.Response.parseOrThrow(_response.body, { @@ -185,6 +197,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.water("user-id", { + * startDate: "start-date" + * }) */ public async water( userId: string, @@ -192,14 +209,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -212,11 +229,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.water.Response.parseOrThrow(_response.body, { @@ -264,6 +282,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.steps("user-id", { + * startDate: "start-date" + * }) */ public async steps( userId: string, @@ -271,14 +294,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -291,11 +314,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.steps.Response.parseOrThrow(_response.body, { @@ -343,6 +367,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.floorsClimbed("user-id", { + * startDate: "start-date" + * }) */ public async floorsClimbed( userId: string, @@ -350,14 +379,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -370,11 +399,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.floorsClimbed.Response.parseOrThrow(_response.body, { @@ -422,6 +452,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.distance("user-id", { + * startDate: "start-date" + * }) */ public async distance( userId: string, @@ -429,14 +464,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -449,11 +484,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.distance.Response.parseOrThrow(_response.body, { @@ -501,6 +537,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.caloriesBasal("user-id", { + * startDate: "start-date" + * }) */ public async caloriesBasal( userId: string, @@ -508,14 +549,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -528,11 +569,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.caloriesBasal.Response.parseOrThrow(_response.body, { @@ -580,6 +622,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.caloriesActive("user-id", { + * startDate: "start-date" + * }) */ public async caloriesActive( userId: string, @@ -587,14 +634,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -607,11 +654,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.caloriesActive.Response.parseOrThrow(_response.body, { @@ -659,6 +707,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.respiratoryRate("user-id", { + * startDate: "start-date" + * }) */ public async respiratoryRate( userId: string, @@ -666,14 +719,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -686,11 +739,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.respiratoryRate.Response.parseOrThrow(_response.body, { @@ -738,6 +792,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.ige("user-id", { + * startDate: "start-date" + * }) */ public async ige( userId: string, @@ -745,14 +804,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -765,11 +824,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.ige.Response.parseOrThrow(_response.body, { @@ -817,6 +877,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.igg("user-id", { + * startDate: "start-date" + * }) */ public async igg( userId: string, @@ -824,14 +889,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -844,11 +909,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.igg.Response.parseOrThrow(_response.body, { @@ -896,6 +962,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.hypnogram("user-id", { + * startDate: "start-date" + * }) */ public async hypnogram( userId: string, @@ -903,14 +974,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -923,11 +994,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.hypnogram.Response.parseOrThrow(_response.body, { @@ -975,6 +1047,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.hrv("user-id", { + * startDate: "start-date" + * }) */ public async hrv( userId: string, @@ -982,14 +1059,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -1002,11 +1079,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.hrv.Response.parseOrThrow(_response.body, { @@ -1054,6 +1132,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.heartrate("user-id", { + * startDate: "start-date" + * }) */ public async heartrate( userId: string, @@ -1061,14 +1144,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -1081,11 +1164,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.heartrate.Response.parseOrThrow(_response.body, { @@ -1133,6 +1217,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.glucose("user-id", { + * startDate: "start-date" + * }) */ public async glucose( userId: string, @@ -1140,14 +1229,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -1160,11 +1249,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.glucose.Response.parseOrThrow(_response.body, { @@ -1212,6 +1302,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.triglycerides("user-id", { + * startDate: "start-date" + * }) */ public async triglycerides( userId: string, @@ -1219,14 +1314,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -1239,11 +1334,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.triglycerides.Response.parseOrThrow(_response.body, { @@ -1291,6 +1387,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.cholesterolTotal("user-id", { + * startDate: "start-date" + * }) */ public async cholesterolTotal( userId: string, @@ -1298,14 +1399,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -1318,11 +1419,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.cholesterolTotal.Response.parseOrThrow(_response.body, { @@ -1370,6 +1472,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.cholesterolHdl("user-id", { + * startDate: "start-date" + * }) */ public async cholesterolHdl( userId: string, @@ -1377,14 +1484,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -1397,11 +1504,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.cholesterolHdl.Response.parseOrThrow(_response.body, { @@ -1449,6 +1557,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.cholesterolLdl("user-id", { + * startDate: "start-date" + * }) */ public async cholesterolLdl( userId: string, @@ -1456,14 +1569,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -1476,11 +1589,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.cholesterolLdl.Response.parseOrThrow(_response.body, { @@ -1528,6 +1642,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.cholesterol("user-id", { + * startDate: "start-date" + * }) */ public async cholesterol( userId: string, @@ -1535,14 +1654,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -1555,11 +1674,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.cholesterol.Response.parseOrThrow(_response.body, { @@ -1607,6 +1727,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.bloodOxygen("user-id", { + * startDate: "start-date" + * }) */ public async bloodOxygen( userId: string, @@ -1614,14 +1739,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -1634,11 +1759,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.bloodOxygen.Response.parseOrThrow(_response.body, { @@ -1686,6 +1812,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.electrocardiogramVoltage("user-id", { + * startDate: "start-date" + * }) */ public async electrocardiogramVoltage( userId: string, @@ -1693,14 +1824,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -1713,11 +1844,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.electrocardiogramVoltage.Response.parseOrThrow(_response.body, { @@ -1765,6 +1897,11 @@ export class Vitals { /** * Get timeseries data for user * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.vitals.bloodPressure("user-id", { + * startDate: "start-date" + * }) */ public async bloodPressure( userId: string, @@ -1772,14 +1909,14 @@ export class Vitals { requestOptions?: Vitals.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -1792,11 +1929,12 @@ export class Vitals { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.vitals.bloodPressure.Response.parseOrThrow(_response.body, { diff --git a/src/api/resources/vitals/client/requests/VitalsBloodOxygenRequest.ts b/src/api/resources/vitals/client/requests/VitalsBloodOxygenRequest.ts index 3c0ddde8..5bfbaa40 100644 --- a/src/api/resources/vitals/client/requests/VitalsBloodOxygenRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsBloodOxygenRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsBloodOxygenRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsBloodPressureRequest.ts b/src/api/resources/vitals/client/requests/VitalsBloodPressureRequest.ts index dca1f47b..ffa73dbf 100644 --- a/src/api/resources/vitals/client/requests/VitalsBloodPressureRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsBloodPressureRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsBloodPressureRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsCaffeineRequest.ts b/src/api/resources/vitals/client/requests/VitalsCaffeineRequest.ts index e912000d..2f58a022 100644 --- a/src/api/resources/vitals/client/requests/VitalsCaffeineRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsCaffeineRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsCaffeineRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsCaloriesActiveRequest.ts b/src/api/resources/vitals/client/requests/VitalsCaloriesActiveRequest.ts index 96d512da..9a48d649 100644 --- a/src/api/resources/vitals/client/requests/VitalsCaloriesActiveRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsCaloriesActiveRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsCaloriesActiveRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsCaloriesBasalRequest.ts b/src/api/resources/vitals/client/requests/VitalsCaloriesBasalRequest.ts index 6ec026a0..fea205e9 100644 --- a/src/api/resources/vitals/client/requests/VitalsCaloriesBasalRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsCaloriesBasalRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsCaloriesBasalRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsCholesterolHdlRequest.ts b/src/api/resources/vitals/client/requests/VitalsCholesterolHdlRequest.ts index b38f94ca..24ba2527 100644 --- a/src/api/resources/vitals/client/requests/VitalsCholesterolHdlRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsCholesterolHdlRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsCholesterolHdlRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsCholesterolLdlRequest.ts b/src/api/resources/vitals/client/requests/VitalsCholesterolLdlRequest.ts index d77fadba..b8430e5a 100644 --- a/src/api/resources/vitals/client/requests/VitalsCholesterolLdlRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsCholesterolLdlRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsCholesterolLdlRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsCholesterolRequest.ts b/src/api/resources/vitals/client/requests/VitalsCholesterolRequest.ts index 476dddf6..7e4476d4 100644 --- a/src/api/resources/vitals/client/requests/VitalsCholesterolRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsCholesterolRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsCholesterolRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsCholesterolTotalRequest.ts b/src/api/resources/vitals/client/requests/VitalsCholesterolTotalRequest.ts index c3274ece..c17a8d1f 100644 --- a/src/api/resources/vitals/client/requests/VitalsCholesterolTotalRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsCholesterolTotalRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsCholesterolTotalRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsDistanceRequest.ts b/src/api/resources/vitals/client/requests/VitalsDistanceRequest.ts index f7217d4c..3ddbd858 100644 --- a/src/api/resources/vitals/client/requests/VitalsDistanceRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsDistanceRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsDistanceRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsElectrocardiogramVoltageRequest.ts b/src/api/resources/vitals/client/requests/VitalsElectrocardiogramVoltageRequest.ts index b236ea3e..2605903b 100644 --- a/src/api/resources/vitals/client/requests/VitalsElectrocardiogramVoltageRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsElectrocardiogramVoltageRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsElectrocardiogramVoltageRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsFloorsClimbedRequest.ts b/src/api/resources/vitals/client/requests/VitalsFloorsClimbedRequest.ts index 25b546a4..8f46525b 100644 --- a/src/api/resources/vitals/client/requests/VitalsFloorsClimbedRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsFloorsClimbedRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsFloorsClimbedRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsGlucoseRequest.ts b/src/api/resources/vitals/client/requests/VitalsGlucoseRequest.ts index cb46c406..c2a088b7 100644 --- a/src/api/resources/vitals/client/requests/VitalsGlucoseRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsGlucoseRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsGlucoseRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsHeartrateRequest.ts b/src/api/resources/vitals/client/requests/VitalsHeartrateRequest.ts index f3aeb22a..0e0b7a1c 100644 --- a/src/api/resources/vitals/client/requests/VitalsHeartrateRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsHeartrateRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsHeartrateRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsHrvRequest.ts b/src/api/resources/vitals/client/requests/VitalsHrvRequest.ts index 6ecf15aa..5d28a448 100644 --- a/src/api/resources/vitals/client/requests/VitalsHrvRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsHrvRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsHrvRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsHypnogramRequest.ts b/src/api/resources/vitals/client/requests/VitalsHypnogramRequest.ts index efe0bdda..e05886f9 100644 --- a/src/api/resources/vitals/client/requests/VitalsHypnogramRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsHypnogramRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsHypnogramRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsIgeRequest.ts b/src/api/resources/vitals/client/requests/VitalsIgeRequest.ts index 7c3e2385..d199b1a1 100644 --- a/src/api/resources/vitals/client/requests/VitalsIgeRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsIgeRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsIgeRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsIggRequest.ts b/src/api/resources/vitals/client/requests/VitalsIggRequest.ts index 6a51ca2d..e4deeab0 100644 --- a/src/api/resources/vitals/client/requests/VitalsIggRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsIggRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsIggRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsMindfulnessMinutesRequest.ts b/src/api/resources/vitals/client/requests/VitalsMindfulnessMinutesRequest.ts index 0126f156..8fe08dbc 100644 --- a/src/api/resources/vitals/client/requests/VitalsMindfulnessMinutesRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsMindfulnessMinutesRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsMindfulnessMinutesRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsRespiratoryRateRequest.ts b/src/api/resources/vitals/client/requests/VitalsRespiratoryRateRequest.ts index f8c7a86b..3d9f6db6 100644 --- a/src/api/resources/vitals/client/requests/VitalsRespiratoryRateRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsRespiratoryRateRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsRespiratoryRateRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsStepsRequest.ts b/src/api/resources/vitals/client/requests/VitalsStepsRequest.ts index 748734e1..4c98b867 100644 --- a/src/api/resources/vitals/client/requests/VitalsStepsRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsStepsRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsStepsRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsTriglyceridesRequest.ts b/src/api/resources/vitals/client/requests/VitalsTriglyceridesRequest.ts index 3cc030df..2e57ccbf 100644 --- a/src/api/resources/vitals/client/requests/VitalsTriglyceridesRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsTriglyceridesRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsTriglyceridesRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/vitals/client/requests/VitalsWaterRequest.ts b/src/api/resources/vitals/client/requests/VitalsWaterRequest.ts index c6d3350f..82942f8c 100644 --- a/src/api/resources/vitals/client/requests/VitalsWaterRequest.ts +++ b/src/api/resources/vitals/client/requests/VitalsWaterRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface VitalsWaterRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/workouts/client/Client.ts b/src/api/resources/workouts/client/Client.ts index c8d9fa60..01ad595e 100644 --- a/src/api/resources/workouts/client/Client.ts +++ b/src/api/resources/workouts/client/Client.ts @@ -5,7 +5,6 @@ import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Vital from "../../.."; -import { default as URLSearchParams } from "@ungap/url-search-params"; import urlJoin from "url-join"; import * as serializers from "../../../../serialization"; import * as errors from "../../../../errors"; @@ -18,6 +17,7 @@ export declare namespace Workouts { interface RequestOptions { timeoutInSeconds?: number; + maxRetries?: number; } } @@ -27,6 +27,11 @@ export class Workouts { /** * Get Daily workout for user_id * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.workouts.get("user-id", { + * startDate: "start-date" + * }) */ public async get( userId: string, @@ -34,14 +39,14 @@ export class Workouts { requestOptions?: Workouts.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -54,11 +59,12 @@ export class Workouts { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientWorkoutResponse.parseOrThrow(_response.body, { @@ -106,6 +112,11 @@ export class Workouts { /** * Get Daily workout for user_id * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.workouts.getRaw("user-id", { + * startDate: "start-date" + * }) */ public async getRaw( userId: string, @@ -113,14 +124,14 @@ export class Workouts { requestOptions?: Workouts.RequestOptions ): Promise { const { provider, startDate, endDate } = request; - const _queryParams = new URLSearchParams(); + const _queryParams: Record = {}; if (provider != null) { - _queryParams.append("provider", provider); + _queryParams["provider"] = provider; } - _queryParams.append("start_date", startDate); + _queryParams["start_date"] = startDate; if (endDate != null) { - _queryParams.append("end_date", endDate); + _queryParams["end_date"] = endDate; } const _response = await core.fetcher({ @@ -133,11 +144,12 @@ export class Workouts { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", queryParameters: _queryParams, timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.RawWorkout.parseOrThrow(_response.body, { @@ -184,6 +196,9 @@ export class Workouts { /** * @throws {@link Vital.UnprocessableEntityError} + * + * @example + * await vital.workouts.getByWorkoutId("workout-id") */ public async getByWorkoutId( workoutId: string, @@ -199,10 +214,11 @@ export class Workouts { "x-vital-api-key": await core.Supplier.get(this._options.apiKey), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@tryvital/vital-node", - "X-Fern-SDK-Version": "3.0.7", + "X-Fern-SDK-Version": "3.0.8", }, contentType: "application/json", timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000, + maxRetries: requestOptions?.maxRetries, }); if (_response.ok) { return await serializers.ClientFacingStream.parseOrThrow(_response.body, { diff --git a/src/api/resources/workouts/client/requests/WorkoutsGetRawRequest.ts b/src/api/resources/workouts/client/requests/WorkoutsGetRawRequest.ts index 918260c3..8431d185 100644 --- a/src/api/resources/workouts/client/requests/WorkoutsGetRawRequest.ts +++ b/src/api/resources/workouts/client/requests/WorkoutsGetRawRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface WorkoutsGetRawRequest { /** * Provider oura/strava etc diff --git a/src/api/resources/workouts/client/requests/WorkoutsGetRequest.ts b/src/api/resources/workouts/client/requests/WorkoutsGetRequest.ts index b5679c1a..bf52c6da 100644 --- a/src/api/resources/workouts/client/requests/WorkoutsGetRequest.ts +++ b/src/api/resources/workouts/client/requests/WorkoutsGetRequest.ts @@ -2,6 +2,12 @@ * This file was auto-generated by Fern from our API Definition. */ +/** + * @example + * { + * startDate: "start-date" + * } + */ export interface WorkoutsGetRequest { /** * Provider oura/strava etc diff --git a/src/api/types/ClientFacingDiagnosisInformation.ts b/src/api/types/ClientFacingDiagnosisInformation.ts index a4c5662f..5a572261 100644 --- a/src/api/types/ClientFacingDiagnosisInformation.ts +++ b/src/api/types/ClientFacingDiagnosisInformation.ts @@ -3,8 +3,8 @@ */ export interface ClientFacingDiagnosisInformation { - /** Diagnosis code for insurance information required by Labcorp. */ + /** Diagnosis code for insurance information. */ diagnosisCode: string; - /** Diagnosis description insurance information required by Labcorp. */ + /** Diagnosis description insurance information. */ description: string; } diff --git a/src/api/types/ClientFacingLabTest.ts b/src/api/types/ClientFacingLabTest.ts index a5c49ece..69bd042c 100644 --- a/src/api/types/ClientFacingLabTest.ts +++ b/src/api/types/ClientFacingLabTest.ts @@ -14,7 +14,7 @@ export interface ClientFacingLabTest { /** Deprecated. Use status instead. */ isActive: boolean; status: Vital.LabTestStatus; - /** Defines whether a lab test requires fasting. Only available for Labcorp. */ + /** Defines whether a lab test requires fasting. */ fasting?: boolean; lab?: Vital.ClientFacingLab; markers?: Vital.ClientFacingMarker[]; diff --git a/src/api/types/ClientFacingOrder.ts b/src/api/types/ClientFacingOrder.ts index 9c320019..f7d7a3c0 100644 --- a/src/api/types/ClientFacingOrder.ts +++ b/src/api/types/ClientFacingOrder.ts @@ -33,7 +33,7 @@ export interface ClientFacingOrder { healthInsuranceId?: string; /** DEPRECATED. Requistion form url. */ requisitionFormUrl?: string; - /** Defines whether order is priority or not. Only available for Labcorp. For Labcorp, this corresponds to a STAT order. */ + /** Defines whether order is priority or not. For some labs, this refers to a STAT order. */ priority?: boolean; /** Shipping Details. For unregistered testkit orders. */ shippingDetails?: Vital.ShippingAddress; diff --git a/src/api/types/ClientFacingPayorSearchResponse.ts b/src/api/types/ClientFacingPayorSearchResponse.ts index 883a292a..91c7189a 100644 --- a/src/api/types/ClientFacingPayorSearchResponse.ts +++ b/src/api/types/ClientFacingPayorSearchResponse.ts @@ -5,10 +5,10 @@ import * as Vital from ".."; export interface ClientFacingPayorSearchResponse { - /** Payor code returned for the insurance information required by Labcorp. */ + /** Payor code returned for the insurance information. */ code: string; - /** Insurance name returned for the insurance information required by Labcorp. */ + /** Insurance name returned for the insurance information. */ name: string; - /** Insurance business address returned for the insurance information required by Labcorp. */ + /** Insurance business address returned for the insurance information. */ orgAddress: Vital.Address; } diff --git a/src/api/types/ClientFacingSleep.ts b/src/api/types/ClientFacingSleep.ts index daa61a14..c48f9bcc 100644 --- a/src/api/types/ClientFacingSleep.ts +++ b/src/api/types/ClientFacingSleep.ts @@ -36,7 +36,7 @@ export interface ClientFacingSleep { hrLowest?: number; /** The average heart rate registered during the sleep period::beats per minute */ hrAverage?: number; - /** Sleep efficiency is the percentage of the sleep period spent asleep (100% * sleep.total / sleep.duration)::perc */ + /** Sleep efficiency is the percentage of the sleep period spent asleep (100% \* sleep.total / sleep.duration)::perc */ efficiency?: number; /** Detected latency from bedtime_start to the beginning of the first five minutes of persistent sleep::seconds */ latency?: number; diff --git a/src/api/types/ClientFacingUser.ts b/src/api/types/ClientFacingUser.ts index 67104006..b967e9d3 100644 --- a/src/api/types/ClientFacingUser.ts +++ b/src/api/types/ClientFacingUser.ts @@ -18,7 +18,6 @@ export interface ClientFacingUser { /** * Fallback time zone of the user, in the form of a valid IANA tzdatabase identifier (e.g., `Europe/London` or `America/Los_Angeles`). * Used when pulling data from sources that are completely time zone agnostic (e.g., all time is relative to UTC clock, without any time zone attributions on data points). - * */ fallbackTimeZone?: Vital.FallbackTimeZone; } diff --git a/src/api/types/FallbackTimeZone.ts b/src/api/types/FallbackTimeZone.ts index 6cc434b1..552fb18d 100644 --- a/src/api/types/FallbackTimeZone.ts +++ b/src/api/types/FallbackTimeZone.ts @@ -6,7 +6,6 @@ export interface FallbackTimeZone { /** * Fallback time zone of the user, in the form of a valid IANA tzdatabase identifier (e.g., `Europe/London` or `America/Los_Angeles`). * Used when pulling data from sources that are completely time zone agnostic (e.g., all time is relative to UTC clock, without any time zone attributions on data points). - * */ id: string; /** Slug for designated source */ diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 2b91d756..e0854cb0 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -1,4 +1,3 @@ -export * from "./UsAddress"; export * from "./ActivityV2InDb"; export * from "./Address"; export * from "./AppointmentAvailabilitySlots"; @@ -47,8 +46,8 @@ export * from "./ClientFacingMarker"; export * from "./ClientFacingMarkerComplete"; export * from "./ClientFacingMealResponse"; export * from "./ClientFacingMindfulnessMinutesTimeseries"; -export * from "./ClientFacingOrder"; export * from "./ClientFacingOrderDetails"; +export * from "./ClientFacingOrder"; export * from "./ClientFacingOrderEvent"; export * from "./ClientFacingPatientDetailsCompatible"; export * from "./ClientFacingPayorSearchResponse"; @@ -89,24 +88,24 @@ export * from "./DemoProviders"; export * from "./DeviceV2InDb"; export * from "./EmailProviders"; export * from "./Energy"; -export * from "./EventDestinationPreferences"; export * from "./EventDestinationPreferencesPreferred"; export * from "./EventDestinationPreferencesEnabledItem"; +export * from "./EventDestinationPreferences"; export * from "./FallbackTimeZone"; export * from "./Fats"; export * from "./Gender"; export * from "./GetMarkersResponse"; export * from "./GetOrdersResponse"; export * from "./HttpValidationError"; -export * from "./HealthInsuranceCreateRequest"; export * from "./HealthInsuranceCreateRequestFrontImage"; export * from "./HealthInsuranceCreateRequestBackImage"; export * from "./HealthInsuranceCreateRequestPatientSignatureImage"; +export * from "./HealthInsuranceCreateRequest"; export * from "./HistoricalPullStatus"; export * from "./Jpeg"; export * from "./LabResultsMetadata"; -export * from "./LabResultsRaw"; export * from "./LabResultsRawResults"; +export * from "./LabResultsRaw"; export * from "./LabTestCollectionMethod"; export * from "./LabTestSampleType"; export * from "./LabTestStatus"; @@ -130,8 +129,8 @@ export * from "./PatientDetails"; export * from "./PersonDetails"; export * from "./PhlebotomyAreaInfo"; export * from "./PhlebotomyProviderInfo"; -export * from "./PhysicianCreateRequest"; export * from "./PhysicianCreateRequestSignatureImage"; +export * from "./PhysicianCreateRequest"; export * from "./PhysicianCreateRequestBase"; export * from "./Png"; export * from "./PostOrderResponse"; @@ -162,13 +161,14 @@ export * from "./TeamConfig"; export * from "./TimeSlot"; export * from "./TimeseriesMetricPoint"; export * from "./TimeseriesResource"; +export * from "./UsAddress"; export * from "./UserHistoricalPullsResponse"; export * from "./UserRefreshErrorResponse"; export * from "./UserRefreshSuccessResponse"; export * from "./UserResourcesResponse"; export * from "./UserSignInTokenResponse"; export * from "./UserSuccessResponse"; -export * from "./ValidationError"; export * from "./ValidationErrorLocItem"; +export * from "./ValidationError"; export * from "./VitalTokenCreatedResponse"; export * from "./WorkoutV2InDb"; diff --git a/src/core/fetcher/APIResponse.ts b/src/core/fetcher/APIResponse.ts index ea838f38..3664d09e 100644 --- a/src/core/fetcher/APIResponse.ts +++ b/src/core/fetcher/APIResponse.ts @@ -3,6 +3,7 @@ export type APIResponse = SuccessfulResponse | Failed export interface SuccessfulResponse { ok: true; body: T; + headers?: Record; } export interface FailedResponse { diff --git a/src/core/fetcher/Fetcher.ts b/src/core/fetcher/Fetcher.ts index 6af0fb11..e25819af 100644 --- a/src/core/fetcher/Fetcher.ts +++ b/src/core/fetcher/Fetcher.ts @@ -1,7 +1,11 @@ -import { default as URLSearchParams } from "@ungap/url-search-params"; -import axios, { AxiosAdapter, AxiosError } from "axios"; +import { default as FormData } from "form-data"; +import qs from "qs"; import { APIResponse } from "./APIResponse"; +if (typeof window === "undefined") { + global.fetch = require("node-fetch"); +} + export type FetchFunction = (args: Fetcher.Args) => Promise>; export declare namespace Fetcher { @@ -10,13 +14,12 @@ export declare namespace Fetcher { method: string; contentType?: string; headers?: Record; - queryParameters?: URLSearchParams; + queryParameters?: Record; body?: unknown; timeoutMs?: number; + maxRetries?: number; withCredentials?: boolean; - responseType?: "json" | "blob"; - adapter?: AxiosAdapter; - onUploadProgress?: (event: ProgressEvent) => void; + responseType?: "json" | "blob" | "streaming"; } export type Error = FailedStatusCodeError | NonJsonError | TimeoutError | UnknownError; @@ -43,6 +46,10 @@ export declare namespace Fetcher { } } +const INITIAL_RETRY_DELAY = 1; +const MAX_RETRY_DELAY = 60; +const DEFAULT_MAX_RETRIES = 2; + async function fetcherImpl(args: Fetcher.Args): Promise> { const headers: Record = {}; if (args.body !== undefined && args.contentType != null) { @@ -57,40 +64,71 @@ async function fetcherImpl(args: Fetcher.Args): Promise 0 + ? `${args.url}?${qs.stringify(args.queryParameters, { arrayFormat: "repeat" })}` + : args.url; + + let body: BodyInit | undefined = undefined; + if (args.body instanceof FormData) { + // @ts-expect-error + body = args.body; + } else { + body = JSON.stringify(args.body); + } + + const makeRequest = async (): Promise => { + const controller = new AbortController(); + let abortId = undefined; + if (args.timeoutMs != null) { + abortId = setTimeout(() => controller.abort(), args.timeoutMs); + } + const response = await fetch(url, { method: args.method, headers, - data: args.body, - validateStatus: () => true, - transformResponse: (response) => response, - timeout: args.timeoutMs, - transitional: { - clarifyTimeoutError: true, - }, - withCredentials: args.withCredentials, - adapter: args.adapter, - onUploadProgress: args.onUploadProgress, - maxBodyLength: Infinity, - maxContentLength: Infinity, - responseType: args.responseType ?? "json", + body, + signal: controller.signal, + credentials: args.withCredentials ? "same-origin" : undefined, }); + if (abortId != null) { + clearTimeout(abortId); + } + return response; + }; + + try { + let response = await makeRequest(); + + for (let i = 0; i < (args.maxRetries ?? DEFAULT_MAX_RETRIES); ++i) { + if ( + response.status === 408 || + response.status === 409 || + response.status === 429 || + response.status >= 500 + ) { + const delay = Math.min(INITIAL_RETRY_DELAY * Math.pow(i, 2), MAX_RETRY_DELAY); + await new Promise((resolve) => setTimeout(resolve, delay)); + response = await makeRequest(); + } else { + break; + } + } let body: unknown; - if (args.responseType === "blob") { - body = response.data; - } else if (response.data != null && response.data.length > 0) { + if (response.body != null && args.responseType === "blob") { + body = await response.blob(); + } else if (response.body != null && args.responseType === "streaming") { + body = response.body; + } else if (response.body != null) { try { - body = JSON.parse(response.data) ?? undefined; - } catch { + body = await response.json(); + } catch (err) { return { ok: false, error: { reason: "non-json", statusCode: response.status, - rawBody: response.data, + rawBody: await response.text(), }, }; } @@ -100,6 +138,7 @@ async function fetcherImpl(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise, header: string): string | undefined { + for (const [headerKey, headerValue] of Object.entries(headers)) { + if (headerKey.toLowerCase() === header.toLowerCase()) { + return headerValue; + } + } + return undefined; +} diff --git a/src/core/fetcher/index.ts b/src/core/fetcher/index.ts index 6becab21..2d658ca4 100644 --- a/src/core/fetcher/index.ts +++ b/src/core/fetcher/index.ts @@ -1,4 +1,5 @@ export type { APIResponse } from "./APIResponse"; export { fetcher } from "./Fetcher"; export type { Fetcher, FetchFunction } from "./Fetcher"; +export { getHeader } from "./getHeader"; export { Supplier } from "./Supplier"; diff --git a/src/core/index.ts b/src/core/index.ts index 30d5f3f7..47bda95e 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -1,3 +1,2 @@ export * from "./fetcher"; -export * from "./streaming-fetcher"; export * as serialization from "./schemas"; diff --git a/src/core/schemas/Schema.ts b/src/core/schemas/Schema.ts index 3211fa4f..870f373b 100644 --- a/src/core/schemas/Schema.ts +++ b/src/core/schemas/Schema.ts @@ -17,6 +17,7 @@ export const SchemaType = { ENUM: "enum", LIST: "list", STRING_LITERAL: "stringLiteral", + BOOLEAN_LITERAL: "booleanLiteral", OBJECT: "object", ANY: "any", BOOLEAN: "boolean", diff --git a/src/core/schemas/builders/literals/booleanLiteral.ts b/src/core/schemas/builders/literals/booleanLiteral.ts new file mode 100644 index 00000000..a83d22cd --- /dev/null +++ b/src/core/schemas/builders/literals/booleanLiteral.ts @@ -0,0 +1,29 @@ +import { Schema, SchemaType } from "../../Schema"; +import { createIdentitySchemaCreator } from "../../utils/createIdentitySchemaCreator"; +import { getErrorMessageForIncorrectType } from "../../utils/getErrorMessageForIncorrectType"; + +export function booleanLiteral(literal: V): Schema { + const schemaCreator = createIdentitySchemaCreator( + SchemaType.BOOLEAN_LITERAL, + (value, { breadcrumbsPrefix = [] } = {}) => { + if (value === literal) { + return { + ok: true, + value: literal, + }; + } else { + return { + ok: false, + errors: [ + { + path: breadcrumbsPrefix, + message: getErrorMessageForIncorrectType(value, `${literal.toString()}`), + }, + ], + }; + } + } + ); + + return schemaCreator(); +} diff --git a/src/core/schemas/builders/literals/index.ts b/src/core/schemas/builders/literals/index.ts index a4cd05cd..d2bf08fc 100644 --- a/src/core/schemas/builders/literals/index.ts +++ b/src/core/schemas/builders/literals/index.ts @@ -1 +1,2 @@ export { stringLiteral } from "./stringLiteral"; +export { booleanLiteral } from "./booleanLiteral"; diff --git a/src/core/schemas/builders/object/index.ts b/src/core/schemas/builders/object/index.ts index e6db5b56..e3f4388d 100644 --- a/src/core/schemas/builders/object/index.ts +++ b/src/core/schemas/builders/object/index.ts @@ -1,4 +1,9 @@ export { getObjectUtils, object } from "./object"; +export { objectWithoutOptionalProperties } from "./objectWithoutOptionalProperties"; +export type { + inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas, + inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas, +} from "./objectWithoutOptionalProperties"; export { isProperty, property } from "./property"; export type { Property } from "./property"; export type { diff --git a/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts b/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts new file mode 100644 index 00000000..a0951f48 --- /dev/null +++ b/src/core/schemas/builders/object/objectWithoutOptionalProperties.ts @@ -0,0 +1,18 @@ +import { object } from "./object"; +import { inferParsedPropertySchema, inferRawObjectFromPropertySchemas, ObjectSchema, PropertySchemas } from "./types"; + +export function objectWithoutOptionalProperties>( + schemas: T +): inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas { + return object(schemas) as unknown as inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas; +} + +export type inferObjectWithoutOptionalPropertiesSchemaFromPropertySchemas> = + ObjectSchema< + inferRawObjectFromPropertySchemas, + inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas + >; + +export type inferParsedObjectWithoutOptionalPropertiesFromPropertySchemas> = { + [K in keyof T]: inferParsedPropertySchema; +}; diff --git a/src/core/streaming-fetcher/StreamingFetcher.ts b/src/core/streaming-fetcher/StreamingFetcher.ts deleted file mode 100644 index 88ed0d43..00000000 --- a/src/core/streaming-fetcher/StreamingFetcher.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { default as URLSearchParams } from "@ungap/url-search-params"; -import axios, { AxiosAdapter } from "axios"; -import { Readable } from "stream"; - -export type StreamingFetchFunction = (args: StreamingFetcher.Args) => Promise; - -export declare namespace StreamingFetcher { - export interface Args { - url: string; - method: string; - headers?: Record; - queryParameters?: URLSearchParams; - body?: unknown; - timeoutMs?: number; - withCredentials?: boolean; - adapter?: AxiosAdapter; - onUploadProgress?: (event: ProgressEvent) => void; - onDownloadProgress?: (event: ProgressEvent) => void; - - onData?: (data: unknown) => void; - onError?: (err: unknown) => void; - onFinish?: () => void; - abortController?: AbortController; - responseChunkPrefix?: string; - terminator?: string; - } - - export interface Response { - data: Readable; - headers: Record; - } -} - -export const streamingFetcher: StreamingFetchFunction = async (args) => { - const headers: Record = {}; - if (args.body !== undefined) { - headers["Content-Type"] = "application/json"; - } - if (args.headers != null) { - for (const [key, value] of Object.entries(args.headers)) { - if (value != null) { - headers[key] = value; - } - } - } - - const response = await axios({ - url: args.url, - params: args.queryParameters, - method: args.method, - headers, - data: args.body, - timeout: args.timeoutMs, - transitional: { - clarifyTimeoutError: true, - }, - withCredentials: args.withCredentials, - maxBodyLength: Infinity, - maxContentLength: Infinity, - onUploadProgress: args.onUploadProgress, - onDownloadProgress: args.onDownloadProgress, - signal: args.abortController?.signal, - responseType: "stream", - adapter: args.adapter, - }); - - if (args.onData != null) { - const { onData } = args; - response.data.on("data", (data: Buffer) => { - for (const line of data.toString().split("\n")) { - let data = line; - if (args.responseChunkPrefix != null) { - if (!data.startsWith(args.responseChunkPrefix)) { - continue; - } - data = data.substring(args.responseChunkPrefix.length); - } - - try { - const parsed = JSON.parse(data); - onData(parsed); - } catch (error) { - args.onError?.(error); - } - } - }); - } - - if (args.onFinish != null) { - response.data.on("end", args.onFinish); - } - - return { - data: response.data, - headers: response.headers, - }; -}; diff --git a/src/core/streaming-fetcher/getHeader.ts b/src/core/streaming-fetcher/getHeader.ts deleted file mode 100644 index e59189cf..00000000 --- a/src/core/streaming-fetcher/getHeader.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { StreamingFetcher } from "./StreamingFetcher"; - -export function getHeader(response: StreamingFetcher.Response, header: string): string | undefined { - for (const [headerKey, headerValue] of Object.entries(response.headers)) { - if (headerKey.toLowerCase() === header.toLowerCase()) { - return headerValue; - } - } - return undefined; -} diff --git a/src/core/streaming-fetcher/index.ts b/src/core/streaming-fetcher/index.ts deleted file mode 100644 index da8e4652..00000000 --- a/src/core/streaming-fetcher/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { getHeader } from "./getHeader"; -export { streamingFetcher } from "./StreamingFetcher"; -export type { StreamingFetcher, StreamingFetchFunction } from "./StreamingFetcher"; diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index 2b91d756..e0854cb0 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -1,4 +1,3 @@ -export * from "./UsAddress"; export * from "./ActivityV2InDb"; export * from "./Address"; export * from "./AppointmentAvailabilitySlots"; @@ -47,8 +46,8 @@ export * from "./ClientFacingMarker"; export * from "./ClientFacingMarkerComplete"; export * from "./ClientFacingMealResponse"; export * from "./ClientFacingMindfulnessMinutesTimeseries"; -export * from "./ClientFacingOrder"; export * from "./ClientFacingOrderDetails"; +export * from "./ClientFacingOrder"; export * from "./ClientFacingOrderEvent"; export * from "./ClientFacingPatientDetailsCompatible"; export * from "./ClientFacingPayorSearchResponse"; @@ -89,24 +88,24 @@ export * from "./DemoProviders"; export * from "./DeviceV2InDb"; export * from "./EmailProviders"; export * from "./Energy"; -export * from "./EventDestinationPreferences"; export * from "./EventDestinationPreferencesPreferred"; export * from "./EventDestinationPreferencesEnabledItem"; +export * from "./EventDestinationPreferences"; export * from "./FallbackTimeZone"; export * from "./Fats"; export * from "./Gender"; export * from "./GetMarkersResponse"; export * from "./GetOrdersResponse"; export * from "./HttpValidationError"; -export * from "./HealthInsuranceCreateRequest"; export * from "./HealthInsuranceCreateRequestFrontImage"; export * from "./HealthInsuranceCreateRequestBackImage"; export * from "./HealthInsuranceCreateRequestPatientSignatureImage"; +export * from "./HealthInsuranceCreateRequest"; export * from "./HistoricalPullStatus"; export * from "./Jpeg"; export * from "./LabResultsMetadata"; -export * from "./LabResultsRaw"; export * from "./LabResultsRawResults"; +export * from "./LabResultsRaw"; export * from "./LabTestCollectionMethod"; export * from "./LabTestSampleType"; export * from "./LabTestStatus"; @@ -130,8 +129,8 @@ export * from "./PatientDetails"; export * from "./PersonDetails"; export * from "./PhlebotomyAreaInfo"; export * from "./PhlebotomyProviderInfo"; -export * from "./PhysicianCreateRequest"; export * from "./PhysicianCreateRequestSignatureImage"; +export * from "./PhysicianCreateRequest"; export * from "./PhysicianCreateRequestBase"; export * from "./Png"; export * from "./PostOrderResponse"; @@ -162,13 +161,14 @@ export * from "./TeamConfig"; export * from "./TimeSlot"; export * from "./TimeseriesMetricPoint"; export * from "./TimeseriesResource"; +export * from "./UsAddress"; export * from "./UserHistoricalPullsResponse"; export * from "./UserRefreshErrorResponse"; export * from "./UserRefreshSuccessResponse"; export * from "./UserResourcesResponse"; export * from "./UserSignInTokenResponse"; export * from "./UserSuccessResponse"; -export * from "./ValidationError"; export * from "./ValidationErrorLocItem"; +export * from "./ValidationError"; export * from "./VitalTokenCreatedResponse"; export * from "./WorkoutV2InDb"; diff --git a/yarn.lock b/yarn.lock index 0f04cca3..30546be7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,33 +2,49 @@ # yarn lockfile v1 +"@types/node-fetch@2.6.9": + version "2.6.9" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.9.tgz#15f529d247f1ede1824f7e7acdaa192d5f28071e" + integrity sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA== + dependencies: + "@types/node" "*" + form-data "^4.0.0" + +"@types/node@*": + version "20.10.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.10.5.tgz#47ad460b514096b7ed63a1dae26fad0914ed3ab2" + integrity sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw== + dependencies: + undici-types "~5.26.4" + "@types/node@17.0.33": version "17.0.33" resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.33.tgz#3c1879b276dc63e73030bb91165e62a4509cd506" integrity sha512-miWq2m2FiQZmaHfdZNcbpp9PuXg34W5JZ5CrJ/BaS70VuhoJENBEQybeiYSaPBRNq6KQGnjfEnc/F3PN++D+XQ== +"@types/qs@6.9.8": + version "6.9.8" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.8.tgz#f2a7de3c107b89b441e071d5472e6b726b4adf45" + integrity sha512-u95svzDlTysU5xecFNTgfFG5RUWu1A9P0VzgpcIiGZA9iraHOdSzcxMxQ55DyeRaGCSxQi7LxXDI4rzq/MYfdg== + "@types/url-join@4.0.1": version "4.0.1" resolved "https://registry.yarnpkg.com/@types/url-join/-/url-join-4.0.1.tgz#4989c97f969464647a8586c7252d97b449cdc045" integrity sha512-wDXw9LEEUHyV+7UWy7U315nrJGJ7p1BzaCxDpEoLr789Dk1WDVMMlf3iBfbG2F8NdWnYyFbtTxUn2ZNbm1Q4LQ== -"@ungap/url-search-params@0.2.2": - version "0.2.2" - resolved "https://registry.yarnpkg.com/@ungap/url-search-params/-/url-search-params-0.2.2.tgz#2de3bdec21476a9b70ef11fd7b794752f9afa04c" - integrity sha512-qQsguKXZVKdCixOHX9jqnX/K/1HekPDpGKyEcXHT+zR6EjGA7S4boSuelL4uuPv6YfhN0n8c4UxW+v/Z3gM2iw== - asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== -axios@0.27.2: - version "0.27.2" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972" - integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ== +call-bind@^1.0.0: + version "1.0.5" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.5.tgz#6fa2b7845ce0ea49bf4d8b9ef64727a2c2e2e513" + integrity sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ== dependencies: - follow-redirects "^1.14.9" - form-data "^4.0.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.1" + set-function-length "^1.1.1" combined-stream@^1.0.8: version "1.0.8" @@ -37,17 +53,21 @@ combined-stream@^1.0.8: dependencies: delayed-stream "~1.0.0" +define-data-property@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.1.tgz#c35f7cd0ab09883480d12ac5cb213715587800b3" + integrity sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ== + dependencies: + get-intrinsic "^1.2.1" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" + delayed-stream@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== -follow-redirects@^1.14.9: - version "1.15.3" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.3.tgz#fe2f3ef2690afce7e82ed0b44db08165b207123a" - integrity sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q== - -form-data@^4.0.0: +form-data@4.0.0, form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== @@ -56,6 +76,52 @@ form-data@^4.0.0: combined-stream "^1.0.8" mime-types "^2.1.12" +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + +get-intrinsic@^1.0.2, get-intrinsic@^1.1.3, get-intrinsic@^1.2.1, get-intrinsic@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.2.tgz#281b7622971123e1ef4b3c90fd7539306da93f3b" + integrity sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA== + dependencies: + function-bind "^1.1.2" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" + +gopd@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== + dependencies: + get-intrinsic "^1.1.3" + +has-property-descriptors@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz#52ba30b6c5ec87fd89fa574bc1c39125c6f65340" + integrity sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg== + dependencies: + get-intrinsic "^1.2.2" + +has-proto@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.1.tgz#1885c1305538958aff469fef37937c22795408e0" + integrity sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg== + +has-symbols@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== + +hasown@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.0.tgz#f4c513d454a57b7c7e1650778de226b11700546c" + integrity sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA== + dependencies: + function-bind "^1.1.2" + mime-db@1.52.0: version "1.52.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" @@ -68,17 +134,78 @@ mime-types@^2.1.12: dependencies: mime-db "1.52.0" +node-fetch@2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" + integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== + dependencies: + whatwg-url "^5.0.0" + +object-inspect@^1.9.0: + version "1.13.1" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" + integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== + prettier@2.7.1: version "2.7.1" resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== +qs@6.11.2: + version "6.11.2" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.2.tgz#64bea51f12c1f5da1bc01496f48ffcff7c69d7d9" + integrity sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA== + dependencies: + side-channel "^1.0.4" + +set-function-length@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.1.1.tgz#4bc39fafb0307224a33e106a7d35ca1218d659ed" + integrity sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ== + dependencies: + define-data-property "^1.1.1" + get-intrinsic "^1.2.1" + gopd "^1.0.1" + has-property-descriptors "^1.0.0" + +side-channel@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" + integrity sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw== + dependencies: + call-bind "^1.0.0" + get-intrinsic "^1.0.2" + object-inspect "^1.9.0" + +tr46@~0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" + integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== + typescript@4.6.4: version "4.6.4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.4.tgz#caa78bbc3a59e6a5c510d35703f6a09877ce45e9" integrity sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg== +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + url-join@4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/url-join/-/url-join-4.0.1.tgz#b642e21a2646808ffa178c4c5fda39844e12cde7" integrity sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA== + +webidl-conversions@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" + integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== + +whatwg-url@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" + integrity sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw== + dependencies: + tr46 "~0.0.3" + webidl-conversions "^3.0.0"