// Copyright 2022 Luca Casonato. All rights reserved. MIT license. /** * Google Health API Client for Deno * ================================= * * The Google Health API lets you view and manage health and fitness metrics and measurement data. * * Docs: https://developers.google.com/health * Source: https://googleapis.deno.dev/v1/health:v4.ts */ import { auth, CredentialsClient, GoogleAuth, request } from "/_/base@v1/mod.ts"; export { auth, GoogleAuth }; export type { CredentialsClient }; /** * The Google Health API lets you view and manage health and fitness metrics * and measurement data. */ export class Health { #client: CredentialsClient | undefined; #baseUrl: string; constructor(client?: CredentialsClient, baseUrl: string = "https://health.googleapis.com/") { this.#client = client; this.#baseUrl = baseUrl; } /** * Registers a new subscriber endpoint to receive notifications. A subscriber * represents an application or service that wishes to receive data change * notifications for users who have granted consent. **Endpoint * Verification:** For a subscriber to be successfully created, the provided * `endpoint_uri` must be a valid HTTPS endpoint and must pass an automated * verification check. The backend will send two HTTP POST requests to the * `endpoint_uri`: 1. **Verification with Authorization:** * **Headers:** * Includes `Content-Type: application/json` and `Authorization` (with the * exact value from `CreateSubscriberPayload.endpoint_authorization.secret`). * * **Body:** `{"type": "verification"}` * **Expected Response:** HTTP `201 * Created`. 2. **Verification without Authorization:** * **Headers:** * Includes `Content-Type: application/json`. The `Authorization` header is * OMITTED. * **Body:** `{"type": "verification"}` * **Expected Response:** * HTTP `401 Unauthorized` or `403 Forbidden`. Both tests must pass for the * subscriber creation to succeed. If verification fails, the operation will * not be completed and an error will be returned. This process ensures the * endpoint is reachable and correctly validates the `Authorization` header. * * @param parent Required. The parent resource where this subscriber will be created. Format: projects/{project} Example: projects/my-project-123 */ async projectsSubscribersCreate(parent: string, req: CreateSubscriberPayload, opts: ProjectsSubscribersCreateOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v4/${ parent }/subscribers`); if (opts.subscriberId !== undefined) { url.searchParams.append("subscriberId", String(opts.subscriberId)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as Operation; } /** * Deletes a subscriber registration. This will stop all notifications to the * subscriber's endpoint. * * @param name Required. The name of the subscriber to delete. Format: projects/{project}/subscribers/{subscriber} Example: projects/my-project/subscribers/my-subscriber-123 The {subscriber} ID is user-settable (4-36 characters, matching /[a-z]([a-z0-9-]{2,34}[a-z0-9])/) or system-generated if not provided during creation. */ async projectsSubscribersDelete(name: string, opts: ProjectsSubscribersDeleteOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v4/${ name }`); if (opts.force !== undefined) { url.searchParams.append("force", String(opts.force)); } const data = await request(url.href, { client: this.#client, method: "DELETE", }); return data as Operation; } /** * Lists all subscribers registered within the owned Google Cloud Project. * * @param parent Required. The parent, which owns this collection of subscribers. Format: projects/{project} */ async projectsSubscribersList(parent: string, opts: ProjectsSubscribersListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v4/${ parent }/subscribers`); if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as ListSubscribersResponse; } /** * Updates the configuration of an existing subscriber, such as the endpoint * URI or the data types it's interested in. **Endpoint Verification:** If the * `endpoint_uri` or `endpoint_authorization` field is included in the * `update_mask`, the backend will re-verify the endpoint. The verification * process is the same as described in `CreateSubscriber`: 1. **Verification * with Authorization:** POST to the new or existing `endpoint_uri` with the * new or existing `Authorization` secret. Expects HTTP `201 Created`. 2. * **Verification without Authorization:** POST to the `endpoint_uri` without * the `Authorization` header. Expects HTTP `401 Unauthorized` or `403 * Forbidden`. Both tests must pass using the potentially updated values for * the subscriber update to succeed. If verification fails, the update will * not be applied, and an error will be returned. * * @param name Identifier. The resource name of the Subscriber. Format: projects/{project}/subscribers/{subscriber} The {project} ID is a Google Cloud Project ID or Project Number. The {subscriber} ID is user-settable (4-36 characters, matching /[a-z]([a-z0-9-]{2,34}[a-z0-9])/) if provided during creation, or system-generated otherwise (e.g., a UUID). Example (User-settable subscriber ID): projects/my-project/subscribers/my-sub-123 Example (System-generated subscriber ID): projects/my-project/subscribers/a1b2c3d4-e5f6-7890-1234-567890abcdef */ async projectsSubscribersPatch(name: string, req: Subscriber, opts: ProjectsSubscribersPatchOptions = {}): Promise { opts = serializeProjectsSubscribersPatchOptions(opts); const url = new URL(`${this.#baseUrl}v4/${ name }`); if (opts.updateMask !== undefined) { url.searchParams.append("updateMask", String(opts.updateMask)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return data as Operation; } /** * Delete a batch of identifyable data points. * * @param parent Optional. Parent (data type) for the Data Point collection Format: `users/me/dataTypes/{data_type}`, e.g.: - `users/me/dataTypes/steps` - `users/me/dataTypes/-` For a list of the supported data types see the DataPoint data union field. Deleting data points across multiple data type collections is supported following https://aip.dev/159. If this is set, the parent of all of the data points specified in `names` must match this field. */ async usersDataTypesDataPointsBatchDelete(parent: string, req: BatchDeleteDataPointsRequest): Promise { const url = new URL(`${this.#baseUrl}v4/${ parent }/dataPoints:batchDelete`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as Operation; } /** * Creates a single identifiable data point. * * @param parent Required. The parent resource name where the data point will be created. Format: `users/{user}/dataTypes/{data_type}` */ async usersDataTypesDataPointsCreate(parent: string, req: DataPoint): Promise { req = serializeDataPoint(req); const url = new URL(`${this.#baseUrl}v4/${ parent }/dataPoints`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return data as Operation; } /** * Roll up data points over civil time intervals for supported data types. * * @param parent Required. Parent data type of the Data Point collection. Format: `users/{user}/dataTypes/{data_type}`, e.g.: - `users/me/dataTypes/steps` - `users/me/dataTypes/distance` For a list of the supported data types see the DailyRollupDataPoint value union field. */ async usersDataTypesDataPointsDailyRollUp(parent: string, req: DailyRollUpDataPointsRequest): Promise { const url = new URL(`${this.#baseUrl}v4/${ parent }/dataPoints:dailyRollUp`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeDailyRollUpDataPointsResponse(data); } /** * Exports exercise data in TCX format. Note: While the Authorization section * below states that any one of the listed scopes is accepted, this specific * method requires the user to provide both one of the `activity_and_fitness` * scopes (`normal` or `readonly`) AND one of the `location` scopes (`normal` * or `readonly`) in their access token to succeed. * * @param name Required. The resource name of the exercise data point to export. Format: `users/{user}/dataTypes/exercise/dataPoints/{data_point}` Example: `users/me/dataTypes/exercise/dataPoints/2026443605080188808` The `{user}` is the alias `"me"` currently. Future versions may support user IDs. The `{data_point}` ID maps to the exercise ID, which is a long integer. */ async usersDataTypesDataPointsExportExerciseTcx(name: string, opts: UsersDataTypesDataPointsExportExerciseTcxOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v4/${ name }:exportExerciseTcx`); if (opts.partialData !== undefined) { url.searchParams.append("partialData", String(opts.partialData)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return data as ExportExerciseTcxResponse; } /** * Get a single identifyable data point. * * @param name Required. The name of the data point to retrieve. Format: `users/{user}/dataTypes/{data_type}/dataPoints/{data_point}` See DataPoint.name for examples and possible values. */ async usersDataTypesDataPointsGet(name: string): Promise { const url = new URL(`${this.#baseUrl}v4/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeDataPoint(data); } /** * Query user health and fitness data points. * * @param parent Required. Parent data type of the Data Point collection. Format: `users/me/dataTypes/{data_type}`, e.g.: - `users/me/dataTypes/steps` - `users/me/dataTypes/weight` For a list of the supported data types see the DataPoint data union field. */ async usersDataTypesDataPointsList(parent: string, opts: UsersDataTypesDataPointsListOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v4/${ parent }/dataPoints`); if (opts.filter !== undefined) { url.searchParams.append("filter", String(opts.filter)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeListDataPointsResponse(data); } /** * Updates a single identifiable data point. If a data point with the * specified `name` is not found, the request will fail. * * @param name Identifier. Data point name, only supported for the subset of identifiable data types. For the majority of the data types, individual data points do not need to be identified and this field would be empty. Format: `users/{user}/dataTypes/{data_type}/dataPoints/{data_point}` Example: `users/abcd1234/dataTypes/sleep/dataPoints/a1b2c3d4-e5f6-7890-1234-567890abcdef` The `{user}` ID is a system-generated identifier, as described in Identity.health_user_id. The `{data_type}` ID corresponds to the kebab-case version of the field names in the DataPoint data union field, e.g. `total-calories` for the `total_calories` field. The `{data_point}` ID can be client-provided or system-generated. If client-provided, it must be a string of 4-63 characters, containing only lowercase letters, numbers, and hyphens. */ async usersDataTypesDataPointsPatch(name: string, req: DataPoint): Promise { req = serializeDataPoint(req); const url = new URL(`${this.#baseUrl}v4/${ name }`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return data as Operation; } /** * Reconcile data points from multiple data sources into a single data * stream. * * @param parent Required. Parent data type of the Data Point collection. Format: `users/me/dataTypes/{data_type}`, e.g.: - `users/me/dataTypes/steps` - `users/me/dataTypes/heart-rate` For a list of the supported data types see the DataPoint data union field. */ async usersDataTypesDataPointsReconcile(parent: string, opts: UsersDataTypesDataPointsReconcileOptions = {}): Promise { const url = new URL(`${this.#baseUrl}v4/${ parent }/dataPoints:reconcile`); if (opts.dataSourceFamily !== undefined) { url.searchParams.append("dataSourceFamily", String(opts.dataSourceFamily)); } if (opts.filter !== undefined) { url.searchParams.append("filter", String(opts.filter)); } if (opts.pageSize !== undefined) { url.searchParams.append("pageSize", String(opts.pageSize)); } if (opts.pageToken !== undefined) { url.searchParams.append("pageToken", String(opts.pageToken)); } const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeReconcileDataPointsResponse(data); } /** * Roll up data points over physical time intervals for supported data types. * * @param parent Required. Parent data type of the Data Point collection. Format: `users/{user}/dataTypes/{data_type}`, e.g.: - `users/me/dataTypes/steps` - `users/me/dataTypes/distance` For a list of the supported data types see the RollupDataPoint value union field. */ async usersDataTypesDataPointsRollUp(parent: string, req: RollUpDataPointsRequest): Promise { req = serializeRollUpDataPointsRequest(req); const url = new URL(`${this.#baseUrl}v4/${ parent }/dataPoints:rollUp`); const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "POST", body, }); return deserializeRollUpDataPointsResponse(data); } /** * Gets the user's identity. It includes the legacy Fitbit user ID and the * Google user ID and it can be used by migrating clients to map identifiers * between the two systems. * * @param name Required. The resource name of the Identity. Format: `users/me/identity` */ async usersGetIdentity(name: string): Promise { const url = new URL(`${this.#baseUrl}v4/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as Identity; } /** * Returns user Profile details. * * @param name Required. The name of the Profile. Format: `users/me/profile`. */ async usersGetProfile(name: string): Promise { const url = new URL(`${this.#baseUrl}v4/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return data as Profile; } /** * Returns user settings details. * * @param name Required. The name of the Settings. Format: `users/me/settings`. */ async usersGetSettings(name: string): Promise { const url = new URL(`${this.#baseUrl}v4/${ name }`); const data = await request(url.href, { client: this.#client, method: "GET", }); return deserializeSettings(data); } /** * Updates the user's profile details. * * @param name Identifier. The resource name of this Profile resource. Format: `users/{user}/profile` Example: `users/1234567890/profile` or `users/me/profile` The {user} ID is a system-generated Google Health API user ID, a string of 1-63 characters consisting of lowercase and uppercase letters, numbers, and hyphens. The literal `me` can also be used to refer to the authenticated user. */ async usersUpdateProfile(name: string, req: Profile, opts: UsersUpdateProfileOptions = {}): Promise { opts = serializeUsersUpdateProfileOptions(opts); const url = new URL(`${this.#baseUrl}v4/${ name }`); if (opts.updateMask !== undefined) { url.searchParams.append("updateMask", String(opts.updateMask)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return data as Profile; } /** * Updates the user's settings details. * * @param name Identifier. The resource name of this Settings resource. Format: `users/{user}/settings` Example: `users/1234567890/settings` or `users/me/settings` The {user} ID is a system-generated Google Health API user ID, a string of 1-63 characters consisting of lowercase and uppercase letters, numbers, and hyphens. The literal `me` can also be used to refer to the authenticated user. */ async usersUpdateSettings(name: string, req: Settings, opts: UsersUpdateSettingsOptions = {}): Promise { req = serializeSettings(req); opts = serializeUsersUpdateSettingsOptions(opts); const url = new URL(`${this.#baseUrl}v4/${ name }`); if (opts.updateMask !== undefined) { url.searchParams.append("updateMask", String(opts.updateMask)); } const body = JSON.stringify(req); const data = await request(url.href, { client: this.#client, method: "PATCH", body, }); return deserializeSettings(data); } } /** * Record of active minutes in a given time interval. */ export interface ActiveMinutes { /** * Required. Active minutes by activity level. At most one record per * activity level is allowed. */ activeMinutesByActivityLevel?: ActiveMinutesByActivityLevel[]; /** * Required. Observed interval. */ interval?: ObservationTimeInterval; } function serializeActiveMinutes(data: any): ActiveMinutes { return { ...data, activeMinutesByActivityLevel: data["activeMinutesByActivityLevel"] !== undefined ? data["activeMinutesByActivityLevel"].map((item: any) => (serializeActiveMinutesByActivityLevel(item))) : undefined, interval: data["interval"] !== undefined ? serializeObservationTimeInterval(data["interval"]) : undefined, }; } function deserializeActiveMinutes(data: any): ActiveMinutes { return { ...data, activeMinutesByActivityLevel: data["activeMinutesByActivityLevel"] !== undefined ? data["activeMinutesByActivityLevel"].map((item: any) => (deserializeActiveMinutesByActivityLevel(item))) : undefined, interval: data["interval"] !== undefined ? deserializeObservationTimeInterval(data["interval"]) : undefined, }; } /** * Active minutes at a given activity level. */ export interface ActiveMinutesByActivityLevel { /** * Required. Number of whole minutes spent in activity. */ activeMinutes?: bigint; /** * Required. The level of activity. */ activityLevel?: | "ACTIVITY_LEVEL_UNSPECIFIED" | "LIGHT" | "MODERATE" | "VIGOROUS"; } function serializeActiveMinutesByActivityLevel(data: any): ActiveMinutesByActivityLevel { return { ...data, activeMinutes: data["activeMinutes"] !== undefined ? String(data["activeMinutes"]) : undefined, }; } function deserializeActiveMinutesByActivityLevel(data: any): ActiveMinutesByActivityLevel { return { ...data, activeMinutes: data["activeMinutes"] !== undefined ? BigInt(data["activeMinutes"]) : undefined, }; } /** * Active minutes by activity level. */ export interface ActiveMinutesRollupByActivityLevel { /** * Number of whole minutes spent in activity. */ activeMinutesSum?: bigint; /** * The level of activity. */ activityLevel?: | "ACTIVITY_LEVEL_UNSPECIFIED" | "LIGHT" | "MODERATE" | "VIGOROUS"; } function serializeActiveMinutesRollupByActivityLevel(data: any): ActiveMinutesRollupByActivityLevel { return { ...data, activeMinutesSum: data["activeMinutesSum"] !== undefined ? String(data["activeMinutesSum"]) : undefined, }; } function deserializeActiveMinutesRollupByActivityLevel(data: any): ActiveMinutesRollupByActivityLevel { return { ...data, activeMinutesSum: data["activeMinutesSum"] !== undefined ? BigInt(data["activeMinutesSum"]) : undefined, }; } /** * Represents the result of the rollup of the active minutes data type. */ export interface ActiveMinutesRollupValue { /** * Active minutes by activity level. At most one record per activity level is * allowed. */ activeMinutesRollupByActivityLevel?: ActiveMinutesRollupByActivityLevel[]; } function serializeActiveMinutesRollupValue(data: any): ActiveMinutesRollupValue { return { ...data, activeMinutesRollupByActivityLevel: data["activeMinutesRollupByActivityLevel"] !== undefined ? data["activeMinutesRollupByActivityLevel"].map((item: any) => (serializeActiveMinutesRollupByActivityLevel(item))) : undefined, }; } function deserializeActiveMinutesRollupValue(data: any): ActiveMinutesRollupValue { return { ...data, activeMinutesRollupByActivityLevel: data["activeMinutesRollupByActivityLevel"] !== undefined ? data["activeMinutesRollupByActivityLevel"].map((item: any) => (deserializeActiveMinutesRollupByActivityLevel(item))) : undefined, }; } /** * Record of active zone minutes in a given time interval. */ export interface ActiveZoneMinutes { /** * Required. Number of Active Zone Minutes earned in the given time interval. * Note: active_zone_minutes equals to 1 for low intensity (fat burn) zones or * 2 for high intensity zones (cardio, peak). */ activeZoneMinutes?: bigint; /** * Required. Heart rate zone in which the active zone minutes have been * earned, in the given time interval. */ heartRateZone?: | "HEART_RATE_ZONE_UNSPECIFIED" | "FAT_BURN" | "CARDIO" | "PEAK"; /** * Required. Observed interval. */ interval?: ObservationTimeInterval; } function serializeActiveZoneMinutes(data: any): ActiveZoneMinutes { return { ...data, activeZoneMinutes: data["activeZoneMinutes"] !== undefined ? String(data["activeZoneMinutes"]) : undefined, interval: data["interval"] !== undefined ? serializeObservationTimeInterval(data["interval"]) : undefined, }; } function deserializeActiveZoneMinutes(data: any): ActiveZoneMinutes { return { ...data, activeZoneMinutes: data["activeZoneMinutes"] !== undefined ? BigInt(data["activeZoneMinutes"]) : undefined, interval: data["interval"] !== undefined ? deserializeObservationTimeInterval(data["interval"]) : undefined, }; } /** * Represents the result of the rollup of the active zone minutes data type. */ export interface ActiveZoneMinutesRollupValue { /** * Active zone minutes in `HeartRateZone.CARDIO`. */ sumInCardioHeartZone?: bigint; /** * Active zone minutes in `HeartRateZone.FAT_BURN`. */ sumInFatBurnHeartZone?: bigint; /** * Active zone minutes in `HeartRateZone.PEAK`. */ sumInPeakHeartZone?: bigint; } function serializeActiveZoneMinutesRollupValue(data: any): ActiveZoneMinutesRollupValue { return { ...data, sumInCardioHeartZone: data["sumInCardioHeartZone"] !== undefined ? String(data["sumInCardioHeartZone"]) : undefined, sumInFatBurnHeartZone: data["sumInFatBurnHeartZone"] !== undefined ? String(data["sumInFatBurnHeartZone"]) : undefined, sumInPeakHeartZone: data["sumInPeakHeartZone"] !== undefined ? String(data["sumInPeakHeartZone"]) : undefined, }; } function deserializeActiveZoneMinutesRollupValue(data: any): ActiveZoneMinutesRollupValue { return { ...data, sumInCardioHeartZone: data["sumInCardioHeartZone"] !== undefined ? BigInt(data["sumInCardioHeartZone"]) : undefined, sumInFatBurnHeartZone: data["sumInFatBurnHeartZone"] !== undefined ? BigInt(data["sumInFatBurnHeartZone"]) : undefined, sumInPeakHeartZone: data["sumInPeakHeartZone"] !== undefined ? BigInt(data["sumInPeakHeartZone"]) : undefined, }; } /** * Internal type to capture activity level during a certain time interval. */ export interface ActivityLevel { /** * Required. Activity level type in the given time interval. */ activityLevelType?: | "ACTIVITY_LEVEL_TYPE_UNSPECIFIED" | "SEDENTARY" | "LIGHTLY_ACTIVE" | "MODERATELY_ACTIVE" | "VERY_ACTIVE"; /** * Required. Observed interval. */ interval?: ObservationTimeInterval; } function serializeActivityLevel(data: any): ActivityLevel { return { ...data, interval: data["interval"] !== undefined ? serializeObservationTimeInterval(data["interval"]) : undefined, }; } function deserializeActivityLevel(data: any): ActivityLevel { return { ...data, interval: data["interval"] !== undefined ? deserializeObservationTimeInterval(data["interval"]) : undefined, }; } /** * Represents the total duration in a specific activity level type. */ export interface ActivityLevelRollupByActivityLevelType { /** * Activity level type. */ activityLevelType?: | "ACTIVITY_LEVEL_TYPE_UNSPECIFIED" | "SEDENTARY" | "LIGHTLY_ACTIVE" | "MODERATELY_ACTIVE" | "VERY_ACTIVE"; /** * Total duration in the activity level type. */ totalDuration?: number /* Duration */; } function serializeActivityLevelRollupByActivityLevelType(data: any): ActivityLevelRollupByActivityLevelType { return { ...data, totalDuration: data["totalDuration"] !== undefined ? data["totalDuration"] : undefined, }; } function deserializeActivityLevelRollupByActivityLevelType(data: any): ActivityLevelRollupByActivityLevelType { return { ...data, totalDuration: data["totalDuration"] !== undefined ? data["totalDuration"] : undefined, }; } /** * Represents the result of the rollup of the activity level data type. */ export interface ActivityLevelRollupValue { /** * List of total durations in each activity level type. */ activityLevelRollupsByActivityLevelType?: ActivityLevelRollupByActivityLevelType[]; } function serializeActivityLevelRollupValue(data: any): ActivityLevelRollupValue { return { ...data, activityLevelRollupsByActivityLevelType: data["activityLevelRollupsByActivityLevelType"] !== undefined ? data["activityLevelRollupsByActivityLevelType"].map((item: any) => (serializeActivityLevelRollupByActivityLevelType(item))) : undefined, }; } function deserializeActivityLevelRollupValue(data: any): ActivityLevelRollupValue { return { ...data, activityLevelRollupsByActivityLevelType: data["activityLevelRollupsByActivityLevelType"] !== undefined ? data["activityLevelRollupsByActivityLevelType"].map((item: any) => (deserializeActivityLevelRollupByActivityLevelType(item))) : undefined, }; } /** * Captures the altitude gain (i.e. deltas), and not level above sea, for a * user in millimeters. */ export interface Altitude { /** * Required. Altitude gain in millimeters over the observed interval. */ gainMillimeters?: bigint; /** * Required. Observed interval. */ interval?: ObservationTimeInterval; } function serializeAltitude(data: any): Altitude { return { ...data, gainMillimeters: data["gainMillimeters"] !== undefined ? String(data["gainMillimeters"]) : undefined, interval: data["interval"] !== undefined ? serializeObservationTimeInterval(data["interval"]) : undefined, }; } function deserializeAltitude(data: any): Altitude { return { ...data, gainMillimeters: data["gainMillimeters"] !== undefined ? BigInt(data["gainMillimeters"]) : undefined, interval: data["interval"] !== undefined ? deserializeObservationTimeInterval(data["interval"]) : undefined, }; } /** * Represents the result of the rollup of the user's altitude. */ export interface AltitudeRollupValue { /** * Sum of the altitude gain in millimeters. */ gainMillimetersSum?: bigint; } function serializeAltitudeRollupValue(data: any): AltitudeRollupValue { return { ...data, gainMillimetersSum: data["gainMillimetersSum"] !== undefined ? String(data["gainMillimetersSum"]) : undefined, }; } function deserializeAltitudeRollupValue(data: any): AltitudeRollupValue { return { ...data, gainMillimetersSum: data["gainMillimetersSum"] !== undefined ? BigInt(data["gainMillimetersSum"]) : undefined, }; } /** * Optional metadata for the application that provided this data. */ export interface Application { /** * Output only. The Google OAuth 2.0 client ID of the web application or * service that recorded the data. This is the client ID used during the * Google OAuth flow to obtain user credentials. This field is * system-populated when the data is uploaded from Google Web API. */ readonly googleWebClientId?: string; /** * Output only. A unique identifier for the mobile application that was the * source of the data. This is typically the application's package name on * Android (e.g., `com.google.fitbit`) or the bundle ID on iOS. This field is * informational and helps trace data origin. This field is system-populated * when the data is uploaded from the Fitbit mobile application, Health * Connect or Health Kit. */ readonly packageName?: string; /** * Output only. The client ID of the application that recorded the data. This * ID is a legacy Fitbit API client ID, which is different from a Google OAuth * client ID. Example format: `ABC123`. This field is system-populated and * used for tracing data from legacy Fitbit API integrations. This field is * system-populated when the data is uploaded from a legacy Fitbit API * integration. */ readonly webClientId?: string; } /** * Request to delete a batch of identifiable data points. */ export interface BatchDeleteDataPointsRequest { /** * Required. The names of the DataPoints to delete. A maximum of 10000 data * points can be deleted in a single request. */ names?: string[]; } /** * Body fat measurement. */ export interface BodyFat { /** * Required. Body fat percentage, in range [0, 100]. */ percentage?: number; /** * Required. The time at which body fat was measured. */ sampleTime?: ObservationSampleTime; } function serializeBodyFat(data: any): BodyFat { return { ...data, sampleTime: data["sampleTime"] !== undefined ? serializeObservationSampleTime(data["sampleTime"]) : undefined, }; } function deserializeBodyFat(data: any): BodyFat { return { ...data, sampleTime: data["sampleTime"] !== undefined ? deserializeObservationSampleTime(data["sampleTime"]) : undefined, }; } /** * Represents the result of the rollup of the body fat data type. */ export interface BodyFatRollupValue { /** * Average body fat percentage. */ bodyFatPercentageAvg?: number; } /** * Represents the result of the rollup of the calories in heart rate zone data * type. */ export interface CaloriesInHeartRateZoneRollupValue { /** * List of calories burned in each heart rate zone. */ caloriesInHeartRateZones?: CaloriesInHeartRateZoneValue[]; } /** * Represents the amount of kilocalories burned in a specific heart rate zone. */ export interface CaloriesInHeartRateZoneValue { /** * The heart rate zone. */ heartRateZone?: | "HEART_RATE_ZONE_TYPE_UNSPECIFIED" | "LIGHT" | "MODERATE" | "VIGOROUS" | "PEAK"; /** * The amount of kilocalories burned in the specified heart rate zone. */ kcal?: number; } /** * Civil time representation similar to google.type.DateTime, but ensures that * neither the timezone nor the UTC offset can be set to avoid confusion between * civil and physical time queries. */ export interface CivilDateTime { /** * Required. Calendar date. */ date?: Date; /** * Optional. Time of day. Defaults to the start of the day, at midnight if * omitted. */ time?: TimeOfDay; } /** * Counterpart of google.type.Interval, but using CivilDateTime. */ export interface CivilTimeInterval { /** * Required. The exclusive end of the range. */ end?: CivilDateTime; /** * Required. The inclusive start of the range. */ start?: CivilDateTime; } /** * Payload for creating a subscriber. */ export interface CreateSubscriberPayload { /** * Required. Authorization mechanism for the subscriber endpoint. The * `secret` within this message is crucial for endpoint verification and for * securing webhook notifications. */ endpointAuthorization?: EndpointAuthorization; /** * Required. The full HTTPS URI where update notifications will be sent. The * URI must be a valid URL and use HTTPS as the scheme. This endpoint will be * verified during the `CreateSubscriber` call. See CreateSubscriber RPC * documentation for verification details. */ endpointUri?: string; /** * Optional. Configuration for the subscriber. */ subscriberConfigs?: SubscriberConfig[]; } /** * Represents the daily heart rate variability data type. At least one of the * following fields must be set: - `average_heart_rate_variability_milliseconds` * - `non_rem_heart_rate_beats_per_minute` - `entropy` - * `deep_sleep_root_mean_square_of_successive_differences_milliseconds` */ export interface DailyHeartRateVariability { /** * Optional. A user's average heart rate variability calculated using the * root mean square of successive differences (RMSSD) in times between * heartbeats. */ averageHeartRateVariabilityMilliseconds?: number; /** * Required. Date (in the user's timezone) of heart rate variability * measurement. */ date?: Date; /** * Optional. The root mean square of successive differences (RMSSD) value * during deep sleep. */ deepSleepRootMeanSquareOfSuccessiveDifferencesMilliseconds?: number; /** * Optional. The Shanon entropy of heartbeat intervals. Entropy quantifies * randomness or disorder in a system. High entropy indicates high HRV. * Entropy is measured from the histogram of time interval between successive * heart beats values measured during sleep. */ entropy?: number; /** * Optional. Non-REM heart rate */ nonRemHeartRateBeatsPerMinute?: bigint; } function serializeDailyHeartRateVariability(data: any): DailyHeartRateVariability { return { ...data, nonRemHeartRateBeatsPerMinute: data["nonRemHeartRateBeatsPerMinute"] !== undefined ? String(data["nonRemHeartRateBeatsPerMinute"]) : undefined, }; } function deserializeDailyHeartRateVariability(data: any): DailyHeartRateVariability { return { ...data, nonRemHeartRateBeatsPerMinute: data["nonRemHeartRateBeatsPerMinute"] !== undefined ? BigInt(data["nonRemHeartRateBeatsPerMinute"]) : undefined, }; } /** * User's heart rate zone thresholds based on the Karvonen algorithm for a * specific day. */ export interface DailyHeartRateZones { /** * Required. Date (in user's timezone) of the heart rate zones record. */ date?: Date; /** * Required. The heart rate zones. */ heartRateZones?: HeartRateZone[]; } function serializeDailyHeartRateZones(data: any): DailyHeartRateZones { return { ...data, heartRateZones: data["heartRateZones"] !== undefined ? data["heartRateZones"].map((item: any) => (serializeHeartRateZone(item))) : undefined, }; } function deserializeDailyHeartRateZones(data: any): DailyHeartRateZones { return { ...data, heartRateZones: data["heartRateZones"] !== undefined ? data["heartRateZones"].map((item: any) => (deserializeHeartRateZone(item))) : undefined, }; } /** * A daily oxygen saturation (SpO2) record. Represents the user's daily oxygen * saturation summary, typically calculated during sleep. */ export interface DailyOxygenSaturation { /** * Required. The average value of the oxygen saturation samples during the * sleep. */ averagePercentage?: number; /** * Required. Date (in user's timezone) of the daily oxygen saturation record. */ date?: Date; /** * Required. The lower bound of the confidence interval of oxygen saturation * samples during sleep. */ lowerBoundPercentage?: number; /** * Optional. Standard deviation of the daily oxygen saturation averages from * the past 7-30 days. */ standardDeviationPercentage?: number; /** * Required. The upper bound of the confidence interval of oxygen saturation * samples during sleep. */ upperBoundPercentage?: number; } /** * A daily average respiratory rate (breaths per minute) for a day of the year. * One data point per day calculated for the main sleep. */ export interface DailyRespiratoryRate { /** * Required. The average number of breaths taken per minute. */ breathsPerMinute?: number; /** * Required. The date on which the respiratory rate was measured. */ date?: Date; } /** * Measures the daily resting heart rate for a user, calculated using the all * day heart rate measurements. */ export interface DailyRestingHeartRate { /** * Required. The resting heart rate value in beats per minute. */ beatsPerMinute?: bigint; /** * Optional. Metadata for the daily resting heart rate. */ dailyRestingHeartRateMetadata?: DailyRestingHeartRateMetadata; /** * Required. Date (in the user's timezone) of the resting heart rate * measurement. */ date?: Date; } function serializeDailyRestingHeartRate(data: any): DailyRestingHeartRate { return { ...data, beatsPerMinute: data["beatsPerMinute"] !== undefined ? String(data["beatsPerMinute"]) : undefined, }; } function deserializeDailyRestingHeartRate(data: any): DailyRestingHeartRate { return { ...data, beatsPerMinute: data["beatsPerMinute"] !== undefined ? BigInt(data["beatsPerMinute"]) : undefined, }; } /** * Metadata for the daily resting heart rate. */ export interface DailyRestingHeartRateMetadata { /** * Required. The method used to calculate the resting heart rate. */ calculationMethod?: | "CALCULATION_METHOD_UNSPECIFIED" | "WITH_SLEEP" | "ONLY_WITH_AWAKE_DATA"; } /** * Value of a daily rollup for a single civil time interval (aggregation * window) */ export interface DailyRollupDataPoint { /** * Returned by default when rolling up data points from the `active-minutes` * data type, or when requested explicitly using the `active-minutes` rollup * type identifier. */ activeMinutes?: ActiveMinutesRollupValue; /** * Returned by default when rolling up data points from the * `active-zone-minutes` data type, or when requested explicitly using the * `active-zone-minutes` rollup type identifier. */ activeZoneMinutes?: ActiveZoneMinutesRollupValue; /** * Returned by default when rolling up data points from the `activity-level` * data type, or when requested explicitly using the `activity-level` rollup * type identifier. */ activityLevel?: ActivityLevelRollupValue; /** * Returned by default when rolling up data points from the `altitude` data * type, or when requested explicitly using the `altitude` rollup type * identifier. */ altitude?: AltitudeRollupValue; /** * Returned by default when rolling up data points from the `body-fat` data * type, or when requested explicitly using the `body-fat` rollup type * identifier. */ bodyFat?: BodyFatRollupValue; /** * Returned by default when rolling up data points from the * `calories-in-heart-rate-zone` data type, or when requested explicitly using * the `calories-in-heart-rate-zone` rollup type identifier. */ caloriesInHeartRateZone?: CaloriesInHeartRateZoneRollupValue; /** * End time of the window this value aggregates over */ civilEndTime?: CivilDateTime; /** * Start time of the window this value aggregates over */ civilStartTime?: CivilDateTime; /** * Returned by default when rolling up data points from the `distance` data * type, or when requested explicitly using the `distance` rollup type * identifier. */ distance?: DistanceRollupValue; /** * Returned by default when rolling up data points from the `floors` data * type, or when requested explicitly using the `floors` rollup type * identifier. */ floors?: FloorsRollupValue; /** * Returned by default when rolling up data points from the `heart-rate` data * type, or when requested explicitly using the `heart-rate` rollup type * identifier. */ heartRate?: HeartRateRollupValue; /** * Returned by default when rolling up data points from the * `daily-heart-rate-variability` data type, or when requested explicitly * using the `heart-rate-variability-personal-range` rollup type identifier. */ heartRateVariabilityPersonalRange?: HeartRateVariabilityPersonalRangeRollupValue; /** * Returned by default when rolling up data points from the `hydration-log` * data type, or when requested explicitly using the `hydration-log` rollup * type identifier. */ hydrationLog?: HydrationLogRollupValue; /** * Returned by default when rolling up data points from the * `daily-resting-heart-rate` data type, or when requested explicitly using * the `resting-heart-rate-personal-range` rollup type identifier. */ restingHeartRatePersonalRange?: RestingHeartRatePersonalRangeRollupValue; /** * Returned by default when rolling up data points from the `run-vo2-max` * data type, or when requested explicitly using the `run-vo2-max` rollup type * identifier. */ runVo2Max?: RunVO2MaxRollupValue; /** * Returned by default when rolling up data points from the * `sedentary-period` data type, or when requested explicitly using the * `sedentary-period` rollup type identifier. */ sedentaryPeriod?: SedentaryPeriodRollupValue; /** * Returned by default when rolling up data points from the `steps` data * type, or when requested explicitly using the `steps` rollup type * identifier. */ steps?: StepsRollupValue; /** * Returned by default when rolling up data points from the * `swim-lengths-data` data type, or when requested explicitly using the * `swim-lengths-data` rollup type identifier. */ swimLengthsData?: SwimLengthsDataRollupValue; /** * Returned by default when rolling up data points from the * `time-in-heart-rate-zone` data type, or when requested explicitly using the * `time-in-heart-rate-zone` rollup type identifier. */ timeInHeartRateZone?: TimeInHeartRateZoneRollupValue; /** * Returned by default when rolling up data points from the `total-calories` * data type, or when requested explicitly using the `total-calories` rollup * type identifier. */ totalCalories?: TotalCaloriesRollupValue; /** * Returned by default when rolling up data points from the `weight` data * type, or when requested explicitly using the `weight` rollup type * identifier. */ weight?: WeightRollupValue; } function serializeDailyRollupDataPoint(data: any): DailyRollupDataPoint { return { ...data, activeMinutes: data["activeMinutes"] !== undefined ? serializeActiveMinutesRollupValue(data["activeMinutes"]) : undefined, activeZoneMinutes: data["activeZoneMinutes"] !== undefined ? serializeActiveZoneMinutesRollupValue(data["activeZoneMinutes"]) : undefined, activityLevel: data["activityLevel"] !== undefined ? serializeActivityLevelRollupValue(data["activityLevel"]) : undefined, altitude: data["altitude"] !== undefined ? serializeAltitudeRollupValue(data["altitude"]) : undefined, distance: data["distance"] !== undefined ? serializeDistanceRollupValue(data["distance"]) : undefined, floors: data["floors"] !== undefined ? serializeFloorsRollupValue(data["floors"]) : undefined, sedentaryPeriod: data["sedentaryPeriod"] !== undefined ? serializeSedentaryPeriodRollupValue(data["sedentaryPeriod"]) : undefined, steps: data["steps"] !== undefined ? serializeStepsRollupValue(data["steps"]) : undefined, swimLengthsData: data["swimLengthsData"] !== undefined ? serializeSwimLengthsDataRollupValue(data["swimLengthsData"]) : undefined, timeInHeartRateZone: data["timeInHeartRateZone"] !== undefined ? serializeTimeInHeartRateZoneRollupValue(data["timeInHeartRateZone"]) : undefined, }; } function deserializeDailyRollupDataPoint(data: any): DailyRollupDataPoint { return { ...data, activeMinutes: data["activeMinutes"] !== undefined ? deserializeActiveMinutesRollupValue(data["activeMinutes"]) : undefined, activeZoneMinutes: data["activeZoneMinutes"] !== undefined ? deserializeActiveZoneMinutesRollupValue(data["activeZoneMinutes"]) : undefined, activityLevel: data["activityLevel"] !== undefined ? deserializeActivityLevelRollupValue(data["activityLevel"]) : undefined, altitude: data["altitude"] !== undefined ? deserializeAltitudeRollupValue(data["altitude"]) : undefined, distance: data["distance"] !== undefined ? deserializeDistanceRollupValue(data["distance"]) : undefined, floors: data["floors"] !== undefined ? deserializeFloorsRollupValue(data["floors"]) : undefined, sedentaryPeriod: data["sedentaryPeriod"] !== undefined ? deserializeSedentaryPeriodRollupValue(data["sedentaryPeriod"]) : undefined, steps: data["steps"] !== undefined ? deserializeStepsRollupValue(data["steps"]) : undefined, swimLengthsData: data["swimLengthsData"] !== undefined ? deserializeSwimLengthsDataRollupValue(data["swimLengthsData"]) : undefined, timeInHeartRateZone: data["timeInHeartRateZone"] !== undefined ? deserializeTimeInHeartRateZoneRollupValue(data["timeInHeartRateZone"]) : undefined, }; } /** * Request to roll up data points by civil time intervals. */ export interface DailyRollUpDataPointsRequest { /** * Optional. The data source family name to roll up. If empty, data points * from all available data sources will be rolled up. Format: * `users/me/dataSourceFamilies/{data_source_family}` The supported values * are: - `users/me/dataSourceFamilies/all-sources` - default value - * `users/me/dataSourceFamilies/google-wearables` - tracker devices - * `users/me/dataSourceFamilies/google-sources` - Google first party sources */ dataSourceFamily?: string; /** * Optional. The maximum number of data points to return. If unspecified, at * most 1440 data points will be returned. The maximum page size is 10000; * values above that will be truncated accordingly. */ pageSize?: number; /** * Optional. The `next_page_token` from a previous request, if any. All other * request fields need to be the same as in the initial request when the page * token is specified. */ pageToken?: string; /** * Required. Closed-open range of data points that will be rolled up. The * start time must be aligned with the aggregation window. The maximum range * for `calories-in-heart-rate-zone`, `heart-rate`, `active-minutes` and * `total-calories` is 14 days. The maximum range for all other data types is * 90 days. */ range?: CivilTimeInterval; /** * Optional. Aggregation window size, in number of days. Defaults to 1 if not * specified. */ windowSizeDays?: number; } /** * Response containing the list of rolled up data points. */ export interface DailyRollUpDataPointsResponse { /** * Values for each aggregation time window. */ rollupDataPoints?: DailyRollupDataPoint[]; } function serializeDailyRollUpDataPointsResponse(data: any): DailyRollUpDataPointsResponse { return { ...data, rollupDataPoints: data["rollupDataPoints"] !== undefined ? data["rollupDataPoints"].map((item: any) => (serializeDailyRollupDataPoint(item))) : undefined, }; } function deserializeDailyRollUpDataPointsResponse(data: any): DailyRollUpDataPointsResponse { return { ...data, rollupDataPoints: data["rollupDataPoints"] !== undefined ? data["rollupDataPoints"].map((item: any) => (deserializeDailyRollupDataPoint(item))) : undefined, }; } /** * Provides derived sleep temperature values, calculated from skin or internal * device temperature readings during sleep. */ export interface DailySleepTemperatureDerivations { /** * Optional. The user's baseline skin temperature. It is the median of the * user's nightly skin temperature over the past 30 days. */ baselineTemperatureCelsius?: number; /** * Required. Date for which the sleep temperature derivations are calculated. */ date?: Date; /** * Required. The user's nightly skin temperature. It is the mean of skin * temperature samples taken from the user’s sleep. */ nightlyTemperatureCelsius?: number; /** * Optional. The standard deviation of the user’s relative nightly skin * temperature (temperature - baseline) over the past 30 days. */ relativeNightlyStddev30dCelsius?: number; } /** * Contains a daily summary of the user's VO2 max (cardio fitness score), which * is the maximum rate of oxygen the body can use during exercise. */ export interface DailyVO2Max { /** * Optional. Represents the user's cardio fitness level based on their VO2 * max. */ cardioFitnessLevel?: | "CARDIO_FITNESS_LEVEL_UNSPECIFIED" | "POOR" | "FAIR" | "AVERAGE" | "GOOD" | "VERY_GOOD" | "EXCELLENT"; /** * Required. The date for which the Daily VO2 max was measured. */ date?: Date; /** * Optional. An estimated field is added to indicate when the confidence has * decreased sufficiently to consider the value an estimation. */ estimated?: boolean; /** * Required. Daily VO2 max value measured as in ml consumed oxygen / kg of * body weight / min. */ vo2Max?: number; /** * Optional. The covariance of the VO2 max value. */ vo2MaxCovariance?: number; } /** * A computed or recorded metric. */ export interface DataPoint { /** * Optional. Data for points in the `active-minutes` interval data type * collection. */ activeMinutes?: ActiveMinutes; /** * Optional. Data for points in the `active-zone-minutes` interval data type * collection, measured in minutes. */ activeZoneMinutes?: ActiveZoneMinutes; /** * Optional. Data for points in the `activity-level` daily data type * collection. */ activityLevel?: ActivityLevel; /** * Optional. Data for points in the `altitude` interval data type collection. */ altitude?: Altitude; /** * Optional. Data for points in the `body-fat` sample data type collection. */ bodyFat?: BodyFat; /** * Optional. Data for points in the `daily-heart-rate-variability` daily data * type collection. */ dailyHeartRateVariability?: DailyHeartRateVariability; /** * Optional. Data for points in the `daily-heart-rate-zones` daily data type * collection. */ dailyHeartRateZones?: DailyHeartRateZones; /** * Optional. Data for points in the `daily-oxygen-saturation` daily data type * collection. */ dailyOxygenSaturation?: DailyOxygenSaturation; /** * Optional. Data for points in the `daily-respiratory-rate` daily data type * collection. */ dailyRespiratoryRate?: DailyRespiratoryRate; /** * Optional. Data for points in the `daily-resting-heart-rate` daily data * type collection. */ dailyRestingHeartRate?: DailyRestingHeartRate; /** * Optional. Data for points in the `daily-sleep-temperature-derivations` * daily data type collection. */ dailySleepTemperatureDerivations?: DailySleepTemperatureDerivations; /** * Optional. Data for points in the `daily-vo2-max` daily data type * collection. */ dailyVo2Max?: DailyVO2Max; /** * Optional. Data source information for the metric */ dataSource?: DataSource; /** * Optional. Data for points in the `distance` interval data type collection. */ distance?: Distance; /** * Optional. Data for points in the `exercise` session data type collection. */ exercise?: Exercise; /** * Optional. Data for points in the `floors` interval data type collection. */ floors?: Floors; /** * Optional. Data for points in the `heart-rate` sample data type collection. */ heartRate?: HeartRate; /** * Optional. Data for points in the `heart-rate-variability` sample data type * collection. */ heartRateVariability?: HeartRateVariability; /** * Optional. Data for points in the `height` sample data type collection. */ height?: Height; /** * Optional. Data for points in the `hydration-log` session data type * collection. */ hydrationLog?: HydrationLog; /** * Identifier. Data point name, only supported for the subset of identifiable * data types. For the majority of the data types, individual data points do * not need to be identified and this field would be empty. Format: * `users/{user}/dataTypes/{data_type}/dataPoints/{data_point}` Example: * `users/abcd1234/dataTypes/sleep/dataPoints/a1b2c3d4-e5f6-7890-1234-567890abcdef` * The `{user}` ID is a system-generated identifier, as described in * Identity.health_user_id. The `{data_type}` ID corresponds to the kebab-case * version of the field names in the DataPoint data union field, e.g. * `total-calories` for the `total_calories` field. The `{data_point}` ID can * be client-provided or system-generated. If client-provided, it must be a * string of 4-63 characters, containing only lowercase letters, numbers, and * hyphens. */ name?: string; /** * Optional. Data for points in the `oxygen-saturation` sample data type * collection. */ oxygenSaturation?: OxygenSaturation; /** * Optional. Data for points in the `respiratory-rate-sleep-summary` sample * data type collection. */ respiratoryRateSleepSummary?: RespiratoryRateSleepSummary; /** * Optional. Data for points in the `run-vo2-max` sample data type * collection. */ runVo2Max?: RunVO2Max; /** * Optional. Data for points in the `sedentary-period` interval data type * collection. */ sedentaryPeriod?: SedentaryPeriod; /** * Optional. Data for points in the `sleep` session data type collection. */ sleep?: Sleep; /** * Optional. Data for points in the `steps` interval data type collection. */ steps?: Steps; /** * Optional. Data for points in the `swim-lengths-data` interval data type * collection. */ swimLengthsData?: SwimLengthsData; /** * Optional. Data for points in the `time-in-heart-rate-zone` interval data * type collection. */ timeInHeartRateZone?: TimeInHeartRateZone; /** * Optional. Data for points in the `vo2-max` sample data type collection. */ vo2Max?: VO2Max; /** * Optional. Data for points in the `weight` sample data type collection. */ weight?: Weight; } function serializeDataPoint(data: any): DataPoint { return { ...data, activeMinutes: data["activeMinutes"] !== undefined ? serializeActiveMinutes(data["activeMinutes"]) : undefined, activeZoneMinutes: data["activeZoneMinutes"] !== undefined ? serializeActiveZoneMinutes(data["activeZoneMinutes"]) : undefined, activityLevel: data["activityLevel"] !== undefined ? serializeActivityLevel(data["activityLevel"]) : undefined, altitude: data["altitude"] !== undefined ? serializeAltitude(data["altitude"]) : undefined, bodyFat: data["bodyFat"] !== undefined ? serializeBodyFat(data["bodyFat"]) : undefined, dailyHeartRateVariability: data["dailyHeartRateVariability"] !== undefined ? serializeDailyHeartRateVariability(data["dailyHeartRateVariability"]) : undefined, dailyHeartRateZones: data["dailyHeartRateZones"] !== undefined ? serializeDailyHeartRateZones(data["dailyHeartRateZones"]) : undefined, dailyRestingHeartRate: data["dailyRestingHeartRate"] !== undefined ? serializeDailyRestingHeartRate(data["dailyRestingHeartRate"]) : undefined, distance: data["distance"] !== undefined ? serializeDistance(data["distance"]) : undefined, exercise: data["exercise"] !== undefined ? serializeExercise(data["exercise"]) : undefined, floors: data["floors"] !== undefined ? serializeFloors(data["floors"]) : undefined, heartRate: data["heartRate"] !== undefined ? serializeHeartRate(data["heartRate"]) : undefined, heartRateVariability: data["heartRateVariability"] !== undefined ? serializeHeartRateVariability(data["heartRateVariability"]) : undefined, height: data["height"] !== undefined ? serializeHeight(data["height"]) : undefined, hydrationLog: data["hydrationLog"] !== undefined ? serializeHydrationLog(data["hydrationLog"]) : undefined, oxygenSaturation: data["oxygenSaturation"] !== undefined ? serializeOxygenSaturation(data["oxygenSaturation"]) : undefined, respiratoryRateSleepSummary: data["respiratoryRateSleepSummary"] !== undefined ? serializeRespiratoryRateSleepSummary(data["respiratoryRateSleepSummary"]) : undefined, runVo2Max: data["runVo2Max"] !== undefined ? serializeRunVO2Max(data["runVo2Max"]) : undefined, sedentaryPeriod: data["sedentaryPeriod"] !== undefined ? serializeSedentaryPeriod(data["sedentaryPeriod"]) : undefined, sleep: data["sleep"] !== undefined ? serializeSleep(data["sleep"]) : undefined, steps: data["steps"] !== undefined ? serializeSteps(data["steps"]) : undefined, swimLengthsData: data["swimLengthsData"] !== undefined ? serializeSwimLengthsData(data["swimLengthsData"]) : undefined, timeInHeartRateZone: data["timeInHeartRateZone"] !== undefined ? serializeTimeInHeartRateZone(data["timeInHeartRateZone"]) : undefined, vo2Max: data["vo2Max"] !== undefined ? serializeVO2Max(data["vo2Max"]) : undefined, weight: data["weight"] !== undefined ? serializeWeight(data["weight"]) : undefined, }; } function deserializeDataPoint(data: any): DataPoint { return { ...data, activeMinutes: data["activeMinutes"] !== undefined ? deserializeActiveMinutes(data["activeMinutes"]) : undefined, activeZoneMinutes: data["activeZoneMinutes"] !== undefined ? deserializeActiveZoneMinutes(data["activeZoneMinutes"]) : undefined, activityLevel: data["activityLevel"] !== undefined ? deserializeActivityLevel(data["activityLevel"]) : undefined, altitude: data["altitude"] !== undefined ? deserializeAltitude(data["altitude"]) : undefined, bodyFat: data["bodyFat"] !== undefined ? deserializeBodyFat(data["bodyFat"]) : undefined, dailyHeartRateVariability: data["dailyHeartRateVariability"] !== undefined ? deserializeDailyHeartRateVariability(data["dailyHeartRateVariability"]) : undefined, dailyHeartRateZones: data["dailyHeartRateZones"] !== undefined ? deserializeDailyHeartRateZones(data["dailyHeartRateZones"]) : undefined, dailyRestingHeartRate: data["dailyRestingHeartRate"] !== undefined ? deserializeDailyRestingHeartRate(data["dailyRestingHeartRate"]) : undefined, distance: data["distance"] !== undefined ? deserializeDistance(data["distance"]) : undefined, exercise: data["exercise"] !== undefined ? deserializeExercise(data["exercise"]) : undefined, floors: data["floors"] !== undefined ? deserializeFloors(data["floors"]) : undefined, heartRate: data["heartRate"] !== undefined ? deserializeHeartRate(data["heartRate"]) : undefined, heartRateVariability: data["heartRateVariability"] !== undefined ? deserializeHeartRateVariability(data["heartRateVariability"]) : undefined, height: data["height"] !== undefined ? deserializeHeight(data["height"]) : undefined, hydrationLog: data["hydrationLog"] !== undefined ? deserializeHydrationLog(data["hydrationLog"]) : undefined, oxygenSaturation: data["oxygenSaturation"] !== undefined ? deserializeOxygenSaturation(data["oxygenSaturation"]) : undefined, respiratoryRateSleepSummary: data["respiratoryRateSleepSummary"] !== undefined ? deserializeRespiratoryRateSleepSummary(data["respiratoryRateSleepSummary"]) : undefined, runVo2Max: data["runVo2Max"] !== undefined ? deserializeRunVO2Max(data["runVo2Max"]) : undefined, sedentaryPeriod: data["sedentaryPeriod"] !== undefined ? deserializeSedentaryPeriod(data["sedentaryPeriod"]) : undefined, sleep: data["sleep"] !== undefined ? deserializeSleep(data["sleep"]) : undefined, steps: data["steps"] !== undefined ? deserializeSteps(data["steps"]) : undefined, swimLengthsData: data["swimLengthsData"] !== undefined ? deserializeSwimLengthsData(data["swimLengthsData"]) : undefined, timeInHeartRateZone: data["timeInHeartRateZone"] !== undefined ? deserializeTimeInHeartRateZone(data["timeInHeartRateZone"]) : undefined, vo2Max: data["vo2Max"] !== undefined ? deserializeVO2Max(data["vo2Max"]) : undefined, weight: data["weight"] !== undefined ? deserializeWeight(data["weight"]) : undefined, }; } /** * Data Source definition to track the origin of data. Each health data point, * regardless of the complexity or data model (whether a simple step count or a * detailed sleep session) must retain information about its source of origin * (e.g. the device or app that collected it). */ export interface DataSource { /** * Output only. Captures metadata for the application that provided this * data. */ readonly application?: Application; /** * Optional. Captures metadata for raw data points originating from devices. * We expect this data source to be used for data points written on device * sync. */ device?: Device; /** * Output only. Captures the platform that uploaded the data. */ readonly platform?: | "PLATFORM_UNSPECIFIED" | "FITBIT" | "HEALTH_CONNECT" | "HEALTH_KIT" | "FIT" | "FITBIT_WEB_API" | "NEST" | "GOOGLE_WEB_API" | "GOOGLE_PARTNER_INTEGRATION"; /** * Optional. Captures how the data was recorded. */ recordingMethod?: | "RECORDING_METHOD_UNSPECIFIED" | "MANUAL" | "PASSIVELY_MEASURED" | "DERIVED" | "ACTIVELY_MEASURED" | "UNKNOWN"; } /** * Represents a whole or partial calendar date, such as a birthday. The time of * day and time zone are either specified elsewhere or are insignificant. The * date is relative to the Gregorian Calendar. This can represent one of the * following: * A full date, with non-zero year, month, and day values. * A * month and day, with a zero year (for example, an anniversary). * A year on * its own, with a zero month and a zero day. * A year and month, with a zero * day (for example, a credit card expiration date). Related types: * * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp */ export interface Date { /** * Day of a month. Must be from 1 to 31 and valid for the year and month, or * 0 to specify a year by itself or a year and month where the day isn't * significant. */ day?: number; /** * Month of a year. Must be from 1 to 12, or 0 to specify a year without a * month and day. */ month?: number; /** * Year of the date. Must be from 1 to 9999, or 0 to specify a date without a * year. */ year?: number; } /** * Represents civil time (or occasionally physical time). This type can * represent a civil time in one of a few possible ways: * When utc_offset is * set and time_zone is unset: a civil time on a calendar day with a particular * offset from UTC. * When time_zone is set and utc_offset is unset: a civil * time on a calendar day in a particular time zone. * When neither time_zone * nor utc_offset is set: a civil time on a calendar day in local time. The date * is relative to the Proleptic Gregorian Calendar. If year, month, or day are * 0, the DateTime is considered not to have a specific year, month, or day * respectively. This type may also be used to represent a physical time if all * the date and time fields are set and either case of the `time_offset` oneof * is set. Consider using `Timestamp` message for physical time instead. If your * use case also would like to store the user's timezone, that can be done in * another field. This type is more flexible than some applications may want. * Make sure to document and validate your application's limitations. */ export interface DateTime { /** * Optional. Day of month. Must be from 1 to 31 and valid for the year and * month, or 0 if specifying a datetime without a day. */ day?: number; /** * Optional. Hours of day in 24 hour format. Should be from 0 to 23, defaults * to 0 (midnight). An API may choose to allow the value "24:00:00" for * scenarios like business closing time. */ hours?: number; /** * Optional. Minutes of hour of day. Must be from 0 to 59, defaults to 0. */ minutes?: number; /** * Optional. Month of year. Must be from 1 to 12, or 0 if specifying a * datetime without a month. */ month?: number; /** * Optional. Fractions of seconds in nanoseconds. Must be from 0 to * 999,999,999, defaults to 0. */ nanos?: number; /** * Optional. Seconds of minutes of the time. Must normally be from 0 to 59, * defaults to 0. An API may allow the value 60 if it allows leap-seconds. */ seconds?: number; /** * Time zone. */ timeZone?: TimeZone; /** * UTC offset. Must be whole seconds, between -18 hours and +18 hours. For * example, a UTC offset of -4:00 would be represented as { seconds: -14400 }. */ utcOffset?: number /* Duration */; /** * Optional. Year of date. Must be from 1 to 9999, or 0 if specifying a * datetime without a year. */ year?: number; } function serializeDateTime(data: any): DateTime { return { ...data, utcOffset: data["utcOffset"] !== undefined ? data["utcOffset"] : undefined, }; } function deserializeDateTime(data: any): DateTime { return { ...data, utcOffset: data["utcOffset"] !== undefined ? data["utcOffset"] : undefined, }; } /** * Captures metadata about the device that recorded the measurement. */ export interface Device { /** * Optional. An optional name for the device. */ displayName?: string; /** * Optional. Captures the form factor of the device. */ formFactor?: | "FORM_FACTOR_UNSPECIFIED" | "FITNESS_BAND" | "WATCH" | "PHONE" | "RING" | "CHEST_STRAP" | "SCALE" | "TABLET" | "HEAD_MOUNTED" | "SMART_DISPLAY"; /** * Optional. An optional manufacturer of the device. */ manufacturer?: string; } /** * Distance traveled over an interval of time. */ export interface Distance { /** * Required. Observed interval. */ interval?: ObservationTimeInterval; /** * Required. Distance in millimeters over the observed interval. */ millimeters?: bigint; } function serializeDistance(data: any): Distance { return { ...data, interval: data["interval"] !== undefined ? serializeObservationTimeInterval(data["interval"]) : undefined, millimeters: data["millimeters"] !== undefined ? String(data["millimeters"]) : undefined, }; } function deserializeDistance(data: any): Distance { return { ...data, interval: data["interval"] !== undefined ? deserializeObservationTimeInterval(data["interval"]) : undefined, millimeters: data["millimeters"] !== undefined ? BigInt(data["millimeters"]) : undefined, }; } /** * Result of the rollup of the user's distance. */ export interface DistanceRollupValue { /** * Sum of the distance in millimeters. */ millimetersSum?: bigint; } function serializeDistanceRollupValue(data: any): DistanceRollupValue { return { ...data, millimetersSum: data["millimetersSum"] !== undefined ? String(data["millimetersSum"]) : undefined, }; } function deserializeDistanceRollupValue(data: any): DistanceRollupValue { return { ...data, millimetersSum: data["millimetersSum"] !== undefined ? BigInt(data["millimetersSum"]) : undefined, }; } /** * Authorization mechanism for a subscriber endpoint. For all requests sent by * the Webhooks service, the JSON payload is cryptographically signed. The * signature is delivered in the `X-HEALTHAPI-SIGNATURE` HTTP header. This is an * ECDSA (NIST P256) signature of the JSON payload. Clients must verify this * signature using Google Health API's public key to confirm the payload was * sent by the Health API. */ export interface EndpointAuthorization { /** * Required. Input only. Provides a client-provided secret that will be sent * with each notification to the subscriber endpoint using the "Authorization" * header. The value must include the authorization scheme, e.g., "Bearer " or * "Basic ", as it will be used as the full Authorization header value. This * secret is used by the API to test the endpoint during `CreateSubscriber` * and `UpdateSubscriber` calls, and will be sent in the `Authorization` * header for all subsequent webhook notifications to this endpoint. */ secret?: string; /** * Output only. Whether the secret is set. */ readonly secretSet?: boolean; } /** * An exercise that stores information about a physical activity. */ export interface Exercise { /** * Optional. Duration excluding pauses. */ activeDuration?: number /* Duration */; /** * Output only. Represents the timestamp of the creation of the exercise. */ readonly createTime?: Date; /** * Required. Exercise display name. */ displayName?: string; /** * Optional. Exercise events that happen during an exercise, such as pause & * restarts. */ exerciseEvents?: ExerciseEvent[]; /** * Optional. Additional exercise metadata. */ exerciseMetadata?: ExerciseMetadata; /** * Required. The type of activity performed during an exercise. */ exerciseType?: | "EXERCISE_TYPE_UNSPECIFIED" | "RUNNING" | "WALKING" | "BIKING" | "SWIMMING" | "HIKING" | "YOGA" | "PILATES" | "WORKOUT" | "HIIT" | "WEIGHTLIFTING" | "STRENGTH_TRAINING" | "OTHER"; /** * Required. Observed exercise interval */ interval?: SessionTimeInterval; /** * Required. Summary metrics for this exercise ( ) */ metricsSummary?: MetricsSummary; /** * Optional. Standard free-form notes captured at manual logging. */ notes?: string; /** * Optional. The default split is 1 km or 1 mile. - if the movement distance * is less than the default, then there are no splits - if the movement * distance is greater than or equal to the default, then we have splits */ splits?: SplitSummary[]; /** * Optional. Laps or splits recorded within an exercise. Laps could be split * based on distance or other criteria (duration, etc.) Laps should not be * overlapping with each other. */ splitSummaries?: SplitSummary[]; /** * Output only. This is the timestamp of the last update to the exercise. */ readonly updateTime?: Date; } function serializeExercise(data: any): Exercise { return { ...data, activeDuration: data["activeDuration"] !== undefined ? data["activeDuration"] : undefined, exerciseEvents: data["exerciseEvents"] !== undefined ? data["exerciseEvents"].map((item: any) => (serializeExerciseEvent(item))) : undefined, exerciseMetadata: data["exerciseMetadata"] !== undefined ? serializeExerciseMetadata(data["exerciseMetadata"]) : undefined, interval: data["interval"] !== undefined ? serializeSessionTimeInterval(data["interval"]) : undefined, metricsSummary: data["metricsSummary"] !== undefined ? serializeMetricsSummary(data["metricsSummary"]) : undefined, splits: data["splits"] !== undefined ? data["splits"].map((item: any) => (serializeSplitSummary(item))) : undefined, splitSummaries: data["splitSummaries"] !== undefined ? data["splitSummaries"].map((item: any) => (serializeSplitSummary(item))) : undefined, }; } function deserializeExercise(data: any): Exercise { return { ...data, activeDuration: data["activeDuration"] !== undefined ? data["activeDuration"] : undefined, createTime: data["createTime"] !== undefined ? new Date(data["createTime"]) : undefined, exerciseEvents: data["exerciseEvents"] !== undefined ? data["exerciseEvents"].map((item: any) => (deserializeExerciseEvent(item))) : undefined, exerciseMetadata: data["exerciseMetadata"] !== undefined ? deserializeExerciseMetadata(data["exerciseMetadata"]) : undefined, interval: data["interval"] !== undefined ? deserializeSessionTimeInterval(data["interval"]) : undefined, metricsSummary: data["metricsSummary"] !== undefined ? deserializeMetricsSummary(data["metricsSummary"]) : undefined, splits: data["splits"] !== undefined ? data["splits"].map((item: any) => (deserializeSplitSummary(item))) : undefined, splitSummaries: data["splitSummaries"] !== undefined ? data["splitSummaries"].map((item: any) => (deserializeSplitSummary(item))) : undefined, updateTime: data["updateTime"] !== undefined ? new Date(data["updateTime"]) : undefined, }; } /** * Represents instantaneous events that happen during an exercise, such as * start, stop, pause, split. */ export interface ExerciseEvent { /** * Required. Exercise event time */ eventTime?: Date; /** * Required. Exercise event time offset from UTC */ eventUtcOffset?: number /* Duration */; /** * Required. The type of the event, such as start, stop, pause, resume. */ exerciseEventType?: | "EXERCISE_EVENT_TYPE_UNSPECIFIED" | "START" | "STOP" | "PAUSE" | "RESUME" | "AUTO_PAUSE" | "AUTO_RESUME"; } function serializeExerciseEvent(data: any): ExerciseEvent { return { ...data, eventTime: data["eventTime"] !== undefined ? data["eventTime"].toISOString() : undefined, eventUtcOffset: data["eventUtcOffset"] !== undefined ? data["eventUtcOffset"] : undefined, }; } function deserializeExerciseEvent(data: any): ExerciseEvent { return { ...data, eventTime: data["eventTime"] !== undefined ? new Date(data["eventTime"]) : undefined, eventUtcOffset: data["eventUtcOffset"] !== undefined ? data["eventUtcOffset"] : undefined, }; } /** * Additional exercise metadata. */ export interface ExerciseMetadata { /** * Optional. Whether the exercise had GPS tracking. */ hasGps?: boolean; /** * Optional. Pool length in millimeters. Only present in the swimming * exercises. */ poolLengthMillimeters?: bigint; } function serializeExerciseMetadata(data: any): ExerciseMetadata { return { ...data, poolLengthMillimeters: data["poolLengthMillimeters"] !== undefined ? String(data["poolLengthMillimeters"]) : undefined, }; } function deserializeExerciseMetadata(data: any): ExerciseMetadata { return { ...data, poolLengthMillimeters: data["poolLengthMillimeters"] !== undefined ? BigInt(data["poolLengthMillimeters"]) : undefined, }; } /** * Represents a Response for exporting exercise data in TCX format. */ export interface ExportExerciseTcxResponse { /** * Contains the exported TCX data. */ tcxData?: string; } /** * Gained elevation measured in floors over the time interval */ export interface Floors { /** * Required. Number of floors in the recorded interval */ count?: bigint; /** * Required. Observed interval */ interval?: ObservationTimeInterval; } function serializeFloors(data: any): Floors { return { ...data, count: data["count"] !== undefined ? String(data["count"]) : undefined, interval: data["interval"] !== undefined ? serializeObservationTimeInterval(data["interval"]) : undefined, }; } function deserializeFloors(data: any): Floors { return { ...data, count: data["count"] !== undefined ? BigInt(data["count"]) : undefined, interval: data["interval"] !== undefined ? deserializeObservationTimeInterval(data["interval"]) : undefined, }; } /** * Represents the result of the rollup of the user's floors. */ export interface FloorsRollupValue { /** * Sum of the floors count. */ countSum?: bigint; } function serializeFloorsRollupValue(data: any): FloorsRollupValue { return { ...data, countSum: data["countSum"] !== undefined ? String(data["countSum"]) : undefined, }; } function deserializeFloorsRollupValue(data: any): FloorsRollupValue { return { ...data, countSum: data["countSum"] !== undefined ? BigInt(data["countSum"]) : undefined, }; } /** * Represents a type of health data a user can have data points recorded for. * It matches the parent resource of collection containing data points of the * given type. Clients currently do not need to interact with this resource * directly. */ export interface GoogleDevicesandservicesHealthV4DataType { /** * Identifier. The resource name of the data type. Format: * `users/{user}/dataTypes/{data_type}` See DataPoint.name for examples and * possible values. */ name?: string; } /** * A heart rate measurement. */ export interface HeartRate { /** * Required. The heart rate value in beats per minute. */ beatsPerMinute?: bigint; /** * Optional. Metadata about the heart rate sample. */ metadata?: HeartRateMetadata; /** * Required. Observation time */ sampleTime?: ObservationSampleTime; } function serializeHeartRate(data: any): HeartRate { return { ...data, beatsPerMinute: data["beatsPerMinute"] !== undefined ? String(data["beatsPerMinute"]) : undefined, sampleTime: data["sampleTime"] !== undefined ? serializeObservationSampleTime(data["sampleTime"]) : undefined, }; } function deserializeHeartRate(data: any): HeartRate { return { ...data, beatsPerMinute: data["beatsPerMinute"] !== undefined ? BigInt(data["beatsPerMinute"]) : undefined, sampleTime: data["sampleTime"] !== undefined ? deserializeObservationSampleTime(data["sampleTime"]) : undefined, }; } /** * Heart rate metadata. */ export interface HeartRateMetadata { /** * Optional. Indicates the user’s level of activity when the heart rate * sample was measured */ motionContext?: | "MOTION_CONTEXT_UNSPECIFIED" | "ACTIVE" | "SEDENTARY"; /** * Optional. Indicates the location of the sensor that measured the heart * rate. */ sensorLocation?: | "SENSOR_LOCATION_UNSPECIFIED" | "CHEST" | "WRIST" | "FINGER" | "HAND" | "EAR_LOBE" | "FOOT"; } /** * Represents the result of the rollup of the heart rate data type. */ export interface HeartRateRollupValue { /** * The average heart rate value in the interval. */ beatsPerMinuteAvg?: number; /** * The maximum heart rate value in the interval. */ beatsPerMinuteMax?: number; /** * The minimum heart rate value in the interval. */ beatsPerMinuteMin?: number; } /** * Captures user's heart rate variability (HRV) as measured by the root mean * square of successive differences (RMSSD) between normal heartbeats or by * standard deviation of the inter-beat intervals (SDNN). */ export interface HeartRateVariability { /** * Optional. The root mean square of successive differences between normal * heartbeats. This is a measure of heart rate variability used by Fitbit. */ rootMeanSquareOfSuccessiveDifferencesMilliseconds?: number; /** * Required. The time of the heart rate variability measurement. */ sampleTime?: ObservationSampleTime; /** * Optional. The standard deviation of the heart rate variability * measurement. */ standardDeviationMilliseconds?: number; } function serializeHeartRateVariability(data: any): HeartRateVariability { return { ...data, sampleTime: data["sampleTime"] !== undefined ? serializeObservationSampleTime(data["sampleTime"]) : undefined, }; } function deserializeHeartRateVariability(data: any): HeartRateVariability { return { ...data, sampleTime: data["sampleTime"] !== undefined ? deserializeObservationSampleTime(data["sampleTime"]) : undefined, }; } /** * Represents the result of the rollup of the user's daily heart rate * variability personal range. */ export interface HeartRateVariabilityPersonalRangeRollupValue { /** * The upper bound of the user's average heart rate variability personal * range. */ averageHeartRateVariabilityMillisecondsMax?: number; /** * The lower bound of the user's average heart rate variability personal * range. */ averageHeartRateVariabilityMillisecondsMin?: number; } /** * The heart rate zone. */ export interface HeartRateZone { /** * Required. The heart rate zone type. */ heartRateZoneType?: | "HEART_RATE_ZONE_TYPE_UNSPECIFIED" | "LIGHT" | "MODERATE" | "VIGOROUS" | "PEAK"; /** * Required. Maximum heart rate for this zone in beats per minute. */ maxBeatsPerMinute?: bigint; /** * Required. Minimum heart rate for this zone in beats per minute. */ minBeatsPerMinute?: bigint; } function serializeHeartRateZone(data: any): HeartRateZone { return { ...data, maxBeatsPerMinute: data["maxBeatsPerMinute"] !== undefined ? String(data["maxBeatsPerMinute"]) : undefined, minBeatsPerMinute: data["minBeatsPerMinute"] !== undefined ? String(data["minBeatsPerMinute"]) : undefined, }; } function deserializeHeartRateZone(data: any): HeartRateZone { return { ...data, maxBeatsPerMinute: data["maxBeatsPerMinute"] !== undefined ? BigInt(data["maxBeatsPerMinute"]) : undefined, minBeatsPerMinute: data["minBeatsPerMinute"] !== undefined ? BigInt(data["minBeatsPerMinute"]) : undefined, }; } /** * Body height measurement. */ export interface Height { /** * Required. Height of the user in millimeters. */ heightMillimeters?: bigint; /** * Required. The time at which the height was recorded. */ sampleTime?: ObservationSampleTime; } function serializeHeight(data: any): Height { return { ...data, heightMillimeters: data["heightMillimeters"] !== undefined ? String(data["heightMillimeters"]) : undefined, sampleTime: data["sampleTime"] !== undefined ? serializeObservationSampleTime(data["sampleTime"]) : undefined, }; } function deserializeHeight(data: any): Height { return { ...data, heightMillimeters: data["heightMillimeters"] !== undefined ? BigInt(data["heightMillimeters"]) : undefined, sampleTime: data["sampleTime"] !== undefined ? deserializeObservationSampleTime(data["sampleTime"]) : undefined, }; } /** * Represents an HTTP header. */ export interface HttpHeader { /** * The HTTP header key. It is case insensitive. */ key?: string; /** * The HTTP header value. */ value?: string; } /** * Represents an HTTP response. */ export interface HttpResponse { /** * The HTTP response body. If the body is not expected, it should be empty. */ body?: Uint8Array; /** * The HTTP response headers. The ordering of the headers is significant. * Multiple headers with the same key may present for the response. */ headers?: HttpHeader[]; /** * The HTTP reason phrase, such as "OK" or "Not Found". */ reason?: string; /** * The HTTP status code, such as 200 or 404. */ status?: number; } function serializeHttpResponse(data: any): HttpResponse { return { ...data, body: data["body"] !== undefined ? encodeBase64(data["body"]) : undefined, }; } function deserializeHttpResponse(data: any): HttpResponse { return { ...data, body: data["body"] !== undefined ? decodeBase64(data["body"] as string) : undefined, }; } /** * Holds information about a user logged hydration. */ export interface HydrationLog { /** * Required. Amount of liquid (ex. water) consumed. */ amountConsumed?: VolumeQuantity; /** * Required. Observed interval. */ interval?: SessionTimeInterval; } function serializeHydrationLog(data: any): HydrationLog { return { ...data, interval: data["interval"] !== undefined ? serializeSessionTimeInterval(data["interval"]) : undefined, }; } function deserializeHydrationLog(data: any): HydrationLog { return { ...data, interval: data["interval"] !== undefined ? deserializeSessionTimeInterval(data["interval"]) : undefined, }; } /** * Represents the result of the rollup of the hydration log data type. */ export interface HydrationLogRollupValue { /** * Rollup for amount consumed. */ amountConsumed?: VolumeQuantityRollup; } /** * Represents details about the Google user's identity. */ export interface Identity { /** * Output only. The Google User Identifier in the Google Health APIs. It * matches the `{user}` resource ID segment in the resource name paths, e.g. * `users/{user}/dataTypes/steps`. Valid values are strings of 1-63 * characters, and valid characters are lowercase and uppercase letters, * numbers, and hyphens. */ readonly healthUserId?: string; /** * Output only. The legacy Fitbit User identifier. This is the Fitbit ID used * in the legacy Fitbit APIs (v1-v3). It can be referenced by clients * migrating from the legacy Fitbit APIs to map their existing identifiers to * the new Google user ID. It **must not** be used for any other purpose. It * is not of any use for new clients using only the Google Health APIs. Valid * values are strings of 1-63 characters, and valid characters are lowercase * and uppercase letters, numbers, and hyphens. */ readonly legacyUserId?: string; /** * Identifier. The resource name of this Identity resource. Format: * `users/me/identity` */ name?: string; } /** * Represents a time interval, encoded as a Timestamp start (inclusive) and a * Timestamp end (exclusive). The start must be less than or equal to the end. * When the start equals the end, the interval is empty (matches no time). When * both start and end are unspecified, the interval matches any time. */ export interface Interval { /** * Optional. Exclusive end of the interval. If specified, a Timestamp * matching this interval will have to be before the end. */ endTime?: Date; /** * Optional. Inclusive start of the interval. If specified, a Timestamp * matching this interval will have to be the same or after the start. */ startTime?: Date; } function serializeInterval(data: any): Interval { return { ...data, endTime: data["endTime"] !== undefined ? data["endTime"].toISOString() : undefined, startTime: data["startTime"] !== undefined ? data["startTime"].toISOString() : undefined, }; } function deserializeInterval(data: any): Interval { return { ...data, endTime: data["endTime"] !== undefined ? new Date(data["endTime"]) : undefined, startTime: data["startTime"] !== undefined ? new Date(data["startTime"]) : undefined, }; } /** * Response containing raw data points matching the query */ export interface ListDataPointsResponse { /** * Data points matching the query */ dataPoints?: DataPoint[]; /** * Next page token, empty if the response is complete */ nextPageToken?: string; } function serializeListDataPointsResponse(data: any): ListDataPointsResponse { return { ...data, dataPoints: data["dataPoints"] !== undefined ? data["dataPoints"].map((item: any) => (serializeDataPoint(item))) : undefined, }; } function deserializeListDataPointsResponse(data: any): ListDataPointsResponse { return { ...data, dataPoints: data["dataPoints"] !== undefined ? data["dataPoints"].map((item: any) => (deserializeDataPoint(item))) : undefined, }; } /** * Response message for ListSubscribers. */ export interface ListSubscribersResponse { /** * A token, which can be sent as `page_token` to retrieve the next page. If * this field is omitted, there are no subsequent pages. */ nextPageToken?: string; /** * Subscribers from the specified project. */ subscribers?: Subscriber[]; /** * The total number of subscribers matching the request. */ totalSize?: number; } /** * Summary metrics for an exercise. */ export interface MetricsSummary { /** * Optional. Total active zone minutes for the exercise. */ activeZoneMinutes?: bigint; /** * Optional. Average heart rate during the exercise. */ averageHeartRateBeatsPerMinute?: bigint; /** * Optional. Average pace in seconds per meter. */ averagePaceSecondsPerMeter?: number; /** * Optional. Average speed in millimeters per second. */ averageSpeedMillimetersPerSecond?: number; /** * Optional. Total calories burned by the user during the exercise. */ caloriesKcal?: number; /** * Optional. Total distance covered by the user during the exercise. */ distanceMillimeters?: number; /** * Optional. Total elevation gain during the exercise. */ elevationGainMillimeters?: number; /** * Optional. Time spent in each heart rate zone. */ heartRateZoneDurations?: TimeInHeartRateZones; /** * Optional. Mobility workouts specific metrics. Only present in the advanced * running exercises. */ mobilityMetrics?: MobilityMetrics; /** * Optional. Run VO2 max value for the exercise. Only present in the running * exercises at the top level as in the summary of the whole exercise. */ runVo2Max?: number; /** * Optional. Total steps taken during the exercise. */ steps?: bigint; /** * Optional. Number of full pool lengths completed during the exercise. Only * present in the swimming exercises at the top level as in the summary of the * whole exercise. */ totalSwimLengths?: number; } function serializeMetricsSummary(data: any): MetricsSummary { return { ...data, activeZoneMinutes: data["activeZoneMinutes"] !== undefined ? String(data["activeZoneMinutes"]) : undefined, averageHeartRateBeatsPerMinute: data["averageHeartRateBeatsPerMinute"] !== undefined ? String(data["averageHeartRateBeatsPerMinute"]) : undefined, heartRateZoneDurations: data["heartRateZoneDurations"] !== undefined ? serializeTimeInHeartRateZones(data["heartRateZoneDurations"]) : undefined, mobilityMetrics: data["mobilityMetrics"] !== undefined ? serializeMobilityMetrics(data["mobilityMetrics"]) : undefined, steps: data["steps"] !== undefined ? String(data["steps"]) : undefined, }; } function deserializeMetricsSummary(data: any): MetricsSummary { return { ...data, activeZoneMinutes: data["activeZoneMinutes"] !== undefined ? BigInt(data["activeZoneMinutes"]) : undefined, averageHeartRateBeatsPerMinute: data["averageHeartRateBeatsPerMinute"] !== undefined ? BigInt(data["averageHeartRateBeatsPerMinute"]) : undefined, heartRateZoneDurations: data["heartRateZoneDurations"] !== undefined ? deserializeTimeInHeartRateZones(data["heartRateZoneDurations"]) : undefined, mobilityMetrics: data["mobilityMetrics"] !== undefined ? deserializeMobilityMetrics(data["mobilityMetrics"]) : undefined, steps: data["steps"] !== undefined ? BigInt(data["steps"]) : undefined, }; } /** * Mobility workouts specific metrics */ export interface MobilityMetrics { /** * Optional. Cadence is a measure of the frequency of your foot strikes. * Steps / min in real time during workout. */ avgCadenceStepsPerMinute?: number; /** * Optional. The ground contact time for a particular stride is the amount of * time for which the foot was in contact with the ground on that stride */ avgGroundContactTimeDuration?: number /* Duration */; /** * Optional. Stride length is a measure of the distance covered by a single * stride */ avgStrideLengthMillimeters?: bigint; /** * Optional. Distance off the ground your center of mass moves with each * stride while running */ avgVerticalOscillationMillimeters?: bigint; /** * Optional. Vertical oscillation/stride length between [5.0, 11.0]. */ avgVerticalRatio?: number; } function serializeMobilityMetrics(data: any): MobilityMetrics { return { ...data, avgGroundContactTimeDuration: data["avgGroundContactTimeDuration"] !== undefined ? data["avgGroundContactTimeDuration"] : undefined, avgStrideLengthMillimeters: data["avgStrideLengthMillimeters"] !== undefined ? String(data["avgStrideLengthMillimeters"]) : undefined, avgVerticalOscillationMillimeters: data["avgVerticalOscillationMillimeters"] !== undefined ? String(data["avgVerticalOscillationMillimeters"]) : undefined, }; } function deserializeMobilityMetrics(data: any): MobilityMetrics { return { ...data, avgGroundContactTimeDuration: data["avgGroundContactTimeDuration"] !== undefined ? data["avgGroundContactTimeDuration"] : undefined, avgStrideLengthMillimeters: data["avgStrideLengthMillimeters"] !== undefined ? BigInt(data["avgStrideLengthMillimeters"]) : undefined, avgVerticalOscillationMillimeters: data["avgVerticalOscillationMillimeters"] !== undefined ? BigInt(data["avgVerticalOscillationMillimeters"]) : undefined, }; } /** * Represents a sample time of an observed data point. */ export interface ObservationSampleTime { /** * Output only. The civil time in the timezone the subject is in at the time * of the observation. */ readonly civilTime?: CivilDateTime; /** * Required. The time of the observation. */ physicalTime?: Date; /** * Required. The offset of the user's local time during the observation * relative to the Coordinated Universal Time (UTC). */ utcOffset?: number /* Duration */; } function serializeObservationSampleTime(data: any): ObservationSampleTime { return { ...data, physicalTime: data["physicalTime"] !== undefined ? data["physicalTime"].toISOString() : undefined, utcOffset: data["utcOffset"] !== undefined ? data["utcOffset"] : undefined, }; } function deserializeObservationSampleTime(data: any): ObservationSampleTime { return { ...data, physicalTime: data["physicalTime"] !== undefined ? new Date(data["physicalTime"]) : undefined, utcOffset: data["utcOffset"] !== undefined ? data["utcOffset"] : undefined, }; } /** * Represents a time interval of an observed data point. */ export interface ObservationTimeInterval { /** * Output only. Observed interval end time in civil time in the timezone the * subject is in at the end of the observed interval */ readonly civilEndTime?: CivilDateTime; /** * Output only. Observed interval start time in civil time in the timezone * the subject is in at the start of the observed interval */ readonly civilStartTime?: CivilDateTime; /** * Required. Observed interval end time. */ endTime?: Date; /** * Required. The offset of the user's local time at the end of the * observation relative to the Coordinated Universal Time (UTC). */ endUtcOffset?: number /* Duration */; /** * Required. Observed interval start time. */ startTime?: Date; /** * Required. The offset of the user's local time at the start of the * observation relative to the Coordinated Universal Time (UTC). */ startUtcOffset?: number /* Duration */; } function serializeObservationTimeInterval(data: any): ObservationTimeInterval { return { ...data, endTime: data["endTime"] !== undefined ? data["endTime"].toISOString() : undefined, endUtcOffset: data["endUtcOffset"] !== undefined ? data["endUtcOffset"] : undefined, startTime: data["startTime"] !== undefined ? data["startTime"].toISOString() : undefined, startUtcOffset: data["startUtcOffset"] !== undefined ? data["startUtcOffset"] : undefined, }; } function deserializeObservationTimeInterval(data: any): ObservationTimeInterval { return { ...data, endTime: data["endTime"] !== undefined ? new Date(data["endTime"]) : undefined, endUtcOffset: data["endUtcOffset"] !== undefined ? data["endUtcOffset"] : undefined, startTime: data["startTime"] !== undefined ? new Date(data["startTime"]) : undefined, startUtcOffset: data["startUtcOffset"] !== undefined ? data["startUtcOffset"] : undefined, }; } /** * This resource represents a long-running operation that is the result of a * network API call. */ export interface Operation { /** * If the value is `false`, it means the operation is still in progress. If * `true`, the operation is completed, and either `error` or `response` is * available. */ done?: boolean; /** * The error result of the operation in case of failure or cancellation. */ error?: Status; /** * Service-specific metadata associated with the operation. It typically * contains progress information and common metadata such as create time. Some * services might not provide such metadata. Any method that returns a * long-running operation should document the metadata type, if any. */ metadata?: { [key: string]: any }; /** * The server-assigned name, which is only unique within the same service * that originally returns it. If you use the default HTTP mapping, the `name` * should be a resource name ending with `operations/{unique_id}`. */ name?: string; /** * The normal, successful response of the operation. If the original method * returns no data on success, such as `Delete`, the response is * `google.protobuf.Empty`. If the original method is standard * `Get`/`Create`/`Update`, the response should be the resource. For other * methods, the response should have the type `XxxResponse`, where `Xxx` is * the original method name. For example, if the original method name is * `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. */ response?: { [key: string]: any }; } /** * A time interval to represent an out-of-bed segment. */ export interface OutOfBedSegment { /** * Required. Segment end time. */ endTime?: Date; /** * Required. The offset of the user's local time at the end of the segment * relative to the Coordinated Universal Time (UTC). */ endUtcOffset?: number /* Duration */; /** * Required. Segment tart time. */ startTime?: Date; /** * Required. The offset of the user's local time at the start of the segment * relative to the Coordinated Universal Time (UTC). */ startUtcOffset?: number /* Duration */; } function serializeOutOfBedSegment(data: any): OutOfBedSegment { return { ...data, endTime: data["endTime"] !== undefined ? data["endTime"].toISOString() : undefined, endUtcOffset: data["endUtcOffset"] !== undefined ? data["endUtcOffset"] : undefined, startTime: data["startTime"] !== undefined ? data["startTime"].toISOString() : undefined, startUtcOffset: data["startUtcOffset"] !== undefined ? data["startUtcOffset"] : undefined, }; } function deserializeOutOfBedSegment(data: any): OutOfBedSegment { return { ...data, endTime: data["endTime"] !== undefined ? new Date(data["endTime"]) : undefined, endUtcOffset: data["endUtcOffset"] !== undefined ? data["endUtcOffset"] : undefined, startTime: data["startTime"] !== undefined ? new Date(data["startTime"]) : undefined, startUtcOffset: data["startUtcOffset"] !== undefined ? data["startUtcOffset"] : undefined, }; } /** * Captures the user's instantaneous oxygen saturation percentage (SpO2). */ export interface OxygenSaturation { /** * Required. The oxygen saturation percentage. Valid values are from 0 to * 100. */ percentage?: number; /** * Required. The time at which oxygen saturation was measured. */ sampleTime?: ObservationSampleTime; } function serializeOxygenSaturation(data: any): OxygenSaturation { return { ...data, sampleTime: data["sampleTime"] !== undefined ? serializeObservationSampleTime(data["sampleTime"]) : undefined, }; } function deserializeOxygenSaturation(data: any): OxygenSaturation { return { ...data, sampleTime: data["sampleTime"] !== undefined ? deserializeObservationSampleTime(data["sampleTime"]) : undefined, }; } /** * Profile details. */ export interface Profile { /** * Optional. The age in years based on the user's birth date. Updates to this * field are currently not supported. */ age?: number; /** * Output only. The automatically calculated running stride length, in * millimeters. The user must consent to one of the following access scopes to * access this field: - * `https://www.googleapis.com/auth/googlehealth.activity_and_fitness.readonly` * - `https://www.googleapis.com/auth/googlehealth.activity_and_fitness` */ readonly autoRunningStrideLengthMm?: number; /** * Output only. The automatically calculated walking stride length, in * millimeters. The user must consent to one of the following access scopes to * access this field: - * `https://www.googleapis.com/auth/googlehealth.activity_and_fitness.readonly` * - `https://www.googleapis.com/auth/googlehealth.activity_and_fitness` */ readonly autoWalkingStrideLengthMm?: number; /** * Output only. The date the user created their account. Updates to this * field are currently not supported. */ readonly membershipStartDate?: Date; /** * Identifier. The resource name of this Profile resource. Format: * `users/{user}/profile` Example: `users/1234567890/profile` or * `users/me/profile` The {user} ID is a system-generated Google Health API * user ID, a string of 1-63 characters consisting of lowercase and uppercase * letters, numbers, and hyphens. The literal `me` can also be used to refer * to the authenticated user. */ name?: string; /** * Optional. The user's user configured running stride length, in * millimeters. The user must consent to one of the following access scopes to * access this field: - * `https://www.googleapis.com/auth/googlehealth.activity_and_fitness.readonly` * - `https://www.googleapis.com/auth/googlehealth.activity_and_fitness` */ userConfiguredRunningStrideLengthMm?: number; /** * Optional. The user's user configured walking stride length, in * millimeters. The user must consent to one of the following access scopes to * access this field: - * `https://www.googleapis.com/auth/googlehealth.activity_and_fitness.readonly` * - `https://www.googleapis.com/auth/googlehealth.activity_and_fitness` */ userConfiguredWalkingStrideLengthMm?: number; } /** * Additional options for Health#projectsSubscribersCreate. */ export interface ProjectsSubscribersCreateOptions { /** * Optional. The ID to use for the subscriber, which will become the final * component of the subscriber's resource name. This value should be 4-36 * characters, and valid characters are /[a-z]([a-z0-9-]{2,34}[a-z0-9])/. */ subscriberId?: string; } /** * Additional options for Health#projectsSubscribersDelete. */ export interface ProjectsSubscribersDeleteOptions { /** * Optional. If set to true, any child resources (e.g., subscriptions) will * also be deleted. If false (default) and child resources exist, the request * will fail. */ force?: boolean; } /** * Additional options for Health#projectsSubscribersList. */ export interface ProjectsSubscribersListOptions { /** * Optional. The maximum number of subscribers to return. The service may * return fewer than this value. If unspecified, at most 50 subscribers will * be returned. The maximum value is 1000; values above 1000 will be coerced * to 1000. */ pageSize?: number; /** * Optional. A page token, received from a previous `ListSubscribers` call. * Provide this to retrieve the subsequent page. When paginating, all other * parameters provided to `ListSubscribers` must match the call that provided * the page token. */ pageToken?: string; } /** * Additional options for Health#projectsSubscribersPatch. */ export interface ProjectsSubscribersPatchOptions { /** * Optional. A field mask that specifies which fields of the Subscriber * message are to be updated. This allows for partial updates. Supported * fields: - endpoint_uri - subscriber_configs - endpoint_authorization */ updateMask?: string /* FieldMask */; } function serializeProjectsSubscribersPatchOptions(data: any): ProjectsSubscribersPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } function deserializeProjectsSubscribersPatchOptions(data: any): ProjectsSubscribersPatchOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } /** * Response containing the list of reconciled DataPoints. */ export interface ReconcileDataPointsResponse { /** * Data points matching the query */ dataPoints?: ReconciledDataPoint[]; /** * Next page token, empty if the response is complete */ nextPageToken?: string; } function serializeReconcileDataPointsResponse(data: any): ReconcileDataPointsResponse { return { ...data, dataPoints: data["dataPoints"] !== undefined ? data["dataPoints"].map((item: any) => (serializeReconciledDataPoint(item))) : undefined, }; } function deserializeReconcileDataPointsResponse(data: any): ReconcileDataPointsResponse { return { ...data, dataPoints: data["dataPoints"] !== undefined ? data["dataPoints"].map((item: any) => (deserializeReconciledDataPoint(item))) : undefined, }; } /** * A reconciled computed or recorded metric. */ export interface ReconciledDataPoint { /** * Data for points in the `active-minutes` interval data type collection. */ activeMinutes?: ActiveMinutes; /** * Data for points in the `active-zone-minutes` interval data type * collection, measured in minutes. */ activeZoneMinutes?: ActiveZoneMinutes; /** * Data for points in the `activity-level` daily data type collection. */ activityLevel?: ActivityLevel; /** * Data for points in the `altitude` interval data type collection. */ altitude?: Altitude; /** * Data for points in the `body-fat` sample data type collection. */ bodyFat?: BodyFat; /** * Data for points in the `daily-heart-rate-variability` daily data type * collection. */ dailyHeartRateVariability?: DailyHeartRateVariability; /** * Data for points in the `daily-heart-rate-zones` daily data type * collection. */ dailyHeartRateZones?: DailyHeartRateZones; /** * Data for points in the `daily-oxygen-saturation` daily data type * collection. */ dailyOxygenSaturation?: DailyOxygenSaturation; /** * Data for points in the `daily-respiratory-rate` daily data type * collection. */ dailyRespiratoryRate?: DailyRespiratoryRate; /** * Data for points in the `daily-resting-heart-rate` daily data type * collection. */ dailyRestingHeartRate?: DailyRestingHeartRate; /** * Data for points in the `daily-sleep-temperature-derivations` daily data * type collection. */ dailySleepTemperatureDerivations?: DailySleepTemperatureDerivations; /** * Data for points in the `daily-vo2-max` daily data type collection. */ dailyVo2Max?: DailyVO2Max; /** * Identifier. Data point name, only supported for the subset of identifiable * data types. For the majority of the data types, individual data points do * not need to be identified and this field would be empty. Format: * `users/{user}/dataTypes/{data_type}/dataPoints/{data_point}` Example: * `users/abcd1234/dataTypes/sleep/dataPoints/a1b2c3d4-e5f6-7890-1234-567890abcdef` * The `{user}` ID is a system-generated identifier, as described in * Identity.health_user_id. The `{data_type}` ID corresponds to the kebab-case * version of the field names in the DataPoint data union field, e.g. * `total-calories` for the `total_calories` field. The `{data_point}` ID can * be client-provided or system-generated. If client-provided, it must be a * string of 4-63 characters, containing only lowercase letters, numbers, and * hyphens. */ dataPointName?: string; /** * Data for points in the `distance` interval data type collection. */ distance?: Distance; /** * Data for points in the `exercise` session data type collection. */ exercise?: Exercise; /** * Data for points in the `floors` interval data type collection. */ floors?: Floors; /** * Data for points in the `heart-rate` sample data type collection. */ heartRate?: HeartRate; /** * Data for points in the `heart-rate-variability` sample data type * collection. */ heartRateVariability?: HeartRateVariability; /** * Data for points in the `height` sample data type collection. */ height?: Height; /** * Data for points in the `hydration-log` session data type collection. */ hydrationLog?: HydrationLog; /** * Data for points in the `oxygen-saturation` sample data type collection. */ oxygenSaturation?: OxygenSaturation; /** * Data for points in the `respiratory-rate-sleep-summary` sample data type * collection. */ respiratoryRateSleepSummary?: RespiratoryRateSleepSummary; /** * Data for points in the `run-vo2-max` sample data type collection. */ runVo2Max?: RunVO2Max; /** * Data for points in the `sedentary-period` interval data type collection. */ sedentaryPeriod?: SedentaryPeriod; /** * Data for points in the `sleep` session data type collection. */ sleep?: Sleep; /** * Data for points in the `steps` interval data type collection. */ steps?: Steps; /** * Data for points in the `swim-lengths-data` interval data type collection. */ swimLengthsData?: SwimLengthsData; /** * Data for points in the `time-in-heart-rate-zone` interval data type * collection. */ timeInHeartRateZone?: TimeInHeartRateZone; /** * Data for points in the `vo2-max` sample data type collection. */ vo2Max?: VO2Max; /** * Data for points in the `weight` sample data type collection. */ weight?: Weight; } function serializeReconciledDataPoint(data: any): ReconciledDataPoint { return { ...data, activeMinutes: data["activeMinutes"] !== undefined ? serializeActiveMinutes(data["activeMinutes"]) : undefined, activeZoneMinutes: data["activeZoneMinutes"] !== undefined ? serializeActiveZoneMinutes(data["activeZoneMinutes"]) : undefined, activityLevel: data["activityLevel"] !== undefined ? serializeActivityLevel(data["activityLevel"]) : undefined, altitude: data["altitude"] !== undefined ? serializeAltitude(data["altitude"]) : undefined, bodyFat: data["bodyFat"] !== undefined ? serializeBodyFat(data["bodyFat"]) : undefined, dailyHeartRateVariability: data["dailyHeartRateVariability"] !== undefined ? serializeDailyHeartRateVariability(data["dailyHeartRateVariability"]) : undefined, dailyHeartRateZones: data["dailyHeartRateZones"] !== undefined ? serializeDailyHeartRateZones(data["dailyHeartRateZones"]) : undefined, dailyRestingHeartRate: data["dailyRestingHeartRate"] !== undefined ? serializeDailyRestingHeartRate(data["dailyRestingHeartRate"]) : undefined, distance: data["distance"] !== undefined ? serializeDistance(data["distance"]) : undefined, exercise: data["exercise"] !== undefined ? serializeExercise(data["exercise"]) : undefined, floors: data["floors"] !== undefined ? serializeFloors(data["floors"]) : undefined, heartRate: data["heartRate"] !== undefined ? serializeHeartRate(data["heartRate"]) : undefined, heartRateVariability: data["heartRateVariability"] !== undefined ? serializeHeartRateVariability(data["heartRateVariability"]) : undefined, height: data["height"] !== undefined ? serializeHeight(data["height"]) : undefined, hydrationLog: data["hydrationLog"] !== undefined ? serializeHydrationLog(data["hydrationLog"]) : undefined, oxygenSaturation: data["oxygenSaturation"] !== undefined ? serializeOxygenSaturation(data["oxygenSaturation"]) : undefined, respiratoryRateSleepSummary: data["respiratoryRateSleepSummary"] !== undefined ? serializeRespiratoryRateSleepSummary(data["respiratoryRateSleepSummary"]) : undefined, runVo2Max: data["runVo2Max"] !== undefined ? serializeRunVO2Max(data["runVo2Max"]) : undefined, sedentaryPeriod: data["sedentaryPeriod"] !== undefined ? serializeSedentaryPeriod(data["sedentaryPeriod"]) : undefined, sleep: data["sleep"] !== undefined ? serializeSleep(data["sleep"]) : undefined, steps: data["steps"] !== undefined ? serializeSteps(data["steps"]) : undefined, swimLengthsData: data["swimLengthsData"] !== undefined ? serializeSwimLengthsData(data["swimLengthsData"]) : undefined, timeInHeartRateZone: data["timeInHeartRateZone"] !== undefined ? serializeTimeInHeartRateZone(data["timeInHeartRateZone"]) : undefined, vo2Max: data["vo2Max"] !== undefined ? serializeVO2Max(data["vo2Max"]) : undefined, weight: data["weight"] !== undefined ? serializeWeight(data["weight"]) : undefined, }; } function deserializeReconciledDataPoint(data: any): ReconciledDataPoint { return { ...data, activeMinutes: data["activeMinutes"] !== undefined ? deserializeActiveMinutes(data["activeMinutes"]) : undefined, activeZoneMinutes: data["activeZoneMinutes"] !== undefined ? deserializeActiveZoneMinutes(data["activeZoneMinutes"]) : undefined, activityLevel: data["activityLevel"] !== undefined ? deserializeActivityLevel(data["activityLevel"]) : undefined, altitude: data["altitude"] !== undefined ? deserializeAltitude(data["altitude"]) : undefined, bodyFat: data["bodyFat"] !== undefined ? deserializeBodyFat(data["bodyFat"]) : undefined, dailyHeartRateVariability: data["dailyHeartRateVariability"] !== undefined ? deserializeDailyHeartRateVariability(data["dailyHeartRateVariability"]) : undefined, dailyHeartRateZones: data["dailyHeartRateZones"] !== undefined ? deserializeDailyHeartRateZones(data["dailyHeartRateZones"]) : undefined, dailyRestingHeartRate: data["dailyRestingHeartRate"] !== undefined ? deserializeDailyRestingHeartRate(data["dailyRestingHeartRate"]) : undefined, distance: data["distance"] !== undefined ? deserializeDistance(data["distance"]) : undefined, exercise: data["exercise"] !== undefined ? deserializeExercise(data["exercise"]) : undefined, floors: data["floors"] !== undefined ? deserializeFloors(data["floors"]) : undefined, heartRate: data["heartRate"] !== undefined ? deserializeHeartRate(data["heartRate"]) : undefined, heartRateVariability: data["heartRateVariability"] !== undefined ? deserializeHeartRateVariability(data["heartRateVariability"]) : undefined, height: data["height"] !== undefined ? deserializeHeight(data["height"]) : undefined, hydrationLog: data["hydrationLog"] !== undefined ? deserializeHydrationLog(data["hydrationLog"]) : undefined, oxygenSaturation: data["oxygenSaturation"] !== undefined ? deserializeOxygenSaturation(data["oxygenSaturation"]) : undefined, respiratoryRateSleepSummary: data["respiratoryRateSleepSummary"] !== undefined ? deserializeRespiratoryRateSleepSummary(data["respiratoryRateSleepSummary"]) : undefined, runVo2Max: data["runVo2Max"] !== undefined ? deserializeRunVO2Max(data["runVo2Max"]) : undefined, sedentaryPeriod: data["sedentaryPeriod"] !== undefined ? deserializeSedentaryPeriod(data["sedentaryPeriod"]) : undefined, sleep: data["sleep"] !== undefined ? deserializeSleep(data["sleep"]) : undefined, steps: data["steps"] !== undefined ? deserializeSteps(data["steps"]) : undefined, swimLengthsData: data["swimLengthsData"] !== undefined ? deserializeSwimLengthsData(data["swimLengthsData"]) : undefined, timeInHeartRateZone: data["timeInHeartRateZone"] !== undefined ? deserializeTimeInHeartRateZone(data["timeInHeartRateZone"]) : undefined, vo2Max: data["vo2Max"] !== undefined ? deserializeVO2Max(data["vo2Max"]) : undefined, weight: data["weight"] !== undefined ? deserializeWeight(data["weight"]) : undefined, }; } /** * Records respiratory rate details during sleep. Can have multiple per day if * the user sleeps multiple times. */ export interface RespiratoryRateSleepSummary { /** * Optional. Respiratory rate statistics for deep sleep. */ deepSleepStats?: RespiratoryRateSleepSummaryStatistics; /** * Required. Full respiratory rate statistics. */ fullSleepStats?: RespiratoryRateSleepSummaryStatistics; /** * Optional. Respiratory rate statistics for light sleep. */ lightSleepStats?: RespiratoryRateSleepSummaryStatistics; /** * Optional. Respiratory rate statistics for REM sleep. */ remSleepStats?: RespiratoryRateSleepSummaryStatistics; /** * Required. The time at which respiratory rate was measured. */ sampleTime?: ObservationSampleTime; } function serializeRespiratoryRateSleepSummary(data: any): RespiratoryRateSleepSummary { return { ...data, sampleTime: data["sampleTime"] !== undefined ? serializeObservationSampleTime(data["sampleTime"]) : undefined, }; } function deserializeRespiratoryRateSleepSummary(data: any): RespiratoryRateSleepSummary { return { ...data, sampleTime: data["sampleTime"] !== undefined ? deserializeObservationSampleTime(data["sampleTime"]) : undefined, }; } /** * Respiratory rate statistics for a given sleep stage. */ export interface RespiratoryRateSleepSummaryStatistics { /** * Required. Average breaths per minute. */ breathsPerMinute?: number; /** * Optional. How trustworthy the data is for the computation. */ signalToNoise?: number; /** * Optional. Standard deviation of the respiratory rate during sleep. */ standardDeviation?: number; } /** * Represents the rollup value for the daily resting heart rate data type. */ export interface RestingHeartRatePersonalRangeRollupValue { /** * The upper bound of the user's daily resting heart rate personal range. */ beatsPerMinuteMax?: number; /** * The lower bound of the user's daily resting heart rate personal range. */ beatsPerMinuteMin?: number; } /** * Value of a rollup for a single physical time interval (aggregation window) */ export interface RollupDataPoint { /** * Returned by default when rolling up data points from the `active-minutes` * data type, or when requested explicitly using the `active-minutes` rollup * type identifier. */ activeMinutes?: ActiveMinutesRollupValue; /** * Returned by default when rolling up data points from the * `active-zone-minutes` data type, or when requested explicitly using the * `active-zone-minutes` rollup type identifier. */ activeZoneMinutes?: ActiveZoneMinutesRollupValue; /** * Returned by default when rolling up data points from the `activity-level` * data type, or when requested explicitly using the `activity-level` rollup * type identifier. */ activityLevel?: ActivityLevelRollupValue; /** * Returned by default when rolling up data points from the `altitude` data * type, or when requested explicitly using the `altitude` rollup type * identifier. */ altitude?: AltitudeRollupValue; /** * Returned by default when rolling up data points from the `body-fat` data * type, or when requested explicitly using the `body-fat` rollup type * identifier. */ bodyFat?: BodyFatRollupValue; /** * Returned by default when rolling up data points from the * `calories-in-heart-rate-zone` data type, or when requested explicitly using * the `calories-in-heart-rate-zone` rollup type identifier. */ caloriesInHeartRateZone?: CaloriesInHeartRateZoneRollupValue; /** * Returned by default when rolling up data points from the `distance` data * type, or when requested explicitly using the `distance` rollup type * identifier. */ distance?: DistanceRollupValue; /** * End time of the window this value aggregates over */ endTime?: Date; /** * Returned by default when rolling up data points from the `floors` data * type, or when requested explicitly using the `floors` rollup type * identifier. */ floors?: FloorsRollupValue; /** * Returned by default when rolling up data points from the `heart-rate` data * type, or when requested explicitly using the `heart-rate` rollup type * identifier. */ heartRate?: HeartRateRollupValue; /** * Returned by default when rolling up data points from the `hydration-log` * data type, or when requested explicitly using the `hydration-log` rollup * type identifier. */ hydrationLog?: HydrationLogRollupValue; /** * Returned by default when rolling up data points from the `run-vo2-max` * data type, or when requested explicitly using the `run-vo2-max` rollup type * identifier. */ runVo2Max?: RunVO2MaxRollupValue; /** * Returned by default when rolling up data points from the * `sedentary-period` data type, or when requested explicitly using the * `sedentary-period` rollup type identifier. */ sedentaryPeriod?: SedentaryPeriodRollupValue; /** * Start time of the window this value aggregates over */ startTime?: Date; /** * Returned by default when rolling up data points from the `steps` data * type, or when requested explicitly using the `steps` rollup type * identifier. */ steps?: StepsRollupValue; /** * Returned by default when rolling up data points from the * `swim-lengths-data` data type, or when requested explicitly using the * `swim-lengths-data` rollup type identifier. */ swimLengthsData?: SwimLengthsDataRollupValue; /** * Returned by default when rolling up data points from the * `time-in-heart-rate-zone` data type, or when requested explicitly using the * `time-in-heart-rate-zone` rollup type identifier. */ timeInHeartRateZone?: TimeInHeartRateZoneRollupValue; /** * Returned by default when rolling up data points from the `total-calories` * data type, or when requested explicitly using the `total-calories` rollup * type identifier. */ totalCalories?: TotalCaloriesRollupValue; /** * Returned by default when rolling up data points from the `weight` data * type, or when requested explicitly using the `weight` rollup type * identifier. */ weight?: WeightRollupValue; } function serializeRollupDataPoint(data: any): RollupDataPoint { return { ...data, activeMinutes: data["activeMinutes"] !== undefined ? serializeActiveMinutesRollupValue(data["activeMinutes"]) : undefined, activeZoneMinutes: data["activeZoneMinutes"] !== undefined ? serializeActiveZoneMinutesRollupValue(data["activeZoneMinutes"]) : undefined, activityLevel: data["activityLevel"] !== undefined ? serializeActivityLevelRollupValue(data["activityLevel"]) : undefined, altitude: data["altitude"] !== undefined ? serializeAltitudeRollupValue(data["altitude"]) : undefined, distance: data["distance"] !== undefined ? serializeDistanceRollupValue(data["distance"]) : undefined, endTime: data["endTime"] !== undefined ? data["endTime"].toISOString() : undefined, floors: data["floors"] !== undefined ? serializeFloorsRollupValue(data["floors"]) : undefined, sedentaryPeriod: data["sedentaryPeriod"] !== undefined ? serializeSedentaryPeriodRollupValue(data["sedentaryPeriod"]) : undefined, startTime: data["startTime"] !== undefined ? data["startTime"].toISOString() : undefined, steps: data["steps"] !== undefined ? serializeStepsRollupValue(data["steps"]) : undefined, swimLengthsData: data["swimLengthsData"] !== undefined ? serializeSwimLengthsDataRollupValue(data["swimLengthsData"]) : undefined, timeInHeartRateZone: data["timeInHeartRateZone"] !== undefined ? serializeTimeInHeartRateZoneRollupValue(data["timeInHeartRateZone"]) : undefined, }; } function deserializeRollupDataPoint(data: any): RollupDataPoint { return { ...data, activeMinutes: data["activeMinutes"] !== undefined ? deserializeActiveMinutesRollupValue(data["activeMinutes"]) : undefined, activeZoneMinutes: data["activeZoneMinutes"] !== undefined ? deserializeActiveZoneMinutesRollupValue(data["activeZoneMinutes"]) : undefined, activityLevel: data["activityLevel"] !== undefined ? deserializeActivityLevelRollupValue(data["activityLevel"]) : undefined, altitude: data["altitude"] !== undefined ? deserializeAltitudeRollupValue(data["altitude"]) : undefined, distance: data["distance"] !== undefined ? deserializeDistanceRollupValue(data["distance"]) : undefined, endTime: data["endTime"] !== undefined ? new Date(data["endTime"]) : undefined, floors: data["floors"] !== undefined ? deserializeFloorsRollupValue(data["floors"]) : undefined, sedentaryPeriod: data["sedentaryPeriod"] !== undefined ? deserializeSedentaryPeriodRollupValue(data["sedentaryPeriod"]) : undefined, startTime: data["startTime"] !== undefined ? new Date(data["startTime"]) : undefined, steps: data["steps"] !== undefined ? deserializeStepsRollupValue(data["steps"]) : undefined, swimLengthsData: data["swimLengthsData"] !== undefined ? deserializeSwimLengthsDataRollupValue(data["swimLengthsData"]) : undefined, timeInHeartRateZone: data["timeInHeartRateZone"] !== undefined ? deserializeTimeInHeartRateZoneRollupValue(data["timeInHeartRateZone"]) : undefined, }; } /** * Request to roll up data points by physical time intervals. */ export interface RollUpDataPointsRequest { /** * Optional. The data source family name to roll up. If empty, data points * from all available data sources will be rolled up. Format: * `users/me/dataSourceFamilies/{data_source_family}` The supported values * are: - `users/me/dataSourceFamilies/all-sources` - default value - * `users/me/dataSourceFamilies/google-wearables` - tracker devices - * `users/me/dataSourceFamilies/google-sources` - Google first party sources */ dataSourceFamily?: string; /** * Optional. The maximum number of data points to return. If unspecified, at * most 1440 data points will be returned. The maximum page size is 10000; * values above that will be truncated accordingly. */ pageSize?: number; /** * Optional. The next_page_token from a previous request, if any. All other * request fields need to be the same as in the initial request when the page * token is specified. */ pageToken?: string; /** * Required. Closed-open range of data points that will be rolled up. The * maximum range for `calories-in-heart-rate-zone`, `heart-rate`, * `active-minutes` and `total-calories` is 14 days. The maximum range for all * other data types is 90 days. */ range?: Interval; /** * Required. The size of the time window to group data points into before * applying the aggregation functions. */ windowSize?: number /* Duration */; } function serializeRollUpDataPointsRequest(data: any): RollUpDataPointsRequest { return { ...data, range: data["range"] !== undefined ? serializeInterval(data["range"]) : undefined, windowSize: data["windowSize"] !== undefined ? data["windowSize"] : undefined, }; } function deserializeRollUpDataPointsRequest(data: any): RollUpDataPointsRequest { return { ...data, range: data["range"] !== undefined ? deserializeInterval(data["range"]) : undefined, windowSize: data["windowSize"] !== undefined ? data["windowSize"] : undefined, }; } /** * Response containing the list of rolled up data points. */ export interface RollUpDataPointsResponse { /** * A token, which can be sent as `page_token` to retrieve the next page. If * this field is omitted, there are no subsequent pages. */ nextPageToken?: string; /** * Values for each aggregation time window. */ rollupDataPoints?: RollupDataPoint[]; } function serializeRollUpDataPointsResponse(data: any): RollUpDataPointsResponse { return { ...data, rollupDataPoints: data["rollupDataPoints"] !== undefined ? data["rollupDataPoints"].map((item: any) => (serializeRollupDataPoint(item))) : undefined, }; } function deserializeRollUpDataPointsResponse(data: any): RollUpDataPointsResponse { return { ...data, rollupDataPoints: data["rollupDataPoints"] !== undefined ? data["rollupDataPoints"].map((item: any) => (deserializeRollupDataPoint(item))) : undefined, }; } /** * VO2 max value calculated based on the user's running activity. Value stored * in ml/kg/min. */ export interface RunVO2Max { /** * Required. Run VO2 max value in ml/kg/min. */ runVo2Max?: number; /** * Required. The time at which the metric was measured. */ sampleTime?: ObservationSampleTime; } function serializeRunVO2Max(data: any): RunVO2Max { return { ...data, sampleTime: data["sampleTime"] !== undefined ? serializeObservationSampleTime(data["sampleTime"]) : undefined, }; } function deserializeRunVO2Max(data: any): RunVO2Max { return { ...data, sampleTime: data["sampleTime"] !== undefined ? deserializeObservationSampleTime(data["sampleTime"]) : undefined, }; } /** * Represents the result of the rollup of the user's daily heart rate * variability personal range. */ export interface RunVO2MaxRollupValue { /** * Average value of run VO2 max in the interval. */ rateAvg?: number; /** * Maximum value of run VO2 max in the interval. */ rateMax?: number; /** * Minimum value of run VO2 max in the interval.. */ rateMin?: number; } /** * SedentaryPeriod SedentaryPeriod data represents the periods of time that the * user was sedentary (i.e. not moving while wearing the device). */ export interface SedentaryPeriod { /** * Required. Observed interval. */ interval?: ObservationTimeInterval; } function serializeSedentaryPeriod(data: any): SedentaryPeriod { return { ...data, interval: data["interval"] !== undefined ? serializeObservationTimeInterval(data["interval"]) : undefined, }; } function deserializeSedentaryPeriod(data: any): SedentaryPeriod { return { ...data, interval: data["interval"] !== undefined ? deserializeObservationTimeInterval(data["interval"]) : undefined, }; } /** * Represents the result of the rollup of the user's sedentary periods. */ export interface SedentaryPeriodRollupValue { /** * The total time user spent sedentary during the interval. */ durationSum?: number /* Duration */; } function serializeSedentaryPeriodRollupValue(data: any): SedentaryPeriodRollupValue { return { ...data, durationSum: data["durationSum"] !== undefined ? data["durationSum"] : undefined, }; } function deserializeSedentaryPeriodRollupValue(data: any): SedentaryPeriodRollupValue { return { ...data, durationSum: data["durationSum"] !== undefined ? data["durationSum"] : undefined, }; } /** * Represents a time interval of session data point, which bundles multiple * observed metrics together. */ export interface SessionTimeInterval { /** * Output only. Session end time in civil time in the timezone the subject is * in at the end of the session. */ readonly civilEndTime?: CivilDateTime; /** * Output only. Session start time in civil time in the timezone the subject * is in at the start of the session. */ readonly civilStartTime?: CivilDateTime; /** * Required. The end time of the observed session. */ endTime?: Date; /** * Required. The offset of the user's local time at the end of the session * relative to the Coordinated Universal Time (UTC). */ endUtcOffset?: number /* Duration */; /** * Required. The start time of the observed session. */ startTime?: Date; /** * Required. The offset of the user's local time at the start of the session * relative to the Coordinated Universal Time (UTC). */ startUtcOffset?: number /* Duration */; } function serializeSessionTimeInterval(data: any): SessionTimeInterval { return { ...data, endTime: data["endTime"] !== undefined ? data["endTime"].toISOString() : undefined, endUtcOffset: data["endUtcOffset"] !== undefined ? data["endUtcOffset"] : undefined, startTime: data["startTime"] !== undefined ? data["startTime"].toISOString() : undefined, startUtcOffset: data["startUtcOffset"] !== undefined ? data["startUtcOffset"] : undefined, }; } function deserializeSessionTimeInterval(data: any): SessionTimeInterval { return { ...data, endTime: data["endTime"] !== undefined ? new Date(data["endTime"]) : undefined, endUtcOffset: data["endUtcOffset"] !== undefined ? data["endUtcOffset"] : undefined, startTime: data["startTime"] !== undefined ? new Date(data["startTime"]) : undefined, startUtcOffset: data["startUtcOffset"] !== undefined ? data["startUtcOffset"] : undefined, }; } /** * Settings details. */ export interface Settings { /** * Optional. True if the user's stride length is determined automatically. * Updates to this field are currently not supported. */ autoStrideEnabled?: boolean; /** * Optional. The measurement unit defined in the user's account settings. * Updates to this field are currently not supported. */ distanceUnit?: | "DISTANCE_UNIT_UNSPECIFIED" | "DISTANCE_UNIT_MILES" | "DISTANCE_UNIT_KILOMETERS"; /** * Optional. The measurement unit defined in the user's account settings. */ glucoseUnit?: | "GLUCOSE_UNIT_UNSPECIFIED" | "GLUCOSE_UNIT_MG_DL" | "GLUCOSE_UNIT_MMOL_L"; /** * Optional. The measurement unit defined in the user's account settings. */ heightUnit?: | "HEIGHT_UNIT_UNSPECIFIED" | "HEIGHT_UNIT_INCHES" | "HEIGHT_UNIT_CENTIMETERS"; /** * Optional. The locale defined in the user's account settings. Updates to * this field are currently not supported. */ languageLocale?: string; /** * Identifier. The resource name of this Settings resource. Format: * `users/{user}/settings` Example: `users/1234567890/settings` or * `users/me/settings` The {user} ID is a system-generated Google Health API * user ID, a string of 1-63 characters consisting of lowercase and uppercase * letters, numbers, and hyphens. The literal `me` can also be used to refer * to the authenticated user. */ name?: string; /** * Optional. The stride length type defined in the user's account settings * for running. Updates to this field are currently not supported. */ strideLengthRunningType?: | "STRIDE_LENGTH_TYPE_UNSPECIFIED" | "STRIDE_LENGTH_TYPE_DEFAULT" | "STRIDE_LENGTH_TYPE_MANUAL" | "STRIDE_LENGTH_TYPE_AUTO"; /** * Optional. The stride length type defined in the user's account settings * for walking. Updates to this field are currently not supported. */ strideLengthWalkingType?: | "STRIDE_LENGTH_TYPE_UNSPECIFIED" | "STRIDE_LENGTH_TYPE_DEFAULT" | "STRIDE_LENGTH_TYPE_MANUAL" | "STRIDE_LENGTH_TYPE_AUTO"; /** * Optional. The measurement unit defined in the user's account settings. */ swimUnit?: | "SWIM_UNIT_UNSPECIFIED" | "SWIM_UNIT_METERS" | "SWIM_UNIT_YARDS"; /** * Optional. The measurement unit defined in the user's account settings. */ temperatureUnit?: | "TEMPERATURE_UNIT_UNSPECIFIED" | "TEMPERATURE_UNIT_CELSIUS" | "TEMPERATURE_UNIT_FAHRENHEIT"; /** * Optional. The timezone defined in the user's account settings. This * follows the IANA [Time Zone Database](https://www.iana.org/time-zones). * Updates to this field are currently not supported. */ timeZone?: string; /** * Optional. The user's timezone offset relative to UTC. Updates to this * field are currently not supported. */ utcOffset?: number /* Duration */; /** * Optional. The measurement unit defined in the user's account settings. */ waterUnit?: | "WATER_UNIT_UNSPECIFIED" | "WATER_UNIT_ML" | "WATER_UNIT_FL_OZ" | "WATER_UNIT_CUP"; /** * Optional. The measurement unit defined in the user's account settings. */ weightUnit?: | "WEIGHT_UNIT_UNSPECIFIED" | "WEIGHT_UNIT_POUNDS" | "WEIGHT_UNIT_STONE" | "WEIGHT_UNIT_KILOGRAMS"; } function serializeSettings(data: any): Settings { return { ...data, utcOffset: data["utcOffset"] !== undefined ? data["utcOffset"] : undefined, }; } function deserializeSettings(data: any): Settings { return { ...data, utcOffset: data["utcOffset"] !== undefined ? data["utcOffset"] : undefined, }; } /** * A sleep session possibly including stages. */ export interface Sleep { /** * Output only. Creation time of this sleep observation. */ readonly createTime?: Date; /** * Required. Observed sleep interval. */ interval?: SessionTimeInterval; /** * Optional. Sleep metadata: processing, main, manually edited, stages * status. */ metadata?: SleepMetadata; /** * Optional. “Out of bed” segments that can overlap with sleep stages. */ outOfBedSegments?: OutOfBedSegment[]; /** * Optional. List of non-overlapping contiguous sleep stage segments that * cover the sleep period. */ stages?: SleepStage[]; /** * Output only. Sleep summary: metrics and stages summary. */ readonly summary?: SleepSummary; /** * Optional. SleepType: classic or stages. */ type?: | "SLEEP_TYPE_UNSPECIFIED" | "CLASSIC" | "STAGES"; /** * Output only. Last update time of this sleep observation. */ readonly updateTime?: Date; } function serializeSleep(data: any): Sleep { return { ...data, interval: data["interval"] !== undefined ? serializeSessionTimeInterval(data["interval"]) : undefined, outOfBedSegments: data["outOfBedSegments"] !== undefined ? data["outOfBedSegments"].map((item: any) => (serializeOutOfBedSegment(item))) : undefined, stages: data["stages"] !== undefined ? data["stages"].map((item: any) => (serializeSleepStage(item))) : undefined, }; } function deserializeSleep(data: any): Sleep { return { ...data, createTime: data["createTime"] !== undefined ? new Date(data["createTime"]) : undefined, interval: data["interval"] !== undefined ? deserializeSessionTimeInterval(data["interval"]) : undefined, outOfBedSegments: data["outOfBedSegments"] !== undefined ? data["outOfBedSegments"].map((item: any) => (deserializeOutOfBedSegment(item))) : undefined, stages: data["stages"] !== undefined ? data["stages"].map((item: any) => (deserializeSleepStage(item))) : undefined, updateTime: data["updateTime"] !== undefined ? new Date(data["updateTime"]) : undefined, }; } /** * Additional information about how the sleep was processed. */ export interface SleepMetadata { /** * Optional. Sleep identifier relevant in the context of the data source. */ externalId?: string; /** * Output only. Some sleeps autodetected by algorithms can be manually edited * by users. */ readonly manuallyEdited?: boolean; /** * Output only. Naps are sleeps without stages and relatively short * durations. */ readonly nap?: boolean; /** * Output only. Sleep and sleep stages algorithms finished processing. */ readonly processed?: boolean; /** * Output only. Sleep stages algorithm processing status. */ readonly stagesStatus?: | "STAGES_STATE_UNSPECIFIED" | "REJECTED_COVERAGE" | "REJECTED_MAX_GAP" | "REJECTED_START_GAP" | "REJECTED_END_GAP" | "REJECTED_NAP" | "REJECTED_SERVER" | "TIMEOUT" | "SUCCEEDED" | "PROCESSING_INTERNAL_ERROR"; } /** * Sleep stage segment. */ export interface SleepStage { /** * Output only. Creation time of this sleep stages segment. */ readonly createTime?: Date; /** * Required. Sleep stage end time. */ endTime?: Date; /** * Required. The offset of the user's local time at the end of the sleep * stage relative to the Coordinated Universal Time (UTC). */ endUtcOffset?: number /* Duration */; /** * Required. Sleep stage start time. */ startTime?: Date; /** * Required. The offset of the user's local time at the start of the sleep * stage relative to the Coordinated Universal Time (UTC). */ startUtcOffset?: number /* Duration */; /** * Required. Sleep stage type: AWAKE, DEEP, REM, LIGHT etc. */ type?: | "SLEEP_STAGE_TYPE_UNSPECIFIED" | "AWAKE" | "LIGHT" | "DEEP" | "REM" | "ASLEEP" | "RESTLESS"; /** * Output only. Last update time of this sleep stages segment. */ readonly updateTime?: Date; } function serializeSleepStage(data: any): SleepStage { return { ...data, endTime: data["endTime"] !== undefined ? data["endTime"].toISOString() : undefined, endUtcOffset: data["endUtcOffset"] !== undefined ? data["endUtcOffset"] : undefined, startTime: data["startTime"] !== undefined ? data["startTime"].toISOString() : undefined, startUtcOffset: data["startUtcOffset"] !== undefined ? data["startUtcOffset"] : undefined, }; } function deserializeSleepStage(data: any): SleepStage { return { ...data, createTime: data["createTime"] !== undefined ? new Date(data["createTime"]) : undefined, endTime: data["endTime"] !== undefined ? new Date(data["endTime"]) : undefined, endUtcOffset: data["endUtcOffset"] !== undefined ? data["endUtcOffset"] : undefined, startTime: data["startTime"] !== undefined ? new Date(data["startTime"]) : undefined, startUtcOffset: data["startUtcOffset"] !== undefined ? data["startUtcOffset"] : undefined, updateTime: data["updateTime"] !== undefined ? new Date(data["updateTime"]) : undefined, }; } /** * Sleep summary: metrics and stages summary. */ export interface SleepSummary { /** * Output only. Minutes after wake up calculated by restlessness algorithm. */ readonly minutesAfterWakeUp?: bigint; /** * Output only. Total number of minutes asleep. For classic sleep it is the * sum of ASLEEP stages (excluding AWAKE and RESTLESS). For "stages" sleep it * is the sum of LIGHT, REM and DEEP stages (excluding AWAKE). */ readonly minutesAsleep?: bigint; /** * Output only. Total number of minutes awake. It is a sum of all AWAKE * stages. */ readonly minutesAwake?: bigint; /** * Output only. Delta between wake time and bedtime. It is the sum of all * stages. */ readonly minutesInSleepPeriod?: bigint; /** * Output only. Minutes to fall asleep calculated by restlessness algorithm. */ readonly minutesToFallAsleep?: bigint; /** * Output only. List of summaries (total duration and segment count) per each * sleep stage type. */ readonly stagesSummary?: StageSummary[]; } /** * Represents splits or laps recorded within an exercise. Lap events partition * a workout into segments based on criteria like distance, time, or calories. */ export interface SplitSummary { /** * Output only. Lap time excluding the pauses. */ readonly activeDuration?: number /* Duration */; /** * Required. Lap end time */ endTime?: Date; /** * Required. Lap end time offset from UTC */ endUtcOffset?: number /* Duration */; /** * Required. Summary metrics for this split. */ metricsSummary?: MetricsSummary; /** * Required. Method used to split the exercise laps. Users may manually mark * the lap as complete even if the tracking is automatic. */ splitType?: | "SPLIT_TYPE_UNSPECIFIED" | "MANUAL" | "DURATION" | "DISTANCE" | "CALORIES"; /** * Required. Lap start time */ startTime?: Date; /** * Required. Lap start time offset from UTC */ startUtcOffset?: number /* Duration */; } function serializeSplitSummary(data: any): SplitSummary { return { ...data, endTime: data["endTime"] !== undefined ? data["endTime"].toISOString() : undefined, endUtcOffset: data["endUtcOffset"] !== undefined ? data["endUtcOffset"] : undefined, metricsSummary: data["metricsSummary"] !== undefined ? serializeMetricsSummary(data["metricsSummary"]) : undefined, startTime: data["startTime"] !== undefined ? data["startTime"].toISOString() : undefined, startUtcOffset: data["startUtcOffset"] !== undefined ? data["startUtcOffset"] : undefined, }; } function deserializeSplitSummary(data: any): SplitSummary { return { ...data, activeDuration: data["activeDuration"] !== undefined ? data["activeDuration"] : undefined, endTime: data["endTime"] !== undefined ? new Date(data["endTime"]) : undefined, endUtcOffset: data["endUtcOffset"] !== undefined ? data["endUtcOffset"] : undefined, metricsSummary: data["metricsSummary"] !== undefined ? deserializeMetricsSummary(data["metricsSummary"]) : undefined, startTime: data["startTime"] !== undefined ? new Date(data["startTime"]) : undefined, startUtcOffset: data["startUtcOffset"] !== undefined ? data["startUtcOffset"] : undefined, }; } /** * Total duration and segment count for a stage. */ export interface StageSummary { /** * Output only. Number of sleep stages segments. */ readonly count?: bigint; /** * Output only. Total duration in minutes of a sleep stage. */ readonly minutes?: bigint; /** * Output only. Sleep stage type: AWAKE, DEEP, REM, LIGHT etc. */ readonly type?: | "SLEEP_STAGE_TYPE_UNSPECIFIED" | "AWAKE" | "LIGHT" | "DEEP" | "REM" | "ASLEEP" | "RESTLESS"; } /** * The `Status` type defines a logical error model that is suitable for * different programming environments, including REST APIs and RPC APIs. It is * used by [gRPC](https://github.com/grpc). Each `Status` message contains three * pieces of data: error code, error message, and error details. You can find * out more about this error model and how to work with it in the [API Design * Guide](https://cloud.google.com/apis/design/errors). */ export interface Status { /** * The status code, which should be an enum value of google.rpc.Code. */ code?: number; /** * A list of messages that carry the error details. There is a common set of * message types for APIs to use. */ details?: { [key: string]: any }[]; /** * A developer-facing error message, which should be in English. Any * user-facing error message should be localized and sent in the * google.rpc.Status.details field, or localized by the client. */ message?: string; } /** * Step count over the time interval. */ export interface Steps { /** * Required. Number of steps in the recorded interval. */ count?: bigint; /** * Required. Observed interval. */ interval?: ObservationTimeInterval; } function serializeSteps(data: any): Steps { return { ...data, count: data["count"] !== undefined ? String(data["count"]) : undefined, interval: data["interval"] !== undefined ? serializeObservationTimeInterval(data["interval"]) : undefined, }; } function deserializeSteps(data: any): Steps { return { ...data, count: data["count"] !== undefined ? BigInt(data["count"]) : undefined, interval: data["interval"] !== undefined ? deserializeObservationTimeInterval(data["interval"]) : undefined, }; } /** * Represents the result of the rollup of the steps data type. */ export interface StepsRollupValue { /** * Total number of steps in the interval. */ countSum?: bigint; } function serializeStepsRollupValue(data: any): StepsRollupValue { return { ...data, countSum: data["countSum"] !== undefined ? String(data["countSum"]) : undefined, }; } function deserializeStepsRollupValue(data: any): StepsRollupValue { return { ...data, countSum: data["countSum"] !== undefined ? BigInt(data["countSum"]) : undefined, }; } /** * -- Resource Messages -- A subscriber receives notifications from Google * Health API. */ export interface Subscriber { /** * Output only. The time at which the subscriber was created. */ readonly createTime?: Date; /** * Required. Authorization mechanism for a subscriber endpoint. This is * required to ensure the endpoint can be verified. */ endpointAuthorization?: EndpointAuthorization; /** * Required. The full HTTPS URI where update notifications will be sent. The * URI must be a valid URL and use HTTPS as the scheme. This endpoint will be * verified during CreateSubscriber and UpdateSubscriber calls. See RPC * documentation for verification details. */ endpointUri?: string; /** * Identifier. The resource name of the Subscriber. Format: * projects/{project}/subscribers/{subscriber} The {project} ID is a Google * Cloud Project ID or Project Number. The {subscriber} ID is user-settable * (4-36 characters, matching /[a-z]([a-z0-9-]{2,34}[a-z0-9])/) if provided * during creation, or system-generated otherwise (e.g., a UUID). Example * (User-settable subscriber ID): projects/my-project/subscribers/my-sub-123 * Example (System-generated subscriber ID): * projects/my-project/subscribers/a1b2c3d4-e5f6-7890-1234-567890abcdef */ name?: string; /** * Output only. The state of the subscriber. */ readonly state?: | "STATE_UNSPECIFIED" | "UNVERIFIED" | "ACTIVE" | "INACTIVE"; /** * Optional. Configuration for the subscriber. */ subscriberConfigs?: SubscriberConfig[]; /** * Output only. The time at which the subscriber was last updated. */ readonly updateTime?: Date; } /** * Configuration for a subscriber. A notification is sent to a subscription * ONLY if the subscriber has a config for the data type. */ export interface SubscriberConfig { /** * Required. Supported data types are: "altitude", "distance", "floors", * "sleep", "steps", "weight". Values should be in kebab-case. */ dataTypes?: string[]; /** * Required. Policy for subscription creation. */ subscriptionCreatePolicy?: | "SUBSCRIPTION_CREATE_POLICY_UNSPECIFIED" | "AUTOMATIC" | "MANUAL"; } /** * Swim lengths data over the time interval. */ export interface SwimLengthsData { /** * Required. Observed interval. */ interval?: ObservationTimeInterval; /** * Required. Number of strokes in the lap. */ strokeCount?: bigint; /** * Required. Swim stroke type. */ swimStrokeType?: | "SWIM_STROKE_TYPE_UNSPECIFIED" | "FREESTYLE" | "BACKSTROKE" | "BREASTSTROKE" | "BUTTERFLY"; } function serializeSwimLengthsData(data: any): SwimLengthsData { return { ...data, interval: data["interval"] !== undefined ? serializeObservationTimeInterval(data["interval"]) : undefined, strokeCount: data["strokeCount"] !== undefined ? String(data["strokeCount"]) : undefined, }; } function deserializeSwimLengthsData(data: any): SwimLengthsData { return { ...data, interval: data["interval"] !== undefined ? deserializeObservationTimeInterval(data["interval"]) : undefined, strokeCount: data["strokeCount"] !== undefined ? BigInt(data["strokeCount"]) : undefined, }; } /** * Represents the result of the rollup of the swim lengths data type. */ export interface SwimLengthsDataRollupValue { /** * Total number of swim strokes in the interval. */ strokeCountSum?: bigint; } function serializeSwimLengthsDataRollupValue(data: any): SwimLengthsDataRollupValue { return { ...data, strokeCountSum: data["strokeCountSum"] !== undefined ? String(data["strokeCountSum"]) : undefined, }; } function deserializeSwimLengthsDataRollupValue(data: any): SwimLengthsDataRollupValue { return { ...data, strokeCountSum: data["strokeCountSum"] !== undefined ? BigInt(data["strokeCountSum"]) : undefined, }; } /** * Time in heart rate zone record. It's an interval spent in specific heart * rate zone. */ export interface TimeInHeartRateZone { /** * Required. Heart rate zone type. */ heartRateZoneType?: | "HEART_RATE_ZONE_TYPE_UNSPECIFIED" | "LIGHT" | "MODERATE" | "VIGOROUS" | "PEAK"; /** * Required. Observed interval. */ interval?: ObservationTimeInterval; } function serializeTimeInHeartRateZone(data: any): TimeInHeartRateZone { return { ...data, interval: data["interval"] !== undefined ? serializeObservationTimeInterval(data["interval"]) : undefined, }; } function deserializeTimeInHeartRateZone(data: any): TimeInHeartRateZone { return { ...data, interval: data["interval"] !== undefined ? deserializeObservationTimeInterval(data["interval"]) : undefined, }; } /** * Represents the result of the rollup of the time in heart rate zone data * type. */ export interface TimeInHeartRateZoneRollupValue { /** * List of time spent in each heart rate zone. */ timeInHeartRateZones?: TimeInHeartRateZoneValue[]; } function serializeTimeInHeartRateZoneRollupValue(data: any): TimeInHeartRateZoneRollupValue { return { ...data, timeInHeartRateZones: data["timeInHeartRateZones"] !== undefined ? data["timeInHeartRateZones"].map((item: any) => (serializeTimeInHeartRateZoneValue(item))) : undefined, }; } function deserializeTimeInHeartRateZoneRollupValue(data: any): TimeInHeartRateZoneRollupValue { return { ...data, timeInHeartRateZones: data["timeInHeartRateZones"] !== undefined ? data["timeInHeartRateZones"].map((item: any) => (deserializeTimeInHeartRateZoneValue(item))) : undefined, }; } /** * Time spent in each heart rate zone. */ export interface TimeInHeartRateZones { /** * Optional. Time spent in light heart rate zone. */ lightTime?: number /* Duration */; /** * Optional. Time spent in moderate heart rate zone. */ moderateTime?: number /* Duration */; /** * Optional. Time spent in peak heart rate zone. */ peakTime?: number /* Duration */; /** * Optional. Time spent in vigorous heart rate zone. */ vigorousTime?: number /* Duration */; } function serializeTimeInHeartRateZones(data: any): TimeInHeartRateZones { return { ...data, lightTime: data["lightTime"] !== undefined ? data["lightTime"] : undefined, moderateTime: data["moderateTime"] !== undefined ? data["moderateTime"] : undefined, peakTime: data["peakTime"] !== undefined ? data["peakTime"] : undefined, vigorousTime: data["vigorousTime"] !== undefined ? data["vigorousTime"] : undefined, }; } function deserializeTimeInHeartRateZones(data: any): TimeInHeartRateZones { return { ...data, lightTime: data["lightTime"] !== undefined ? data["lightTime"] : undefined, moderateTime: data["moderateTime"] !== undefined ? data["moderateTime"] : undefined, peakTime: data["peakTime"] !== undefined ? data["peakTime"] : undefined, vigorousTime: data["vigorousTime"] !== undefined ? data["vigorousTime"] : undefined, }; } /** * Represents the total time spent in a specific heart rate zone. */ export interface TimeInHeartRateZoneValue { /** * The total time spent in the specified heart rate zone. */ duration?: number /* Duration */; /** * The heart rate zone. */ heartRateZone?: | "HEART_RATE_ZONE_TYPE_UNSPECIFIED" | "LIGHT" | "MODERATE" | "VIGOROUS" | "PEAK"; } function serializeTimeInHeartRateZoneValue(data: any): TimeInHeartRateZoneValue { return { ...data, duration: data["duration"] !== undefined ? data["duration"] : undefined, }; } function deserializeTimeInHeartRateZoneValue(data: any): TimeInHeartRateZoneValue { return { ...data, duration: data["duration"] !== undefined ? data["duration"] : undefined, }; } /** * Represents a time of day. The date and time zone are either not significant * or are specified elsewhere. An API may choose to allow leap seconds. Related * types are google.type.Date and `google.protobuf.Timestamp`. */ export interface TimeOfDay { /** * Hours of a day in 24 hour format. Must be greater than or equal to 0 and * typically must be less than or equal to 23. An API may choose to allow the * value "24:00:00" for scenarios like business closing time. */ hours?: number; /** * Minutes of an hour. Must be greater than or equal to 0 and less than or * equal to 59. */ minutes?: number; /** * Fractions of seconds, in nanoseconds. Must be greater than or equal to 0 * and less than or equal to 999,999,999. */ nanos?: number; /** * Seconds of a minute. Must be greater than or equal to 0 and typically must * be less than or equal to 59. An API may allow the value 60 if it allows * leap-seconds. */ seconds?: number; } /** * Represents a time zone from the [IANA Time Zone * Database](https://www.iana.org/time-zones). */ export interface TimeZone { /** * IANA Time Zone Database time zone. For example "America/New_York". */ id?: string; /** * Optional. IANA Time Zone Database version number. For example "2019a". */ version?: string; } /** * Represents the result of the rollup of the user's total calories. */ export interface TotalCaloriesRollupValue { /** * Sum of the total calories in kilocalories. */ kcalSum?: number; } /** * Additional options for Health#usersDataTypesDataPointsExportExerciseTcx. */ export interface UsersDataTypesDataPointsExportExerciseTcxOptions { /** * Optional. Indicates whether to include the TCX data points when the GPS * data is not available. If not specified, defaults to `false` and partial * data will not be included. */ partialData?: boolean; } /** * Additional options for Health#usersDataTypesDataPointsList. */ export interface UsersDataTypesDataPointsListOptions { /** * Optional. Filter expression following https://google.aip.dev/160. A time * range (either physical or civil) can be specified. The supported filter * fields are: - Interval start time: - Pattern: * `{interval_data_type}.interval.start_time` - Supported comparison * operators: `>=`, `<` - Timestamp literal expected in RFC-3339 format - * Supported logical operators: `AND` - Example: - `steps.interval.start_time * >= "2023-11-24T00:00:00Z" AND steps.interval.start_time < * "2023-11-25T00:00:00Z"` - `distance.interval.start_time >= * "2024-08-14T12:34:56Z"` - Interval civil start time: - Pattern: * `{interval_data_type}.interval.civil_start_time` - Supported comparison * operators: `>=`, `<` - Date with optional time literal expected in ISO 8601 * `YYYY-MM-DD[THH:mm:ss]` format - Supported logical operators: `AND` - * Example: - `steps.interval.civil_start_time >= "2023-11-24" AND * steps.interval.civil_start_time < "2023-11-25"` - * `distance.interval.civil_start_time >= "2024-08-14T12:34:56"` - Sample * observation physical time: - Pattern: * `{sample_data_type}.sample_time.physical_time` - Supported comparison * operators: `>=`, `<` - Timestamp literal expected in RFC-3339 format - * Supported logical operators: `AND` - Example: - * `weight.sample_time.physical_time >= "2023-11-24T00:00:00Z" AND * weight.sample_time.physical_time < "2023-11-25T00:00:00Z"` - * `weight.sample_time.physical_time >= "2024-08-14T12:34:56Z"` - Sample * observation civil time: - Pattern: * `{sample_data_type}.sample_time.civil_time` - Supported comparison * operators: `>=`, `<` - Date with optional time literal expected in ISO 8601 * `YYYY-MM-DD[THH:mm:ss]` format - Supported logical operators: `AND` - * Example: - `weight.sample_time.civil_time >= "2023-11-24" AND * weight.sample_time.civil_time < "2023-11-25"` - * `weight.sample_time.civil_time >= "2024-08-14T12:34:56"` - Daily summary * date: - Pattern: `{daily_summary_data_type}.date` - Supported comparison * operators: `>=`, `<` - Date literal expected in ISO 8601 `YYYY-MM-DD` * format - Supported logical operators: `AND` - Example: - * `daily_resting_heart_rate.date >= "2024-08-14"` - * `daily_heart_rate_variability.date < "2024-08-15"` - Session civil start * time (**Excluding Sleep**): - Pattern: * `{session_data_type}.interval.civil_start_time` - Supported comparison * operators: `>=`, `<` - Date with optional time literal expected in ISO 8601 * `YYYY-MM-DD[THH:mm:ss]` format - Supported logical operators: `AND` - * Example: - `exercise.interval.civil_start_time >= "2023-11-24" AND * exercise.interval.civil_start_time < "2023-11-25"` - * `exercise.interval.civil_start_time >= "2024-08-14T12:34:56"` - Session end * time (**Sleep specific**): - Pattern: `sleep.interval.end_time` - Supported * comparison operators: `>=`, `<` - Timestamp literal expected in RFC-3339 * format - Supported logical operators: `AND`, `OR` - Example: - * `sleep.interval.end_time >= "2023-11-24T00:00:00Z" AND * sleep.interval.end_time < "2023-11-25T00:00:00Z"` - Session civil end time * (**Sleep specific**): - Pattern: `sleep.interval.civil_end_time` - * Supported comparison operators: `>=`, `<` - Date with optional time literal * expected in ISO 8601 `YYYY-MM-DD[THH:mm:ss]` format - Supported logical * operators: `AND`, `OR` - Example: - `sleep.interval.civil_end_time >= * "2023-11-24" AND sleep.interval.civil_end_time < "2023-11-25"` Data points * in the response will be ordered by the interval start time in descending * order. */ filter?: string; /** * Optional. The maximum number of data points to return. If unspecified, at * most 1440 data points will be returned. The maximum page size is 10000; * values above that will be truncated accordingly. For `exercise` and `sleep` * the default page size is 25. The maximum page size for `exercise` and * `sleep` is 25. */ pageSize?: number; /** * Optional. The `next_page_token` from a previous request, if any. */ pageToken?: string; } /** * Additional options for Health#usersDataTypesDataPointsReconcile. */ export interface UsersDataTypesDataPointsReconcileOptions { /** * Optional. The data source family name to reconcile. If empty, data points * from all data sources will be reconciled. Format: * `users/me/dataSourceFamilies/{data_source_family}` The supported values * are: - `users/me/dataSourceFamilies/all-sources` - default value - * `users/me/dataSourceFamilies/google-wearables` - tracker devices - * `users/me/dataSourceFamilies/google-sources` - Google first party sources */ dataSourceFamily?: string; /** * Optional. Filter expression based on https://aip.dev/160. A time range, * either physical or civil, can be specified. See the * ListDataPointsRequest.filter for the supported fields and syntax. */ filter?: string; /** * Optional. The maximum number of data points to return. If unspecified, at * most 1440 data points will be returned. The maximum page size is 10000; * values above that will be truncated accordingly. For `exercise` and `sleep` * the default page size is 25. The maximum page size for `exercise` and * `sleep` is 25. */ pageSize?: number; /** * Optional. The `next_page_token` from a previous request, if any. */ pageToken?: string; } /** * Additional options for Health#usersUpdateProfile. */ export interface UsersUpdateProfileOptions { /** * Optional. The list of fields to be updated. */ updateMask?: string /* FieldMask */; } function serializeUsersUpdateProfileOptions(data: any): UsersUpdateProfileOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } function deserializeUsersUpdateProfileOptions(data: any): UsersUpdateProfileOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } /** * Additional options for Health#usersUpdateSettings. */ export interface UsersUpdateSettingsOptions { /** * Optional. The list of fields to be updated. */ updateMask?: string /* FieldMask */; } function serializeUsersUpdateSettingsOptions(data: any): UsersUpdateSettingsOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } function deserializeUsersUpdateSettingsOptions(data: any): UsersUpdateSettingsOptions { return { ...data, updateMask: data["updateMask"] !== undefined ? data["updateMask"] : undefined, }; } /** * VO2 max measurement. */ export interface VO2Max { /** * Optional. The method used to measure the VO2 max value. */ measurementMethod?: | "MEASUREMENT_METHOD_UNSPECIFIED" | "FITBIT_RUN" | "GOOGLE_DEMOGRAPHIC" | "COOPER_TEST" | "HEART_RATE_RATIO" | "METABOLIC_CART" | "MULTISTAGE_FITNESS_TEST" | "ROCKPORT_FITNESS_TEST" | "MAX_EXERCISE" | "PREDICTION_SUB_MAX_EXERCISE" | "PREDICTION_NON_EXERCISE" | "OTHER"; /** * Required. The time at which VO2 max was measured. */ sampleTime?: ObservationSampleTime; /** * Required. VO2 max value measured as in ml consumed oxygen / kg of body * weight / min. */ vo2Max?: number; } function serializeVO2Max(data: any): VO2Max { return { ...data, sampleTime: data["sampleTime"] !== undefined ? serializeObservationSampleTime(data["sampleTime"]) : undefined, }; } function deserializeVO2Max(data: any): VO2Max { return { ...data, sampleTime: data["sampleTime"] !== undefined ? deserializeObservationSampleTime(data["sampleTime"]) : undefined, }; } /** * Represents the volume quantity. */ export interface VolumeQuantity { /** * Required. Value representing the volume in milliliters. */ milliliters?: number; /** * Optional. Value representing the user provided unit. */ userProvidedUnit?: | "VOLUME_UNIT_UNSPECIFIED" | "CUP_IMPERIAL" | "CUP_US" | "FLUID_OUNCE_IMPERIAL" | "FLUID_OUNCE_US" | "LITER" | "MILLILITER" | "PINT_IMPERIAL" | "PINT_US"; } /** * Rollup for volume quantity. */ export interface VolumeQuantityRollup { /** * Required. The sum of volume in milliliters. */ millilitersSum?: number; /** * Optional. The user provided unit on the last element. */ userProvidedUnitLast?: | "VOLUME_UNIT_UNSPECIFIED" | "CUP_IMPERIAL" | "CUP_US" | "FLUID_OUNCE_IMPERIAL" | "FLUID_OUNCE_US" | "LITER" | "MILLILITER" | "PINT_IMPERIAL" | "PINT_US"; } /** * Log message for a webhook notification sent by the Google Health API to a * subscriber's endpoint. Includes the HTTP response received from the endpoint. */ export interface WebhookNotificationCloudLog { /** * Required. Represents the HTTP response. This message includes the status * code, reason phrase, headers, and body. */ httpResponse?: HttpResponse; } function serializeWebhookNotificationCloudLog(data: any): WebhookNotificationCloudLog { return { ...data, httpResponse: data["httpResponse"] !== undefined ? serializeHttpResponse(data["httpResponse"]) : undefined, }; } function deserializeWebhookNotificationCloudLog(data: any): WebhookNotificationCloudLog { return { ...data, httpResponse: data["httpResponse"] !== undefined ? deserializeHttpResponse(data["httpResponse"]) : undefined, }; } /** * Body weight measurement. */ export interface Weight { /** * Optional. Standard free-form notes captured at manual logging. */ notes?: string; /** * Required. The time at which the weight was measured */ sampleTime?: ObservationSampleTime; /** * Required. Weight of a user in grams. */ weightGrams?: number; } function serializeWeight(data: any): Weight { return { ...data, sampleTime: data["sampleTime"] !== undefined ? serializeObservationSampleTime(data["sampleTime"]) : undefined, }; } function deserializeWeight(data: any): Weight { return { ...data, sampleTime: data["sampleTime"] !== undefined ? deserializeObservationSampleTime(data["sampleTime"]) : undefined, }; } /** * Represents the result of the rollup of the weight data type. */ export interface WeightRollupValue { /** * Average weight in grams. */ weightGramsAvg?: number; } function decodeBase64(b64: string): Uint8Array { const binString = atob(b64); const size = binString.length; const bytes = new Uint8Array(size); for (let i = 0; i < size; i++) { bytes[i] = binString.charCodeAt(i); } return bytes; } const base64abc = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"]; /** * CREDIT: https://gist.github.com/enepomnyaschih/72c423f727d395eeaa09697058238727 * Encodes a given Uint8Array, ArrayBuffer or string into RFC4648 base64 representation * @param data */ function encodeBase64(uint8: Uint8Array): string { let result = "", i; const l = uint8.length; for (i = 2; i < l; i += 3) { result += base64abc[uint8[i - 2] >> 2]; result += base64abc[((uint8[i - 2] & 0x03) << 4) | (uint8[i - 1] >> 4)]; result += base64abc[((uint8[i - 1] & 0x0f) << 2) | (uint8[i] >> 6)]; result += base64abc[uint8[i] & 0x3f]; } if (i === l + 1) { // 1 octet yet to write result += base64abc[uint8[i - 2] >> 2]; result += base64abc[(uint8[i - 2] & 0x03) << 4]; result += "=="; } if (i === l) { // 2 octets yet to write result += base64abc[uint8[i - 2] >> 2]; result += base64abc[((uint8[i - 2] & 0x03) << 4) | (uint8[i - 1] >> 4)]; result += base64abc[(uint8[i - 1] & 0x0f) << 2]; result += "="; } return result; }