Skip to content

Commit

Permalink
Release 3.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Dec 22, 2023
1 parent 9aea361 commit 3fabeaf
Show file tree
Hide file tree
Showing 91 changed files with 1,251 additions and 500 deletions.
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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"
Expand Down
1 change: 1 addition & 0 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export declare namespace VitalClient {

interface RequestOptions {
timeoutInSeconds?: number;
maxRetries?: number;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/api/errors/BadRequestError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
1 change: 1 addition & 0 deletions src/api/errors/UnprocessableEntityError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down
34 changes: 23 additions & 11 deletions src/api/resources/activity/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -18,6 +17,7 @@ export declare namespace Activity {

interface RequestOptions {
timeoutInSeconds?: number;
maxRetries?: number;
}
}

Expand All @@ -27,21 +27,26 @@ 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,
request: Vital.ActivityGetRequest,
requestOptions?: Activity.RequestOptions
): Promise<Vital.ClientActivityResponse> {
const { provider, startDate, endDate } = request;
const _queryParams = new URLSearchParams();
const _queryParams: Record<string, string | string[]> = {};
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({
Expand All @@ -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, {
Expand Down Expand Up @@ -106,21 +112,26 @@ 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,
request: Vital.ActivityGetRawRequest,
requestOptions?: Activity.RequestOptions
): Promise<Vital.RawActivity> {
const { provider, startDate, endDate } = request;
const _queryParams = new URLSearchParams();
const _queryParams: Record<string, string | string[]> = {};
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({
Expand All @@ -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, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 23 additions & 11 deletions src/api/resources/body/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -18,6 +17,7 @@ export declare namespace Body {

interface RequestOptions {
timeoutInSeconds?: number;
maxRetries?: number;
}
}

Expand All @@ -27,21 +27,26 @@ 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,
request: Vital.BodyGetRequest,
requestOptions?: Body.RequestOptions
): Promise<Vital.ClientBodyResponse> {
const { provider, startDate, endDate } = request;
const _queryParams = new URLSearchParams();
const _queryParams: Record<string, string | string[]> = {};
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({
Expand All @@ -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, {
Expand Down Expand Up @@ -106,21 +112,26 @@ 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,
request: Vital.BodyGetRawRequest,
requestOptions?: Body.RequestOptions
): Promise<Vital.RawBody> {
const { provider, startDate, endDate } = request;
const _queryParams = new URLSearchParams();
const _queryParams: Record<string, string | string[]> = {};
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({
Expand All @@ -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, {
Expand Down
6 changes: 6 additions & 0 deletions src/api/resources/body/client/requests/BodyGetRawRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/api/resources/body/client/requests/BodyGetRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions src/api/resources/devices/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -18,6 +17,7 @@ export declare namespace Devices {

interface RequestOptions {
timeoutInSeconds?: number;
maxRetries?: number;
}
}

Expand All @@ -27,16 +27,19 @@ export class Devices {
/**
* Get Devices for user_id
* @throws {@link Vital.UnprocessableEntityError}
*
* @example
* await vital.devices.getRaw("user-id", {})
*/
public async getRaw(
userId: string,
request: Vital.DevicesGetRawRequest = {},
requestOptions?: Devices.RequestOptions
): Promise<Vital.RawDevices> {
const { provider } = request;
const _queryParams = new URLSearchParams();
const _queryParams: Record<string, string | string[]> = {};
if (provider != null) {
_queryParams.append("provider", provider);
_queryParams["provider"] = provider;
}

const _response = await core.fetcher({
Expand All @@ -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, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
* This file was auto-generated by Fern from our API Definition.
*/

/**
* @example
* {}
*/
export interface DevicesGetRawRequest {
/**
* Provider oura/strava etc
Expand Down
Loading

0 comments on commit 3fabeaf

Please sign in to comment.