diff --git a/packages/google-devicesandservices-health/.eslintignore b/packages/google-devicesandservices-health/.eslintignore new file mode 100644 index 000000000000..cfc348ec4d11 --- /dev/null +++ b/packages/google-devicesandservices-health/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/packages/google-devicesandservices-health/.eslintrc.json b/packages/google-devicesandservices-health/.eslintrc.json new file mode 100644 index 000000000000..3e8d97ccb390 --- /dev/null +++ b/packages/google-devicesandservices-health/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "extends": "./node_modules/gts", + "root": true +} diff --git a/packages/google-devicesandservices-health/README.md b/packages/google-devicesandservices-health/README.md index 59cdd45a9e48..9f88de4a099b 100644 --- a/packages/google-devicesandservices-health/README.md +++ b/packages/google-devicesandservices-health/README.md @@ -66,6 +66,10 @@ Samples are in the [`samples/`][homepage_samples] directory. Each sample's `READ | reconcile data points | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devicesandservices-health/samples/generated/v4/data_points_service.reconcile_data_points.js) | | roll up data points | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devicesandservices-health/samples/generated/v4/data_points_service.roll_up_data_points.js) | | update data point | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devicesandservices-health/samples/generated/v4/data_points_service.update_data_point.js) | +| create subscriber | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devicesandservices-health/samples/generated/v4/data_subscription_service.create_subscriber.js) | +| delete subscriber | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devicesandservices-health/samples/generated/v4/data_subscription_service.delete_subscriber.js) | +| list subscribers | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devicesandservices-health/samples/generated/v4/data_subscription_service.list_subscribers.js) | +| update subscriber | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devicesandservices-health/samples/generated/v4/data_subscription_service.update_subscriber.js) | | get identity | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devicesandservices-health/samples/generated/v4/health_profile_service.get_identity.js) | | get profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devicesandservices-health/samples/generated/v4/health_profile_service.get_profile.js) | | get settings | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devicesandservices-health/samples/generated/v4/health_profile_service.get_settings.js) | @@ -105,7 +109,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devicesandservices-health/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). Please note that this `README.md` and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) @@ -115,7 +119,7 @@ are generated from a central template. Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-devicesandservices-health/LICENSE) +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project diff --git a/packages/google-devicesandservices-health/protos/google/devicesandservices/health/v4/data_model.proto b/packages/google-devicesandservices-health/protos/google/devicesandservices/health/v4/data_model.proto index 2bb2a9d69068..7c4febe624fb 100644 --- a/packages/google-devicesandservices-health/protos/google/devicesandservices/health/v4/data_model.proto +++ b/packages/google-devicesandservices-health/protos/google/devicesandservices/health/v4/data_model.proto @@ -106,19 +106,20 @@ message 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). - int64 active_zone_minutes = 3 [(google.api.field_behavior) = REQUIRED]; + optional int64 active_zone_minutes = 3 + [(google.api.field_behavior) = REQUIRED]; } // Represents the result of the rollup of the active zone minutes data type. message ActiveZoneMinutesRollupValue { // Active zone minutes in `HeartRateZone.CARDIO`. - int64 sum_in_cardio_heart_zone = 1; + optional int64 sum_in_cardio_heart_zone = 1; // Active zone minutes in `HeartRateZone.PEAK`. - int64 sum_in_peak_heart_zone = 2; + optional int64 sum_in_peak_heart_zone = 2; // Active zone minutes in `HeartRateZone.FAT_BURN`. - int64 sum_in_fat_burn_heart_zone = 3; + optional int64 sum_in_fat_burn_heart_zone = 3; } // Record of active minutes in a given time interval. @@ -129,7 +130,7 @@ message ActiveMinutes { ActivityLevel activity_level = 1 [(google.api.field_behavior) = REQUIRED]; // Required. Number of whole minutes spent in activity. - int64 active_minutes = 2 [(google.api.field_behavior) = REQUIRED]; + optional int64 active_minutes = 2 [(google.api.field_behavior) = REQUIRED]; } // Activity level. @@ -164,7 +165,7 @@ message ActiveMinutesRollupValue { ActiveMinutes.ActivityLevel activity_level = 1; // Number of whole minutes spent in activity. - int64 active_minutes_sum = 2; + optional int64 active_minutes_sum = 2; } // Active minutes by activity level. At most one record per activity level @@ -224,7 +225,7 @@ message Altitude { ObservationTimeInterval interval = 2 [(google.api.field_behavior) = REQUIRED]; // Required. Altitude gain in millimeters over the observed interval. - int64 gain_millimeters = 3 [(google.api.field_behavior) = REQUIRED]; + optional int64 gain_millimeters = 3 [(google.api.field_behavior) = REQUIRED]; } // Number of calories burned due to basal metabolic rate (BMR) over a period of @@ -235,7 +236,7 @@ message BasalEnergyBurned { // Required. Number of calories burned due to basal metabolic rate in // kilocalories over the observed interval. - double kcal = 2 [(google.api.field_behavior) = REQUIRED]; + optional double kcal = 2 [(google.api.field_behavior) = REQUIRED]; } // Body fat measurement. @@ -245,13 +246,13 @@ message BodyFat { [(google.api.field_behavior) = REQUIRED]; // Required. Body fat percentage, in range [0, 100]. - double percentage = 3 [(google.api.field_behavior) = REQUIRED]; + optional double percentage = 3 [(google.api.field_behavior) = REQUIRED]; } // Represents the result of the rollup of the body fat data type. message BodyFatRollupValue { // Average body fat percentage. - double body_fat_percentage_avg = 1; + optional double body_fat_percentage_avg = 1; } // Represents the result of the rollup of the calories in heart rate zone data @@ -263,7 +264,7 @@ message CaloriesInHeartRateZoneRollupValue { HeartRateZoneType heart_rate_zone = 1; // The amount of kilocalories burned in the specified heart rate zone. - double kcal = 2; + optional double kcal = 2; } // List of calories burned in each heart rate zone. @@ -280,10 +281,12 @@ message DailyHeartRateZones { [(google.api.field_behavior) = REQUIRED]; // Required. Minimum heart rate for this zone in beats per minute. - int64 min_beats_per_minute = 2 [(google.api.field_behavior) = REQUIRED]; + optional int64 min_beats_per_minute = 2 + [(google.api.field_behavior) = REQUIRED]; // Required. Maximum heart rate for this zone in beats per minute. - int64 max_beats_per_minute = 3 [(google.api.field_behavior) = REQUIRED]; + optional int64 max_beats_per_minute = 3 + [(google.api.field_behavior) = REQUIRED]; } // Required. Date (in user's timezone) of the heart rate zones record. @@ -336,7 +339,8 @@ message DailyRespiratoryRate { google.type.Date date = 1 [(google.api.field_behavior) = REQUIRED]; // Required. The average number of breaths taken per minute. - double breaths_per_minute = 2 [(google.api.field_behavior) = REQUIRED]; + optional double breaths_per_minute = 2 + [(google.api.field_behavior) = REQUIRED]; } // A daily oxygen saturation (SpO2) record. @@ -348,19 +352,22 @@ message DailyOxygenSaturation { // Required. The average value of the oxygen saturation samples during the // sleep. - double average_percentage = 2 [(google.api.field_behavior) = REQUIRED]; + optional double average_percentage = 2 + [(google.api.field_behavior) = REQUIRED]; // Required. The lower bound of the confidence interval of oxygen saturation // samples during sleep. - double lower_bound_percentage = 3 [(google.api.field_behavior) = REQUIRED]; + optional double lower_bound_percentage = 3 + [(google.api.field_behavior) = REQUIRED]; // Required. The upper bound of the confidence interval of oxygen saturation // samples during sleep. - double upper_bound_percentage = 4 [(google.api.field_behavior) = REQUIRED]; + optional double upper_bound_percentage = 4 + [(google.api.field_behavior) = REQUIRED]; // Optional. Standard deviation of the daily oxygen saturation averages from // the past 7-30 days. - double standard_deviation_percentage = 5 + optional double standard_deviation_percentage = 5 [(google.api.field_behavior) = OPTIONAL]; } @@ -391,7 +398,7 @@ message DailyRestingHeartRate { google.type.Date date = 2 [(google.api.field_behavior) = REQUIRED]; // Required. The resting heart rate value in beats per minute. - int64 beats_per_minute = 4 [(google.api.field_behavior) = REQUIRED]; + optional int64 beats_per_minute = 4 [(google.api.field_behavior) = REQUIRED]; // Optional. Metadata for the daily resting heart rate. DailyRestingHeartRateMetadata daily_resting_heart_rate_metadata = 5 @@ -406,17 +413,17 @@ message DailySleepTemperatureDerivations { // Required. The user's nightly skin temperature. It is the mean of skin // temperature samples taken from the user’s sleep. - double nightly_temperature_celsius = 2 + optional double nightly_temperature_celsius = 2 [(google.api.field_behavior) = REQUIRED]; // Optional. The user's baseline skin temperature. It is the median of the // user's nightly skin temperature over the past 30 days. - double baseline_temperature_celsius = 3 + optional double baseline_temperature_celsius = 3 [(google.api.field_behavior) = OPTIONAL]; // Optional. The standard deviation of the user’s relative nightly skin // temperature (temperature - baseline) over the past 30 days. - double relative_nightly_stddev_30d_celsius = 4 + optional double relative_nightly_stddev_30d_celsius = 4 [(google.api.field_behavior) = OPTIONAL]; } @@ -452,7 +459,7 @@ message DailyVO2Max { // Required. Daily VO2 max value measured as in ml consumed oxygen / kg of // body weight / min. - double vo2_max = 2 [(google.api.field_behavior) = REQUIRED]; + optional double vo2_max = 2 [(google.api.field_behavior) = REQUIRED]; // Optional. An estimated field is added to indicate when the confidence has // decreased sufficiently to consider the value an estimation. @@ -464,7 +471,8 @@ message DailyVO2Max { [(google.api.field_behavior) = OPTIONAL]; // Optional. The covariance of the VO2 max value. - double vo2_max_covariance = 5 [(google.api.field_behavior) = OPTIONAL]; + optional double vo2_max_covariance = 5 + [(google.api.field_behavior) = OPTIONAL]; } // Distance traveled over an interval of time. @@ -473,13 +481,13 @@ message Distance { ObservationTimeInterval interval = 2 [(google.api.field_behavior) = REQUIRED]; // Required. Distance in millimeters over the observed interval. - int64 millimeters = 3 [(google.api.field_behavior) = REQUIRED]; + optional int64 millimeters = 3 [(google.api.field_behavior) = REQUIRED]; } // Result of the rollup of the user's distance. message DistanceRollupValue { // Sum of the distance in millimeters. - int64 millimeters_sum = 1; + optional int64 millimeters_sum = 1; } // An exercise that stores information about a physical activity. @@ -579,7 +587,8 @@ message Exercise { message ExerciseMetadata { // Optional. Pool length in millimeters. Only present in the swimming // exercises. - int64 pool_length_millimeters = 1 [(google.api.field_behavior) = OPTIONAL]; + optional int64 pool_length_millimeters = 1 + [(google.api.field_behavior) = OPTIONAL]; // Optional. Whether the exercise had GPS tracking. bool has_gps = 2 [(google.api.field_behavior) = OPTIONAL]; @@ -685,19 +694,19 @@ message Floors { ObservationTimeInterval interval = 2 [(google.api.field_behavior) = REQUIRED]; // Required. Number of floors in the recorded interval - int64 count = 4 [(google.api.field_behavior) = REQUIRED]; + optional int64 count = 4 [(google.api.field_behavior) = REQUIRED]; } // Represents the result of the rollup of the user's floors. message FloorsRollupValue { // Sum of the floors count. - int64 count_sum = 1; + optional int64 count_sum = 1; } // Represents the result of the rollup of the user's altitude. message AltitudeRollupValue { // Sum of the altitude gain in millimeters. - int64 gain_millimeters_sum = 1; + optional int64 gain_millimeters_sum = 1; } // A heart rate measurement. @@ -754,7 +763,7 @@ message HeartRate { [(google.api.field_behavior) = REQUIRED]; // Required. The heart rate value in beats per minute. - int64 beats_per_minute = 4 [(google.api.field_behavior) = REQUIRED]; + optional int64 beats_per_minute = 4 [(google.api.field_behavior) = REQUIRED]; // Optional. Metadata about the heart rate sample. HeartRateMetadata metadata = 6 [(google.api.field_behavior) = OPTIONAL]; @@ -776,13 +785,13 @@ message HeartRateRollupValue { // variability personal range. message RunVO2MaxRollupValue { // Minimum value of run VO2 max in the interval.. - double rate_min = 1; + optional double rate_min = 1; // Maximum value of run VO2 max in the interval. - double rate_max = 2; + optional double rate_max = 2; // Average value of run VO2 max in the interval. - double rate_avg = 3; + optional double rate_avg = 3; } // VO2 max value calculated based on the user's running activity. @@ -793,7 +802,7 @@ message RunVO2Max { [(google.api.field_behavior) = REQUIRED]; // Required. Run VO2 max value in ml/kg/min. - double run_vo2_max = 2 [(google.api.field_behavior) = REQUIRED]; + optional double run_vo2_max = 2 [(google.api.field_behavior) = REQUIRED]; } // Represents the result of the rollup of the user's daily heart rate @@ -815,7 +824,8 @@ message Height { [(google.api.field_behavior) = REQUIRED]; // Required. Height of the user in millimeters. - int64 height_millimeters = 2 [(google.api.field_behavior) = REQUIRED]; + optional int64 height_millimeters = 2 + [(google.api.field_behavior) = REQUIRED]; } // Captures user's heart rate variability (HRV) as measured by the root mean @@ -827,21 +837,24 @@ message HeartRateVariability { [(google.api.field_behavior) = REQUIRED]; // Optional. The root mean square of successive differences between normal - // heartbeats. This is a measure of heart rate variability used by Fitbit. - double root_mean_square_of_successive_differences_milliseconds = 2 + // heartbeats. This is a measure of heart rate variability used by Google + // Health. + optional double root_mean_square_of_successive_differences_milliseconds = 2 [(google.api.field_behavior) = OPTIONAL]; // Optional. The standard deviation of the heart rate variability measurement. - double standard_deviation_milliseconds = 3 + optional double standard_deviation_milliseconds = 3 [(google.api.field_behavior) = OPTIONAL]; } // Represents the volume quantity. message VolumeQuantity { // Required. Value representing the volume in milliliters. - double milliliters = 1 [(google.api.field_behavior) = REQUIRED]; + optional double milliliters = 1 [(google.api.field_behavior) = REQUIRED]; - // Optional. Value representing the user provided unit. + // Optional. Value representing the user provided unit, used only for + // user-facing input and display purposes. In the API format, all volume + // quantities are converted to milliliters. VolumeUnit user_provided_unit = 2 [(google.api.field_behavior) = OPTIONAL]; } @@ -859,7 +872,8 @@ message HydrationLogRollupValue { // Rollup for volume quantity. message VolumeQuantityRollup { // Required. The sum of volume in milliliters. - double milliliters_sum = 1 [(google.api.field_behavior) = REQUIRED]; + optional double milliliters_sum = 1 + [(google.api.field_behavior) = REQUIRED]; // Optional. The user provided unit on the last element. VolumeUnit user_provided_unit_last = 2 @@ -975,7 +989,7 @@ message OxygenSaturation { [(google.api.field_behavior) = REQUIRED]; // Required. The oxygen saturation percentage. Valid values are from 0 to 100. - double percentage = 2 [(google.api.field_behavior) = REQUIRED]; + optional double percentage = 2 [(google.api.field_behavior) = REQUIRED]; } // Represents the rollup value for the daily resting heart rate data type. @@ -993,13 +1007,16 @@ message RespiratoryRateSleepSummary { // Respiratory rate statistics for a given sleep stage. message RespiratoryRateSleepSummaryStatistics { // Required. Average breaths per minute. - double breaths_per_minute = 1 [(google.api.field_behavior) = REQUIRED]; + optional double breaths_per_minute = 1 + [(google.api.field_behavior) = REQUIRED]; // Optional. Standard deviation of the respiratory rate during sleep. - double standard_deviation = 2 [(google.api.field_behavior) = OPTIONAL]; + optional double standard_deviation = 2 + [(google.api.field_behavior) = OPTIONAL]; // Optional. How trustworthy the data is for the computation. - double signal_to_noise = 3 [(google.api.field_behavior) = OPTIONAL]; + optional double signal_to_noise = 3 + [(google.api.field_behavior) = OPTIONAL]; } // Required. The time at which respiratory rate was measured. @@ -1146,10 +1163,10 @@ message Sleep { SleepStageType type = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Total duration in minutes of a sleep stage. - int64 minutes = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + optional int64 minutes = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Number of sleep stages segments. - int64 count = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + optional int64 count = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; } // Output only. Delta between wake time and bedtime. It is the sum of all @@ -1257,13 +1274,13 @@ message Steps { ObservationTimeInterval interval = 2 [(google.api.field_behavior) = REQUIRED]; // Required. Number of steps in the recorded interval. - int64 count = 4 [(google.api.field_behavior) = REQUIRED]; + optional int64 count = 4 [(google.api.field_behavior) = REQUIRED]; } // Represents the result of the rollup of the steps data type. message StepsRollupValue { // Total number of steps in the interval. - int64 count_sum = 1; + optional int64 count_sum = 1; } // Swim lengths data over the time interval. @@ -1293,13 +1310,13 @@ message SwimLengthsData { SwimStrokeType swim_stroke_type = 2 [(google.api.field_behavior) = REQUIRED]; // Required. Number of strokes in the lap. - int64 stroke_count = 3 [(google.api.field_behavior) = REQUIRED]; + optional int64 stroke_count = 3 [(google.api.field_behavior) = REQUIRED]; } // Represents the result of the rollup of the swim lengths data type. message SwimLengthsDataRollupValue { // Total number of swim strokes in the interval. - int64 stroke_count_sum = 1; + optional int64 stroke_count_sum = 1; } // Time in heart rate zone record. It's an interval spent in specific heart @@ -1332,7 +1349,7 @@ message TimeInHeartRateZoneRollupValue { // Represents the result of the rollup of the user's total calories. message TotalCaloriesRollupValue { // Sum of the total calories in kilocalories. - double kcal_sum = 1; + optional double kcal_sum = 1; } // VO2 max measurement. @@ -1390,7 +1407,7 @@ message VO2Max { // Required. VO2 max value measured as in ml consumed oxygen / kg of body // weight / min. - double vo2_max = 2 [(google.api.field_behavior) = REQUIRED]; + optional double vo2_max = 2 [(google.api.field_behavior) = REQUIRED]; // Optional. The method used to measure the VO2 max value. MeasurementMethod measurement_method = 4 @@ -1404,7 +1421,7 @@ message Weight { [(google.api.field_behavior) = REQUIRED]; // Required. Weight of a user in grams. - double weight_grams = 3 [(google.api.field_behavior) = REQUIRED]; + optional double weight_grams = 3 [(google.api.field_behavior) = REQUIRED]; // Optional. Standard free-form notes captured at manual logging. string notes = 4 [(google.api.field_behavior) = OPTIONAL]; @@ -1413,7 +1430,7 @@ message Weight { // Represents the result of the rollup of the weight data type. message WeightRollupValue { // Average weight in grams. - double weight_grams_avg = 1; + optional double weight_grams_avg = 1; } // SedentaryPeriod diff --git a/packages/google-devicesandservices-health/protos/google/devicesandservices/health/v4/data_points.proto b/packages/google-devicesandservices-health/protos/google/devicesandservices/health/v4/data_points.proto index b6f1e69cdb2c..c974df0eeee0 100644 --- a/packages/google-devicesandservices-health/protos/google/devicesandservices/health/v4/data_points.proto +++ b/packages/google-devicesandservices-health/protos/google/devicesandservices/health/v4/data_points.proto @@ -133,8 +133,17 @@ service DataPointsService { // Exports exercise data in TCX format. // + // **IMPORTANT:** HTTP clients must append `?alt=media` to the + // request URL to download the raw TCX file. // - // Note: While the Authorization section below states that any one of the + // Example: + // `https://health.googleapis.com/v4/users/me/dataTypes/exercise/dataPoints/EXERCISE_ID:exportExerciseTcx?alt=media` + // + // Without `alt=media`, the server returns a JSON response + // (`ExportExerciseTcxResponse`) + // which is intended primarily for gRPC clients. + // + // **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 @@ -162,6 +171,9 @@ message DataPoint { // These messages represent the data payload for each data type and are // embedded within the `DataPoint` resource. They are not standalone resources // themselves. + // Unless otherwise noted, data types will exclude data points that are + // identified as recorded by wearables in intervals when they were not + // actually worn. oneof data { // Optional. Data for points in the `steps` interval data type collection. Steps steps = 4 [(google.api.field_behavior) = OPTIONAL]; @@ -323,6 +335,9 @@ message ReconciledDataPoint { // These messages represent the data payload for each data type and are // embedded within the `DataPoint` resource. They are not standalone resources // themselves. + // Unless otherwise noted, data types reconciliation algorithm will exclude + // data points that are identified as recorded by wearables in intervals + // when they were not actually worn. oneof data { // Data for points in the `steps` interval data type collection. Steps steps = 4; @@ -449,7 +464,10 @@ message ReconciledDataPoint { string data_point_name = 1 [(google.api.field_behavior) = IDENTIFIER]; } -// Value of a rollup for a single physical time interval (aggregation window) +// Value of a rollup for a single physical time interval (aggregation window) of +// reconciled data points from all data sources, excluding those data points +// that are identified as recorded by wearables in intervals when they were not +// actually worn. message RollupDataPoint { // Outcome of a rollup of the requested data type. // @@ -460,7 +478,11 @@ message RollupDataPoint { // `{original_field_name}_{aggregation_function}`. For example: // `confidence_min`, `confidence_sum`. // - // If there were no data points in this interval, the value will not be set. + // If there were no manual, on-wrist data points in this interval, + // the value will not be set. When the value is set, but the data shows zero, + // e.g. `steps.count_sum = 0`, it means that a device was worn but it did not + // record any data points for this data type. + // // These messages represent the aggregated data payload for each data type // and are embedded within the `RollupDataPoint`. They are not standalone // resources themselves. @@ -559,6 +581,9 @@ message RollupDataPoint { } // Value of a daily rollup for a single civil time interval (aggregation window) +// of reconciled data points from all data sources, excluding those data points +// that are identified as recorded by wearables in intervals when they were not +// actually worn. message DailyRollupDataPoint { // Outcome of a rollup of the requested roll-up type. // @@ -569,7 +594,11 @@ message DailyRollupDataPoint { // `{original_field_name}_{aggregation_function}`. For example: // `confidence_min`, `confidence_sum`. // - // If there were no data points in this interval, the value will not be set. + // If there were no manual, on-wrist data points in this interval, + // the value will not be set. When the value is set, but the data shows zero, + // e.g. `steps.count_sum = 0`, it means that a device was worn but it did not + // record any data points for this data type. + // // These messages represent the aggregated data payload for each data type // and are embedded within the `DailyRollupDataPoint`. They are not standalone // resources themselves. @@ -782,10 +811,19 @@ message ListDataPointsRequest { // - 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 start time (**ECG specific**): + // - Pattern: `electrocardiogram.interval.start_time` + // - Supported comparison operators: `>=` + // - Timestamp literal expected in RFC-3339 format + // - Example: + // - `electrocardiogram.interval.start_time >= "2024-08-14T12:34:56Z"` + // - Note: Only filtering by start time is supported for ECG. Filtering + // by end time (e.g., `electrocardiogram.interval.end_time`) is not + // supported. // - Session civil start time (**Excluding Sleep**): // - Pattern: `{session_data_type}.interval.civil_start_time` // - Supported comparison operators: `>=`, `<` @@ -1139,5 +1177,9 @@ message ExportExerciseTcxRequest { // Represents a Response for exporting exercise data in TCX format. message ExportExerciseTcxResponse { // Contains the exported TCX data. + // + // This field is intended for gRPC clients, as media download integration + // is not supported for gRPC. HTTP clients should instead use the `alt=media` + // query parameter to download the raw binary TCX file. string tcx_data = 2; } diff --git a/packages/google-devicesandservices-health/protos/google/devicesandservices/health/v4/data_subscription_service.proto b/packages/google-devicesandservices-health/protos/google/devicesandservices/health/v4/data_subscription_service.proto new file mode 100644 index 000000000000..5dede7f8fb2a --- /dev/null +++ b/packages/google-devicesandservices-health/protos/google/devicesandservices/health/v4/data_subscription_service.proto @@ -0,0 +1,398 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.devicesandservices.health.v4; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.DevicesAndServices.Health.V4"; +option go_package = "google.golang.org/genproto/googleapis/devicesandservices/health/apiv4main;healthpb"; +option java_multiple_files = true; +option java_outer_classname = "DataSubscriptionServiceProto"; +option java_package = "com.google.devicesandservices.health.v4"; +option php_namespace = "Google\\DevicesAndServices\\Health\\V4"; +option ruby_package = "Google::DevicesAndServices::Health::V4"; + +// Data Subscription Service that allows clients (e.g., Fitbit 3P +// applications, internal Fitbit Services) to manage their subscriber endpoints. +// This service provides CRUD APIs for subscribers, +// and also offers functionalities for subscriber verification and statistics. +service DataSubscriptionService { + option (google.api.default_host) = "health.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // 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. + rpc CreateSubscriber(CreateSubscriberRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v4/{parent=projects/*}/subscribers" + body: "subscriber" + }; + option (google.api.method_signature) = "parent,subscriber,subscriber_id"; + option (google.longrunning.operation_info) = { + response_type: "Subscriber" + metadata_type: "CreateSubscriberMetadata" + }; + } + + // Lists all subscribers registered within the owned Google Cloud Project. + rpc ListSubscribers(ListSubscribersRequest) + returns (ListSubscribersResponse) { + option (google.api.http) = { + get: "/v4/{parent=projects/*}/subscribers" + }; + option (google.api.method_signature) = "parent"; + } + + // 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. + rpc UpdateSubscriber(UpdateSubscriberRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v4/{subscriber.name=projects/*/subscribers/*}" + body: "subscriber" + }; + option (google.api.method_signature) = "subscriber,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Subscriber" + metadata_type: "UpdateSubscriberMetadata" + }; + } + + // Deletes a subscriber registration. This will stop all notifications + // to the subscriber's endpoint. + rpc DeleteSubscriber(DeleteSubscriberRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v4/{name=projects/*/subscribers/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeleteSubscriberMetadata" + }; + } +} + +// -- Messages -- +// Request message for CreateSubscriber. +message CreateSubscriberRequest { + // Required. The parent resource where this subscriber will be created. + // Format: projects/{project} + // Example: projects/my-project-123 + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "health.googleapis.com/Subscriber" + } + ]; + + // Required. The subscriber to create. + CreateSubscriberPayload subscriber = 2 + [(google.api.field_behavior) = REQUIRED]; + + // 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])/. + string subscriber_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for ListSubscribers. +message ListSubscribersRequest { + // Required. The parent, which owns this collection of subscribers. + // Format: projects/{project} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "health.googleapis.com/Subscriber" + } + ]; + + // 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. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // 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. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for ListSubscribers. +message ListSubscribersResponse { + // Subscribers from the specified project. + repeated Subscriber subscribers = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // The total number of subscribers matching the request. + int32 total_size = 3; +} + +// Request message for UpdateSubscriber. +message UpdateSubscriberRequest { + // Required. The subscriber resource to update. Its 'name' field is mapped to + // the URI, and the value of the 'name' field should be of the form: + // "projects/{project}/subscribers/{subscriber_id}". + // The remaining fields of the Subscriber object represent the new values + // for the corresponding fields in the existing subscriber resource. + Subscriber subscriber = 1 [(google.api.field_behavior) = REQUIRED]; + + // 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 + google.protobuf.FieldMask update_mask = 2 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for DeleteSubscriber. +message DeleteSubscriberRequest { + // 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. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "health.googleapis.com/Subscriber" + } + ]; + + // 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. + bool force = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// -- Resource Messages -- +// A subscriber receives notifications from Google Health API. +message Subscriber { + option (google.api.resource) = { + type: "health.googleapis.com/Subscriber" + pattern: "projects/{project}/subscribers/{subscriber}" + plural: "subscribers" + singular: "subscriber" + }; + + // The state of the subscriber. + enum State { + // Represents an unspecified subscriber state. + STATE_UNSPECIFIED = 0; + + // Represents an unverified subscriber. This is the initial state of the + // subscriber when it is created. The backend will verify the subscriber's + // endpoint_uri. + UNVERIFIED = 1; + + // Represents an active subscriber. The endpoint has been verified. + ACTIVE = 2; + + // Represents an inactive subscriber. + INACTIVE = 3; + } + + // 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 + string name = 1 [(google.api.field_behavior) = IDENTIFIER]; + + // 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. + string endpoint_uri = 2 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The time at which the subscriber was created. + google.protobuf.Timestamp create_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which the subscriber was last updated. + google.protobuf.Timestamp update_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Configuration for the subscriber. + repeated SubscriberConfig subscriber_configs = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Required. Authorization mechanism for a subscriber endpoint. + // This is required to ensure the endpoint can be verified. + EndpointAuthorization endpoint_authorization = 7 + [(google.api.field_behavior) = REQUIRED]; + + // Output only. The state of the subscriber. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Configuration for a subscriber. +// A notification is sent to a subscription ONLY if the subscriber has a config +// for the data type. +message SubscriberConfig { + // Policy for subscription creation. + enum SubscriptionCreatePolicy { + // Represents an unspecified policy. + SUBSCRIPTION_CREATE_POLICY_UNSPECIFIED = 0; + + // When using `AUTOMATIC`, individual subscriptions are not created or + // stored. Instead, eligibility for notifications is computed dynamically. + // When a data update occurs for a given data type, notifications are sent + // to all subscribers with an `AUTOMATIC` policy for that data type, + // provided the user has granted the necessary consents. + // + // This means you do not need to call `CreateSubscription` for each user; + // notifications are managed automatically based on user consents. As + // `Subscription` resources are not stored, they cannot be retrieved or + // managed through `GetSubscription`, `ListSubscriptions`, + // `UpdateSubscription`, or `DeleteSubscription`. + AUTOMATIC = 1; + + // Requires subscriptions to be created manually for new users. + // The developer needs to call CreateSubscription for new users. + MANUAL = 2; + } + + // Required. See [Google Health API data + // types](https://developers.google.com/health/data-types) for the list of + // supported data types. Values should be in kebab-case. + repeated string data_types = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "health.googleapis.com/DataType" } + ]; + + // Required. Policy for subscription creation. + SubscriptionCreatePolicy subscription_create_policy = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// 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. +message 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. + string secret = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = INPUT_ONLY + ]; + + // Output only. Whether the secret is set. + bool secret_set = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Payload for creating a subscriber. +message CreateSubscriberPayload { + // 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. + string endpoint_uri = 1 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Configuration for the subscriber. + repeated SubscriberConfig subscriber_configs = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Required. Authorization mechanism for the subscriber endpoint. + // The `secret` within this message is crucial for endpoint verification + // and for securing webhook notifications. + EndpointAuthorization endpoint_authorization = 3 + [(google.api.field_behavior) = REQUIRED]; +} + +// Represents metadata for creating a subscriber. +message CreateSubscriberMetadata {} + +// Represents metadata for updating a subscriber. +message UpdateSubscriberMetadata {} + +// Represents metadata for deleting a subscriber. +message DeleteSubscriberMetadata {} diff --git a/packages/google-devicesandservices-health/protos/protos.d.ts b/packages/google-devicesandservices-health/protos/protos.d.ts index 36cc843be0a6..3fd8bbb8a1bd 100644 --- a/packages/google-devicesandservices-health/protos/protos.d.ts +++ b/packages/google-devicesandservices-health/protos/protos.d.ts @@ -646,7 +646,7 @@ export namespace google { public heartRateZone: (google.devicesandservices.health.v4.ActiveZoneMinutes.HeartRateZone|keyof typeof google.devicesandservices.health.v4.ActiveZoneMinutes.HeartRateZone); /** ActiveZoneMinutes activeZoneMinutes. */ - public activeZoneMinutes: (number|Long|string); + public activeZoneMinutes?: (number|Long|string|null); /** * Creates a new ActiveZoneMinutes instance using the specified properties. @@ -760,13 +760,13 @@ export namespace google { constructor(properties?: google.devicesandservices.health.v4.IActiveZoneMinutesRollupValue); /** ActiveZoneMinutesRollupValue sumInCardioHeartZone. */ - public sumInCardioHeartZone: (number|Long|string); + public sumInCardioHeartZone?: (number|Long|string|null); /** ActiveZoneMinutesRollupValue sumInPeakHeartZone. */ - public sumInPeakHeartZone: (number|Long|string); + public sumInPeakHeartZone?: (number|Long|string|null); /** ActiveZoneMinutesRollupValue sumInFatBurnHeartZone. */ - public sumInFatBurnHeartZone: (number|Long|string); + public sumInFatBurnHeartZone?: (number|Long|string|null); /** * Creates a new ActiveZoneMinutesRollupValue instance using the specified properties. @@ -974,7 +974,7 @@ export namespace google { public activityLevel: (google.devicesandservices.health.v4.ActiveMinutes.ActivityLevel|keyof typeof google.devicesandservices.health.v4.ActiveMinutes.ActivityLevel); /** ActiveMinutesByActivityLevel activeMinutes. */ - public activeMinutes: (number|Long|string); + public activeMinutes?: (number|Long|string|null); /** * Creates a new ActiveMinutesByActivityLevel instance using the specified properties. @@ -1185,7 +1185,7 @@ export namespace google { public activityLevel: (google.devicesandservices.health.v4.ActiveMinutes.ActivityLevel|keyof typeof google.devicesandservices.health.v4.ActiveMinutes.ActivityLevel); /** ActiveMinutesRollupByActivityLevel activeMinutesSum. */ - public activeMinutesSum: (number|Long|string); + public activeMinutesSum?: (number|Long|string|null); /** * Creates a new ActiveMinutesRollupByActivityLevel instance using the specified properties. @@ -1607,7 +1607,7 @@ export namespace google { public interval?: (google.devicesandservices.health.v4.IObservationTimeInterval|null); /** Altitude gainMillimeters. */ - public gainMillimeters: (number|Long|string); + public gainMillimeters?: (number|Long|string|null); /** * Creates a new Altitude instance using the specified properties. @@ -1710,7 +1710,7 @@ export namespace google { public interval?: (google.devicesandservices.health.v4.IObservationTimeInterval|null); /** BasalEnergyBurned kcal. */ - public kcal: number; + public kcal?: (number|null); /** * Creates a new BasalEnergyBurned instance using the specified properties. @@ -1813,7 +1813,7 @@ export namespace google { public sampleTime?: (google.devicesandservices.health.v4.IObservationSampleTime|null); /** BodyFat percentage. */ - public percentage: number; + public percentage?: (number|null); /** * Creates a new BodyFat instance using the specified properties. @@ -1910,7 +1910,7 @@ export namespace google { constructor(properties?: google.devicesandservices.health.v4.IBodyFatRollupValue); /** BodyFatRollupValue bodyFatPercentageAvg. */ - public bodyFatPercentageAvg: number; + public bodyFatPercentageAvg?: (number|null); /** * Creates a new BodyFatRollupValue instance using the specified properties. @@ -2112,7 +2112,7 @@ export namespace google { public heartRateZone: (google.devicesandservices.health.v4.HeartRateZoneType|keyof typeof google.devicesandservices.health.v4.HeartRateZoneType); /** CaloriesInHeartRateZoneValue kcal. */ - public kcal: number; + public kcal?: (number|null); /** * Creates a new CaloriesInHeartRateZoneValue instance using the specified properties. @@ -2324,10 +2324,10 @@ export namespace google { public heartRateZoneType: (google.devicesandservices.health.v4.HeartRateZoneType|keyof typeof google.devicesandservices.health.v4.HeartRateZoneType); /** HeartRateZone minBeatsPerMinute. */ - public minBeatsPerMinute: (number|Long|string); + public minBeatsPerMinute?: (number|Long|string|null); /** HeartRateZone maxBeatsPerMinute. */ - public maxBeatsPerMinute: (number|Long|string); + public maxBeatsPerMinute?: (number|Long|string|null); /** * Creates a new HeartRateZone instance using the specified properties. @@ -2552,7 +2552,7 @@ export namespace google { public date?: (google.type.IDate|null); /** DailyRespiratoryRate breathsPerMinute. */ - public breathsPerMinute: number; + public breathsPerMinute?: (number|null); /** * Creates a new DailyRespiratoryRate instance using the specified properties. @@ -2664,16 +2664,16 @@ export namespace google { public date?: (google.type.IDate|null); /** DailyOxygenSaturation averagePercentage. */ - public averagePercentage: number; + public averagePercentage?: (number|null); /** DailyOxygenSaturation lowerBoundPercentage. */ - public lowerBoundPercentage: number; + public lowerBoundPercentage?: (number|null); /** DailyOxygenSaturation upperBoundPercentage. */ - public upperBoundPercentage: number; + public upperBoundPercentage?: (number|null); /** DailyOxygenSaturation standardDeviationPercentage. */ - public standardDeviationPercentage: number; + public standardDeviationPercentage?: (number|null); /** * Creates a new DailyOxygenSaturation instance using the specified properties. @@ -2779,7 +2779,7 @@ export namespace google { public date?: (google.type.IDate|null); /** DailyRestingHeartRate beatsPerMinute. */ - public beatsPerMinute: (number|Long|string); + public beatsPerMinute?: (number|Long|string|null); /** DailyRestingHeartRate dailyRestingHeartRateMetadata. */ public dailyRestingHeartRateMetadata?: (google.devicesandservices.health.v4.DailyRestingHeartRate.IDailyRestingHeartRateMetadata|null); @@ -3001,13 +3001,13 @@ export namespace google { public date?: (google.type.IDate|null); /** DailySleepTemperatureDerivations nightlyTemperatureCelsius. */ - public nightlyTemperatureCelsius: number; + public nightlyTemperatureCelsius?: (number|null); /** DailySleepTemperatureDerivations baselineTemperatureCelsius. */ - public baselineTemperatureCelsius: number; + public baselineTemperatureCelsius?: (number|null); /** DailySleepTemperatureDerivations relativeNightlyStddev_30dCelsius. */ - public relativeNightlyStddev_30dCelsius: number; + public relativeNightlyStddev_30dCelsius?: (number|null); /** * Creates a new DailySleepTemperatureDerivations instance using the specified properties. @@ -3119,7 +3119,7 @@ export namespace google { public date?: (google.type.IDate|null); /** DailyVO2Max vo2Max. */ - public vo2Max: number; + public vo2Max?: (number|null); /** DailyVO2Max estimated. */ public estimated: boolean; @@ -3128,7 +3128,7 @@ export namespace google { public cardioFitnessLevel: (google.devicesandservices.health.v4.DailyVO2Max.CardioFitnessLevel|keyof typeof google.devicesandservices.health.v4.DailyVO2Max.CardioFitnessLevel); /** DailyVO2Max vo2MaxCovariance. */ - public vo2MaxCovariance: number; + public vo2MaxCovariance?: (number|null); /** * Creates a new DailyVO2Max instance using the specified properties. @@ -3245,7 +3245,7 @@ export namespace google { public interval?: (google.devicesandservices.health.v4.IObservationTimeInterval|null); /** Distance millimeters. */ - public millimeters: (number|Long|string); + public millimeters?: (number|Long|string|null); /** * Creates a new Distance instance using the specified properties. @@ -3342,7 +3342,7 @@ export namespace google { constructor(properties?: google.devicesandservices.health.v4.IDistanceRollupValue); /** DistanceRollupValue millimetersSum. */ - public millimetersSum: (number|Long|string); + public millimetersSum?: (number|Long|string|null); /** * Creates a new DistanceRollupValue instance using the specified properties. @@ -3875,7 +3875,7 @@ export namespace google { constructor(properties?: google.devicesandservices.health.v4.Exercise.IExerciseMetadata); /** ExerciseMetadata poolLengthMillimeters. */ - public poolLengthMillimeters: (number|Long|string); + public poolLengthMillimeters?: (number|Long|string|null); /** ExerciseMetadata hasGps. */ public hasGps: boolean; @@ -3999,7 +3999,7 @@ export namespace google { public interval?: (google.devicesandservices.health.v4.IObservationTimeInterval|null); /** Floors count. */ - public count: (number|Long|string); + public count?: (number|Long|string|null); /** * Creates a new Floors instance using the specified properties. @@ -4096,7 +4096,7 @@ export namespace google { constructor(properties?: google.devicesandservices.health.v4.IFloorsRollupValue); /** FloorsRollupValue countSum. */ - public countSum: (number|Long|string); + public countSum?: (number|Long|string|null); /** * Creates a new FloorsRollupValue instance using the specified properties. @@ -4193,7 +4193,7 @@ export namespace google { constructor(properties?: google.devicesandservices.health.v4.IAltitudeRollupValue); /** AltitudeRollupValue gainMillimetersSum. */ - public gainMillimetersSum: (number|Long|string); + public gainMillimetersSum?: (number|Long|string|null); /** * Creates a new AltitudeRollupValue instance using the specified properties. @@ -4299,7 +4299,7 @@ export namespace google { public sampleTime?: (google.devicesandservices.health.v4.IObservationSampleTime|null); /** HeartRate beatsPerMinute. */ - public beatsPerMinute: (number|Long|string); + public beatsPerMinute?: (number|Long|string|null); /** HeartRate metadata. */ public metadata?: (google.devicesandservices.health.v4.HeartRate.IHeartRateMetadata|null); @@ -4641,13 +4641,13 @@ export namespace google { constructor(properties?: google.devicesandservices.health.v4.IRunVO2MaxRollupValue); /** RunVO2MaxRollupValue rateMin. */ - public rateMin: number; + public rateMin?: (number|null); /** RunVO2MaxRollupValue rateMax. */ - public rateMax: number; + public rateMax?: (number|null); /** RunVO2MaxRollupValue rateAvg. */ - public rateAvg: number; + public rateAvg?: (number|null); /** * Creates a new RunVO2MaxRollupValue instance using the specified properties. @@ -4750,7 +4750,7 @@ export namespace google { public sampleTime?: (google.devicesandservices.health.v4.IObservationSampleTime|null); /** RunVO2Max runVo2Max. */ - public runVo2Max: number; + public runVo2Max?: (number|null); /** * Creates a new RunVO2Max instance using the specified properties. @@ -4956,7 +4956,7 @@ export namespace google { public sampleTime?: (google.devicesandservices.health.v4.IObservationSampleTime|null); /** Height heightMillimeters. */ - public heightMillimeters: (number|Long|string); + public heightMillimeters?: (number|Long|string|null); /** * Creates a new Height instance using the specified properties. @@ -5062,10 +5062,10 @@ export namespace google { public sampleTime?: (google.devicesandservices.health.v4.IObservationSampleTime|null); /** HeartRateVariability rootMeanSquareOfSuccessiveDifferencesMilliseconds. */ - public rootMeanSquareOfSuccessiveDifferencesMilliseconds: number; + public rootMeanSquareOfSuccessiveDifferencesMilliseconds?: (number|null); /** HeartRateVariability standardDeviationMilliseconds. */ - public standardDeviationMilliseconds: number; + public standardDeviationMilliseconds?: (number|null); /** * Creates a new HeartRateVariability instance using the specified properties. @@ -5165,7 +5165,7 @@ export namespace google { constructor(properties?: google.devicesandservices.health.v4.IVolumeQuantity); /** VolumeQuantity milliliters. */ - public milliliters: number; + public milliliters?: (number|null); /** VolumeQuantity userProvidedUnit. */ public userProvidedUnit: (google.devicesandservices.health.v4.VolumeUnit|keyof typeof google.devicesandservices.health.v4.VolumeUnit); @@ -5470,7 +5470,7 @@ export namespace google { constructor(properties?: google.devicesandservices.health.v4.HydrationLogRollupValue.IVolumeQuantityRollup); /** VolumeQuantityRollup millilitersSum. */ - public millilitersSum: number; + public millilitersSum?: (number|null); /** VolumeQuantityRollup userProvidedUnitLast. */ public userProvidedUnitLast: (google.devicesandservices.health.v4.VolumeUnit|keyof typeof google.devicesandservices.health.v4.VolumeUnit); @@ -5979,7 +5979,7 @@ export namespace google { public sampleTime?: (google.devicesandservices.health.v4.IObservationSampleTime|null); /** OxygenSaturation percentage. */ - public percentage: number; + public percentage?: (number|null); /** * Creates a new OxygenSaturation instance using the specified properties. @@ -6308,13 +6308,13 @@ export namespace google { constructor(properties?: google.devicesandservices.health.v4.RespiratoryRateSleepSummary.IRespiratoryRateSleepSummaryStatistics); /** RespiratoryRateSleepSummaryStatistics breathsPerMinute. */ - public breathsPerMinute: number; + public breathsPerMinute?: (number|null); /** RespiratoryRateSleepSummaryStatistics standardDeviation. */ - public standardDeviation: number; + public standardDeviation?: (number|null); /** RespiratoryRateSleepSummaryStatistics signalToNoise. */ - public signalToNoise: number; + public signalToNoise?: (number|null); /** * Creates a new RespiratoryRateSleepSummaryStatistics instance using the specified properties. @@ -7077,10 +7077,10 @@ export namespace google { public type: (google.devicesandservices.health.v4.Sleep.SleepStageType|keyof typeof google.devicesandservices.health.v4.Sleep.SleepStageType); /** StageSummary minutes. */ - public minutes: (number|Long|string); + public minutes?: (number|Long|string|null); /** StageSummary count. */ - public count: (number|Long|string); + public count?: (number|Long|string|null); /** * Creates a new StageSummary instance using the specified properties. @@ -7203,7 +7203,7 @@ export namespace google { public interval?: (google.devicesandservices.health.v4.IObservationTimeInterval|null); /** Steps count. */ - public count: (number|Long|string); + public count?: (number|Long|string|null); /** * Creates a new Steps instance using the specified properties. @@ -7300,7 +7300,7 @@ export namespace google { constructor(properties?: google.devicesandservices.health.v4.IStepsRollupValue); /** StepsRollupValue countSum. */ - public countSum: (number|Long|string); + public countSum?: (number|Long|string|null); /** * Creates a new StepsRollupValue instance using the specified properties. @@ -7409,7 +7409,7 @@ export namespace google { public swimStrokeType: (google.devicesandservices.health.v4.SwimLengthsData.SwimStrokeType|keyof typeof google.devicesandservices.health.v4.SwimLengthsData.SwimStrokeType); /** SwimLengthsData strokeCount. */ - public strokeCount: (number|Long|string); + public strokeCount?: (number|Long|string|null); /** * Creates a new SwimLengthsData instance using the specified properties. @@ -7518,7 +7518,7 @@ export namespace google { constructor(properties?: google.devicesandservices.health.v4.ISwimLengthsDataRollupValue); /** SwimLengthsDataRollupValue strokeCountSum. */ - public strokeCountSum: (number|Long|string); + public strokeCountSum?: (number|Long|string|null); /** * Creates a new SwimLengthsDataRollupValue instance using the specified properties. @@ -7921,7 +7921,7 @@ export namespace google { constructor(properties?: google.devicesandservices.health.v4.ITotalCaloriesRollupValue); /** TotalCaloriesRollupValue kcalSum. */ - public kcalSum: number; + public kcalSum?: (number|null); /** * Creates a new TotalCaloriesRollupValue instance using the specified properties. @@ -8027,7 +8027,7 @@ export namespace google { public sampleTime?: (google.devicesandservices.health.v4.IObservationSampleTime|null); /** VO2Max vo2Max. */ - public vo2Max: number; + public vo2Max?: (number|null); /** VO2Max measurementMethod. */ public measurementMethod: (google.devicesandservices.health.v4.VO2Max.MeasurementMethod|keyof typeof google.devicesandservices.health.v4.VO2Max.MeasurementMethod); @@ -8155,7 +8155,7 @@ export namespace google { public sampleTime?: (google.devicesandservices.health.v4.IObservationSampleTime|null); /** Weight weightGrams. */ - public weightGrams: number; + public weightGrams?: (number|null); /** Weight notes. */ public notes: string; @@ -8255,7 +8255,7 @@ export namespace google { constructor(properties?: google.devicesandservices.health.v4.IWeightRollupValue); /** WeightRollupValue weightGramsAvg. */ - public weightGramsAvg: number; + public weightGramsAvg?: (number|null); /** * Creates a new WeightRollupValue instance using the specified properties. @@ -12081,11 +12081,11 @@ export namespace google { } } - /** Represents a HealthProfileService */ - class HealthProfileService extends $protobuf.rpc.Service { + /** Represents a DataSubscriptionService */ + class DataSubscriptionService extends $protobuf.rpc.Service { /** - * Constructs a new HealthProfileService service. + * Constructs a new DataSubscriptionService service. * @param rpcImpl RPC implementation * @param [requestDelimited=false] Whether requests are length-delimited * @param [responseDelimited=false] Whether responses are length-delimited @@ -12093,419 +12093,1802 @@ export namespace google { constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); /** - * Creates new HealthProfileService service using the specified rpc implementation. + * Creates new DataSubscriptionService service using the specified rpc implementation. * @param rpcImpl RPC implementation * @param [requestDelimited=false] Whether requests are length-delimited * @param [responseDelimited=false] Whether responses are length-delimited * @returns RPC service. Useful where requests and/or responses are streamed. */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): HealthProfileService; - - /** - * Calls GetProfile. - * @param request GetProfileRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Profile - */ - public getProfile(request: google.devicesandservices.health.v4.IGetProfileRequest, callback: google.devicesandservices.health.v4.HealthProfileService.GetProfileCallback): void; - - /** - * Calls GetProfile. - * @param request GetProfileRequest message or plain object - * @returns Promise - */ - public getProfile(request: google.devicesandservices.health.v4.IGetProfileRequest): Promise; + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): DataSubscriptionService; /** - * Calls UpdateProfile. - * @param request UpdateProfileRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Profile + * Calls CreateSubscriber. + * @param request CreateSubscriberRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public updateProfile(request: google.devicesandservices.health.v4.IUpdateProfileRequest, callback: google.devicesandservices.health.v4.HealthProfileService.UpdateProfileCallback): void; + public createSubscriber(request: google.devicesandservices.health.v4.ICreateSubscriberRequest, callback: google.devicesandservices.health.v4.DataSubscriptionService.CreateSubscriberCallback): void; /** - * Calls UpdateProfile. - * @param request UpdateProfileRequest message or plain object + * Calls CreateSubscriber. + * @param request CreateSubscriberRequest message or plain object * @returns Promise */ - public updateProfile(request: google.devicesandservices.health.v4.IUpdateProfileRequest): Promise; + public createSubscriber(request: google.devicesandservices.health.v4.ICreateSubscriberRequest): Promise; /** - * Calls GetSettings. - * @param request GetSettingsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Settings + * Calls ListSubscribers. + * @param request ListSubscribersRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListSubscribersResponse */ - public getSettings(request: google.devicesandservices.health.v4.IGetSettingsRequest, callback: google.devicesandservices.health.v4.HealthProfileService.GetSettingsCallback): void; + public listSubscribers(request: google.devicesandservices.health.v4.IListSubscribersRequest, callback: google.devicesandservices.health.v4.DataSubscriptionService.ListSubscribersCallback): void; /** - * Calls GetSettings. - * @param request GetSettingsRequest message or plain object + * Calls ListSubscribers. + * @param request ListSubscribersRequest message or plain object * @returns Promise */ - public getSettings(request: google.devicesandservices.health.v4.IGetSettingsRequest): Promise; + public listSubscribers(request: google.devicesandservices.health.v4.IListSubscribersRequest): Promise; /** - * Calls UpdateSettings. - * @param request UpdateSettingsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Settings + * Calls UpdateSubscriber. + * @param request UpdateSubscriberRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public updateSettings(request: google.devicesandservices.health.v4.IUpdateSettingsRequest, callback: google.devicesandservices.health.v4.HealthProfileService.UpdateSettingsCallback): void; + public updateSubscriber(request: google.devicesandservices.health.v4.IUpdateSubscriberRequest, callback: google.devicesandservices.health.v4.DataSubscriptionService.UpdateSubscriberCallback): void; /** - * Calls UpdateSettings. - * @param request UpdateSettingsRequest message or plain object + * Calls UpdateSubscriber. + * @param request UpdateSubscriberRequest message or plain object * @returns Promise */ - public updateSettings(request: google.devicesandservices.health.v4.IUpdateSettingsRequest): Promise; + public updateSubscriber(request: google.devicesandservices.health.v4.IUpdateSubscriberRequest): Promise; /** - * Calls GetIdentity. - * @param request GetIdentityRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Identity + * Calls DeleteSubscriber. + * @param request DeleteSubscriberRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation */ - public getIdentity(request: google.devicesandservices.health.v4.IGetIdentityRequest, callback: google.devicesandservices.health.v4.HealthProfileService.GetIdentityCallback): void; + public deleteSubscriber(request: google.devicesandservices.health.v4.IDeleteSubscriberRequest, callback: google.devicesandservices.health.v4.DataSubscriptionService.DeleteSubscriberCallback): void; /** - * Calls GetIdentity. - * @param request GetIdentityRequest message or plain object + * Calls DeleteSubscriber. + * @param request DeleteSubscriberRequest message or plain object * @returns Promise */ - public getIdentity(request: google.devicesandservices.health.v4.IGetIdentityRequest): Promise; + public deleteSubscriber(request: google.devicesandservices.health.v4.IDeleteSubscriberRequest): Promise; } - namespace HealthProfileService { - - /** - * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|getProfile}. - * @param error Error, if any - * @param [response] Profile - */ - type GetProfileCallback = (error: (Error|null), response?: google.devicesandservices.health.v4.Profile) => void; + namespace DataSubscriptionService { /** - * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|updateProfile}. + * Callback as used by {@link google.devicesandservices.health.v4.DataSubscriptionService|createSubscriber}. * @param error Error, if any - * @param [response] Profile + * @param [response] Operation */ - type UpdateProfileCallback = (error: (Error|null), response?: google.devicesandservices.health.v4.Profile) => void; + type CreateSubscriberCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|getSettings}. + * Callback as used by {@link google.devicesandservices.health.v4.DataSubscriptionService|listSubscribers}. * @param error Error, if any - * @param [response] Settings + * @param [response] ListSubscribersResponse */ - type GetSettingsCallback = (error: (Error|null), response?: google.devicesandservices.health.v4.Settings) => void; + type ListSubscribersCallback = (error: (Error|null), response?: google.devicesandservices.health.v4.ListSubscribersResponse) => void; /** - * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|updateSettings}. + * Callback as used by {@link google.devicesandservices.health.v4.DataSubscriptionService|updateSubscriber}. * @param error Error, if any - * @param [response] Settings + * @param [response] Operation */ - type UpdateSettingsCallback = (error: (Error|null), response?: google.devicesandservices.health.v4.Settings) => void; + type UpdateSubscriberCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; /** - * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|getIdentity}. + * Callback as used by {@link google.devicesandservices.health.v4.DataSubscriptionService|deleteSubscriber}. * @param error Error, if any - * @param [response] Identity + * @param [response] Operation */ - type GetIdentityCallback = (error: (Error|null), response?: google.devicesandservices.health.v4.Identity) => void; + type DeleteSubscriberCallback = (error: (Error|null), response?: google.longrunning.Operation) => void; } - /** Properties of a Profile. */ - interface IProfile { - - /** Profile name */ - name?: (string|null); - - /** Profile age */ - age?: (number|null); - - /** Profile membershipStartDate */ - membershipStartDate?: (google.type.IDate|null); - - /** Profile userConfiguredWalkingStrideLengthMm */ - userConfiguredWalkingStrideLengthMm?: (number|null); + /** Properties of a CreateSubscriberRequest. */ + interface ICreateSubscriberRequest { - /** Profile userConfiguredRunningStrideLengthMm */ - userConfiguredRunningStrideLengthMm?: (number|null); + /** CreateSubscriberRequest parent */ + parent?: (string|null); - /** Profile autoWalkingStrideLengthMm */ - autoWalkingStrideLengthMm?: (number|null); + /** CreateSubscriberRequest subscriber */ + subscriber?: (google.devicesandservices.health.v4.ICreateSubscriberPayload|null); - /** Profile autoRunningStrideLengthMm */ - autoRunningStrideLengthMm?: (number|null); + /** CreateSubscriberRequest subscriberId */ + subscriberId?: (string|null); } - /** Represents a Profile. */ - class Profile implements IProfile { + /** Represents a CreateSubscriberRequest. */ + class CreateSubscriberRequest implements ICreateSubscriberRequest { /** - * Constructs a new Profile. + * Constructs a new CreateSubscriberRequest. * @param [properties] Properties to set */ - constructor(properties?: google.devicesandservices.health.v4.IProfile); - - /** Profile name. */ - public name: string; - - /** Profile age. */ - public age: number; - - /** Profile membershipStartDate. */ - public membershipStartDate?: (google.type.IDate|null); - - /** Profile userConfiguredWalkingStrideLengthMm. */ - public userConfiguredWalkingStrideLengthMm?: (number|null); + constructor(properties?: google.devicesandservices.health.v4.ICreateSubscriberRequest); - /** Profile userConfiguredRunningStrideLengthMm. */ - public userConfiguredRunningStrideLengthMm?: (number|null); + /** CreateSubscriberRequest parent. */ + public parent: string; - /** Profile autoWalkingStrideLengthMm. */ - public autoWalkingStrideLengthMm?: (number|null); + /** CreateSubscriberRequest subscriber. */ + public subscriber?: (google.devicesandservices.health.v4.ICreateSubscriberPayload|null); - /** Profile autoRunningStrideLengthMm. */ - public autoRunningStrideLengthMm?: (number|null); + /** CreateSubscriberRequest subscriberId. */ + public subscriberId: string; /** - * Creates a new Profile instance using the specified properties. + * Creates a new CreateSubscriberRequest instance using the specified properties. * @param [properties] Properties to set - * @returns Profile instance + * @returns CreateSubscriberRequest instance */ - public static create(properties?: google.devicesandservices.health.v4.IProfile): google.devicesandservices.health.v4.Profile; + public static create(properties?: google.devicesandservices.health.v4.ICreateSubscriberRequest): google.devicesandservices.health.v4.CreateSubscriberRequest; /** - * Encodes the specified Profile message. Does not implicitly {@link google.devicesandservices.health.v4.Profile.verify|verify} messages. - * @param message Profile message or plain object to encode + * Encodes the specified CreateSubscriberRequest message. Does not implicitly {@link google.devicesandservices.health.v4.CreateSubscriberRequest.verify|verify} messages. + * @param message CreateSubscriberRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.devicesandservices.health.v4.IProfile, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.devicesandservices.health.v4.ICreateSubscriberRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Profile message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.Profile.verify|verify} messages. - * @param message Profile message or plain object to encode + * Encodes the specified CreateSubscriberRequest message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.CreateSubscriberRequest.verify|verify} messages. + * @param message CreateSubscriberRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.devicesandservices.health.v4.IProfile, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.devicesandservices.health.v4.ICreateSubscriberRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Profile message from the specified reader or buffer. + * Decodes a CreateSubscriberRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Profile + * @returns CreateSubscriberRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devicesandservices.health.v4.Profile; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devicesandservices.health.v4.CreateSubscriberRequest; /** - * Decodes a Profile message from the specified reader or buffer, length delimited. + * Decodes a CreateSubscriberRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Profile + * @returns CreateSubscriberRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devicesandservices.health.v4.Profile; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devicesandservices.health.v4.CreateSubscriberRequest; /** - * Verifies a Profile message. + * Verifies a CreateSubscriberRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Profile message from a plain object. Also converts values to their respective internal types. + * Creates a CreateSubscriberRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Profile + * @returns CreateSubscriberRequest */ - public static fromObject(object: { [k: string]: any }): google.devicesandservices.health.v4.Profile; + public static fromObject(object: { [k: string]: any }): google.devicesandservices.health.v4.CreateSubscriberRequest; /** - * Creates a plain object from a Profile message. Also converts values to other types if specified. - * @param message Profile + * Creates a plain object from a CreateSubscriberRequest message. Also converts values to other types if specified. + * @param message CreateSubscriberRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.devicesandservices.health.v4.Profile, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.devicesandservices.health.v4.CreateSubscriberRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Profile to JSON. + * Converts this CreateSubscriberRequest to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; /** - * Gets the default type url for Profile + * Gets the default type url for CreateSubscriberRequest * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns The default type url */ public static getTypeUrl(typeUrlPrefix?: string): string; } - /** Properties of a Settings. */ - interface ISettings { - - /** Settings name */ - name?: (string|null); - - /** Settings autoStrideEnabled */ - autoStrideEnabled?: (boolean|null); - - /** Settings distanceUnit */ - distanceUnit?: (google.devicesandservices.health.v4.Settings.DistanceUnit|keyof typeof google.devicesandservices.health.v4.Settings.DistanceUnit|null); - - /** Settings glucoseUnit */ - glucoseUnit?: (google.devicesandservices.health.v4.Settings.GlucoseUnit|keyof typeof google.devicesandservices.health.v4.Settings.GlucoseUnit|null); - - /** Settings heightUnit */ - heightUnit?: (google.devicesandservices.health.v4.Settings.HeightUnit|keyof typeof google.devicesandservices.health.v4.Settings.HeightUnit|null); - - /** Settings languageLocale */ - languageLocale?: (string|null); - - /** Settings utcOffset */ - utcOffset?: (google.protobuf.IDuration|null); - - /** Settings strideLengthWalkingType */ - strideLengthWalkingType?: (google.devicesandservices.health.v4.Settings.StrideLengthType|keyof typeof google.devicesandservices.health.v4.Settings.StrideLengthType|null); - - /** Settings strideLengthRunningType */ - strideLengthRunningType?: (google.devicesandservices.health.v4.Settings.StrideLengthType|keyof typeof google.devicesandservices.health.v4.Settings.StrideLengthType|null); - - /** Settings swimUnit */ - swimUnit?: (google.devicesandservices.health.v4.Settings.SwimUnit|keyof typeof google.devicesandservices.health.v4.Settings.SwimUnit|null); - - /** Settings temperatureUnit */ - temperatureUnit?: (google.devicesandservices.health.v4.Settings.TemperatureUnit|keyof typeof google.devicesandservices.health.v4.Settings.TemperatureUnit|null); + /** Properties of a ListSubscribersRequest. */ + interface IListSubscribersRequest { - /** Settings timeZone */ - timeZone?: (string|null); + /** ListSubscribersRequest parent */ + parent?: (string|null); - /** Settings weightUnit */ - weightUnit?: (google.devicesandservices.health.v4.Settings.WeightUnit|keyof typeof google.devicesandservices.health.v4.Settings.WeightUnit|null); + /** ListSubscribersRequest pageSize */ + pageSize?: (number|null); - /** Settings waterUnit */ - waterUnit?: (google.devicesandservices.health.v4.Settings.WaterUnit|keyof typeof google.devicesandservices.health.v4.Settings.WaterUnit|null); + /** ListSubscribersRequest pageToken */ + pageToken?: (string|null); } - /** Represents a Settings. */ - class Settings implements ISettings { + /** Represents a ListSubscribersRequest. */ + class ListSubscribersRequest implements IListSubscribersRequest { /** - * Constructs a new Settings. + * Constructs a new ListSubscribersRequest. * @param [properties] Properties to set */ - constructor(properties?: google.devicesandservices.health.v4.ISettings); - - /** Settings name. */ - public name: string; - - /** Settings autoStrideEnabled. */ - public autoStrideEnabled: boolean; - - /** Settings distanceUnit. */ - public distanceUnit: (google.devicesandservices.health.v4.Settings.DistanceUnit|keyof typeof google.devicesandservices.health.v4.Settings.DistanceUnit); - - /** Settings glucoseUnit. */ - public glucoseUnit: (google.devicesandservices.health.v4.Settings.GlucoseUnit|keyof typeof google.devicesandservices.health.v4.Settings.GlucoseUnit); - - /** Settings heightUnit. */ - public heightUnit: (google.devicesandservices.health.v4.Settings.HeightUnit|keyof typeof google.devicesandservices.health.v4.Settings.HeightUnit); - - /** Settings languageLocale. */ - public languageLocale: string; - - /** Settings utcOffset. */ - public utcOffset?: (google.protobuf.IDuration|null); - - /** Settings strideLengthWalkingType. */ - public strideLengthWalkingType: (google.devicesandservices.health.v4.Settings.StrideLengthType|keyof typeof google.devicesandservices.health.v4.Settings.StrideLengthType); - - /** Settings strideLengthRunningType. */ - public strideLengthRunningType: (google.devicesandservices.health.v4.Settings.StrideLengthType|keyof typeof google.devicesandservices.health.v4.Settings.StrideLengthType); - - /** Settings swimUnit. */ - public swimUnit: (google.devicesandservices.health.v4.Settings.SwimUnit|keyof typeof google.devicesandservices.health.v4.Settings.SwimUnit); - - /** Settings temperatureUnit. */ - public temperatureUnit: (google.devicesandservices.health.v4.Settings.TemperatureUnit|keyof typeof google.devicesandservices.health.v4.Settings.TemperatureUnit); + constructor(properties?: google.devicesandservices.health.v4.IListSubscribersRequest); - /** Settings timeZone. */ - public timeZone: string; + /** ListSubscribersRequest parent. */ + public parent: string; - /** Settings weightUnit. */ - public weightUnit: (google.devicesandservices.health.v4.Settings.WeightUnit|keyof typeof google.devicesandservices.health.v4.Settings.WeightUnit); + /** ListSubscribersRequest pageSize. */ + public pageSize: number; - /** Settings waterUnit. */ - public waterUnit: (google.devicesandservices.health.v4.Settings.WaterUnit|keyof typeof google.devicesandservices.health.v4.Settings.WaterUnit); + /** ListSubscribersRequest pageToken. */ + public pageToken: string; /** - * Creates a new Settings instance using the specified properties. + * Creates a new ListSubscribersRequest instance using the specified properties. * @param [properties] Properties to set - * @returns Settings instance + * @returns ListSubscribersRequest instance */ - public static create(properties?: google.devicesandservices.health.v4.ISettings): google.devicesandservices.health.v4.Settings; + public static create(properties?: google.devicesandservices.health.v4.IListSubscribersRequest): google.devicesandservices.health.v4.ListSubscribersRequest; /** - * Encodes the specified Settings message. Does not implicitly {@link google.devicesandservices.health.v4.Settings.verify|verify} messages. - * @param message Settings message or plain object to encode + * Encodes the specified ListSubscribersRequest message. Does not implicitly {@link google.devicesandservices.health.v4.ListSubscribersRequest.verify|verify} messages. + * @param message ListSubscribersRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encode(message: google.devicesandservices.health.v4.ISettings, writer?: $protobuf.Writer): $protobuf.Writer; + public static encode(message: google.devicesandservices.health.v4.IListSubscribersRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Encodes the specified Settings message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.Settings.verify|verify} messages. - * @param message Settings message or plain object to encode + * Encodes the specified ListSubscribersRequest message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.ListSubscribersRequest.verify|verify} messages. + * @param message ListSubscribersRequest message or plain object to encode * @param [writer] Writer to encode to * @returns Writer */ - public static encodeDelimited(message: google.devicesandservices.health.v4.ISettings, writer?: $protobuf.Writer): $protobuf.Writer; + public static encodeDelimited(message: google.devicesandservices.health.v4.IListSubscribersRequest, writer?: $protobuf.Writer): $protobuf.Writer; /** - * Decodes a Settings message from the specified reader or buffer. + * Decodes a ListSubscribersRequest message from the specified reader or buffer. * @param reader Reader or buffer to decode from * @param [length] Message length if known beforehand - * @returns Settings + * @returns ListSubscribersRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devicesandservices.health.v4.Settings; + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devicesandservices.health.v4.ListSubscribersRequest; /** - * Decodes a Settings message from the specified reader or buffer, length delimited. + * Decodes a ListSubscribersRequest message from the specified reader or buffer, length delimited. * @param reader Reader or buffer to decode from - * @returns Settings + * @returns ListSubscribersRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devicesandservices.health.v4.Settings; + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devicesandservices.health.v4.ListSubscribersRequest; /** - * Verifies a Settings message. + * Verifies a ListSubscribersRequest message. * @param message Plain object to verify * @returns `null` if valid, otherwise the reason why it is not */ public static verify(message: { [k: string]: any }): (string|null); /** - * Creates a Settings message from a plain object. Also converts values to their respective internal types. + * Creates a ListSubscribersRequest message from a plain object. Also converts values to their respective internal types. * @param object Plain object - * @returns Settings + * @returns ListSubscribersRequest */ - public static fromObject(object: { [k: string]: any }): google.devicesandservices.health.v4.Settings; + public static fromObject(object: { [k: string]: any }): google.devicesandservices.health.v4.ListSubscribersRequest; /** - * Creates a plain object from a Settings message. Also converts values to other types if specified. - * @param message Settings + * Creates a plain object from a ListSubscribersRequest message. Also converts values to other types if specified. + * @param message ListSubscribersRequest * @param [options] Conversion options * @returns Plain object */ - public static toObject(message: google.devicesandservices.health.v4.Settings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + public static toObject(message: google.devicesandservices.health.v4.ListSubscribersRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; /** - * Converts this Settings to JSON. + * Converts this ListSubscribersRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSubscribersRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListSubscribersResponse. */ + interface IListSubscribersResponse { + + /** ListSubscribersResponse subscribers */ + subscribers?: (google.devicesandservices.health.v4.ISubscriber[]|null); + + /** ListSubscribersResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListSubscribersResponse totalSize */ + totalSize?: (number|null); + } + + /** Represents a ListSubscribersResponse. */ + class ListSubscribersResponse implements IListSubscribersResponse { + + /** + * Constructs a new ListSubscribersResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.devicesandservices.health.v4.IListSubscribersResponse); + + /** ListSubscribersResponse subscribers. */ + public subscribers: google.devicesandservices.health.v4.ISubscriber[]; + + /** ListSubscribersResponse nextPageToken. */ + public nextPageToken: string; + + /** ListSubscribersResponse totalSize. */ + public totalSize: number; + + /** + * Creates a new ListSubscribersResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListSubscribersResponse instance + */ + public static create(properties?: google.devicesandservices.health.v4.IListSubscribersResponse): google.devicesandservices.health.v4.ListSubscribersResponse; + + /** + * Encodes the specified ListSubscribersResponse message. Does not implicitly {@link google.devicesandservices.health.v4.ListSubscribersResponse.verify|verify} messages. + * @param message ListSubscribersResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devicesandservices.health.v4.IListSubscribersResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListSubscribersResponse message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.ListSubscribersResponse.verify|verify} messages. + * @param message ListSubscribersResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devicesandservices.health.v4.IListSubscribersResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListSubscribersResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListSubscribersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devicesandservices.health.v4.ListSubscribersResponse; + + /** + * Decodes a ListSubscribersResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListSubscribersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devicesandservices.health.v4.ListSubscribersResponse; + + /** + * Verifies a ListSubscribersResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListSubscribersResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListSubscribersResponse + */ + public static fromObject(object: { [k: string]: any }): google.devicesandservices.health.v4.ListSubscribersResponse; + + /** + * Creates a plain object from a ListSubscribersResponse message. Also converts values to other types if specified. + * @param message ListSubscribersResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devicesandservices.health.v4.ListSubscribersResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListSubscribersResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListSubscribersResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateSubscriberRequest. */ + interface IUpdateSubscriberRequest { + + /** UpdateSubscriberRequest subscriber */ + subscriber?: (google.devicesandservices.health.v4.ISubscriber|null); + + /** UpdateSubscriberRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateSubscriberRequest. */ + class UpdateSubscriberRequest implements IUpdateSubscriberRequest { + + /** + * Constructs a new UpdateSubscriberRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.devicesandservices.health.v4.IUpdateSubscriberRequest); + + /** UpdateSubscriberRequest subscriber. */ + public subscriber?: (google.devicesandservices.health.v4.ISubscriber|null); + + /** UpdateSubscriberRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateSubscriberRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateSubscriberRequest instance + */ + public static create(properties?: google.devicesandservices.health.v4.IUpdateSubscriberRequest): google.devicesandservices.health.v4.UpdateSubscriberRequest; + + /** + * Encodes the specified UpdateSubscriberRequest message. Does not implicitly {@link google.devicesandservices.health.v4.UpdateSubscriberRequest.verify|verify} messages. + * @param message UpdateSubscriberRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devicesandservices.health.v4.IUpdateSubscriberRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateSubscriberRequest message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.UpdateSubscriberRequest.verify|verify} messages. + * @param message UpdateSubscriberRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devicesandservices.health.v4.IUpdateSubscriberRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateSubscriberRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateSubscriberRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devicesandservices.health.v4.UpdateSubscriberRequest; + + /** + * Decodes an UpdateSubscriberRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateSubscriberRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devicesandservices.health.v4.UpdateSubscriberRequest; + + /** + * Verifies an UpdateSubscriberRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateSubscriberRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateSubscriberRequest + */ + public static fromObject(object: { [k: string]: any }): google.devicesandservices.health.v4.UpdateSubscriberRequest; + + /** + * Creates a plain object from an UpdateSubscriberRequest message. Also converts values to other types if specified. + * @param message UpdateSubscriberRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devicesandservices.health.v4.UpdateSubscriberRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateSubscriberRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateSubscriberRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteSubscriberRequest. */ + interface IDeleteSubscriberRequest { + + /** DeleteSubscriberRequest name */ + name?: (string|null); + + /** DeleteSubscriberRequest force */ + force?: (boolean|null); + } + + /** Represents a DeleteSubscriberRequest. */ + class DeleteSubscriberRequest implements IDeleteSubscriberRequest { + + /** + * Constructs a new DeleteSubscriberRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.devicesandservices.health.v4.IDeleteSubscriberRequest); + + /** DeleteSubscriberRequest name. */ + public name: string; + + /** DeleteSubscriberRequest force. */ + public force: boolean; + + /** + * Creates a new DeleteSubscriberRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteSubscriberRequest instance + */ + public static create(properties?: google.devicesandservices.health.v4.IDeleteSubscriberRequest): google.devicesandservices.health.v4.DeleteSubscriberRequest; + + /** + * Encodes the specified DeleteSubscriberRequest message. Does not implicitly {@link google.devicesandservices.health.v4.DeleteSubscriberRequest.verify|verify} messages. + * @param message DeleteSubscriberRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devicesandservices.health.v4.IDeleteSubscriberRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteSubscriberRequest message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.DeleteSubscriberRequest.verify|verify} messages. + * @param message DeleteSubscriberRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devicesandservices.health.v4.IDeleteSubscriberRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteSubscriberRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteSubscriberRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devicesandservices.health.v4.DeleteSubscriberRequest; + + /** + * Decodes a DeleteSubscriberRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteSubscriberRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devicesandservices.health.v4.DeleteSubscriberRequest; + + /** + * Verifies a DeleteSubscriberRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteSubscriberRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteSubscriberRequest + */ + public static fromObject(object: { [k: string]: any }): google.devicesandservices.health.v4.DeleteSubscriberRequest; + + /** + * Creates a plain object from a DeleteSubscriberRequest message. Also converts values to other types if specified. + * @param message DeleteSubscriberRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devicesandservices.health.v4.DeleteSubscriberRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteSubscriberRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteSubscriberRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Subscriber. */ + interface ISubscriber { + + /** Subscriber name */ + name?: (string|null); + + /** Subscriber endpointUri */ + endpointUri?: (string|null); + + /** Subscriber createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** Subscriber updateTime */ + updateTime?: (google.protobuf.ITimestamp|null); + + /** Subscriber subscriberConfigs */ + subscriberConfigs?: (google.devicesandservices.health.v4.ISubscriberConfig[]|null); + + /** Subscriber endpointAuthorization */ + endpointAuthorization?: (google.devicesandservices.health.v4.IEndpointAuthorization|null); + + /** Subscriber state */ + state?: (google.devicesandservices.health.v4.Subscriber.State|keyof typeof google.devicesandservices.health.v4.Subscriber.State|null); + } + + /** Represents a Subscriber. */ + class Subscriber implements ISubscriber { + + /** + * Constructs a new Subscriber. + * @param [properties] Properties to set + */ + constructor(properties?: google.devicesandservices.health.v4.ISubscriber); + + /** Subscriber name. */ + public name: string; + + /** Subscriber endpointUri. */ + public endpointUri: string; + + /** Subscriber createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** Subscriber updateTime. */ + public updateTime?: (google.protobuf.ITimestamp|null); + + /** Subscriber subscriberConfigs. */ + public subscriberConfigs: google.devicesandservices.health.v4.ISubscriberConfig[]; + + /** Subscriber endpointAuthorization. */ + public endpointAuthorization?: (google.devicesandservices.health.v4.IEndpointAuthorization|null); + + /** Subscriber state. */ + public state: (google.devicesandservices.health.v4.Subscriber.State|keyof typeof google.devicesandservices.health.v4.Subscriber.State); + + /** + * Creates a new Subscriber instance using the specified properties. + * @param [properties] Properties to set + * @returns Subscriber instance + */ + public static create(properties?: google.devicesandservices.health.v4.ISubscriber): google.devicesandservices.health.v4.Subscriber; + + /** + * Encodes the specified Subscriber message. Does not implicitly {@link google.devicesandservices.health.v4.Subscriber.verify|verify} messages. + * @param message Subscriber message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devicesandservices.health.v4.ISubscriber, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Subscriber message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.Subscriber.verify|verify} messages. + * @param message Subscriber message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devicesandservices.health.v4.ISubscriber, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Subscriber message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Subscriber + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devicesandservices.health.v4.Subscriber; + + /** + * Decodes a Subscriber message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Subscriber + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devicesandservices.health.v4.Subscriber; + + /** + * Verifies a Subscriber message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Subscriber message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Subscriber + */ + public static fromObject(object: { [k: string]: any }): google.devicesandservices.health.v4.Subscriber; + + /** + * Creates a plain object from a Subscriber message. Also converts values to other types if specified. + * @param message Subscriber + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devicesandservices.health.v4.Subscriber, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Subscriber to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Subscriber + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Subscriber { + + /** State enum. */ + enum State { + STATE_UNSPECIFIED = 0, + UNVERIFIED = 1, + ACTIVE = 2, + INACTIVE = 3 + } + } + + /** Properties of a SubscriberConfig. */ + interface ISubscriberConfig { + + /** SubscriberConfig dataTypes */ + dataTypes?: (string[]|null); + + /** SubscriberConfig subscriptionCreatePolicy */ + subscriptionCreatePolicy?: (google.devicesandservices.health.v4.SubscriberConfig.SubscriptionCreatePolicy|keyof typeof google.devicesandservices.health.v4.SubscriberConfig.SubscriptionCreatePolicy|null); + } + + /** Represents a SubscriberConfig. */ + class SubscriberConfig implements ISubscriberConfig { + + /** + * Constructs a new SubscriberConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.devicesandservices.health.v4.ISubscriberConfig); + + /** SubscriberConfig dataTypes. */ + public dataTypes: string[]; + + /** SubscriberConfig subscriptionCreatePolicy. */ + public subscriptionCreatePolicy: (google.devicesandservices.health.v4.SubscriberConfig.SubscriptionCreatePolicy|keyof typeof google.devicesandservices.health.v4.SubscriberConfig.SubscriptionCreatePolicy); + + /** + * Creates a new SubscriberConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SubscriberConfig instance + */ + public static create(properties?: google.devicesandservices.health.v4.ISubscriberConfig): google.devicesandservices.health.v4.SubscriberConfig; + + /** + * Encodes the specified SubscriberConfig message. Does not implicitly {@link google.devicesandservices.health.v4.SubscriberConfig.verify|verify} messages. + * @param message SubscriberConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devicesandservices.health.v4.ISubscriberConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SubscriberConfig message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.SubscriberConfig.verify|verify} messages. + * @param message SubscriberConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devicesandservices.health.v4.ISubscriberConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SubscriberConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SubscriberConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devicesandservices.health.v4.SubscriberConfig; + + /** + * Decodes a SubscriberConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SubscriberConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devicesandservices.health.v4.SubscriberConfig; + + /** + * Verifies a SubscriberConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SubscriberConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SubscriberConfig + */ + public static fromObject(object: { [k: string]: any }): google.devicesandservices.health.v4.SubscriberConfig; + + /** + * Creates a plain object from a SubscriberConfig message. Also converts values to other types if specified. + * @param message SubscriberConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devicesandservices.health.v4.SubscriberConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SubscriberConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SubscriberConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SubscriberConfig { + + /** SubscriptionCreatePolicy enum. */ + enum SubscriptionCreatePolicy { + SUBSCRIPTION_CREATE_POLICY_UNSPECIFIED = 0, + AUTOMATIC = 1, + MANUAL = 2 + } + } + + /** Properties of an EndpointAuthorization. */ + interface IEndpointAuthorization { + + /** EndpointAuthorization secret */ + secret?: (string|null); + + /** EndpointAuthorization secretSet */ + secretSet?: (boolean|null); + } + + /** Represents an EndpointAuthorization. */ + class EndpointAuthorization implements IEndpointAuthorization { + + /** + * Constructs a new EndpointAuthorization. + * @param [properties] Properties to set + */ + constructor(properties?: google.devicesandservices.health.v4.IEndpointAuthorization); + + /** EndpointAuthorization secret. */ + public secret: string; + + /** EndpointAuthorization secretSet. */ + public secretSet: boolean; + + /** + * Creates a new EndpointAuthorization instance using the specified properties. + * @param [properties] Properties to set + * @returns EndpointAuthorization instance + */ + public static create(properties?: google.devicesandservices.health.v4.IEndpointAuthorization): google.devicesandservices.health.v4.EndpointAuthorization; + + /** + * Encodes the specified EndpointAuthorization message. Does not implicitly {@link google.devicesandservices.health.v4.EndpointAuthorization.verify|verify} messages. + * @param message EndpointAuthorization message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devicesandservices.health.v4.IEndpointAuthorization, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EndpointAuthorization message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.EndpointAuthorization.verify|verify} messages. + * @param message EndpointAuthorization message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devicesandservices.health.v4.IEndpointAuthorization, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EndpointAuthorization message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EndpointAuthorization + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devicesandservices.health.v4.EndpointAuthorization; + + /** + * Decodes an EndpointAuthorization message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EndpointAuthorization + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devicesandservices.health.v4.EndpointAuthorization; + + /** + * Verifies an EndpointAuthorization message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EndpointAuthorization message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EndpointAuthorization + */ + public static fromObject(object: { [k: string]: any }): google.devicesandservices.health.v4.EndpointAuthorization; + + /** + * Creates a plain object from an EndpointAuthorization message. Also converts values to other types if specified. + * @param message EndpointAuthorization + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devicesandservices.health.v4.EndpointAuthorization, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EndpointAuthorization to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EndpointAuthorization + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateSubscriberPayload. */ + interface ICreateSubscriberPayload { + + /** CreateSubscriberPayload endpointUri */ + endpointUri?: (string|null); + + /** CreateSubscriberPayload subscriberConfigs */ + subscriberConfigs?: (google.devicesandservices.health.v4.ISubscriberConfig[]|null); + + /** CreateSubscriberPayload endpointAuthorization */ + endpointAuthorization?: (google.devicesandservices.health.v4.IEndpointAuthorization|null); + } + + /** Represents a CreateSubscriberPayload. */ + class CreateSubscriberPayload implements ICreateSubscriberPayload { + + /** + * Constructs a new CreateSubscriberPayload. + * @param [properties] Properties to set + */ + constructor(properties?: google.devicesandservices.health.v4.ICreateSubscriberPayload); + + /** CreateSubscriberPayload endpointUri. */ + public endpointUri: string; + + /** CreateSubscriberPayload subscriberConfigs. */ + public subscriberConfigs: google.devicesandservices.health.v4.ISubscriberConfig[]; + + /** CreateSubscriberPayload endpointAuthorization. */ + public endpointAuthorization?: (google.devicesandservices.health.v4.IEndpointAuthorization|null); + + /** + * Creates a new CreateSubscriberPayload instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateSubscriberPayload instance + */ + public static create(properties?: google.devicesandservices.health.v4.ICreateSubscriberPayload): google.devicesandservices.health.v4.CreateSubscriberPayload; + + /** + * Encodes the specified CreateSubscriberPayload message. Does not implicitly {@link google.devicesandservices.health.v4.CreateSubscriberPayload.verify|verify} messages. + * @param message CreateSubscriberPayload message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devicesandservices.health.v4.ICreateSubscriberPayload, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateSubscriberPayload message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.CreateSubscriberPayload.verify|verify} messages. + * @param message CreateSubscriberPayload message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devicesandservices.health.v4.ICreateSubscriberPayload, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateSubscriberPayload message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateSubscriberPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devicesandservices.health.v4.CreateSubscriberPayload; + + /** + * Decodes a CreateSubscriberPayload message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateSubscriberPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devicesandservices.health.v4.CreateSubscriberPayload; + + /** + * Verifies a CreateSubscriberPayload message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateSubscriberPayload message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateSubscriberPayload + */ + public static fromObject(object: { [k: string]: any }): google.devicesandservices.health.v4.CreateSubscriberPayload; + + /** + * Creates a plain object from a CreateSubscriberPayload message. Also converts values to other types if specified. + * @param message CreateSubscriberPayload + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devicesandservices.health.v4.CreateSubscriberPayload, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateSubscriberPayload to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateSubscriberPayload + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CreateSubscriberMetadata. */ + interface ICreateSubscriberMetadata { + } + + /** Represents a CreateSubscriberMetadata. */ + class CreateSubscriberMetadata implements ICreateSubscriberMetadata { + + /** + * Constructs a new CreateSubscriberMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.devicesandservices.health.v4.ICreateSubscriberMetadata); + + /** + * Creates a new CreateSubscriberMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateSubscriberMetadata instance + */ + public static create(properties?: google.devicesandservices.health.v4.ICreateSubscriberMetadata): google.devicesandservices.health.v4.CreateSubscriberMetadata; + + /** + * Encodes the specified CreateSubscriberMetadata message. Does not implicitly {@link google.devicesandservices.health.v4.CreateSubscriberMetadata.verify|verify} messages. + * @param message CreateSubscriberMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devicesandservices.health.v4.ICreateSubscriberMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateSubscriberMetadata message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.CreateSubscriberMetadata.verify|verify} messages. + * @param message CreateSubscriberMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devicesandservices.health.v4.ICreateSubscriberMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateSubscriberMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateSubscriberMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devicesandservices.health.v4.CreateSubscriberMetadata; + + /** + * Decodes a CreateSubscriberMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateSubscriberMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devicesandservices.health.v4.CreateSubscriberMetadata; + + /** + * Verifies a CreateSubscriberMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateSubscriberMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateSubscriberMetadata + */ + public static fromObject(object: { [k: string]: any }): google.devicesandservices.health.v4.CreateSubscriberMetadata; + + /** + * Creates a plain object from a CreateSubscriberMetadata message. Also converts values to other types if specified. + * @param message CreateSubscriberMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devicesandservices.health.v4.CreateSubscriberMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateSubscriberMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateSubscriberMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateSubscriberMetadata. */ + interface IUpdateSubscriberMetadata { + } + + /** Represents an UpdateSubscriberMetadata. */ + class UpdateSubscriberMetadata implements IUpdateSubscriberMetadata { + + /** + * Constructs a new UpdateSubscriberMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.devicesandservices.health.v4.IUpdateSubscriberMetadata); + + /** + * Creates a new UpdateSubscriberMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateSubscriberMetadata instance + */ + public static create(properties?: google.devicesandservices.health.v4.IUpdateSubscriberMetadata): google.devicesandservices.health.v4.UpdateSubscriberMetadata; + + /** + * Encodes the specified UpdateSubscriberMetadata message. Does not implicitly {@link google.devicesandservices.health.v4.UpdateSubscriberMetadata.verify|verify} messages. + * @param message UpdateSubscriberMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devicesandservices.health.v4.IUpdateSubscriberMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateSubscriberMetadata message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.UpdateSubscriberMetadata.verify|verify} messages. + * @param message UpdateSubscriberMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devicesandservices.health.v4.IUpdateSubscriberMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateSubscriberMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateSubscriberMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devicesandservices.health.v4.UpdateSubscriberMetadata; + + /** + * Decodes an UpdateSubscriberMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateSubscriberMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devicesandservices.health.v4.UpdateSubscriberMetadata; + + /** + * Verifies an UpdateSubscriberMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateSubscriberMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateSubscriberMetadata + */ + public static fromObject(object: { [k: string]: any }): google.devicesandservices.health.v4.UpdateSubscriberMetadata; + + /** + * Creates a plain object from an UpdateSubscriberMetadata message. Also converts values to other types if specified. + * @param message UpdateSubscriberMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devicesandservices.health.v4.UpdateSubscriberMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateSubscriberMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateSubscriberMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteSubscriberMetadata. */ + interface IDeleteSubscriberMetadata { + } + + /** Represents a DeleteSubscriberMetadata. */ + class DeleteSubscriberMetadata implements IDeleteSubscriberMetadata { + + /** + * Constructs a new DeleteSubscriberMetadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.devicesandservices.health.v4.IDeleteSubscriberMetadata); + + /** + * Creates a new DeleteSubscriberMetadata instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteSubscriberMetadata instance + */ + public static create(properties?: google.devicesandservices.health.v4.IDeleteSubscriberMetadata): google.devicesandservices.health.v4.DeleteSubscriberMetadata; + + /** + * Encodes the specified DeleteSubscriberMetadata message. Does not implicitly {@link google.devicesandservices.health.v4.DeleteSubscriberMetadata.verify|verify} messages. + * @param message DeleteSubscriberMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devicesandservices.health.v4.IDeleteSubscriberMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteSubscriberMetadata message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.DeleteSubscriberMetadata.verify|verify} messages. + * @param message DeleteSubscriberMetadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devicesandservices.health.v4.IDeleteSubscriberMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteSubscriberMetadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteSubscriberMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devicesandservices.health.v4.DeleteSubscriberMetadata; + + /** + * Decodes a DeleteSubscriberMetadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteSubscriberMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devicesandservices.health.v4.DeleteSubscriberMetadata; + + /** + * Verifies a DeleteSubscriberMetadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteSubscriberMetadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteSubscriberMetadata + */ + public static fromObject(object: { [k: string]: any }): google.devicesandservices.health.v4.DeleteSubscriberMetadata; + + /** + * Creates a plain object from a DeleteSubscriberMetadata message. Also converts values to other types if specified. + * @param message DeleteSubscriberMetadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devicesandservices.health.v4.DeleteSubscriberMetadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteSubscriberMetadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteSubscriberMetadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a HealthProfileService */ + class HealthProfileService extends $protobuf.rpc.Service { + + /** + * Constructs a new HealthProfileService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new HealthProfileService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): HealthProfileService; + + /** + * Calls GetProfile. + * @param request GetProfileRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Profile + */ + public getProfile(request: google.devicesandservices.health.v4.IGetProfileRequest, callback: google.devicesandservices.health.v4.HealthProfileService.GetProfileCallback): void; + + /** + * Calls GetProfile. + * @param request GetProfileRequest message or plain object + * @returns Promise + */ + public getProfile(request: google.devicesandservices.health.v4.IGetProfileRequest): Promise; + + /** + * Calls UpdateProfile. + * @param request UpdateProfileRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Profile + */ + public updateProfile(request: google.devicesandservices.health.v4.IUpdateProfileRequest, callback: google.devicesandservices.health.v4.HealthProfileService.UpdateProfileCallback): void; + + /** + * Calls UpdateProfile. + * @param request UpdateProfileRequest message or plain object + * @returns Promise + */ + public updateProfile(request: google.devicesandservices.health.v4.IUpdateProfileRequest): Promise; + + /** + * Calls GetSettings. + * @param request GetSettingsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Settings + */ + public getSettings(request: google.devicesandservices.health.v4.IGetSettingsRequest, callback: google.devicesandservices.health.v4.HealthProfileService.GetSettingsCallback): void; + + /** + * Calls GetSettings. + * @param request GetSettingsRequest message or plain object + * @returns Promise + */ + public getSettings(request: google.devicesandservices.health.v4.IGetSettingsRequest): Promise; + + /** + * Calls UpdateSettings. + * @param request UpdateSettingsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Settings + */ + public updateSettings(request: google.devicesandservices.health.v4.IUpdateSettingsRequest, callback: google.devicesandservices.health.v4.HealthProfileService.UpdateSettingsCallback): void; + + /** + * Calls UpdateSettings. + * @param request UpdateSettingsRequest message or plain object + * @returns Promise + */ + public updateSettings(request: google.devicesandservices.health.v4.IUpdateSettingsRequest): Promise; + + /** + * Calls GetIdentity. + * @param request GetIdentityRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Identity + */ + public getIdentity(request: google.devicesandservices.health.v4.IGetIdentityRequest, callback: google.devicesandservices.health.v4.HealthProfileService.GetIdentityCallback): void; + + /** + * Calls GetIdentity. + * @param request GetIdentityRequest message or plain object + * @returns Promise + */ + public getIdentity(request: google.devicesandservices.health.v4.IGetIdentityRequest): Promise; + } + + namespace HealthProfileService { + + /** + * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|getProfile}. + * @param error Error, if any + * @param [response] Profile + */ + type GetProfileCallback = (error: (Error|null), response?: google.devicesandservices.health.v4.Profile) => void; + + /** + * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|updateProfile}. + * @param error Error, if any + * @param [response] Profile + */ + type UpdateProfileCallback = (error: (Error|null), response?: google.devicesandservices.health.v4.Profile) => void; + + /** + * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|getSettings}. + * @param error Error, if any + * @param [response] Settings + */ + type GetSettingsCallback = (error: (Error|null), response?: google.devicesandservices.health.v4.Settings) => void; + + /** + * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|updateSettings}. + * @param error Error, if any + * @param [response] Settings + */ + type UpdateSettingsCallback = (error: (Error|null), response?: google.devicesandservices.health.v4.Settings) => void; + + /** + * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|getIdentity}. + * @param error Error, if any + * @param [response] Identity + */ + type GetIdentityCallback = (error: (Error|null), response?: google.devicesandservices.health.v4.Identity) => void; + } + + /** Properties of a Profile. */ + interface IProfile { + + /** Profile name */ + name?: (string|null); + + /** Profile age */ + age?: (number|null); + + /** Profile membershipStartDate */ + membershipStartDate?: (google.type.IDate|null); + + /** Profile userConfiguredWalkingStrideLengthMm */ + userConfiguredWalkingStrideLengthMm?: (number|null); + + /** Profile userConfiguredRunningStrideLengthMm */ + userConfiguredRunningStrideLengthMm?: (number|null); + + /** Profile autoWalkingStrideLengthMm */ + autoWalkingStrideLengthMm?: (number|null); + + /** Profile autoRunningStrideLengthMm */ + autoRunningStrideLengthMm?: (number|null); + } + + /** Represents a Profile. */ + class Profile implements IProfile { + + /** + * Constructs a new Profile. + * @param [properties] Properties to set + */ + constructor(properties?: google.devicesandservices.health.v4.IProfile); + + /** Profile name. */ + public name: string; + + /** Profile age. */ + public age: number; + + /** Profile membershipStartDate. */ + public membershipStartDate?: (google.type.IDate|null); + + /** Profile userConfiguredWalkingStrideLengthMm. */ + public userConfiguredWalkingStrideLengthMm?: (number|null); + + /** Profile userConfiguredRunningStrideLengthMm. */ + public userConfiguredRunningStrideLengthMm?: (number|null); + + /** Profile autoWalkingStrideLengthMm. */ + public autoWalkingStrideLengthMm?: (number|null); + + /** Profile autoRunningStrideLengthMm. */ + public autoRunningStrideLengthMm?: (number|null); + + /** + * Creates a new Profile instance using the specified properties. + * @param [properties] Properties to set + * @returns Profile instance + */ + public static create(properties?: google.devicesandservices.health.v4.IProfile): google.devicesandservices.health.v4.Profile; + + /** + * Encodes the specified Profile message. Does not implicitly {@link google.devicesandservices.health.v4.Profile.verify|verify} messages. + * @param message Profile message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devicesandservices.health.v4.IProfile, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Profile message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.Profile.verify|verify} messages. + * @param message Profile message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devicesandservices.health.v4.IProfile, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Profile message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Profile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devicesandservices.health.v4.Profile; + + /** + * Decodes a Profile message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Profile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devicesandservices.health.v4.Profile; + + /** + * Verifies a Profile message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Profile message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Profile + */ + public static fromObject(object: { [k: string]: any }): google.devicesandservices.health.v4.Profile; + + /** + * Creates a plain object from a Profile message. Also converts values to other types if specified. + * @param message Profile + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devicesandservices.health.v4.Profile, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Profile to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Profile + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Settings. */ + interface ISettings { + + /** Settings name */ + name?: (string|null); + + /** Settings autoStrideEnabled */ + autoStrideEnabled?: (boolean|null); + + /** Settings distanceUnit */ + distanceUnit?: (google.devicesandservices.health.v4.Settings.DistanceUnit|keyof typeof google.devicesandservices.health.v4.Settings.DistanceUnit|null); + + /** Settings glucoseUnit */ + glucoseUnit?: (google.devicesandservices.health.v4.Settings.GlucoseUnit|keyof typeof google.devicesandservices.health.v4.Settings.GlucoseUnit|null); + + /** Settings heightUnit */ + heightUnit?: (google.devicesandservices.health.v4.Settings.HeightUnit|keyof typeof google.devicesandservices.health.v4.Settings.HeightUnit|null); + + /** Settings languageLocale */ + languageLocale?: (string|null); + + /** Settings utcOffset */ + utcOffset?: (google.protobuf.IDuration|null); + + /** Settings strideLengthWalkingType */ + strideLengthWalkingType?: (google.devicesandservices.health.v4.Settings.StrideLengthType|keyof typeof google.devicesandservices.health.v4.Settings.StrideLengthType|null); + + /** Settings strideLengthRunningType */ + strideLengthRunningType?: (google.devicesandservices.health.v4.Settings.StrideLengthType|keyof typeof google.devicesandservices.health.v4.Settings.StrideLengthType|null); + + /** Settings swimUnit */ + swimUnit?: (google.devicesandservices.health.v4.Settings.SwimUnit|keyof typeof google.devicesandservices.health.v4.Settings.SwimUnit|null); + + /** Settings temperatureUnit */ + temperatureUnit?: (google.devicesandservices.health.v4.Settings.TemperatureUnit|keyof typeof google.devicesandservices.health.v4.Settings.TemperatureUnit|null); + + /** Settings timeZone */ + timeZone?: (string|null); + + /** Settings weightUnit */ + weightUnit?: (google.devicesandservices.health.v4.Settings.WeightUnit|keyof typeof google.devicesandservices.health.v4.Settings.WeightUnit|null); + + /** Settings waterUnit */ + waterUnit?: (google.devicesandservices.health.v4.Settings.WaterUnit|keyof typeof google.devicesandservices.health.v4.Settings.WaterUnit|null); + } + + /** Represents a Settings. */ + class Settings implements ISettings { + + /** + * Constructs a new Settings. + * @param [properties] Properties to set + */ + constructor(properties?: google.devicesandservices.health.v4.ISettings); + + /** Settings name. */ + public name: string; + + /** Settings autoStrideEnabled. */ + public autoStrideEnabled: boolean; + + /** Settings distanceUnit. */ + public distanceUnit: (google.devicesandservices.health.v4.Settings.DistanceUnit|keyof typeof google.devicesandservices.health.v4.Settings.DistanceUnit); + + /** Settings glucoseUnit. */ + public glucoseUnit: (google.devicesandservices.health.v4.Settings.GlucoseUnit|keyof typeof google.devicesandservices.health.v4.Settings.GlucoseUnit); + + /** Settings heightUnit. */ + public heightUnit: (google.devicesandservices.health.v4.Settings.HeightUnit|keyof typeof google.devicesandservices.health.v4.Settings.HeightUnit); + + /** Settings languageLocale. */ + public languageLocale: string; + + /** Settings utcOffset. */ + public utcOffset?: (google.protobuf.IDuration|null); + + /** Settings strideLengthWalkingType. */ + public strideLengthWalkingType: (google.devicesandservices.health.v4.Settings.StrideLengthType|keyof typeof google.devicesandservices.health.v4.Settings.StrideLengthType); + + /** Settings strideLengthRunningType. */ + public strideLengthRunningType: (google.devicesandservices.health.v4.Settings.StrideLengthType|keyof typeof google.devicesandservices.health.v4.Settings.StrideLengthType); + + /** Settings swimUnit. */ + public swimUnit: (google.devicesandservices.health.v4.Settings.SwimUnit|keyof typeof google.devicesandservices.health.v4.Settings.SwimUnit); + + /** Settings temperatureUnit. */ + public temperatureUnit: (google.devicesandservices.health.v4.Settings.TemperatureUnit|keyof typeof google.devicesandservices.health.v4.Settings.TemperatureUnit); + + /** Settings timeZone. */ + public timeZone: string; + + /** Settings weightUnit. */ + public weightUnit: (google.devicesandservices.health.v4.Settings.WeightUnit|keyof typeof google.devicesandservices.health.v4.Settings.WeightUnit); + + /** Settings waterUnit. */ + public waterUnit: (google.devicesandservices.health.v4.Settings.WaterUnit|keyof typeof google.devicesandservices.health.v4.Settings.WaterUnit); + + /** + * Creates a new Settings instance using the specified properties. + * @param [properties] Properties to set + * @returns Settings instance + */ + public static create(properties?: google.devicesandservices.health.v4.ISettings): google.devicesandservices.health.v4.Settings; + + /** + * Encodes the specified Settings message. Does not implicitly {@link google.devicesandservices.health.v4.Settings.verify|verify} messages. + * @param message Settings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.devicesandservices.health.v4.ISettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Settings message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.Settings.verify|verify} messages. + * @param message Settings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.devicesandservices.health.v4.ISettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Settings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Settings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.devicesandservices.health.v4.Settings; + + /** + * Decodes a Settings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Settings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.devicesandservices.health.v4.Settings; + + /** + * Verifies a Settings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Settings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Settings + */ + public static fromObject(object: { [k: string]: any }): google.devicesandservices.health.v4.Settings; + + /** + * Creates a plain object from a Settings message. Also converts values to other types if specified. + * @param message Settings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.devicesandservices.health.v4.Settings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Settings to JSON. * @returns JSON object */ public toJSON(): { [k: string]: any }; @@ -13922,6 +15305,9 @@ export namespace google { /** CommonLanguageSettings destinations */ destinations?: (google.api.ClientLibraryDestination[]|null); + + /** CommonLanguageSettings selectiveGapicGeneration */ + selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); } /** Represents a CommonLanguageSettings. */ @@ -13939,6 +15325,9 @@ export namespace google { /** CommonLanguageSettings destinations. */ public destinations: google.api.ClientLibraryDestination[]; + /** CommonLanguageSettings selectiveGapicGeneration. */ + public selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @param [properties] Properties to set @@ -14639,6 +16028,9 @@ export namespace google { /** PythonSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** PythonSettings experimentalFeatures */ + experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); } /** Represents a PythonSettings. */ @@ -14653,6 +16045,9 @@ export namespace google { /** PythonSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** PythonSettings experimentalFeatures. */ + public experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); + /** * Creates a new PythonSettings instance using the specified properties. * @param [properties] Properties to set @@ -14709,26 +16104,138 @@ export namespace google { */ public static fromObject(object: { [k: string]: any }): google.api.PythonSettings; - /** - * Creates a plain object from a PythonSettings message. Also converts values to other types if specified. - * @param message PythonSettings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.PythonSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + /** + * Creates a plain object from a PythonSettings message. Also converts values to other types if specified. + * @param message PythonSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PythonSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PythonSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PythonSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace PythonSettings { + + /** Properties of an ExperimentalFeatures. */ + interface IExperimentalFeatures { + + /** ExperimentalFeatures restAsyncIoEnabled */ + restAsyncIoEnabled?: (boolean|null); + + /** ExperimentalFeatures protobufPythonicTypesEnabled */ + protobufPythonicTypesEnabled?: (boolean|null); + + /** ExperimentalFeatures unversionedPackageDisabled */ + unversionedPackageDisabled?: (boolean|null); + } + + /** Represents an ExperimentalFeatures. */ + class ExperimentalFeatures implements IExperimentalFeatures { + + /** + * Constructs a new ExperimentalFeatures. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.PythonSettings.IExperimentalFeatures); + + /** ExperimentalFeatures restAsyncIoEnabled. */ + public restAsyncIoEnabled: boolean; + + /** ExperimentalFeatures protobufPythonicTypesEnabled. */ + public protobufPythonicTypesEnabled: boolean; + + /** ExperimentalFeatures unversionedPackageDisabled. */ + public unversionedPackageDisabled: boolean; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @param [properties] Properties to set + * @returns ExperimentalFeatures instance + */ + public static create(properties?: google.api.PythonSettings.IExperimentalFeatures): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Verifies an ExperimentalFeatures message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExperimentalFeatures + */ + public static fromObject(object: { [k: string]: any }): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @param message ExperimentalFeatures + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PythonSettings.ExperimentalFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; - /** - * Converts this PythonSettings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; + /** + * Converts this ExperimentalFeatures to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; - /** - * Gets the default type url for PythonSettings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; + /** + * Gets the default type url for ExperimentalFeatures + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Properties of a NodeSettings. */ @@ -15057,6 +16564,9 @@ export namespace google { /** GoSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** GoSettings renamedServices */ + renamedServices?: ({ [k: string]: string }|null); } /** Represents a GoSettings. */ @@ -15071,6 +16581,9 @@ export namespace google { /** GoSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** GoSettings renamedServices. */ + public renamedServices: { [k: string]: string }; + /** * Creates a new GoSettings instance using the specified properties. * @param [properties] Properties to set @@ -15395,6 +16908,109 @@ export namespace google { PACKAGE_MANAGER = 20 } + /** Properties of a SelectiveGapicGeneration. */ + interface ISelectiveGapicGeneration { + + /** SelectiveGapicGeneration methods */ + methods?: (string[]|null); + + /** SelectiveGapicGeneration generateOmittedAsInternal */ + generateOmittedAsInternal?: (boolean|null); + } + + /** Represents a SelectiveGapicGeneration. */ + class SelectiveGapicGeneration implements ISelectiveGapicGeneration { + + /** + * Constructs a new SelectiveGapicGeneration. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ISelectiveGapicGeneration); + + /** SelectiveGapicGeneration methods. */ + public methods: string[]; + + /** SelectiveGapicGeneration generateOmittedAsInternal. */ + public generateOmittedAsInternal: boolean; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectiveGapicGeneration instance + */ + public static create(properties?: google.api.ISelectiveGapicGeneration): google.api.SelectiveGapicGeneration; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.SelectiveGapicGeneration; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.SelectiveGapicGeneration; + + /** + * Verifies a SelectiveGapicGeneration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectiveGapicGeneration + */ + public static fromObject(object: { [k: string]: any }): google.api.SelectiveGapicGeneration; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @param message SelectiveGapicGeneration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.SelectiveGapicGeneration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** LaunchStage enum. */ enum LaunchStage { LAUNCH_STAGE_UNSPECIFIED = 0, @@ -15511,6 +17127,7 @@ export namespace google { /** Edition enum. */ enum Edition { EDITION_UNKNOWN = 0, + EDITION_LEGACY = 900, EDITION_PROTO2 = 998, EDITION_PROTO3 = 999, EDITION_2023 = 1000, @@ -15541,6 +17158,9 @@ export namespace google { /** FileDescriptorProto weakDependency */ weakDependency?: (number[]|null); + /** FileDescriptorProto optionDependency */ + optionDependency?: (string[]|null); + /** FileDescriptorProto messageType */ messageType?: (google.protobuf.IDescriptorProto[]|null); @@ -15590,6 +17210,9 @@ export namespace google { /** FileDescriptorProto weakDependency. */ public weakDependency: number[]; + /** FileDescriptorProto optionDependency. */ + public optionDependency: string[]; + /** FileDescriptorProto messageType. */ public messageType: google.protobuf.IDescriptorProto[]; @@ -15724,6 +17347,9 @@ export namespace google { /** DescriptorProto reservedName */ reservedName?: (string[]|null); + + /** DescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents a DescriptorProto. */ @@ -15765,6 +17391,9 @@ export namespace google { /** DescriptorProto reservedName. */ public reservedName: string[]; + /** DescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new DescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -16612,6 +18241,9 @@ export namespace google { /** EnumDescriptorProto reservedName */ reservedName?: (string[]|null); + + /** EnumDescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents an EnumDescriptorProto. */ @@ -16638,6 +18270,9 @@ export namespace google { /** EnumDescriptorProto reservedName. */ public reservedName: string[]; + /** EnumDescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -17572,6 +19207,9 @@ export namespace google { /** FieldOptions features */ features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); @@ -17627,6 +19265,9 @@ export namespace google { /** FieldOptions features. */ public features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -17847,6 +19488,121 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a FeatureSupport. */ + interface IFeatureSupport { + + /** FeatureSupport editionIntroduced */ + editionIntroduced?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport editionDeprecated */ + editionDeprecated?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport deprecationWarning */ + deprecationWarning?: (string|null); + + /** FeatureSupport editionRemoved */ + editionRemoved?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSupport. */ + class FeatureSupport implements IFeatureSupport { + + /** + * Constructs a new FeatureSupport. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FieldOptions.IFeatureSupport); + + /** FeatureSupport editionIntroduced. */ + public editionIntroduced: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport editionDeprecated. */ + public editionDeprecated: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport deprecationWarning. */ + public deprecationWarning: string; + + /** FeatureSupport editionRemoved. */ + public editionRemoved: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSupport instance + */ + public static create(properties?: google.protobuf.FieldOptions.IFeatureSupport): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Verifies a FeatureSupport message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSupport + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @param message FeatureSupport + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions.FeatureSupport, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSupport to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSupport + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Properties of an OneofOptions. */ @@ -18085,6 +19841,9 @@ export namespace google { /** EnumValueOptions debugRedact */ debugRedact?: (boolean|null); + /** EnumValueOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); } @@ -18107,6 +19866,9 @@ export namespace google { /** EnumValueOptions debugRedact. */ public debugRedact: boolean; + /** EnumValueOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -18699,6 +20461,12 @@ export namespace google { /** FeatureSet jsonFormat */ jsonFormat?: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat|null); + + /** FeatureSet enforceNamingStyle */ + enforceNamingStyle?: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle|null); + + /** FeatureSet defaultSymbolVisibility */ + defaultSymbolVisibility?: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null); } /** Represents a FeatureSet. */ @@ -18728,6 +20496,12 @@ export namespace google { /** FeatureSet jsonFormat. */ public jsonFormat: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat); + /** FeatureSet enforceNamingStyle. */ + public enforceNamingStyle: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle); + + /** FeatureSet defaultSymbolVisibility. */ + public defaultSymbolVisibility: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility); + /** * Creates a new FeatureSet instance using the specified properties. * @param [properties] Properties to set @@ -18850,6 +20624,116 @@ export namespace google { ALLOW = 1, LEGACY_BEST_EFFORT = 2 } + + /** EnforceNamingStyle enum. */ + enum EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0, + STYLE2024 = 1, + STYLE_LEGACY = 2 + } + + /** Properties of a VisibilityFeature. */ + interface IVisibilityFeature { + } + + /** Represents a VisibilityFeature. */ + class VisibilityFeature implements IVisibilityFeature { + + /** + * Constructs a new VisibilityFeature. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FeatureSet.IVisibilityFeature); + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @param [properties] Properties to set + * @returns VisibilityFeature instance + */ + public static create(properties?: google.protobuf.FeatureSet.IVisibilityFeature): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Verifies a VisibilityFeature message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisibilityFeature + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @param message VisibilityFeature + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSet.VisibilityFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisibilityFeature to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisibilityFeature + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace VisibilityFeature { + + /** DefaultSymbolVisibility enum. */ + enum DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, + EXPORT_ALL = 1, + EXPORT_TOP_LEVEL = 2, + LOCAL_ALL = 3, + STRICT = 4 + } + } } /** Properties of a FeatureSetDefaults. */ @@ -18969,8 +20853,11 @@ export namespace google { /** FeatureSetEditionDefault edition */ edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - /** FeatureSetEditionDefault features */ - features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures */ + overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures */ + fixedFeatures?: (google.protobuf.IFeatureSet|null); } /** Represents a FeatureSetEditionDefault. */ @@ -18985,8 +20872,11 @@ export namespace google { /** FeatureSetEditionDefault edition. */ public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - /** FeatureSetEditionDefault features. */ - public features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures. */ + public overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures. */ + public fixedFeatures?: (google.protobuf.IFeatureSet|null); /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -19519,6 +21409,13 @@ export namespace google { } } + /** SymbolVisibility enum. */ + enum SymbolVisibility { + VISIBILITY_UNSET = 0, + VISIBILITY_LOCAL = 1, + VISIBILITY_EXPORT = 2 + } + /** Properties of a Duration. */ interface IDuration { diff --git a/packages/google-devicesandservices-health/protos/protos.js b/packages/google-devicesandservices-health/protos/protos.js index 7b505ff44279..c7c843b5de30 100644 --- a/packages/google-devicesandservices-health/protos/protos.js +++ b/packages/google-devicesandservices-health/protos/protos.js @@ -1605,11 +1605,20 @@ /** * ActiveZoneMinutes activeZoneMinutes. - * @member {number|Long} activeZoneMinutes + * @member {number|Long|null|undefined} activeZoneMinutes * @memberof google.devicesandservices.health.v4.ActiveZoneMinutes * @instance */ - ActiveZoneMinutes.prototype.activeZoneMinutes = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ActiveZoneMinutes.prototype.activeZoneMinutes = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ActiveZoneMinutes.prototype, "_activeZoneMinutes", { + get: $util.oneOfGetter($oneOfFields = ["activeZoneMinutes"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new ActiveZoneMinutes instance using the specified properties. @@ -1724,6 +1733,7 @@ ActiveZoneMinutes.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.interval != null && message.hasOwnProperty("interval")) { var error = $root.google.devicesandservices.health.v4.ObservationTimeInterval.verify(message.interval); if (error) @@ -1739,9 +1749,11 @@ case 3: break; } - if (message.activeZoneMinutes != null && message.hasOwnProperty("activeZoneMinutes")) + if (message.activeZoneMinutes != null && message.hasOwnProperty("activeZoneMinutes")) { + properties._activeZoneMinutes = 1; if (!$util.isInteger(message.activeZoneMinutes) && !(message.activeZoneMinutes && $util.isInteger(message.activeZoneMinutes.low) && $util.isInteger(message.activeZoneMinutes.high))) return "activeZoneMinutes: integer|Long expected"; + } return null; }; @@ -1814,21 +1826,19 @@ if (options.defaults) { object.interval = null; object.heartRateZone = options.enums === String ? "HEART_RATE_ZONE_UNSPECIFIED" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.activeZoneMinutes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.activeZoneMinutes = options.longs === String ? "0" : 0; } if (message.interval != null && message.hasOwnProperty("interval")) object.interval = $root.google.devicesandservices.health.v4.ObservationTimeInterval.toObject(message.interval, options); if (message.heartRateZone != null && message.hasOwnProperty("heartRateZone")) object.heartRateZone = options.enums === String ? $root.google.devicesandservices.health.v4.ActiveZoneMinutes.HeartRateZone[message.heartRateZone] === undefined ? message.heartRateZone : $root.google.devicesandservices.health.v4.ActiveZoneMinutes.HeartRateZone[message.heartRateZone] : message.heartRateZone; - if (message.activeZoneMinutes != null && message.hasOwnProperty("activeZoneMinutes")) + if (message.activeZoneMinutes != null && message.hasOwnProperty("activeZoneMinutes")) { if (typeof message.activeZoneMinutes === "number") object.activeZoneMinutes = options.longs === String ? String(message.activeZoneMinutes) : message.activeZoneMinutes; else object.activeZoneMinutes = options.longs === String ? $util.Long.prototype.toString.call(message.activeZoneMinutes) : options.longs === Number ? new $util.LongBits(message.activeZoneMinutes.low >>> 0, message.activeZoneMinutes.high >>> 0).toNumber() : message.activeZoneMinutes; + if (options.oneofs) + object._activeZoneMinutes = "activeZoneMinutes"; + } return object; }; @@ -1907,27 +1917,48 @@ /** * ActiveZoneMinutesRollupValue sumInCardioHeartZone. - * @member {number|Long} sumInCardioHeartZone + * @member {number|Long|null|undefined} sumInCardioHeartZone * @memberof google.devicesandservices.health.v4.ActiveZoneMinutesRollupValue * @instance */ - ActiveZoneMinutesRollupValue.prototype.sumInCardioHeartZone = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ActiveZoneMinutesRollupValue.prototype.sumInCardioHeartZone = null; /** * ActiveZoneMinutesRollupValue sumInPeakHeartZone. - * @member {number|Long} sumInPeakHeartZone + * @member {number|Long|null|undefined} sumInPeakHeartZone * @memberof google.devicesandservices.health.v4.ActiveZoneMinutesRollupValue * @instance */ - ActiveZoneMinutesRollupValue.prototype.sumInPeakHeartZone = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ActiveZoneMinutesRollupValue.prototype.sumInPeakHeartZone = null; /** * ActiveZoneMinutesRollupValue sumInFatBurnHeartZone. - * @member {number|Long} sumInFatBurnHeartZone + * @member {number|Long|null|undefined} sumInFatBurnHeartZone * @memberof google.devicesandservices.health.v4.ActiveZoneMinutesRollupValue * @instance */ - ActiveZoneMinutesRollupValue.prototype.sumInFatBurnHeartZone = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ActiveZoneMinutesRollupValue.prototype.sumInFatBurnHeartZone = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ActiveZoneMinutesRollupValue.prototype, "_sumInCardioHeartZone", { + get: $util.oneOfGetter($oneOfFields = ["sumInCardioHeartZone"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ActiveZoneMinutesRollupValue.prototype, "_sumInPeakHeartZone", { + get: $util.oneOfGetter($oneOfFields = ["sumInPeakHeartZone"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ActiveZoneMinutesRollupValue.prototype, "_sumInFatBurnHeartZone", { + get: $util.oneOfGetter($oneOfFields = ["sumInFatBurnHeartZone"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new ActiveZoneMinutesRollupValue instance using the specified properties. @@ -2042,15 +2073,22 @@ ActiveZoneMinutesRollupValue.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.sumInCardioHeartZone != null && message.hasOwnProperty("sumInCardioHeartZone")) + var properties = {}; + if (message.sumInCardioHeartZone != null && message.hasOwnProperty("sumInCardioHeartZone")) { + properties._sumInCardioHeartZone = 1; if (!$util.isInteger(message.sumInCardioHeartZone) && !(message.sumInCardioHeartZone && $util.isInteger(message.sumInCardioHeartZone.low) && $util.isInteger(message.sumInCardioHeartZone.high))) return "sumInCardioHeartZone: integer|Long expected"; - if (message.sumInPeakHeartZone != null && message.hasOwnProperty("sumInPeakHeartZone")) + } + if (message.sumInPeakHeartZone != null && message.hasOwnProperty("sumInPeakHeartZone")) { + properties._sumInPeakHeartZone = 1; if (!$util.isInteger(message.sumInPeakHeartZone) && !(message.sumInPeakHeartZone && $util.isInteger(message.sumInPeakHeartZone.low) && $util.isInteger(message.sumInPeakHeartZone.high))) return "sumInPeakHeartZone: integer|Long expected"; - if (message.sumInFatBurnHeartZone != null && message.hasOwnProperty("sumInFatBurnHeartZone")) + } + if (message.sumInFatBurnHeartZone != null && message.hasOwnProperty("sumInFatBurnHeartZone")) { + properties._sumInFatBurnHeartZone = 1; if (!$util.isInteger(message.sumInFatBurnHeartZone) && !(message.sumInFatBurnHeartZone && $util.isInteger(message.sumInFatBurnHeartZone.low) && $util.isInteger(message.sumInFatBurnHeartZone.high))) return "sumInFatBurnHeartZone: integer|Long expected"; + } return null; }; @@ -2109,38 +2147,30 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.sumInCardioHeartZone = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sumInCardioHeartZone = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.sumInPeakHeartZone = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sumInPeakHeartZone = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.sumInFatBurnHeartZone = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.sumInFatBurnHeartZone = options.longs === String ? "0" : 0; - } - if (message.sumInCardioHeartZone != null && message.hasOwnProperty("sumInCardioHeartZone")) + if (message.sumInCardioHeartZone != null && message.hasOwnProperty("sumInCardioHeartZone")) { if (typeof message.sumInCardioHeartZone === "number") object.sumInCardioHeartZone = options.longs === String ? String(message.sumInCardioHeartZone) : message.sumInCardioHeartZone; else object.sumInCardioHeartZone = options.longs === String ? $util.Long.prototype.toString.call(message.sumInCardioHeartZone) : options.longs === Number ? new $util.LongBits(message.sumInCardioHeartZone.low >>> 0, message.sumInCardioHeartZone.high >>> 0).toNumber() : message.sumInCardioHeartZone; - if (message.sumInPeakHeartZone != null && message.hasOwnProperty("sumInPeakHeartZone")) + if (options.oneofs) + object._sumInCardioHeartZone = "sumInCardioHeartZone"; + } + if (message.sumInPeakHeartZone != null && message.hasOwnProperty("sumInPeakHeartZone")) { if (typeof message.sumInPeakHeartZone === "number") object.sumInPeakHeartZone = options.longs === String ? String(message.sumInPeakHeartZone) : message.sumInPeakHeartZone; else object.sumInPeakHeartZone = options.longs === String ? $util.Long.prototype.toString.call(message.sumInPeakHeartZone) : options.longs === Number ? new $util.LongBits(message.sumInPeakHeartZone.low >>> 0, message.sumInPeakHeartZone.high >>> 0).toNumber() : message.sumInPeakHeartZone; - if (message.sumInFatBurnHeartZone != null && message.hasOwnProperty("sumInFatBurnHeartZone")) + if (options.oneofs) + object._sumInPeakHeartZone = "sumInPeakHeartZone"; + } + if (message.sumInFatBurnHeartZone != null && message.hasOwnProperty("sumInFatBurnHeartZone")) { if (typeof message.sumInFatBurnHeartZone === "number") object.sumInFatBurnHeartZone = options.longs === String ? String(message.sumInFatBurnHeartZone) : message.sumInFatBurnHeartZone; else object.sumInFatBurnHeartZone = options.longs === String ? $util.Long.prototype.toString.call(message.sumInFatBurnHeartZone) : options.longs === Number ? new $util.LongBits(message.sumInFatBurnHeartZone.low >>> 0, message.sumInFatBurnHeartZone.high >>> 0).toNumber() : message.sumInFatBurnHeartZone; + if (options.oneofs) + object._sumInFatBurnHeartZone = "sumInFatBurnHeartZone"; + } return object; }; @@ -2460,11 +2490,20 @@ /** * ActiveMinutesByActivityLevel activeMinutes. - * @member {number|Long} activeMinutes + * @member {number|Long|null|undefined} activeMinutes * @memberof google.devicesandservices.health.v4.ActiveMinutes.ActiveMinutesByActivityLevel * @instance */ - ActiveMinutesByActivityLevel.prototype.activeMinutes = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ActiveMinutesByActivityLevel.prototype.activeMinutes = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ActiveMinutesByActivityLevel.prototype, "_activeMinutes", { + get: $util.oneOfGetter($oneOfFields = ["activeMinutes"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new ActiveMinutesByActivityLevel instance using the specified properties. @@ -2573,6 +2612,7 @@ ActiveMinutesByActivityLevel.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.activityLevel != null && message.hasOwnProperty("activityLevel")) switch (message.activityLevel) { default: @@ -2583,9 +2623,11 @@ case 3: break; } - if (message.activeMinutes != null && message.hasOwnProperty("activeMinutes")) + if (message.activeMinutes != null && message.hasOwnProperty("activeMinutes")) { + properties._activeMinutes = 1; if (!$util.isInteger(message.activeMinutes) && !(message.activeMinutes && $util.isInteger(message.activeMinutes.low) && $util.isInteger(message.activeMinutes.high))) return "activeMinutes: integer|Long expected"; + } return null; }; @@ -2650,21 +2692,18 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.activityLevel = options.enums === String ? "ACTIVITY_LEVEL_UNSPECIFIED" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.activeMinutes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.activeMinutes = options.longs === String ? "0" : 0; - } if (message.activityLevel != null && message.hasOwnProperty("activityLevel")) object.activityLevel = options.enums === String ? $root.google.devicesandservices.health.v4.ActiveMinutes.ActivityLevel[message.activityLevel] === undefined ? message.activityLevel : $root.google.devicesandservices.health.v4.ActiveMinutes.ActivityLevel[message.activityLevel] : message.activityLevel; - if (message.activeMinutes != null && message.hasOwnProperty("activeMinutes")) + if (message.activeMinutes != null && message.hasOwnProperty("activeMinutes")) { if (typeof message.activeMinutes === "number") object.activeMinutes = options.longs === String ? String(message.activeMinutes) : message.activeMinutes; else object.activeMinutes = options.longs === String ? $util.Long.prototype.toString.call(message.activeMinutes) : options.longs === Number ? new $util.LongBits(message.activeMinutes.low >>> 0, message.activeMinutes.high >>> 0).toNumber() : message.activeMinutes; + if (options.oneofs) + object._activeMinutes = "activeMinutes"; + } return object; }; @@ -2976,11 +3015,20 @@ /** * ActiveMinutesRollupByActivityLevel activeMinutesSum. - * @member {number|Long} activeMinutesSum + * @member {number|Long|null|undefined} activeMinutesSum * @memberof google.devicesandservices.health.v4.ActiveMinutesRollupValue.ActiveMinutesRollupByActivityLevel * @instance */ - ActiveMinutesRollupByActivityLevel.prototype.activeMinutesSum = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ActiveMinutesRollupByActivityLevel.prototype.activeMinutesSum = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ActiveMinutesRollupByActivityLevel.prototype, "_activeMinutesSum", { + get: $util.oneOfGetter($oneOfFields = ["activeMinutesSum"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new ActiveMinutesRollupByActivityLevel instance using the specified properties. @@ -3089,6 +3137,7 @@ ActiveMinutesRollupByActivityLevel.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.activityLevel != null && message.hasOwnProperty("activityLevel")) switch (message.activityLevel) { default: @@ -3099,9 +3148,11 @@ case 3: break; } - if (message.activeMinutesSum != null && message.hasOwnProperty("activeMinutesSum")) + if (message.activeMinutesSum != null && message.hasOwnProperty("activeMinutesSum")) { + properties._activeMinutesSum = 1; if (!$util.isInteger(message.activeMinutesSum) && !(message.activeMinutesSum && $util.isInteger(message.activeMinutesSum.low) && $util.isInteger(message.activeMinutesSum.high))) return "activeMinutesSum: integer|Long expected"; + } return null; }; @@ -3166,21 +3217,18 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.activityLevel = options.enums === String ? "ACTIVITY_LEVEL_UNSPECIFIED" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.activeMinutesSum = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.activeMinutesSum = options.longs === String ? "0" : 0; - } if (message.activityLevel != null && message.hasOwnProperty("activityLevel")) object.activityLevel = options.enums === String ? $root.google.devicesandservices.health.v4.ActiveMinutes.ActivityLevel[message.activityLevel] === undefined ? message.activityLevel : $root.google.devicesandservices.health.v4.ActiveMinutes.ActivityLevel[message.activityLevel] : message.activityLevel; - if (message.activeMinutesSum != null && message.hasOwnProperty("activeMinutesSum")) + if (message.activeMinutesSum != null && message.hasOwnProperty("activeMinutesSum")) { if (typeof message.activeMinutesSum === "number") object.activeMinutesSum = options.longs === String ? String(message.activeMinutesSum) : message.activeMinutesSum; else object.activeMinutesSum = options.longs === String ? $util.Long.prototype.toString.call(message.activeMinutesSum) : options.longs === Number ? new $util.LongBits(message.activeMinutesSum.low >>> 0, message.activeMinutesSum.high >>> 0).toNumber() : message.activeMinutesSum; + if (options.oneofs) + object._activeMinutesSum = "activeMinutesSum"; + } return object; }; @@ -4033,11 +4081,20 @@ /** * Altitude gainMillimeters. - * @member {number|Long} gainMillimeters + * @member {number|Long|null|undefined} gainMillimeters * @memberof google.devicesandservices.health.v4.Altitude * @instance */ - Altitude.prototype.gainMillimeters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + Altitude.prototype.gainMillimeters = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Altitude.prototype, "_gainMillimeters", { + get: $util.oneOfGetter($oneOfFields = ["gainMillimeters"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new Altitude instance using the specified properties. @@ -4146,14 +4203,17 @@ Altitude.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.interval != null && message.hasOwnProperty("interval")) { var error = $root.google.devicesandservices.health.v4.ObservationTimeInterval.verify(message.interval); if (error) return "interval." + error; } - if (message.gainMillimeters != null && message.hasOwnProperty("gainMillimeters")) + if (message.gainMillimeters != null && message.hasOwnProperty("gainMillimeters")) { + properties._gainMillimeters = 1; if (!$util.isInteger(message.gainMillimeters) && !(message.gainMillimeters && $util.isInteger(message.gainMillimeters.low) && $util.isInteger(message.gainMillimeters.high))) return "gainMillimeters: integer|Long expected"; + } return null; }; @@ -4199,21 +4259,18 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.interval = null; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.gainMillimeters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.gainMillimeters = options.longs === String ? "0" : 0; - } if (message.interval != null && message.hasOwnProperty("interval")) object.interval = $root.google.devicesandservices.health.v4.ObservationTimeInterval.toObject(message.interval, options); - if (message.gainMillimeters != null && message.hasOwnProperty("gainMillimeters")) + if (message.gainMillimeters != null && message.hasOwnProperty("gainMillimeters")) { if (typeof message.gainMillimeters === "number") object.gainMillimeters = options.longs === String ? String(message.gainMillimeters) : message.gainMillimeters; else object.gainMillimeters = options.longs === String ? $util.Long.prototype.toString.call(message.gainMillimeters) : options.longs === Number ? new $util.LongBits(message.gainMillimeters.low >>> 0, message.gainMillimeters.high >>> 0).toNumber() : message.gainMillimeters; + if (options.oneofs) + object._gainMillimeters = "gainMillimeters"; + } return object; }; @@ -4281,11 +4338,20 @@ /** * BasalEnergyBurned kcal. - * @member {number} kcal + * @member {number|null|undefined} kcal * @memberof google.devicesandservices.health.v4.BasalEnergyBurned * @instance */ - BasalEnergyBurned.prototype.kcal = 0; + BasalEnergyBurned.prototype.kcal = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(BasalEnergyBurned.prototype, "_kcal", { + get: $util.oneOfGetter($oneOfFields = ["kcal"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new BasalEnergyBurned instance using the specified properties. @@ -4394,14 +4460,17 @@ BasalEnergyBurned.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.interval != null && message.hasOwnProperty("interval")) { var error = $root.google.devicesandservices.health.v4.ObservationTimeInterval.verify(message.interval); if (error) return "interval." + error; } - if (message.kcal != null && message.hasOwnProperty("kcal")) + if (message.kcal != null && message.hasOwnProperty("kcal")) { + properties._kcal = 1; if (typeof message.kcal !== "number") return "kcal: number expected"; + } return null; }; @@ -4440,14 +4509,15 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.interval = null; - object.kcal = 0; - } if (message.interval != null && message.hasOwnProperty("interval")) object.interval = $root.google.devicesandservices.health.v4.ObservationTimeInterval.toObject(message.interval, options); - if (message.kcal != null && message.hasOwnProperty("kcal")) + if (message.kcal != null && message.hasOwnProperty("kcal")) { object.kcal = options.json && !isFinite(message.kcal) ? String(message.kcal) : message.kcal; + if (options.oneofs) + object._kcal = "kcal"; + } return object; }; @@ -4515,11 +4585,20 @@ /** * BodyFat percentage. - * @member {number} percentage + * @member {number|null|undefined} percentage * @memberof google.devicesandservices.health.v4.BodyFat * @instance */ - BodyFat.prototype.percentage = 0; + BodyFat.prototype.percentage = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(BodyFat.prototype, "_percentage", { + get: $util.oneOfGetter($oneOfFields = ["percentage"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new BodyFat instance using the specified properties. @@ -4628,14 +4707,17 @@ BodyFat.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.sampleTime != null && message.hasOwnProperty("sampleTime")) { var error = $root.google.devicesandservices.health.v4.ObservationSampleTime.verify(message.sampleTime); if (error) return "sampleTime." + error; } - if (message.percentage != null && message.hasOwnProperty("percentage")) + if (message.percentage != null && message.hasOwnProperty("percentage")) { + properties._percentage = 1; if (typeof message.percentage !== "number") return "percentage: number expected"; + } return null; }; @@ -4674,14 +4756,15 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.sampleTime = null; - object.percentage = 0; - } if (message.sampleTime != null && message.hasOwnProperty("sampleTime")) object.sampleTime = $root.google.devicesandservices.health.v4.ObservationSampleTime.toObject(message.sampleTime, options); - if (message.percentage != null && message.hasOwnProperty("percentage")) + if (message.percentage != null && message.hasOwnProperty("percentage")) { object.percentage = options.json && !isFinite(message.percentage) ? String(message.percentage) : message.percentage; + if (options.oneofs) + object._percentage = "percentage"; + } return object; }; @@ -4740,11 +4823,20 @@ /** * BodyFatRollupValue bodyFatPercentageAvg. - * @member {number} bodyFatPercentageAvg + * @member {number|null|undefined} bodyFatPercentageAvg * @memberof google.devicesandservices.health.v4.BodyFatRollupValue * @instance */ - BodyFatRollupValue.prototype.bodyFatPercentageAvg = 0; + BodyFatRollupValue.prototype.bodyFatPercentageAvg = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(BodyFatRollupValue.prototype, "_bodyFatPercentageAvg", { + get: $util.oneOfGetter($oneOfFields = ["bodyFatPercentageAvg"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new BodyFatRollupValue instance using the specified properties. @@ -4847,9 +4939,12 @@ BodyFatRollupValue.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.bodyFatPercentageAvg != null && message.hasOwnProperty("bodyFatPercentageAvg")) + var properties = {}; + if (message.bodyFatPercentageAvg != null && message.hasOwnProperty("bodyFatPercentageAvg")) { + properties._bodyFatPercentageAvg = 1; if (typeof message.bodyFatPercentageAvg !== "number") return "bodyFatPercentageAvg: number expected"; + } return null; }; @@ -4883,10 +4978,11 @@ if (!options) options = {}; var object = {}; - if (options.defaults) - object.bodyFatPercentageAvg = 0; - if (message.bodyFatPercentageAvg != null && message.hasOwnProperty("bodyFatPercentageAvg")) + if (message.bodyFatPercentageAvg != null && message.hasOwnProperty("bodyFatPercentageAvg")) { object.bodyFatPercentageAvg = options.json && !isFinite(message.bodyFatPercentageAvg) ? String(message.bodyFatPercentageAvg) : message.bodyFatPercentageAvg; + if (options.oneofs) + object._bodyFatPercentageAvg = "bodyFatPercentageAvg"; + } return object; }; @@ -5177,11 +5273,20 @@ /** * CaloriesInHeartRateZoneValue kcal. - * @member {number} kcal + * @member {number|null|undefined} kcal * @memberof google.devicesandservices.health.v4.CaloriesInHeartRateZoneRollupValue.CaloriesInHeartRateZoneValue * @instance */ - CaloriesInHeartRateZoneValue.prototype.kcal = 0; + CaloriesInHeartRateZoneValue.prototype.kcal = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(CaloriesInHeartRateZoneValue.prototype, "_kcal", { + get: $util.oneOfGetter($oneOfFields = ["kcal"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new CaloriesInHeartRateZoneValue instance using the specified properties. @@ -5290,6 +5395,7 @@ CaloriesInHeartRateZoneValue.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.heartRateZone != null && message.hasOwnProperty("heartRateZone")) switch (message.heartRateZone) { default: @@ -5301,9 +5407,11 @@ case 4: break; } - if (message.kcal != null && message.hasOwnProperty("kcal")) + if (message.kcal != null && message.hasOwnProperty("kcal")) { + properties._kcal = 1; if (typeof message.kcal !== "number") return "kcal: number expected"; + } return null; }; @@ -5365,14 +5473,15 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.heartRateZone = options.enums === String ? "HEART_RATE_ZONE_TYPE_UNSPECIFIED" : 0; - object.kcal = 0; - } if (message.heartRateZone != null && message.hasOwnProperty("heartRateZone")) object.heartRateZone = options.enums === String ? $root.google.devicesandservices.health.v4.HeartRateZoneType[message.heartRateZone] === undefined ? message.heartRateZone : $root.google.devicesandservices.health.v4.HeartRateZoneType[message.heartRateZone] : message.heartRateZone; - if (message.kcal != null && message.hasOwnProperty("kcal")) + if (message.kcal != null && message.hasOwnProperty("kcal")) { object.kcal = options.json && !isFinite(message.kcal) ? String(message.kcal) : message.kcal; + if (options.oneofs) + object._kcal = "kcal"; + } return object; }; @@ -5696,19 +5805,34 @@ /** * HeartRateZone minBeatsPerMinute. - * @member {number|Long} minBeatsPerMinute + * @member {number|Long|null|undefined} minBeatsPerMinute * @memberof google.devicesandservices.health.v4.DailyHeartRateZones.HeartRateZone * @instance */ - HeartRateZone.prototype.minBeatsPerMinute = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + HeartRateZone.prototype.minBeatsPerMinute = null; /** * HeartRateZone maxBeatsPerMinute. - * @member {number|Long} maxBeatsPerMinute + * @member {number|Long|null|undefined} maxBeatsPerMinute * @memberof google.devicesandservices.health.v4.DailyHeartRateZones.HeartRateZone * @instance */ - HeartRateZone.prototype.maxBeatsPerMinute = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + HeartRateZone.prototype.maxBeatsPerMinute = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(HeartRateZone.prototype, "_minBeatsPerMinute", { + get: $util.oneOfGetter($oneOfFields = ["minBeatsPerMinute"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(HeartRateZone.prototype, "_maxBeatsPerMinute", { + get: $util.oneOfGetter($oneOfFields = ["maxBeatsPerMinute"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new HeartRateZone instance using the specified properties. @@ -5823,6 +5947,7 @@ HeartRateZone.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.heartRateZoneType != null && message.hasOwnProperty("heartRateZoneType")) switch (message.heartRateZoneType) { default: @@ -5834,12 +5959,16 @@ case 4: break; } - if (message.minBeatsPerMinute != null && message.hasOwnProperty("minBeatsPerMinute")) + if (message.minBeatsPerMinute != null && message.hasOwnProperty("minBeatsPerMinute")) { + properties._minBeatsPerMinute = 1; if (!$util.isInteger(message.minBeatsPerMinute) && !(message.minBeatsPerMinute && $util.isInteger(message.minBeatsPerMinute.low) && $util.isInteger(message.minBeatsPerMinute.high))) return "minBeatsPerMinute: integer|Long expected"; - if (message.maxBeatsPerMinute != null && message.hasOwnProperty("maxBeatsPerMinute")) + } + if (message.maxBeatsPerMinute != null && message.hasOwnProperty("maxBeatsPerMinute")) { + properties._maxBeatsPerMinute = 1; if (!$util.isInteger(message.maxBeatsPerMinute) && !(message.maxBeatsPerMinute && $util.isInteger(message.maxBeatsPerMinute.low) && $util.isInteger(message.maxBeatsPerMinute.high))) return "maxBeatsPerMinute: integer|Long expected"; + } return null; }; @@ -5917,31 +6046,26 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.heartRateZoneType = options.enums === String ? "HEART_RATE_ZONE_TYPE_UNSPECIFIED" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.minBeatsPerMinute = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.minBeatsPerMinute = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.maxBeatsPerMinute = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.maxBeatsPerMinute = options.longs === String ? "0" : 0; - } if (message.heartRateZoneType != null && message.hasOwnProperty("heartRateZoneType")) object.heartRateZoneType = options.enums === String ? $root.google.devicesandservices.health.v4.HeartRateZoneType[message.heartRateZoneType] === undefined ? message.heartRateZoneType : $root.google.devicesandservices.health.v4.HeartRateZoneType[message.heartRateZoneType] : message.heartRateZoneType; - if (message.minBeatsPerMinute != null && message.hasOwnProperty("minBeatsPerMinute")) + if (message.minBeatsPerMinute != null && message.hasOwnProperty("minBeatsPerMinute")) { if (typeof message.minBeatsPerMinute === "number") object.minBeatsPerMinute = options.longs === String ? String(message.minBeatsPerMinute) : message.minBeatsPerMinute; else object.minBeatsPerMinute = options.longs === String ? $util.Long.prototype.toString.call(message.minBeatsPerMinute) : options.longs === Number ? new $util.LongBits(message.minBeatsPerMinute.low >>> 0, message.minBeatsPerMinute.high >>> 0).toNumber() : message.minBeatsPerMinute; - if (message.maxBeatsPerMinute != null && message.hasOwnProperty("maxBeatsPerMinute")) + if (options.oneofs) + object._minBeatsPerMinute = "minBeatsPerMinute"; + } + if (message.maxBeatsPerMinute != null && message.hasOwnProperty("maxBeatsPerMinute")) { if (typeof message.maxBeatsPerMinute === "number") object.maxBeatsPerMinute = options.longs === String ? String(message.maxBeatsPerMinute) : message.maxBeatsPerMinute; else object.maxBeatsPerMinute = options.longs === String ? $util.Long.prototype.toString.call(message.maxBeatsPerMinute) : options.longs === Number ? new $util.LongBits(message.maxBeatsPerMinute.low >>> 0, message.maxBeatsPerMinute.high >>> 0).toNumber() : message.maxBeatsPerMinute; + if (options.oneofs) + object._maxBeatsPerMinute = "maxBeatsPerMinute"; + } return object; }; @@ -6368,11 +6492,20 @@ /** * DailyRespiratoryRate breathsPerMinute. - * @member {number} breathsPerMinute + * @member {number|null|undefined} breathsPerMinute * @memberof google.devicesandservices.health.v4.DailyRespiratoryRate * @instance */ - DailyRespiratoryRate.prototype.breathsPerMinute = 0; + DailyRespiratoryRate.prototype.breathsPerMinute = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DailyRespiratoryRate.prototype, "_breathsPerMinute", { + get: $util.oneOfGetter($oneOfFields = ["breathsPerMinute"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new DailyRespiratoryRate instance using the specified properties. @@ -6481,14 +6614,17 @@ DailyRespiratoryRate.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.date != null && message.hasOwnProperty("date")) { var error = $root.google.type.Date.verify(message.date); if (error) return "date." + error; } - if (message.breathsPerMinute != null && message.hasOwnProperty("breathsPerMinute")) + if (message.breathsPerMinute != null && message.hasOwnProperty("breathsPerMinute")) { + properties._breathsPerMinute = 1; if (typeof message.breathsPerMinute !== "number") return "breathsPerMinute: number expected"; + } return null; }; @@ -6527,14 +6663,15 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.date = null; - object.breathsPerMinute = 0; - } if (message.date != null && message.hasOwnProperty("date")) object.date = $root.google.type.Date.toObject(message.date, options); - if (message.breathsPerMinute != null && message.hasOwnProperty("breathsPerMinute")) + if (message.breathsPerMinute != null && message.hasOwnProperty("breathsPerMinute")) { object.breathsPerMinute = options.json && !isFinite(message.breathsPerMinute) ? String(message.breathsPerMinute) : message.breathsPerMinute; + if (options.oneofs) + object._breathsPerMinute = "breathsPerMinute"; + } return object; }; @@ -6605,35 +6742,62 @@ /** * DailyOxygenSaturation averagePercentage. - * @member {number} averagePercentage + * @member {number|null|undefined} averagePercentage * @memberof google.devicesandservices.health.v4.DailyOxygenSaturation * @instance */ - DailyOxygenSaturation.prototype.averagePercentage = 0; + DailyOxygenSaturation.prototype.averagePercentage = null; /** * DailyOxygenSaturation lowerBoundPercentage. - * @member {number} lowerBoundPercentage + * @member {number|null|undefined} lowerBoundPercentage * @memberof google.devicesandservices.health.v4.DailyOxygenSaturation * @instance */ - DailyOxygenSaturation.prototype.lowerBoundPercentage = 0; + DailyOxygenSaturation.prototype.lowerBoundPercentage = null; /** * DailyOxygenSaturation upperBoundPercentage. - * @member {number} upperBoundPercentage + * @member {number|null|undefined} upperBoundPercentage * @memberof google.devicesandservices.health.v4.DailyOxygenSaturation * @instance */ - DailyOxygenSaturation.prototype.upperBoundPercentage = 0; + DailyOxygenSaturation.prototype.upperBoundPercentage = null; /** * DailyOxygenSaturation standardDeviationPercentage. - * @member {number} standardDeviationPercentage + * @member {number|null|undefined} standardDeviationPercentage * @memberof google.devicesandservices.health.v4.DailyOxygenSaturation * @instance */ - DailyOxygenSaturation.prototype.standardDeviationPercentage = 0; + DailyOxygenSaturation.prototype.standardDeviationPercentage = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DailyOxygenSaturation.prototype, "_averagePercentage", { + get: $util.oneOfGetter($oneOfFields = ["averagePercentage"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DailyOxygenSaturation.prototype, "_lowerBoundPercentage", { + get: $util.oneOfGetter($oneOfFields = ["lowerBoundPercentage"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DailyOxygenSaturation.prototype, "_upperBoundPercentage", { + get: $util.oneOfGetter($oneOfFields = ["upperBoundPercentage"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DailyOxygenSaturation.prototype, "_standardDeviationPercentage", { + get: $util.oneOfGetter($oneOfFields = ["standardDeviationPercentage"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new DailyOxygenSaturation instance using the specified properties. @@ -6760,23 +6924,32 @@ DailyOxygenSaturation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.date != null && message.hasOwnProperty("date")) { var error = $root.google.type.Date.verify(message.date); if (error) return "date." + error; } - if (message.averagePercentage != null && message.hasOwnProperty("averagePercentage")) + if (message.averagePercentage != null && message.hasOwnProperty("averagePercentage")) { + properties._averagePercentage = 1; if (typeof message.averagePercentage !== "number") return "averagePercentage: number expected"; - if (message.lowerBoundPercentage != null && message.hasOwnProperty("lowerBoundPercentage")) + } + if (message.lowerBoundPercentage != null && message.hasOwnProperty("lowerBoundPercentage")) { + properties._lowerBoundPercentage = 1; if (typeof message.lowerBoundPercentage !== "number") return "lowerBoundPercentage: number expected"; - if (message.upperBoundPercentage != null && message.hasOwnProperty("upperBoundPercentage")) + } + if (message.upperBoundPercentage != null && message.hasOwnProperty("upperBoundPercentage")) { + properties._upperBoundPercentage = 1; if (typeof message.upperBoundPercentage !== "number") return "upperBoundPercentage: number expected"; - if (message.standardDeviationPercentage != null && message.hasOwnProperty("standardDeviationPercentage")) + } + if (message.standardDeviationPercentage != null && message.hasOwnProperty("standardDeviationPercentage")) { + properties._standardDeviationPercentage = 1; if (typeof message.standardDeviationPercentage !== "number") return "standardDeviationPercentage: number expected"; + } return null; }; @@ -6821,23 +6994,30 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.date = null; - object.averagePercentage = 0; - object.lowerBoundPercentage = 0; - object.upperBoundPercentage = 0; - object.standardDeviationPercentage = 0; - } if (message.date != null && message.hasOwnProperty("date")) object.date = $root.google.type.Date.toObject(message.date, options); - if (message.averagePercentage != null && message.hasOwnProperty("averagePercentage")) + if (message.averagePercentage != null && message.hasOwnProperty("averagePercentage")) { object.averagePercentage = options.json && !isFinite(message.averagePercentage) ? String(message.averagePercentage) : message.averagePercentage; - if (message.lowerBoundPercentage != null && message.hasOwnProperty("lowerBoundPercentage")) + if (options.oneofs) + object._averagePercentage = "averagePercentage"; + } + if (message.lowerBoundPercentage != null && message.hasOwnProperty("lowerBoundPercentage")) { object.lowerBoundPercentage = options.json && !isFinite(message.lowerBoundPercentage) ? String(message.lowerBoundPercentage) : message.lowerBoundPercentage; - if (message.upperBoundPercentage != null && message.hasOwnProperty("upperBoundPercentage")) + if (options.oneofs) + object._lowerBoundPercentage = "lowerBoundPercentage"; + } + if (message.upperBoundPercentage != null && message.hasOwnProperty("upperBoundPercentage")) { object.upperBoundPercentage = options.json && !isFinite(message.upperBoundPercentage) ? String(message.upperBoundPercentage) : message.upperBoundPercentage; - if (message.standardDeviationPercentage != null && message.hasOwnProperty("standardDeviationPercentage")) + if (options.oneofs) + object._upperBoundPercentage = "upperBoundPercentage"; + } + if (message.standardDeviationPercentage != null && message.hasOwnProperty("standardDeviationPercentage")) { object.standardDeviationPercentage = options.json && !isFinite(message.standardDeviationPercentage) ? String(message.standardDeviationPercentage) : message.standardDeviationPercentage; + if (options.oneofs) + object._standardDeviationPercentage = "standardDeviationPercentage"; + } return object; }; @@ -6906,11 +7086,11 @@ /** * DailyRestingHeartRate beatsPerMinute. - * @member {number|Long} beatsPerMinute + * @member {number|Long|null|undefined} beatsPerMinute * @memberof google.devicesandservices.health.v4.DailyRestingHeartRate * @instance */ - DailyRestingHeartRate.prototype.beatsPerMinute = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + DailyRestingHeartRate.prototype.beatsPerMinute = null; /** * DailyRestingHeartRate dailyRestingHeartRateMetadata. @@ -6920,6 +7100,15 @@ */ DailyRestingHeartRate.prototype.dailyRestingHeartRateMetadata = null; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DailyRestingHeartRate.prototype, "_beatsPerMinute", { + get: $util.oneOfGetter($oneOfFields = ["beatsPerMinute"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new DailyRestingHeartRate instance using the specified properties. * @function create @@ -7033,14 +7222,17 @@ DailyRestingHeartRate.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.date != null && message.hasOwnProperty("date")) { var error = $root.google.type.Date.verify(message.date); if (error) return "date." + error; } - if (message.beatsPerMinute != null && message.hasOwnProperty("beatsPerMinute")) + if (message.beatsPerMinute != null && message.hasOwnProperty("beatsPerMinute")) { + properties._beatsPerMinute = 1; if (!$util.isInteger(message.beatsPerMinute) && !(message.beatsPerMinute && $util.isInteger(message.beatsPerMinute.low) && $util.isInteger(message.beatsPerMinute.high))) return "beatsPerMinute: integer|Long expected"; + } if (message.dailyRestingHeartRateMetadata != null && message.hasOwnProperty("dailyRestingHeartRateMetadata")) { var error = $root.google.devicesandservices.health.v4.DailyRestingHeartRate.DailyRestingHeartRateMetadata.verify(message.dailyRestingHeartRateMetadata); if (error) @@ -7098,20 +7290,18 @@ var object = {}; if (options.defaults) { object.date = null; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.beatsPerMinute = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.beatsPerMinute = options.longs === String ? "0" : 0; object.dailyRestingHeartRateMetadata = null; } if (message.date != null && message.hasOwnProperty("date")) object.date = $root.google.type.Date.toObject(message.date, options); - if (message.beatsPerMinute != null && message.hasOwnProperty("beatsPerMinute")) + if (message.beatsPerMinute != null && message.hasOwnProperty("beatsPerMinute")) { if (typeof message.beatsPerMinute === "number") object.beatsPerMinute = options.longs === String ? String(message.beatsPerMinute) : message.beatsPerMinute; else object.beatsPerMinute = options.longs === String ? $util.Long.prototype.toString.call(message.beatsPerMinute) : options.longs === Number ? new $util.LongBits(message.beatsPerMinute.low >>> 0, message.beatsPerMinute.high >>> 0).toNumber() : message.beatsPerMinute; + if (options.oneofs) + object._beatsPerMinute = "beatsPerMinute"; + } if (message.dailyRestingHeartRateMetadata != null && message.hasOwnProperty("dailyRestingHeartRateMetadata")) object.dailyRestingHeartRateMetadata = $root.google.devicesandservices.health.v4.DailyRestingHeartRate.DailyRestingHeartRateMetadata.toObject(message.dailyRestingHeartRateMetadata, options); return object; @@ -7428,27 +7618,48 @@ /** * DailySleepTemperatureDerivations nightlyTemperatureCelsius. - * @member {number} nightlyTemperatureCelsius + * @member {number|null|undefined} nightlyTemperatureCelsius * @memberof google.devicesandservices.health.v4.DailySleepTemperatureDerivations * @instance */ - DailySleepTemperatureDerivations.prototype.nightlyTemperatureCelsius = 0; + DailySleepTemperatureDerivations.prototype.nightlyTemperatureCelsius = null; /** * DailySleepTemperatureDerivations baselineTemperatureCelsius. - * @member {number} baselineTemperatureCelsius + * @member {number|null|undefined} baselineTemperatureCelsius * @memberof google.devicesandservices.health.v4.DailySleepTemperatureDerivations * @instance */ - DailySleepTemperatureDerivations.prototype.baselineTemperatureCelsius = 0; + DailySleepTemperatureDerivations.prototype.baselineTemperatureCelsius = null; /** * DailySleepTemperatureDerivations relativeNightlyStddev_30dCelsius. - * @member {number} relativeNightlyStddev_30dCelsius + * @member {number|null|undefined} relativeNightlyStddev_30dCelsius * @memberof google.devicesandservices.health.v4.DailySleepTemperatureDerivations * @instance */ - DailySleepTemperatureDerivations.prototype.relativeNightlyStddev_30dCelsius = 0; + DailySleepTemperatureDerivations.prototype.relativeNightlyStddev_30dCelsius = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DailySleepTemperatureDerivations.prototype, "_nightlyTemperatureCelsius", { + get: $util.oneOfGetter($oneOfFields = ["nightlyTemperatureCelsius"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DailySleepTemperatureDerivations.prototype, "_baselineTemperatureCelsius", { + get: $util.oneOfGetter($oneOfFields = ["baselineTemperatureCelsius"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DailySleepTemperatureDerivations.prototype, "_relativeNightlyStddev_30dCelsius", { + get: $util.oneOfGetter($oneOfFields = ["relativeNightlyStddev_30dCelsius"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new DailySleepTemperatureDerivations instance using the specified properties. @@ -7569,20 +7780,27 @@ DailySleepTemperatureDerivations.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.date != null && message.hasOwnProperty("date")) { var error = $root.google.type.Date.verify(message.date); if (error) return "date." + error; } - if (message.nightlyTemperatureCelsius != null && message.hasOwnProperty("nightlyTemperatureCelsius")) + if (message.nightlyTemperatureCelsius != null && message.hasOwnProperty("nightlyTemperatureCelsius")) { + properties._nightlyTemperatureCelsius = 1; if (typeof message.nightlyTemperatureCelsius !== "number") return "nightlyTemperatureCelsius: number expected"; - if (message.baselineTemperatureCelsius != null && message.hasOwnProperty("baselineTemperatureCelsius")) + } + if (message.baselineTemperatureCelsius != null && message.hasOwnProperty("baselineTemperatureCelsius")) { + properties._baselineTemperatureCelsius = 1; if (typeof message.baselineTemperatureCelsius !== "number") return "baselineTemperatureCelsius: number expected"; - if (message.relativeNightlyStddev_30dCelsius != null && message.hasOwnProperty("relativeNightlyStddev_30dCelsius")) + } + if (message.relativeNightlyStddev_30dCelsius != null && message.hasOwnProperty("relativeNightlyStddev_30dCelsius")) { + properties._relativeNightlyStddev_30dCelsius = 1; if (typeof message.relativeNightlyStddev_30dCelsius !== "number") return "relativeNightlyStddev_30dCelsius: number expected"; + } return null; }; @@ -7625,20 +7843,25 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.date = null; - object.nightlyTemperatureCelsius = 0; - object.baselineTemperatureCelsius = 0; - object.relativeNightlyStddev_30dCelsius = 0; - } if (message.date != null && message.hasOwnProperty("date")) object.date = $root.google.type.Date.toObject(message.date, options); - if (message.nightlyTemperatureCelsius != null && message.hasOwnProperty("nightlyTemperatureCelsius")) + if (message.nightlyTemperatureCelsius != null && message.hasOwnProperty("nightlyTemperatureCelsius")) { object.nightlyTemperatureCelsius = options.json && !isFinite(message.nightlyTemperatureCelsius) ? String(message.nightlyTemperatureCelsius) : message.nightlyTemperatureCelsius; - if (message.baselineTemperatureCelsius != null && message.hasOwnProperty("baselineTemperatureCelsius")) + if (options.oneofs) + object._nightlyTemperatureCelsius = "nightlyTemperatureCelsius"; + } + if (message.baselineTemperatureCelsius != null && message.hasOwnProperty("baselineTemperatureCelsius")) { object.baselineTemperatureCelsius = options.json && !isFinite(message.baselineTemperatureCelsius) ? String(message.baselineTemperatureCelsius) : message.baselineTemperatureCelsius; - if (message.relativeNightlyStddev_30dCelsius != null && message.hasOwnProperty("relativeNightlyStddev_30dCelsius")) + if (options.oneofs) + object._baselineTemperatureCelsius = "baselineTemperatureCelsius"; + } + if (message.relativeNightlyStddev_30dCelsius != null && message.hasOwnProperty("relativeNightlyStddev_30dCelsius")) { object.relativeNightlyStddev_30dCelsius = options.json && !isFinite(message.relativeNightlyStddev_30dCelsius) ? String(message.relativeNightlyStddev_30dCelsius) : message.relativeNightlyStddev_30dCelsius; + if (options.oneofs) + object._relativeNightlyStddev_30dCelsius = "relativeNightlyStddev_30dCelsius"; + } return object; }; @@ -7709,11 +7932,11 @@ /** * DailyVO2Max vo2Max. - * @member {number} vo2Max + * @member {number|null|undefined} vo2Max * @memberof google.devicesandservices.health.v4.DailyVO2Max * @instance */ - DailyVO2Max.prototype.vo2Max = 0; + DailyVO2Max.prototype.vo2Max = null; /** * DailyVO2Max estimated. @@ -7733,11 +7956,26 @@ /** * DailyVO2Max vo2MaxCovariance. - * @member {number} vo2MaxCovariance + * @member {number|null|undefined} vo2MaxCovariance * @memberof google.devicesandservices.health.v4.DailyVO2Max * @instance */ - DailyVO2Max.prototype.vo2MaxCovariance = 0; + DailyVO2Max.prototype.vo2MaxCovariance = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DailyVO2Max.prototype, "_vo2Max", { + get: $util.oneOfGetter($oneOfFields = ["vo2Max"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DailyVO2Max.prototype, "_vo2MaxCovariance", { + get: $util.oneOfGetter($oneOfFields = ["vo2MaxCovariance"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new DailyVO2Max instance using the specified properties. @@ -7864,14 +8102,17 @@ DailyVO2Max.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.date != null && message.hasOwnProperty("date")) { var error = $root.google.type.Date.verify(message.date); if (error) return "date." + error; } - if (message.vo2Max != null && message.hasOwnProperty("vo2Max")) + if (message.vo2Max != null && message.hasOwnProperty("vo2Max")) { + properties._vo2Max = 1; if (typeof message.vo2Max !== "number") return "vo2Max: number expected"; + } if (message.estimated != null && message.hasOwnProperty("estimated")) if (typeof message.estimated !== "boolean") return "estimated: boolean expected"; @@ -7888,9 +8129,11 @@ case 6: break; } - if (message.vo2MaxCovariance != null && message.hasOwnProperty("vo2MaxCovariance")) + if (message.vo2MaxCovariance != null && message.hasOwnProperty("vo2MaxCovariance")) { + properties._vo2MaxCovariance = 1; if (typeof message.vo2MaxCovariance !== "number") return "vo2MaxCovariance: number expected"; + } return null; }; @@ -7971,21 +8214,25 @@ var object = {}; if (options.defaults) { object.date = null; - object.vo2Max = 0; object.estimated = false; object.cardioFitnessLevel = options.enums === String ? "CARDIO_FITNESS_LEVEL_UNSPECIFIED" : 0; - object.vo2MaxCovariance = 0; } if (message.date != null && message.hasOwnProperty("date")) object.date = $root.google.type.Date.toObject(message.date, options); - if (message.vo2Max != null && message.hasOwnProperty("vo2Max")) + if (message.vo2Max != null && message.hasOwnProperty("vo2Max")) { object.vo2Max = options.json && !isFinite(message.vo2Max) ? String(message.vo2Max) : message.vo2Max; + if (options.oneofs) + object._vo2Max = "vo2Max"; + } if (message.estimated != null && message.hasOwnProperty("estimated")) object.estimated = message.estimated; if (message.cardioFitnessLevel != null && message.hasOwnProperty("cardioFitnessLevel")) object.cardioFitnessLevel = options.enums === String ? $root.google.devicesandservices.health.v4.DailyVO2Max.CardioFitnessLevel[message.cardioFitnessLevel] === undefined ? message.cardioFitnessLevel : $root.google.devicesandservices.health.v4.DailyVO2Max.CardioFitnessLevel[message.cardioFitnessLevel] : message.cardioFitnessLevel; - if (message.vo2MaxCovariance != null && message.hasOwnProperty("vo2MaxCovariance")) + if (message.vo2MaxCovariance != null && message.hasOwnProperty("vo2MaxCovariance")) { object.vo2MaxCovariance = options.json && !isFinite(message.vo2MaxCovariance) ? String(message.vo2MaxCovariance) : message.vo2MaxCovariance; + if (options.oneofs) + object._vo2MaxCovariance = "vo2MaxCovariance"; + } return object; }; @@ -8077,11 +8324,20 @@ /** * Distance millimeters. - * @member {number|Long} millimeters + * @member {number|Long|null|undefined} millimeters * @memberof google.devicesandservices.health.v4.Distance * @instance */ - Distance.prototype.millimeters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + Distance.prototype.millimeters = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Distance.prototype, "_millimeters", { + get: $util.oneOfGetter($oneOfFields = ["millimeters"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new Distance instance using the specified properties. @@ -8190,14 +8446,17 @@ Distance.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.interval != null && message.hasOwnProperty("interval")) { var error = $root.google.devicesandservices.health.v4.ObservationTimeInterval.verify(message.interval); if (error) return "interval." + error; } - if (message.millimeters != null && message.hasOwnProperty("millimeters")) + if (message.millimeters != null && message.hasOwnProperty("millimeters")) { + properties._millimeters = 1; if (!$util.isInteger(message.millimeters) && !(message.millimeters && $util.isInteger(message.millimeters.low) && $util.isInteger(message.millimeters.high))) return "millimeters: integer|Long expected"; + } return null; }; @@ -8243,21 +8502,18 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.interval = null; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.millimeters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.millimeters = options.longs === String ? "0" : 0; - } if (message.interval != null && message.hasOwnProperty("interval")) object.interval = $root.google.devicesandservices.health.v4.ObservationTimeInterval.toObject(message.interval, options); - if (message.millimeters != null && message.hasOwnProperty("millimeters")) + if (message.millimeters != null && message.hasOwnProperty("millimeters")) { if (typeof message.millimeters === "number") object.millimeters = options.longs === String ? String(message.millimeters) : message.millimeters; else object.millimeters = options.longs === String ? $util.Long.prototype.toString.call(message.millimeters) : options.longs === Number ? new $util.LongBits(message.millimeters.low >>> 0, message.millimeters.high >>> 0).toNumber() : message.millimeters; + if (options.oneofs) + object._millimeters = "millimeters"; + } return object; }; @@ -8316,11 +8572,20 @@ /** * DistanceRollupValue millimetersSum. - * @member {number|Long} millimetersSum + * @member {number|Long|null|undefined} millimetersSum * @memberof google.devicesandservices.health.v4.DistanceRollupValue * @instance */ - DistanceRollupValue.prototype.millimetersSum = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + DistanceRollupValue.prototype.millimetersSum = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DistanceRollupValue.prototype, "_millimetersSum", { + get: $util.oneOfGetter($oneOfFields = ["millimetersSum"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new DistanceRollupValue instance using the specified properties. @@ -8423,9 +8688,12 @@ DistanceRollupValue.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.millimetersSum != null && message.hasOwnProperty("millimetersSum")) + var properties = {}; + if (message.millimetersSum != null && message.hasOwnProperty("millimetersSum")) { + properties._millimetersSum = 1; if (!$util.isInteger(message.millimetersSum) && !(message.millimetersSum && $util.isInteger(message.millimetersSum.low) && $util.isInteger(message.millimetersSum.high))) return "millimetersSum: integer|Long expected"; + } return null; }; @@ -8466,17 +8734,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.millimetersSum = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.millimetersSum = options.longs === String ? "0" : 0; - if (message.millimetersSum != null && message.hasOwnProperty("millimetersSum")) + if (message.millimetersSum != null && message.hasOwnProperty("millimetersSum")) { if (typeof message.millimetersSum === "number") object.millimetersSum = options.longs === String ? String(message.millimetersSum) : message.millimetersSum; else object.millimetersSum = options.longs === String ? $util.Long.prototype.toString.call(message.millimetersSum) : options.longs === Number ? new $util.LongBits(message.millimetersSum.low >>> 0, message.millimetersSum.high >>> 0).toNumber() : message.millimetersSum; + if (options.oneofs) + object._millimetersSum = "millimetersSum"; + } return object; }; @@ -9919,11 +10184,11 @@ /** * ExerciseMetadata poolLengthMillimeters. - * @member {number|Long} poolLengthMillimeters + * @member {number|Long|null|undefined} poolLengthMillimeters * @memberof google.devicesandservices.health.v4.Exercise.ExerciseMetadata * @instance */ - ExerciseMetadata.prototype.poolLengthMillimeters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + ExerciseMetadata.prototype.poolLengthMillimeters = null; /** * ExerciseMetadata hasGps. @@ -9933,6 +10198,15 @@ */ ExerciseMetadata.prototype.hasGps = false; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ExerciseMetadata.prototype, "_poolLengthMillimeters", { + get: $util.oneOfGetter($oneOfFields = ["poolLengthMillimeters"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new ExerciseMetadata instance using the specified properties. * @function create @@ -10040,9 +10314,12 @@ ExerciseMetadata.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.poolLengthMillimeters != null && message.hasOwnProperty("poolLengthMillimeters")) + var properties = {}; + if (message.poolLengthMillimeters != null && message.hasOwnProperty("poolLengthMillimeters")) { + properties._poolLengthMillimeters = 1; if (!$util.isInteger(message.poolLengthMillimeters) && !(message.poolLengthMillimeters && $util.isInteger(message.poolLengthMillimeters.low) && $util.isInteger(message.poolLengthMillimeters.high))) return "poolLengthMillimeters: integer|Long expected"; + } if (message.hasGps != null && message.hasOwnProperty("hasGps")) if (typeof message.hasGps !== "boolean") return "hasGps: boolean expected"; @@ -10088,19 +10365,16 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.poolLengthMillimeters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.poolLengthMillimeters = options.longs === String ? "0" : 0; + if (options.defaults) object.hasGps = false; - } - if (message.poolLengthMillimeters != null && message.hasOwnProperty("poolLengthMillimeters")) + if (message.poolLengthMillimeters != null && message.hasOwnProperty("poolLengthMillimeters")) { if (typeof message.poolLengthMillimeters === "number") object.poolLengthMillimeters = options.longs === String ? String(message.poolLengthMillimeters) : message.poolLengthMillimeters; else object.poolLengthMillimeters = options.longs === String ? $util.Long.prototype.toString.call(message.poolLengthMillimeters) : options.longs === Number ? new $util.LongBits(message.poolLengthMillimeters.low >>> 0, message.poolLengthMillimeters.high >>> 0).toNumber() : message.poolLengthMillimeters; + if (options.oneofs) + object._poolLengthMillimeters = "poolLengthMillimeters"; + } if (message.hasGps != null && message.hasOwnProperty("hasGps")) object.hasGps = message.hasGps; return object; @@ -10209,11 +10483,20 @@ /** * Floors count. - * @member {number|Long} count + * @member {number|Long|null|undefined} count * @memberof google.devicesandservices.health.v4.Floors * @instance */ - Floors.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + Floors.prototype.count = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Floors.prototype, "_count", { + get: $util.oneOfGetter($oneOfFields = ["count"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new Floors instance using the specified properties. @@ -10322,14 +10605,17 @@ Floors.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.interval != null && message.hasOwnProperty("interval")) { var error = $root.google.devicesandservices.health.v4.ObservationTimeInterval.verify(message.interval); if (error) return "interval." + error; } - if (message.count != null && message.hasOwnProperty("count")) + if (message.count != null && message.hasOwnProperty("count")) { + properties._count = 1; if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) return "count: integer|Long expected"; + } return null; }; @@ -10375,21 +10661,18 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.interval = null; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.count = options.longs === String ? "0" : 0; - } if (message.interval != null && message.hasOwnProperty("interval")) object.interval = $root.google.devicesandservices.health.v4.ObservationTimeInterval.toObject(message.interval, options); - if (message.count != null && message.hasOwnProperty("count")) + if (message.count != null && message.hasOwnProperty("count")) { if (typeof message.count === "number") object.count = options.longs === String ? String(message.count) : message.count; else object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; + if (options.oneofs) + object._count = "count"; + } return object; }; @@ -10448,11 +10731,20 @@ /** * FloorsRollupValue countSum. - * @member {number|Long} countSum + * @member {number|Long|null|undefined} countSum * @memberof google.devicesandservices.health.v4.FloorsRollupValue * @instance */ - FloorsRollupValue.prototype.countSum = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + FloorsRollupValue.prototype.countSum = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(FloorsRollupValue.prototype, "_countSum", { + get: $util.oneOfGetter($oneOfFields = ["countSum"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new FloorsRollupValue instance using the specified properties. @@ -10555,9 +10847,12 @@ FloorsRollupValue.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.countSum != null && message.hasOwnProperty("countSum")) + var properties = {}; + if (message.countSum != null && message.hasOwnProperty("countSum")) { + properties._countSum = 1; if (!$util.isInteger(message.countSum) && !(message.countSum && $util.isInteger(message.countSum.low) && $util.isInteger(message.countSum.high))) return "countSum: integer|Long expected"; + } return null; }; @@ -10598,17 +10893,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.countSum = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.countSum = options.longs === String ? "0" : 0; - if (message.countSum != null && message.hasOwnProperty("countSum")) + if (message.countSum != null && message.hasOwnProperty("countSum")) { if (typeof message.countSum === "number") object.countSum = options.longs === String ? String(message.countSum) : message.countSum; else object.countSum = options.longs === String ? $util.Long.prototype.toString.call(message.countSum) : options.longs === Number ? new $util.LongBits(message.countSum.low >>> 0, message.countSum.high >>> 0).toNumber() : message.countSum; + if (options.oneofs) + object._countSum = "countSum"; + } return object; }; @@ -10667,11 +10959,20 @@ /** * AltitudeRollupValue gainMillimetersSum. - * @member {number|Long} gainMillimetersSum + * @member {number|Long|null|undefined} gainMillimetersSum * @memberof google.devicesandservices.health.v4.AltitudeRollupValue * @instance */ - AltitudeRollupValue.prototype.gainMillimetersSum = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + AltitudeRollupValue.prototype.gainMillimetersSum = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(AltitudeRollupValue.prototype, "_gainMillimetersSum", { + get: $util.oneOfGetter($oneOfFields = ["gainMillimetersSum"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new AltitudeRollupValue instance using the specified properties. @@ -10774,9 +11075,12 @@ AltitudeRollupValue.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.gainMillimetersSum != null && message.hasOwnProperty("gainMillimetersSum")) + var properties = {}; + if (message.gainMillimetersSum != null && message.hasOwnProperty("gainMillimetersSum")) { + properties._gainMillimetersSum = 1; if (!$util.isInteger(message.gainMillimetersSum) && !(message.gainMillimetersSum && $util.isInteger(message.gainMillimetersSum.low) && $util.isInteger(message.gainMillimetersSum.high))) return "gainMillimetersSum: integer|Long expected"; + } return null; }; @@ -10817,17 +11121,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.gainMillimetersSum = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.gainMillimetersSum = options.longs === String ? "0" : 0; - if (message.gainMillimetersSum != null && message.hasOwnProperty("gainMillimetersSum")) + if (message.gainMillimetersSum != null && message.hasOwnProperty("gainMillimetersSum")) { if (typeof message.gainMillimetersSum === "number") object.gainMillimetersSum = options.longs === String ? String(message.gainMillimetersSum) : message.gainMillimetersSum; else object.gainMillimetersSum = options.longs === String ? $util.Long.prototype.toString.call(message.gainMillimetersSum) : options.longs === Number ? new $util.LongBits(message.gainMillimetersSum.low >>> 0, message.gainMillimetersSum.high >>> 0).toNumber() : message.gainMillimetersSum; + if (options.oneofs) + object._gainMillimetersSum = "gainMillimetersSum"; + } return object; }; @@ -10896,11 +11197,11 @@ /** * HeartRate beatsPerMinute. - * @member {number|Long} beatsPerMinute + * @member {number|Long|null|undefined} beatsPerMinute * @memberof google.devicesandservices.health.v4.HeartRate * @instance */ - HeartRate.prototype.beatsPerMinute = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + HeartRate.prototype.beatsPerMinute = null; /** * HeartRate metadata. @@ -10910,6 +11211,15 @@ */ HeartRate.prototype.metadata = null; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(HeartRate.prototype, "_beatsPerMinute", { + get: $util.oneOfGetter($oneOfFields = ["beatsPerMinute"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new HeartRate instance using the specified properties. * @function create @@ -11023,14 +11333,17 @@ HeartRate.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.sampleTime != null && message.hasOwnProperty("sampleTime")) { var error = $root.google.devicesandservices.health.v4.ObservationSampleTime.verify(message.sampleTime); if (error) return "sampleTime." + error; } - if (message.beatsPerMinute != null && message.hasOwnProperty("beatsPerMinute")) + if (message.beatsPerMinute != null && message.hasOwnProperty("beatsPerMinute")) { + properties._beatsPerMinute = 1; if (!$util.isInteger(message.beatsPerMinute) && !(message.beatsPerMinute && $util.isInteger(message.beatsPerMinute.low) && $util.isInteger(message.beatsPerMinute.high))) return "beatsPerMinute: integer|Long expected"; + } if (message.metadata != null && message.hasOwnProperty("metadata")) { var error = $root.google.devicesandservices.health.v4.HeartRate.HeartRateMetadata.verify(message.metadata); if (error) @@ -11088,20 +11401,18 @@ var object = {}; if (options.defaults) { object.sampleTime = null; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.beatsPerMinute = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.beatsPerMinute = options.longs === String ? "0" : 0; object.metadata = null; } if (message.sampleTime != null && message.hasOwnProperty("sampleTime")) object.sampleTime = $root.google.devicesandservices.health.v4.ObservationSampleTime.toObject(message.sampleTime, options); - if (message.beatsPerMinute != null && message.hasOwnProperty("beatsPerMinute")) + if (message.beatsPerMinute != null && message.hasOwnProperty("beatsPerMinute")) { if (typeof message.beatsPerMinute === "number") object.beatsPerMinute = options.longs === String ? String(message.beatsPerMinute) : message.beatsPerMinute; else object.beatsPerMinute = options.longs === String ? $util.Long.prototype.toString.call(message.beatsPerMinute) : options.longs === Number ? new $util.LongBits(message.beatsPerMinute.low >>> 0, message.beatsPerMinute.high >>> 0).toNumber() : message.beatsPerMinute; + if (options.oneofs) + object._beatsPerMinute = "beatsPerMinute"; + } if (message.metadata != null && message.hasOwnProperty("metadata")) object.metadata = $root.google.devicesandservices.health.v4.HeartRate.HeartRateMetadata.toObject(message.metadata, options); return object; @@ -11785,27 +12096,48 @@ /** * RunVO2MaxRollupValue rateMin. - * @member {number} rateMin + * @member {number|null|undefined} rateMin * @memberof google.devicesandservices.health.v4.RunVO2MaxRollupValue * @instance */ - RunVO2MaxRollupValue.prototype.rateMin = 0; + RunVO2MaxRollupValue.prototype.rateMin = null; /** * RunVO2MaxRollupValue rateMax. - * @member {number} rateMax + * @member {number|null|undefined} rateMax * @memberof google.devicesandservices.health.v4.RunVO2MaxRollupValue * @instance */ - RunVO2MaxRollupValue.prototype.rateMax = 0; + RunVO2MaxRollupValue.prototype.rateMax = null; /** * RunVO2MaxRollupValue rateAvg. - * @member {number} rateAvg + * @member {number|null|undefined} rateAvg * @memberof google.devicesandservices.health.v4.RunVO2MaxRollupValue * @instance */ - RunVO2MaxRollupValue.prototype.rateAvg = 0; + RunVO2MaxRollupValue.prototype.rateAvg = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(RunVO2MaxRollupValue.prototype, "_rateMin", { + get: $util.oneOfGetter($oneOfFields = ["rateMin"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(RunVO2MaxRollupValue.prototype, "_rateMax", { + get: $util.oneOfGetter($oneOfFields = ["rateMax"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(RunVO2MaxRollupValue.prototype, "_rateAvg", { + get: $util.oneOfGetter($oneOfFields = ["rateAvg"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new RunVO2MaxRollupValue instance using the specified properties. @@ -11920,15 +12252,22 @@ RunVO2MaxRollupValue.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.rateMin != null && message.hasOwnProperty("rateMin")) + var properties = {}; + if (message.rateMin != null && message.hasOwnProperty("rateMin")) { + properties._rateMin = 1; if (typeof message.rateMin !== "number") return "rateMin: number expected"; - if (message.rateMax != null && message.hasOwnProperty("rateMax")) + } + if (message.rateMax != null && message.hasOwnProperty("rateMax")) { + properties._rateMax = 1; if (typeof message.rateMax !== "number") return "rateMax: number expected"; - if (message.rateAvg != null && message.hasOwnProperty("rateAvg")) + } + if (message.rateAvg != null && message.hasOwnProperty("rateAvg")) { + properties._rateAvg = 1; if (typeof message.rateAvg !== "number") return "rateAvg: number expected"; + } return null; }; @@ -11966,17 +12305,21 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { - object.rateMin = 0; - object.rateMax = 0; - object.rateAvg = 0; - } - if (message.rateMin != null && message.hasOwnProperty("rateMin")) + if (message.rateMin != null && message.hasOwnProperty("rateMin")) { object.rateMin = options.json && !isFinite(message.rateMin) ? String(message.rateMin) : message.rateMin; - if (message.rateMax != null && message.hasOwnProperty("rateMax")) + if (options.oneofs) + object._rateMin = "rateMin"; + } + if (message.rateMax != null && message.hasOwnProperty("rateMax")) { object.rateMax = options.json && !isFinite(message.rateMax) ? String(message.rateMax) : message.rateMax; - if (message.rateAvg != null && message.hasOwnProperty("rateAvg")) + if (options.oneofs) + object._rateMax = "rateMax"; + } + if (message.rateAvg != null && message.hasOwnProperty("rateAvg")) { object.rateAvg = options.json && !isFinite(message.rateAvg) ? String(message.rateAvg) : message.rateAvg; + if (options.oneofs) + object._rateAvg = "rateAvg"; + } return object; }; @@ -12044,11 +12387,20 @@ /** * RunVO2Max runVo2Max. - * @member {number} runVo2Max + * @member {number|null|undefined} runVo2Max * @memberof google.devicesandservices.health.v4.RunVO2Max * @instance */ - RunVO2Max.prototype.runVo2Max = 0; + RunVO2Max.prototype.runVo2Max = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(RunVO2Max.prototype, "_runVo2Max", { + get: $util.oneOfGetter($oneOfFields = ["runVo2Max"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new RunVO2Max instance using the specified properties. @@ -12157,14 +12509,17 @@ RunVO2Max.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.sampleTime != null && message.hasOwnProperty("sampleTime")) { var error = $root.google.devicesandservices.health.v4.ObservationSampleTime.verify(message.sampleTime); if (error) return "sampleTime." + error; } - if (message.runVo2Max != null && message.hasOwnProperty("runVo2Max")) + if (message.runVo2Max != null && message.hasOwnProperty("runVo2Max")) { + properties._runVo2Max = 1; if (typeof message.runVo2Max !== "number") return "runVo2Max: number expected"; + } return null; }; @@ -12203,14 +12558,15 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.sampleTime = null; - object.runVo2Max = 0; - } if (message.sampleTime != null && message.hasOwnProperty("sampleTime")) object.sampleTime = $root.google.devicesandservices.health.v4.ObservationSampleTime.toObject(message.sampleTime, options); - if (message.runVo2Max != null && message.hasOwnProperty("runVo2Max")) + if (message.runVo2Max != null && message.hasOwnProperty("runVo2Max")) { object.runVo2Max = options.json && !isFinite(message.runVo2Max) ? String(message.runVo2Max) : message.runVo2Max; + if (options.oneofs) + object._runVo2Max = "runVo2Max"; + } return object; }; @@ -12529,11 +12885,20 @@ /** * Height heightMillimeters. - * @member {number|Long} heightMillimeters + * @member {number|Long|null|undefined} heightMillimeters * @memberof google.devicesandservices.health.v4.Height * @instance */ - Height.prototype.heightMillimeters = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + Height.prototype.heightMillimeters = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Height.prototype, "_heightMillimeters", { + get: $util.oneOfGetter($oneOfFields = ["heightMillimeters"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new Height instance using the specified properties. @@ -12642,14 +13007,17 @@ Height.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.sampleTime != null && message.hasOwnProperty("sampleTime")) { var error = $root.google.devicesandservices.health.v4.ObservationSampleTime.verify(message.sampleTime); if (error) return "sampleTime." + error; } - if (message.heightMillimeters != null && message.hasOwnProperty("heightMillimeters")) + if (message.heightMillimeters != null && message.hasOwnProperty("heightMillimeters")) { + properties._heightMillimeters = 1; if (!$util.isInteger(message.heightMillimeters) && !(message.heightMillimeters && $util.isInteger(message.heightMillimeters.low) && $util.isInteger(message.heightMillimeters.high))) return "heightMillimeters: integer|Long expected"; + } return null; }; @@ -12695,21 +13063,18 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.sampleTime = null; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.heightMillimeters = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.heightMillimeters = options.longs === String ? "0" : 0; - } if (message.sampleTime != null && message.hasOwnProperty("sampleTime")) object.sampleTime = $root.google.devicesandservices.health.v4.ObservationSampleTime.toObject(message.sampleTime, options); - if (message.heightMillimeters != null && message.hasOwnProperty("heightMillimeters")) + if (message.heightMillimeters != null && message.hasOwnProperty("heightMillimeters")) { if (typeof message.heightMillimeters === "number") object.heightMillimeters = options.longs === String ? String(message.heightMillimeters) : message.heightMillimeters; else object.heightMillimeters = options.longs === String ? $util.Long.prototype.toString.call(message.heightMillimeters) : options.longs === Number ? new $util.LongBits(message.heightMillimeters.low >>> 0, message.heightMillimeters.high >>> 0).toNumber() : message.heightMillimeters; + if (options.oneofs) + object._heightMillimeters = "heightMillimeters"; + } return object; }; @@ -12778,19 +13143,34 @@ /** * HeartRateVariability rootMeanSquareOfSuccessiveDifferencesMilliseconds. - * @member {number} rootMeanSquareOfSuccessiveDifferencesMilliseconds + * @member {number|null|undefined} rootMeanSquareOfSuccessiveDifferencesMilliseconds * @memberof google.devicesandservices.health.v4.HeartRateVariability * @instance */ - HeartRateVariability.prototype.rootMeanSquareOfSuccessiveDifferencesMilliseconds = 0; + HeartRateVariability.prototype.rootMeanSquareOfSuccessiveDifferencesMilliseconds = null; /** * HeartRateVariability standardDeviationMilliseconds. - * @member {number} standardDeviationMilliseconds + * @member {number|null|undefined} standardDeviationMilliseconds * @memberof google.devicesandservices.health.v4.HeartRateVariability * @instance */ - HeartRateVariability.prototype.standardDeviationMilliseconds = 0; + HeartRateVariability.prototype.standardDeviationMilliseconds = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(HeartRateVariability.prototype, "_rootMeanSquareOfSuccessiveDifferencesMilliseconds", { + get: $util.oneOfGetter($oneOfFields = ["rootMeanSquareOfSuccessiveDifferencesMilliseconds"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(HeartRateVariability.prototype, "_standardDeviationMilliseconds", { + get: $util.oneOfGetter($oneOfFields = ["standardDeviationMilliseconds"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new HeartRateVariability instance using the specified properties. @@ -12905,17 +13285,22 @@ HeartRateVariability.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.sampleTime != null && message.hasOwnProperty("sampleTime")) { var error = $root.google.devicesandservices.health.v4.ObservationSampleTime.verify(message.sampleTime); if (error) return "sampleTime." + error; } - if (message.rootMeanSquareOfSuccessiveDifferencesMilliseconds != null && message.hasOwnProperty("rootMeanSquareOfSuccessiveDifferencesMilliseconds")) + if (message.rootMeanSquareOfSuccessiveDifferencesMilliseconds != null && message.hasOwnProperty("rootMeanSquareOfSuccessiveDifferencesMilliseconds")) { + properties._rootMeanSquareOfSuccessiveDifferencesMilliseconds = 1; if (typeof message.rootMeanSquareOfSuccessiveDifferencesMilliseconds !== "number") return "rootMeanSquareOfSuccessiveDifferencesMilliseconds: number expected"; - if (message.standardDeviationMilliseconds != null && message.hasOwnProperty("standardDeviationMilliseconds")) + } + if (message.standardDeviationMilliseconds != null && message.hasOwnProperty("standardDeviationMilliseconds")) { + properties._standardDeviationMilliseconds = 1; if (typeof message.standardDeviationMilliseconds !== "number") return "standardDeviationMilliseconds: number expected"; + } return null; }; @@ -12956,17 +13341,20 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.sampleTime = null; - object.rootMeanSquareOfSuccessiveDifferencesMilliseconds = 0; - object.standardDeviationMilliseconds = 0; - } if (message.sampleTime != null && message.hasOwnProperty("sampleTime")) object.sampleTime = $root.google.devicesandservices.health.v4.ObservationSampleTime.toObject(message.sampleTime, options); - if (message.rootMeanSquareOfSuccessiveDifferencesMilliseconds != null && message.hasOwnProperty("rootMeanSquareOfSuccessiveDifferencesMilliseconds")) + if (message.rootMeanSquareOfSuccessiveDifferencesMilliseconds != null && message.hasOwnProperty("rootMeanSquareOfSuccessiveDifferencesMilliseconds")) { object.rootMeanSquareOfSuccessiveDifferencesMilliseconds = options.json && !isFinite(message.rootMeanSquareOfSuccessiveDifferencesMilliseconds) ? String(message.rootMeanSquareOfSuccessiveDifferencesMilliseconds) : message.rootMeanSquareOfSuccessiveDifferencesMilliseconds; - if (message.standardDeviationMilliseconds != null && message.hasOwnProperty("standardDeviationMilliseconds")) + if (options.oneofs) + object._rootMeanSquareOfSuccessiveDifferencesMilliseconds = "rootMeanSquareOfSuccessiveDifferencesMilliseconds"; + } + if (message.standardDeviationMilliseconds != null && message.hasOwnProperty("standardDeviationMilliseconds")) { object.standardDeviationMilliseconds = options.json && !isFinite(message.standardDeviationMilliseconds) ? String(message.standardDeviationMilliseconds) : message.standardDeviationMilliseconds; + if (options.oneofs) + object._standardDeviationMilliseconds = "standardDeviationMilliseconds"; + } return object; }; @@ -13026,11 +13414,11 @@ /** * VolumeQuantity milliliters. - * @member {number} milliliters + * @member {number|null|undefined} milliliters * @memberof google.devicesandservices.health.v4.VolumeQuantity * @instance */ - VolumeQuantity.prototype.milliliters = 0; + VolumeQuantity.prototype.milliliters = null; /** * VolumeQuantity userProvidedUnit. @@ -13040,6 +13428,15 @@ */ VolumeQuantity.prototype.userProvidedUnit = 0; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(VolumeQuantity.prototype, "_milliliters", { + get: $util.oneOfGetter($oneOfFields = ["milliliters"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new VolumeQuantity instance using the specified properties. * @function create @@ -13147,9 +13544,12 @@ VolumeQuantity.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.milliliters != null && message.hasOwnProperty("milliliters")) + var properties = {}; + if (message.milliliters != null && message.hasOwnProperty("milliliters")) { + properties._milliliters = 1; if (typeof message.milliliters !== "number") return "milliliters: number expected"; + } if (message.userProvidedUnit != null && message.hasOwnProperty("userProvidedUnit")) switch (message.userProvidedUnit) { default: @@ -13242,12 +13642,13 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { - object.milliliters = 0; + if (options.defaults) object.userProvidedUnit = options.enums === String ? "VOLUME_UNIT_UNSPECIFIED" : 0; - } - if (message.milliliters != null && message.hasOwnProperty("milliliters")) + if (message.milliliters != null && message.hasOwnProperty("milliliters")) { object.milliliters = options.json && !isFinite(message.milliliters) ? String(message.milliliters) : message.milliliters; + if (options.oneofs) + object._milliliters = "milliliters"; + } if (message.userProvidedUnit != null && message.hasOwnProperty("userProvidedUnit")) object.userProvidedUnit = options.enums === String ? $root.google.devicesandservices.health.v4.VolumeUnit[message.userProvidedUnit] === undefined ? message.userProvidedUnit : $root.google.devicesandservices.health.v4.VolumeUnit[message.userProvidedUnit] : message.userProvidedUnit; return object; @@ -13755,11 +14156,11 @@ /** * VolumeQuantityRollup millilitersSum. - * @member {number} millilitersSum + * @member {number|null|undefined} millilitersSum * @memberof google.devicesandservices.health.v4.HydrationLogRollupValue.VolumeQuantityRollup * @instance */ - VolumeQuantityRollup.prototype.millilitersSum = 0; + VolumeQuantityRollup.prototype.millilitersSum = null; /** * VolumeQuantityRollup userProvidedUnitLast. @@ -13769,6 +14170,15 @@ */ VolumeQuantityRollup.prototype.userProvidedUnitLast = 0; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(VolumeQuantityRollup.prototype, "_millilitersSum", { + get: $util.oneOfGetter($oneOfFields = ["millilitersSum"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new VolumeQuantityRollup instance using the specified properties. * @function create @@ -13876,9 +14286,12 @@ VolumeQuantityRollup.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.millilitersSum != null && message.hasOwnProperty("millilitersSum")) + var properties = {}; + if (message.millilitersSum != null && message.hasOwnProperty("millilitersSum")) { + properties._millilitersSum = 1; if (typeof message.millilitersSum !== "number") return "millilitersSum: number expected"; + } if (message.userProvidedUnitLast != null && message.hasOwnProperty("userProvidedUnitLast")) switch (message.userProvidedUnitLast) { default: @@ -13971,12 +14384,13 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { - object.millilitersSum = 0; + if (options.defaults) object.userProvidedUnitLast = options.enums === String ? "VOLUME_UNIT_UNSPECIFIED" : 0; - } - if (message.millilitersSum != null && message.hasOwnProperty("millilitersSum")) + if (message.millilitersSum != null && message.hasOwnProperty("millilitersSum")) { object.millilitersSum = options.json && !isFinite(message.millilitersSum) ? String(message.millilitersSum) : message.millilitersSum; + if (options.oneofs) + object._millilitersSum = "millilitersSum"; + } if (message.userProvidedUnitLast != null && message.hasOwnProperty("userProvidedUnitLast")) object.userProvidedUnitLast = options.enums === String ? $root.google.devicesandservices.health.v4.VolumeUnit[message.userProvidedUnitLast] === undefined ? message.userProvidedUnitLast : $root.google.devicesandservices.health.v4.VolumeUnit[message.userProvidedUnitLast] : message.userProvidedUnitLast; return object; @@ -15313,11 +15727,20 @@ /** * OxygenSaturation percentage. - * @member {number} percentage + * @member {number|null|undefined} percentage * @memberof google.devicesandservices.health.v4.OxygenSaturation * @instance */ - OxygenSaturation.prototype.percentage = 0; + OxygenSaturation.prototype.percentage = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(OxygenSaturation.prototype, "_percentage", { + get: $util.oneOfGetter($oneOfFields = ["percentage"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new OxygenSaturation instance using the specified properties. @@ -15426,14 +15849,17 @@ OxygenSaturation.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.sampleTime != null && message.hasOwnProperty("sampleTime")) { var error = $root.google.devicesandservices.health.v4.ObservationSampleTime.verify(message.sampleTime); if (error) return "sampleTime." + error; } - if (message.percentage != null && message.hasOwnProperty("percentage")) + if (message.percentage != null && message.hasOwnProperty("percentage")) { + properties._percentage = 1; if (typeof message.percentage !== "number") return "percentage: number expected"; + } return null; }; @@ -15472,14 +15898,15 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.sampleTime = null; - object.percentage = 0; - } if (message.sampleTime != null && message.hasOwnProperty("sampleTime")) object.sampleTime = $root.google.devicesandservices.health.v4.ObservationSampleTime.toObject(message.sampleTime, options); - if (message.percentage != null && message.hasOwnProperty("percentage")) + if (message.percentage != null && message.hasOwnProperty("percentage")) { object.percentage = options.json && !isFinite(message.percentage) ? String(message.percentage) : message.percentage; + if (options.oneofs) + object._percentage = "percentage"; + } return object; }; @@ -16111,27 +16538,48 @@ /** * RespiratoryRateSleepSummaryStatistics breathsPerMinute. - * @member {number} breathsPerMinute + * @member {number|null|undefined} breathsPerMinute * @memberof google.devicesandservices.health.v4.RespiratoryRateSleepSummary.RespiratoryRateSleepSummaryStatistics * @instance */ - RespiratoryRateSleepSummaryStatistics.prototype.breathsPerMinute = 0; + RespiratoryRateSleepSummaryStatistics.prototype.breathsPerMinute = null; /** * RespiratoryRateSleepSummaryStatistics standardDeviation. - * @member {number} standardDeviation + * @member {number|null|undefined} standardDeviation * @memberof google.devicesandservices.health.v4.RespiratoryRateSleepSummary.RespiratoryRateSleepSummaryStatistics * @instance */ - RespiratoryRateSleepSummaryStatistics.prototype.standardDeviation = 0; + RespiratoryRateSleepSummaryStatistics.prototype.standardDeviation = null; /** * RespiratoryRateSleepSummaryStatistics signalToNoise. - * @member {number} signalToNoise + * @member {number|null|undefined} signalToNoise * @memberof google.devicesandservices.health.v4.RespiratoryRateSleepSummary.RespiratoryRateSleepSummaryStatistics * @instance */ - RespiratoryRateSleepSummaryStatistics.prototype.signalToNoise = 0; + RespiratoryRateSleepSummaryStatistics.prototype.signalToNoise = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(RespiratoryRateSleepSummaryStatistics.prototype, "_breathsPerMinute", { + get: $util.oneOfGetter($oneOfFields = ["breathsPerMinute"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(RespiratoryRateSleepSummaryStatistics.prototype, "_standardDeviation", { + get: $util.oneOfGetter($oneOfFields = ["standardDeviation"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(RespiratoryRateSleepSummaryStatistics.prototype, "_signalToNoise", { + get: $util.oneOfGetter($oneOfFields = ["signalToNoise"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new RespiratoryRateSleepSummaryStatistics instance using the specified properties. @@ -16246,15 +16694,22 @@ RespiratoryRateSleepSummaryStatistics.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.breathsPerMinute != null && message.hasOwnProperty("breathsPerMinute")) + var properties = {}; + if (message.breathsPerMinute != null && message.hasOwnProperty("breathsPerMinute")) { + properties._breathsPerMinute = 1; if (typeof message.breathsPerMinute !== "number") return "breathsPerMinute: number expected"; - if (message.standardDeviation != null && message.hasOwnProperty("standardDeviation")) + } + if (message.standardDeviation != null && message.hasOwnProperty("standardDeviation")) { + properties._standardDeviation = 1; if (typeof message.standardDeviation !== "number") return "standardDeviation: number expected"; - if (message.signalToNoise != null && message.hasOwnProperty("signalToNoise")) + } + if (message.signalToNoise != null && message.hasOwnProperty("signalToNoise")) { + properties._signalToNoise = 1; if (typeof message.signalToNoise !== "number") return "signalToNoise: number expected"; + } return null; }; @@ -16292,17 +16747,21 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { - object.breathsPerMinute = 0; - object.standardDeviation = 0; - object.signalToNoise = 0; - } - if (message.breathsPerMinute != null && message.hasOwnProperty("breathsPerMinute")) + if (message.breathsPerMinute != null && message.hasOwnProperty("breathsPerMinute")) { object.breathsPerMinute = options.json && !isFinite(message.breathsPerMinute) ? String(message.breathsPerMinute) : message.breathsPerMinute; - if (message.standardDeviation != null && message.hasOwnProperty("standardDeviation")) + if (options.oneofs) + object._breathsPerMinute = "breathsPerMinute"; + } + if (message.standardDeviation != null && message.hasOwnProperty("standardDeviation")) { object.standardDeviation = options.json && !isFinite(message.standardDeviation) ? String(message.standardDeviation) : message.standardDeviation; - if (message.signalToNoise != null && message.hasOwnProperty("signalToNoise")) + if (options.oneofs) + object._standardDeviation = "standardDeviation"; + } + if (message.signalToNoise != null && message.hasOwnProperty("signalToNoise")) { object.signalToNoise = options.json && !isFinite(message.signalToNoise) ? String(message.signalToNoise) : message.signalToNoise; + if (options.oneofs) + object._signalToNoise = "signalToNoise"; + } return object; }; @@ -18373,19 +18832,34 @@ /** * StageSummary minutes. - * @member {number|Long} minutes + * @member {number|Long|null|undefined} minutes * @memberof google.devicesandservices.health.v4.Sleep.SleepSummary.StageSummary * @instance */ - StageSummary.prototype.minutes = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + StageSummary.prototype.minutes = null; /** * StageSummary count. - * @member {number|Long} count + * @member {number|Long|null|undefined} count * @memberof google.devicesandservices.health.v4.Sleep.SleepSummary.StageSummary * @instance */ - StageSummary.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + StageSummary.prototype.count = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(StageSummary.prototype, "_minutes", { + get: $util.oneOfGetter($oneOfFields = ["minutes"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(StageSummary.prototype, "_count", { + get: $util.oneOfGetter($oneOfFields = ["count"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new StageSummary instance using the specified properties. @@ -18500,6 +18974,7 @@ StageSummary.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.type != null && message.hasOwnProperty("type")) switch (message.type) { default: @@ -18513,12 +18988,16 @@ case 6: break; } - if (message.minutes != null && message.hasOwnProperty("minutes")) + if (message.minutes != null && message.hasOwnProperty("minutes")) { + properties._minutes = 1; if (!$util.isInteger(message.minutes) && !(message.minutes && $util.isInteger(message.minutes.low) && $util.isInteger(message.minutes.high))) return "minutes: integer|Long expected"; - if (message.count != null && message.hasOwnProperty("count")) + } + if (message.count != null && message.hasOwnProperty("count")) { + properties._count = 1; if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) return "count: integer|Long expected"; + } return null; }; @@ -18604,31 +19083,26 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.type = options.enums === String ? "SLEEP_STAGE_TYPE_UNSPECIFIED" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.minutes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.minutes = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.count = options.longs === String ? "0" : 0; - } if (message.type != null && message.hasOwnProperty("type")) object.type = options.enums === String ? $root.google.devicesandservices.health.v4.Sleep.SleepStageType[message.type] === undefined ? message.type : $root.google.devicesandservices.health.v4.Sleep.SleepStageType[message.type] : message.type; - if (message.minutes != null && message.hasOwnProperty("minutes")) + if (message.minutes != null && message.hasOwnProperty("minutes")) { if (typeof message.minutes === "number") object.minutes = options.longs === String ? String(message.minutes) : message.minutes; else object.minutes = options.longs === String ? $util.Long.prototype.toString.call(message.minutes) : options.longs === Number ? new $util.LongBits(message.minutes.low >>> 0, message.minutes.high >>> 0).toNumber() : message.minutes; - if (message.count != null && message.hasOwnProperty("count")) + if (options.oneofs) + object._minutes = "minutes"; + } + if (message.count != null && message.hasOwnProperty("count")) { if (typeof message.count === "number") object.count = options.longs === String ? String(message.count) : message.count; else object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; + if (options.oneofs) + object._count = "count"; + } return object; }; @@ -18742,11 +19216,20 @@ /** * Steps count. - * @member {number|Long} count + * @member {number|Long|null|undefined} count * @memberof google.devicesandservices.health.v4.Steps * @instance */ - Steps.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + Steps.prototype.count = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Steps.prototype, "_count", { + get: $util.oneOfGetter($oneOfFields = ["count"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new Steps instance using the specified properties. @@ -18855,14 +19338,17 @@ Steps.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.interval != null && message.hasOwnProperty("interval")) { var error = $root.google.devicesandservices.health.v4.ObservationTimeInterval.verify(message.interval); if (error) return "interval." + error; } - if (message.count != null && message.hasOwnProperty("count")) + if (message.count != null && message.hasOwnProperty("count")) { + properties._count = 1; if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) return "count: integer|Long expected"; + } return null; }; @@ -18908,21 +19394,18 @@ if (!options) options = {}; var object = {}; - if (options.defaults) { + if (options.defaults) object.interval = null; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.count = options.longs === String ? "0" : 0; - } if (message.interval != null && message.hasOwnProperty("interval")) object.interval = $root.google.devicesandservices.health.v4.ObservationTimeInterval.toObject(message.interval, options); - if (message.count != null && message.hasOwnProperty("count")) + if (message.count != null && message.hasOwnProperty("count")) { if (typeof message.count === "number") object.count = options.longs === String ? String(message.count) : message.count; else object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; + if (options.oneofs) + object._count = "count"; + } return object; }; @@ -18981,11 +19464,20 @@ /** * StepsRollupValue countSum. - * @member {number|Long} countSum + * @member {number|Long|null|undefined} countSum * @memberof google.devicesandservices.health.v4.StepsRollupValue * @instance */ - StepsRollupValue.prototype.countSum = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + StepsRollupValue.prototype.countSum = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(StepsRollupValue.prototype, "_countSum", { + get: $util.oneOfGetter($oneOfFields = ["countSum"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new StepsRollupValue instance using the specified properties. @@ -19088,9 +19580,12 @@ StepsRollupValue.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.countSum != null && message.hasOwnProperty("countSum")) + var properties = {}; + if (message.countSum != null && message.hasOwnProperty("countSum")) { + properties._countSum = 1; if (!$util.isInteger(message.countSum) && !(message.countSum && $util.isInteger(message.countSum.low) && $util.isInteger(message.countSum.high))) return "countSum: integer|Long expected"; + } return null; }; @@ -19131,17 +19626,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.countSum = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.countSum = options.longs === String ? "0" : 0; - if (message.countSum != null && message.hasOwnProperty("countSum")) + if (message.countSum != null && message.hasOwnProperty("countSum")) { if (typeof message.countSum === "number") object.countSum = options.longs === String ? String(message.countSum) : message.countSum; else object.countSum = options.longs === String ? $util.Long.prototype.toString.call(message.countSum) : options.longs === Number ? new $util.LongBits(message.countSum.low >>> 0, message.countSum.high >>> 0).toNumber() : message.countSum; + if (options.oneofs) + object._countSum = "countSum"; + } return object; }; @@ -19218,11 +19710,20 @@ /** * SwimLengthsData strokeCount. - * @member {number|Long} strokeCount + * @member {number|Long|null|undefined} strokeCount * @memberof google.devicesandservices.health.v4.SwimLengthsData * @instance */ - SwimLengthsData.prototype.strokeCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + SwimLengthsData.prototype.strokeCount = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SwimLengthsData.prototype, "_strokeCount", { + get: $util.oneOfGetter($oneOfFields = ["strokeCount"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new SwimLengthsData instance using the specified properties. @@ -19337,6 +19838,7 @@ SwimLengthsData.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.interval != null && message.hasOwnProperty("interval")) { var error = $root.google.devicesandservices.health.v4.ObservationTimeInterval.verify(message.interval); if (error) @@ -19353,9 +19855,11 @@ case 4: break; } - if (message.strokeCount != null && message.hasOwnProperty("strokeCount")) + if (message.strokeCount != null && message.hasOwnProperty("strokeCount")) { + properties._strokeCount = 1; if (!$util.isInteger(message.strokeCount) && !(message.strokeCount && $util.isInteger(message.strokeCount.low) && $util.isInteger(message.strokeCount.high))) return "strokeCount: integer|Long expected"; + } return null; }; @@ -19432,21 +19936,19 @@ if (options.defaults) { object.interval = null; object.swimStrokeType = options.enums === String ? "SWIM_STROKE_TYPE_UNSPECIFIED" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.strokeCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.strokeCount = options.longs === String ? "0" : 0; } if (message.interval != null && message.hasOwnProperty("interval")) object.interval = $root.google.devicesandservices.health.v4.ObservationTimeInterval.toObject(message.interval, options); if (message.swimStrokeType != null && message.hasOwnProperty("swimStrokeType")) object.swimStrokeType = options.enums === String ? $root.google.devicesandservices.health.v4.SwimLengthsData.SwimStrokeType[message.swimStrokeType] === undefined ? message.swimStrokeType : $root.google.devicesandservices.health.v4.SwimLengthsData.SwimStrokeType[message.swimStrokeType] : message.swimStrokeType; - if (message.strokeCount != null && message.hasOwnProperty("strokeCount")) + if (message.strokeCount != null && message.hasOwnProperty("strokeCount")) { if (typeof message.strokeCount === "number") object.strokeCount = options.longs === String ? String(message.strokeCount) : message.strokeCount; else object.strokeCount = options.longs === String ? $util.Long.prototype.toString.call(message.strokeCount) : options.longs === Number ? new $util.LongBits(message.strokeCount.low >>> 0, message.strokeCount.high >>> 0).toNumber() : message.strokeCount; + if (options.oneofs) + object._strokeCount = "strokeCount"; + } return object; }; @@ -19525,11 +20027,20 @@ /** * SwimLengthsDataRollupValue strokeCountSum. - * @member {number|Long} strokeCountSum + * @member {number|Long|null|undefined} strokeCountSum * @memberof google.devicesandservices.health.v4.SwimLengthsDataRollupValue * @instance */ - SwimLengthsDataRollupValue.prototype.strokeCountSum = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + SwimLengthsDataRollupValue.prototype.strokeCountSum = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SwimLengthsDataRollupValue.prototype, "_strokeCountSum", { + get: $util.oneOfGetter($oneOfFields = ["strokeCountSum"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new SwimLengthsDataRollupValue instance using the specified properties. @@ -19632,9 +20143,12 @@ SwimLengthsDataRollupValue.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.strokeCountSum != null && message.hasOwnProperty("strokeCountSum")) + var properties = {}; + if (message.strokeCountSum != null && message.hasOwnProperty("strokeCountSum")) { + properties._strokeCountSum = 1; if (!$util.isInteger(message.strokeCountSum) && !(message.strokeCountSum && $util.isInteger(message.strokeCountSum.low) && $util.isInteger(message.strokeCountSum.high))) return "strokeCountSum: integer|Long expected"; + } return null; }; @@ -19675,17 +20189,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.strokeCountSum = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.strokeCountSum = options.longs === String ? "0" : 0; - if (message.strokeCountSum != null && message.hasOwnProperty("strokeCountSum")) + if (message.strokeCountSum != null && message.hasOwnProperty("strokeCountSum")) { if (typeof message.strokeCountSum === "number") object.strokeCountSum = options.longs === String ? String(message.strokeCountSum) : message.strokeCountSum; else object.strokeCountSum = options.longs === String ? $util.Long.prototype.toString.call(message.strokeCountSum) : options.longs === Number ? new $util.LongBits(message.strokeCountSum.low >>> 0, message.strokeCountSum.high >>> 0).toNumber() : message.strokeCountSum; + if (options.oneofs) + object._strokeCountSum = "strokeCountSum"; + } return object; }; @@ -20506,11 +21017,20 @@ /** * TotalCaloriesRollupValue kcalSum. - * @member {number} kcalSum + * @member {number|null|undefined} kcalSum * @memberof google.devicesandservices.health.v4.TotalCaloriesRollupValue * @instance */ - TotalCaloriesRollupValue.prototype.kcalSum = 0; + TotalCaloriesRollupValue.prototype.kcalSum = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(TotalCaloriesRollupValue.prototype, "_kcalSum", { + get: $util.oneOfGetter($oneOfFields = ["kcalSum"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new TotalCaloriesRollupValue instance using the specified properties. @@ -20613,9 +21133,12 @@ TotalCaloriesRollupValue.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.kcalSum != null && message.hasOwnProperty("kcalSum")) + var properties = {}; + if (message.kcalSum != null && message.hasOwnProperty("kcalSum")) { + properties._kcalSum = 1; if (typeof message.kcalSum !== "number") return "kcalSum: number expected"; + } return null; }; @@ -20649,10 +21172,11 @@ if (!options) options = {}; var object = {}; - if (options.defaults) - object.kcalSum = 0; - if (message.kcalSum != null && message.hasOwnProperty("kcalSum")) + if (message.kcalSum != null && message.hasOwnProperty("kcalSum")) { object.kcalSum = options.json && !isFinite(message.kcalSum) ? String(message.kcalSum) : message.kcalSum; + if (options.oneofs) + object._kcalSum = "kcalSum"; + } return object; }; @@ -20721,11 +21245,11 @@ /** * VO2Max vo2Max. - * @member {number} vo2Max + * @member {number|null|undefined} vo2Max * @memberof google.devicesandservices.health.v4.VO2Max * @instance */ - VO2Max.prototype.vo2Max = 0; + VO2Max.prototype.vo2Max = null; /** * VO2Max measurementMethod. @@ -20735,6 +21259,15 @@ */ VO2Max.prototype.measurementMethod = 0; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(VO2Max.prototype, "_vo2Max", { + get: $util.oneOfGetter($oneOfFields = ["vo2Max"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new VO2Max instance using the specified properties. * @function create @@ -20848,14 +21381,17 @@ VO2Max.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.sampleTime != null && message.hasOwnProperty("sampleTime")) { var error = $root.google.devicesandservices.health.v4.ObservationSampleTime.verify(message.sampleTime); if (error) return "sampleTime." + error; } - if (message.vo2Max != null && message.hasOwnProperty("vo2Max")) + if (message.vo2Max != null && message.hasOwnProperty("vo2Max")) { + properties._vo2Max = 1; if (typeof message.vo2Max !== "number") return "vo2Max: number expected"; + } if (message.measurementMethod != null && message.hasOwnProperty("measurementMethod")) switch (message.measurementMethod) { default: @@ -20970,13 +21506,15 @@ var object = {}; if (options.defaults) { object.sampleTime = null; - object.vo2Max = 0; object.measurementMethod = options.enums === String ? "MEASUREMENT_METHOD_UNSPECIFIED" : 0; } if (message.sampleTime != null && message.hasOwnProperty("sampleTime")) object.sampleTime = $root.google.devicesandservices.health.v4.ObservationSampleTime.toObject(message.sampleTime, options); - if (message.vo2Max != null && message.hasOwnProperty("vo2Max")) + if (message.vo2Max != null && message.hasOwnProperty("vo2Max")) { object.vo2Max = options.json && !isFinite(message.vo2Max) ? String(message.vo2Max) : message.vo2Max; + if (options.oneofs) + object._vo2Max = "vo2Max"; + } if (message.measurementMethod != null && message.hasOwnProperty("measurementMethod")) object.measurementMethod = options.enums === String ? $root.google.devicesandservices.health.v4.VO2Max.MeasurementMethod[message.measurementMethod] === undefined ? message.measurementMethod : $root.google.devicesandservices.health.v4.VO2Max.MeasurementMethod[message.measurementMethod] : message.measurementMethod; return object; @@ -21081,11 +21619,11 @@ /** * Weight weightGrams. - * @member {number} weightGrams + * @member {number|null|undefined} weightGrams * @memberof google.devicesandservices.health.v4.Weight * @instance */ - Weight.prototype.weightGrams = 0; + Weight.prototype.weightGrams = null; /** * Weight notes. @@ -21095,6 +21633,15 @@ */ Weight.prototype.notes = ""; + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Weight.prototype, "_weightGrams", { + get: $util.oneOfGetter($oneOfFields = ["weightGrams"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new Weight instance using the specified properties. * @function create @@ -21208,14 +21755,17 @@ Weight.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; + var properties = {}; if (message.sampleTime != null && message.hasOwnProperty("sampleTime")) { var error = $root.google.devicesandservices.health.v4.ObservationSampleTime.verify(message.sampleTime); if (error) return "sampleTime." + error; } - if (message.weightGrams != null && message.hasOwnProperty("weightGrams")) + if (message.weightGrams != null && message.hasOwnProperty("weightGrams")) { + properties._weightGrams = 1; if (typeof message.weightGrams !== "number") return "weightGrams: number expected"; + } if (message.notes != null && message.hasOwnProperty("notes")) if (!$util.isString(message.notes)) return "notes: string expected"; @@ -21261,13 +21811,15 @@ var object = {}; if (options.defaults) { object.sampleTime = null; - object.weightGrams = 0; object.notes = ""; } if (message.sampleTime != null && message.hasOwnProperty("sampleTime")) object.sampleTime = $root.google.devicesandservices.health.v4.ObservationSampleTime.toObject(message.sampleTime, options); - if (message.weightGrams != null && message.hasOwnProperty("weightGrams")) + if (message.weightGrams != null && message.hasOwnProperty("weightGrams")) { object.weightGrams = options.json && !isFinite(message.weightGrams) ? String(message.weightGrams) : message.weightGrams; + if (options.oneofs) + object._weightGrams = "weightGrams"; + } if (message.notes != null && message.hasOwnProperty("notes")) object.notes = message.notes; return object; @@ -21328,11 +21880,20 @@ /** * WeightRollupValue weightGramsAvg. - * @member {number} weightGramsAvg + * @member {number|null|undefined} weightGramsAvg * @memberof google.devicesandservices.health.v4.WeightRollupValue * @instance */ - WeightRollupValue.prototype.weightGramsAvg = 0; + WeightRollupValue.prototype.weightGramsAvg = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(WeightRollupValue.prototype, "_weightGramsAvg", { + get: $util.oneOfGetter($oneOfFields = ["weightGramsAvg"]), + set: $util.oneOfSetter($oneOfFields) + }); /** * Creates a new WeightRollupValue instance using the specified properties. @@ -21435,9 +21996,12 @@ WeightRollupValue.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.weightGramsAvg != null && message.hasOwnProperty("weightGramsAvg")) + var properties = {}; + if (message.weightGramsAvg != null && message.hasOwnProperty("weightGramsAvg")) { + properties._weightGramsAvg = 1; if (typeof message.weightGramsAvg !== "number") return "weightGramsAvg: number expected"; + } return null; }; @@ -21471,10 +22035,11 @@ if (!options) options = {}; var object = {}; - if (options.defaults) - object.weightGramsAvg = 0; - if (message.weightGramsAvg != null && message.hasOwnProperty("weightGramsAvg")) + if (message.weightGramsAvg != null && message.hasOwnProperty("weightGramsAvg")) { object.weightGramsAvg = options.json && !isFinite(message.weightGramsAvg) ? String(message.weightGramsAvg) : message.weightGramsAvg; + if (options.oneofs) + object._weightGramsAvg = "weightGramsAvg"; + } return object; }; @@ -32179,230 +32744,193 @@ return DataSource; })(); - v4.HealthProfileService = (function() { + v4.DataSubscriptionService = (function() { /** - * Constructs a new HealthProfileService service. + * Constructs a new DataSubscriptionService service. * @memberof google.devicesandservices.health.v4 - * @classdesc Represents a HealthProfileService + * @classdesc Represents a DataSubscriptionService * @extends $protobuf.rpc.Service * @constructor * @param {$protobuf.RPCImpl} rpcImpl RPC implementation * @param {boolean} [requestDelimited=false] Whether requests are length-delimited * @param {boolean} [responseDelimited=false] Whether responses are length-delimited */ - function HealthProfileService(rpcImpl, requestDelimited, responseDelimited) { + function DataSubscriptionService(rpcImpl, requestDelimited, responseDelimited) { $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); } - (HealthProfileService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = HealthProfileService; + (DataSubscriptionService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = DataSubscriptionService; /** - * Creates new HealthProfileService service using the specified rpc implementation. + * Creates new DataSubscriptionService service using the specified rpc implementation. * @function create - * @memberof google.devicesandservices.health.v4.HealthProfileService + * @memberof google.devicesandservices.health.v4.DataSubscriptionService * @static * @param {$protobuf.RPCImpl} rpcImpl RPC implementation * @param {boolean} [requestDelimited=false] Whether requests are length-delimited * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {HealthProfileService} RPC service. Useful where requests and/or responses are streamed. + * @returns {DataSubscriptionService} RPC service. Useful where requests and/or responses are streamed. */ - HealthProfileService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + DataSubscriptionService.create = function create(rpcImpl, requestDelimited, responseDelimited) { return new this(rpcImpl, requestDelimited, responseDelimited); }; /** - * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|getProfile}. - * @memberof google.devicesandservices.health.v4.HealthProfileService - * @typedef GetProfileCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.devicesandservices.health.v4.Profile} [response] Profile - */ - - /** - * Calls GetProfile. - * @function getProfile - * @memberof google.devicesandservices.health.v4.HealthProfileService - * @instance - * @param {google.devicesandservices.health.v4.IGetProfileRequest} request GetProfileRequest message or plain object - * @param {google.devicesandservices.health.v4.HealthProfileService.GetProfileCallback} callback Node-style callback called with the error, if any, and Profile - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(HealthProfileService.prototype.getProfile = function getProfile(request, callback) { - return this.rpcCall(getProfile, $root.google.devicesandservices.health.v4.GetProfileRequest, $root.google.devicesandservices.health.v4.Profile, request, callback); - }, "name", { value: "GetProfile" }); - - /** - * Calls GetProfile. - * @function getProfile - * @memberof google.devicesandservices.health.v4.HealthProfileService - * @instance - * @param {google.devicesandservices.health.v4.IGetProfileRequest} request GetProfileRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|updateProfile}. - * @memberof google.devicesandservices.health.v4.HealthProfileService - * @typedef UpdateProfileCallback + * Callback as used by {@link google.devicesandservices.health.v4.DataSubscriptionService|createSubscriber}. + * @memberof google.devicesandservices.health.v4.DataSubscriptionService + * @typedef CreateSubscriberCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.devicesandservices.health.v4.Profile} [response] Profile + * @param {google.longrunning.Operation} [response] Operation */ /** - * Calls UpdateProfile. - * @function updateProfile - * @memberof google.devicesandservices.health.v4.HealthProfileService + * Calls CreateSubscriber. + * @function createSubscriber + * @memberof google.devicesandservices.health.v4.DataSubscriptionService * @instance - * @param {google.devicesandservices.health.v4.IUpdateProfileRequest} request UpdateProfileRequest message or plain object - * @param {google.devicesandservices.health.v4.HealthProfileService.UpdateProfileCallback} callback Node-style callback called with the error, if any, and Profile + * @param {google.devicesandservices.health.v4.ICreateSubscriberRequest} request CreateSubscriberRequest message or plain object + * @param {google.devicesandservices.health.v4.DataSubscriptionService.CreateSubscriberCallback} callback Node-style callback called with the error, if any, and Operation * @returns {undefined} * @variation 1 */ - Object.defineProperty(HealthProfileService.prototype.updateProfile = function updateProfile(request, callback) { - return this.rpcCall(updateProfile, $root.google.devicesandservices.health.v4.UpdateProfileRequest, $root.google.devicesandservices.health.v4.Profile, request, callback); - }, "name", { value: "UpdateProfile" }); + Object.defineProperty(DataSubscriptionService.prototype.createSubscriber = function createSubscriber(request, callback) { + return this.rpcCall(createSubscriber, $root.google.devicesandservices.health.v4.CreateSubscriberRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateSubscriber" }); /** - * Calls UpdateProfile. - * @function updateProfile - * @memberof google.devicesandservices.health.v4.HealthProfileService + * Calls CreateSubscriber. + * @function createSubscriber + * @memberof google.devicesandservices.health.v4.DataSubscriptionService * @instance - * @param {google.devicesandservices.health.v4.IUpdateProfileRequest} request UpdateProfileRequest message or plain object - * @returns {Promise} Promise + * @param {google.devicesandservices.health.v4.ICreateSubscriberRequest} request CreateSubscriberRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|getSettings}. - * @memberof google.devicesandservices.health.v4.HealthProfileService - * @typedef GetSettingsCallback + * Callback as used by {@link google.devicesandservices.health.v4.DataSubscriptionService|listSubscribers}. + * @memberof google.devicesandservices.health.v4.DataSubscriptionService + * @typedef ListSubscribersCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.devicesandservices.health.v4.Settings} [response] Settings + * @param {google.devicesandservices.health.v4.ListSubscribersResponse} [response] ListSubscribersResponse */ /** - * Calls GetSettings. - * @function getSettings - * @memberof google.devicesandservices.health.v4.HealthProfileService + * Calls ListSubscribers. + * @function listSubscribers + * @memberof google.devicesandservices.health.v4.DataSubscriptionService * @instance - * @param {google.devicesandservices.health.v4.IGetSettingsRequest} request GetSettingsRequest message or plain object - * @param {google.devicesandservices.health.v4.HealthProfileService.GetSettingsCallback} callback Node-style callback called with the error, if any, and Settings + * @param {google.devicesandservices.health.v4.IListSubscribersRequest} request ListSubscribersRequest message or plain object + * @param {google.devicesandservices.health.v4.DataSubscriptionService.ListSubscribersCallback} callback Node-style callback called with the error, if any, and ListSubscribersResponse * @returns {undefined} * @variation 1 */ - Object.defineProperty(HealthProfileService.prototype.getSettings = function getSettings(request, callback) { - return this.rpcCall(getSettings, $root.google.devicesandservices.health.v4.GetSettingsRequest, $root.google.devicesandservices.health.v4.Settings, request, callback); - }, "name", { value: "GetSettings" }); + Object.defineProperty(DataSubscriptionService.prototype.listSubscribers = function listSubscribers(request, callback) { + return this.rpcCall(listSubscribers, $root.google.devicesandservices.health.v4.ListSubscribersRequest, $root.google.devicesandservices.health.v4.ListSubscribersResponse, request, callback); + }, "name", { value: "ListSubscribers" }); /** - * Calls GetSettings. - * @function getSettings - * @memberof google.devicesandservices.health.v4.HealthProfileService + * Calls ListSubscribers. + * @function listSubscribers + * @memberof google.devicesandservices.health.v4.DataSubscriptionService * @instance - * @param {google.devicesandservices.health.v4.IGetSettingsRequest} request GetSettingsRequest message or plain object - * @returns {Promise} Promise + * @param {google.devicesandservices.health.v4.IListSubscribersRequest} request ListSubscribersRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|updateSettings}. - * @memberof google.devicesandservices.health.v4.HealthProfileService - * @typedef UpdateSettingsCallback + * Callback as used by {@link google.devicesandservices.health.v4.DataSubscriptionService|updateSubscriber}. + * @memberof google.devicesandservices.health.v4.DataSubscriptionService + * @typedef UpdateSubscriberCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.devicesandservices.health.v4.Settings} [response] Settings + * @param {google.longrunning.Operation} [response] Operation */ /** - * Calls UpdateSettings. - * @function updateSettings - * @memberof google.devicesandservices.health.v4.HealthProfileService + * Calls UpdateSubscriber. + * @function updateSubscriber + * @memberof google.devicesandservices.health.v4.DataSubscriptionService * @instance - * @param {google.devicesandservices.health.v4.IUpdateSettingsRequest} request UpdateSettingsRequest message or plain object - * @param {google.devicesandservices.health.v4.HealthProfileService.UpdateSettingsCallback} callback Node-style callback called with the error, if any, and Settings + * @param {google.devicesandservices.health.v4.IUpdateSubscriberRequest} request UpdateSubscriberRequest message or plain object + * @param {google.devicesandservices.health.v4.DataSubscriptionService.UpdateSubscriberCallback} callback Node-style callback called with the error, if any, and Operation * @returns {undefined} * @variation 1 */ - Object.defineProperty(HealthProfileService.prototype.updateSettings = function updateSettings(request, callback) { - return this.rpcCall(updateSettings, $root.google.devicesandservices.health.v4.UpdateSettingsRequest, $root.google.devicesandservices.health.v4.Settings, request, callback); - }, "name", { value: "UpdateSettings" }); + Object.defineProperty(DataSubscriptionService.prototype.updateSubscriber = function updateSubscriber(request, callback) { + return this.rpcCall(updateSubscriber, $root.google.devicesandservices.health.v4.UpdateSubscriberRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateSubscriber" }); /** - * Calls UpdateSettings. - * @function updateSettings - * @memberof google.devicesandservices.health.v4.HealthProfileService + * Calls UpdateSubscriber. + * @function updateSubscriber + * @memberof google.devicesandservices.health.v4.DataSubscriptionService * @instance - * @param {google.devicesandservices.health.v4.IUpdateSettingsRequest} request UpdateSettingsRequest message or plain object - * @returns {Promise} Promise + * @param {google.devicesandservices.health.v4.IUpdateSubscriberRequest} request UpdateSubscriberRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ /** - * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|getIdentity}. - * @memberof google.devicesandservices.health.v4.HealthProfileService - * @typedef GetIdentityCallback + * Callback as used by {@link google.devicesandservices.health.v4.DataSubscriptionService|deleteSubscriber}. + * @memberof google.devicesandservices.health.v4.DataSubscriptionService + * @typedef DeleteSubscriberCallback * @type {function} * @param {Error|null} error Error, if any - * @param {google.devicesandservices.health.v4.Identity} [response] Identity + * @param {google.longrunning.Operation} [response] Operation */ /** - * Calls GetIdentity. - * @function getIdentity - * @memberof google.devicesandservices.health.v4.HealthProfileService + * Calls DeleteSubscriber. + * @function deleteSubscriber + * @memberof google.devicesandservices.health.v4.DataSubscriptionService * @instance - * @param {google.devicesandservices.health.v4.IGetIdentityRequest} request GetIdentityRequest message or plain object - * @param {google.devicesandservices.health.v4.HealthProfileService.GetIdentityCallback} callback Node-style callback called with the error, if any, and Identity + * @param {google.devicesandservices.health.v4.IDeleteSubscriberRequest} request DeleteSubscriberRequest message or plain object + * @param {google.devicesandservices.health.v4.DataSubscriptionService.DeleteSubscriberCallback} callback Node-style callback called with the error, if any, and Operation * @returns {undefined} * @variation 1 */ - Object.defineProperty(HealthProfileService.prototype.getIdentity = function getIdentity(request, callback) { - return this.rpcCall(getIdentity, $root.google.devicesandservices.health.v4.GetIdentityRequest, $root.google.devicesandservices.health.v4.Identity, request, callback); - }, "name", { value: "GetIdentity" }); + Object.defineProperty(DataSubscriptionService.prototype.deleteSubscriber = function deleteSubscriber(request, callback) { + return this.rpcCall(deleteSubscriber, $root.google.devicesandservices.health.v4.DeleteSubscriberRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteSubscriber" }); /** - * Calls GetIdentity. - * @function getIdentity - * @memberof google.devicesandservices.health.v4.HealthProfileService + * Calls DeleteSubscriber. + * @function deleteSubscriber + * @memberof google.devicesandservices.health.v4.DataSubscriptionService * @instance - * @param {google.devicesandservices.health.v4.IGetIdentityRequest} request GetIdentityRequest message or plain object - * @returns {Promise} Promise + * @param {google.devicesandservices.health.v4.IDeleteSubscriberRequest} request DeleteSubscriberRequest message or plain object + * @returns {Promise} Promise * @variation 2 */ - return HealthProfileService; + return DataSubscriptionService; })(); - v4.Profile = (function() { + v4.CreateSubscriberRequest = (function() { /** - * Properties of a Profile. + * Properties of a CreateSubscriberRequest. * @memberof google.devicesandservices.health.v4 - * @interface IProfile - * @property {string|null} [name] Profile name - * @property {number|null} [age] Profile age - * @property {google.type.IDate|null} [membershipStartDate] Profile membershipStartDate - * @property {number|null} [userConfiguredWalkingStrideLengthMm] Profile userConfiguredWalkingStrideLengthMm - * @property {number|null} [userConfiguredRunningStrideLengthMm] Profile userConfiguredRunningStrideLengthMm - * @property {number|null} [autoWalkingStrideLengthMm] Profile autoWalkingStrideLengthMm - * @property {number|null} [autoRunningStrideLengthMm] Profile autoRunningStrideLengthMm + * @interface ICreateSubscriberRequest + * @property {string|null} [parent] CreateSubscriberRequest parent + * @property {google.devicesandservices.health.v4.ICreateSubscriberPayload|null} [subscriber] CreateSubscriberRequest subscriber + * @property {string|null} [subscriberId] CreateSubscriberRequest subscriberId */ /** - * Constructs a new Profile. + * Constructs a new CreateSubscriberRequest. * @memberof google.devicesandservices.health.v4 - * @classdesc Represents a Profile. - * @implements IProfile + * @classdesc Represents a CreateSubscriberRequest. + * @implements ICreateSubscriberRequest * @constructor - * @param {google.devicesandservices.health.v4.IProfile=} [properties] Properties to set + * @param {google.devicesandservices.health.v4.ICreateSubscriberRequest=} [properties] Properties to set */ - function Profile(properties) { + function CreateSubscriberRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -32410,188 +32938,105 @@ } /** - * Profile name. - * @member {string} name - * @memberof google.devicesandservices.health.v4.Profile - * @instance - */ - Profile.prototype.name = ""; - - /** - * Profile age. - * @member {number} age - * @memberof google.devicesandservices.health.v4.Profile - * @instance - */ - Profile.prototype.age = 0; - - /** - * Profile membershipStartDate. - * @member {google.type.IDate|null|undefined} membershipStartDate - * @memberof google.devicesandservices.health.v4.Profile - * @instance - */ - Profile.prototype.membershipStartDate = null; - - /** - * Profile userConfiguredWalkingStrideLengthMm. - * @member {number|null|undefined} userConfiguredWalkingStrideLengthMm - * @memberof google.devicesandservices.health.v4.Profile - * @instance - */ - Profile.prototype.userConfiguredWalkingStrideLengthMm = null; - - /** - * Profile userConfiguredRunningStrideLengthMm. - * @member {number|null|undefined} userConfiguredRunningStrideLengthMm - * @memberof google.devicesandservices.health.v4.Profile + * CreateSubscriberRequest parent. + * @member {string} parent + * @memberof google.devicesandservices.health.v4.CreateSubscriberRequest * @instance */ - Profile.prototype.userConfiguredRunningStrideLengthMm = null; + CreateSubscriberRequest.prototype.parent = ""; /** - * Profile autoWalkingStrideLengthMm. - * @member {number|null|undefined} autoWalkingStrideLengthMm - * @memberof google.devicesandservices.health.v4.Profile + * CreateSubscriberRequest subscriber. + * @member {google.devicesandservices.health.v4.ICreateSubscriberPayload|null|undefined} subscriber + * @memberof google.devicesandservices.health.v4.CreateSubscriberRequest * @instance */ - Profile.prototype.autoWalkingStrideLengthMm = null; + CreateSubscriberRequest.prototype.subscriber = null; /** - * Profile autoRunningStrideLengthMm. - * @member {number|null|undefined} autoRunningStrideLengthMm - * @memberof google.devicesandservices.health.v4.Profile + * CreateSubscriberRequest subscriberId. + * @member {string} subscriberId + * @memberof google.devicesandservices.health.v4.CreateSubscriberRequest * @instance */ - Profile.prototype.autoRunningStrideLengthMm = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Profile.prototype, "_userConfiguredWalkingStrideLengthMm", { - get: $util.oneOfGetter($oneOfFields = ["userConfiguredWalkingStrideLengthMm"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Profile.prototype, "_userConfiguredRunningStrideLengthMm", { - get: $util.oneOfGetter($oneOfFields = ["userConfiguredRunningStrideLengthMm"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Profile.prototype, "_autoWalkingStrideLengthMm", { - get: $util.oneOfGetter($oneOfFields = ["autoWalkingStrideLengthMm"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Profile.prototype, "_autoRunningStrideLengthMm", { - get: $util.oneOfGetter($oneOfFields = ["autoRunningStrideLengthMm"]), - set: $util.oneOfSetter($oneOfFields) - }); + CreateSubscriberRequest.prototype.subscriberId = ""; /** - * Creates a new Profile instance using the specified properties. + * Creates a new CreateSubscriberRequest instance using the specified properties. * @function create - * @memberof google.devicesandservices.health.v4.Profile + * @memberof google.devicesandservices.health.v4.CreateSubscriberRequest * @static - * @param {google.devicesandservices.health.v4.IProfile=} [properties] Properties to set - * @returns {google.devicesandservices.health.v4.Profile} Profile instance + * @param {google.devicesandservices.health.v4.ICreateSubscriberRequest=} [properties] Properties to set + * @returns {google.devicesandservices.health.v4.CreateSubscriberRequest} CreateSubscriberRequest instance */ - Profile.create = function create(properties) { - return new Profile(properties); + CreateSubscriberRequest.create = function create(properties) { + return new CreateSubscriberRequest(properties); }; /** - * Encodes the specified Profile message. Does not implicitly {@link google.devicesandservices.health.v4.Profile.verify|verify} messages. + * Encodes the specified CreateSubscriberRequest message. Does not implicitly {@link google.devicesandservices.health.v4.CreateSubscriberRequest.verify|verify} messages. * @function encode - * @memberof google.devicesandservices.health.v4.Profile + * @memberof google.devicesandservices.health.v4.CreateSubscriberRequest * @static - * @param {google.devicesandservices.health.v4.IProfile} message Profile message or plain object to encode + * @param {google.devicesandservices.health.v4.ICreateSubscriberRequest} message CreateSubscriberRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Profile.encode = function encode(message, writer) { + CreateSubscriberRequest.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.age != null && Object.hasOwnProperty.call(message, "age")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.age); - if (message.membershipStartDate != null && Object.hasOwnProperty.call(message, "membershipStartDate")) - $root.google.type.Date.encode(message.membershipStartDate, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.userConfiguredWalkingStrideLengthMm != null && Object.hasOwnProperty.call(message, "userConfiguredWalkingStrideLengthMm")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.userConfiguredWalkingStrideLengthMm); - if (message.userConfiguredRunningStrideLengthMm != null && Object.hasOwnProperty.call(message, "userConfiguredRunningStrideLengthMm")) - writer.uint32(/* id 14, wireType 0 =*/112).int32(message.userConfiguredRunningStrideLengthMm); - if (message.autoWalkingStrideLengthMm != null && Object.hasOwnProperty.call(message, "autoWalkingStrideLengthMm")) - writer.uint32(/* id 15, wireType 0 =*/120).int32(message.autoWalkingStrideLengthMm); - if (message.autoRunningStrideLengthMm != null && Object.hasOwnProperty.call(message, "autoRunningStrideLengthMm")) - writer.uint32(/* id 16, wireType 0 =*/128).int32(message.autoRunningStrideLengthMm); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.subscriber != null && Object.hasOwnProperty.call(message, "subscriber")) + $root.google.devicesandservices.health.v4.CreateSubscriberPayload.encode(message.subscriber, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.subscriberId != null && Object.hasOwnProperty.call(message, "subscriberId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.subscriberId); return writer; }; /** - * Encodes the specified Profile message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.Profile.verify|verify} messages. + * Encodes the specified CreateSubscriberRequest message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.CreateSubscriberRequest.verify|verify} messages. * @function encodeDelimited - * @memberof google.devicesandservices.health.v4.Profile + * @memberof google.devicesandservices.health.v4.CreateSubscriberRequest * @static - * @param {google.devicesandservices.health.v4.IProfile} message Profile message or plain object to encode + * @param {google.devicesandservices.health.v4.ICreateSubscriberRequest} message CreateSubscriberRequest message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - Profile.encodeDelimited = function encodeDelimited(message, writer) { + CreateSubscriberRequest.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes a Profile message from the specified reader or buffer. + * Decodes a CreateSubscriberRequest message from the specified reader or buffer. * @function decode - * @memberof google.devicesandservices.health.v4.Profile + * @memberof google.devicesandservices.health.v4.CreateSubscriberRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.devicesandservices.health.v4.Profile} Profile + * @returns {google.devicesandservices.health.v4.CreateSubscriberRequest} CreateSubscriberRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Profile.decode = function decode(reader, length, error) { + CreateSubscriberRequest.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devicesandservices.health.v4.Profile(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devicesandservices.health.v4.CreateSubscriberRequest(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { case 1: { - message.name = reader.string(); - break; - } - case 6: { - message.age = reader.int32(); - break; - } - case 9: { - message.membershipStartDate = $root.google.type.Date.decode(reader, reader.uint32()); - break; - } - case 13: { - message.userConfiguredWalkingStrideLengthMm = reader.int32(); - break; - } - case 14: { - message.userConfiguredRunningStrideLengthMm = reader.int32(); + message.parent = reader.string(); break; } - case 15: { - message.autoWalkingStrideLengthMm = reader.int32(); + case 2: { + message.subscriber = $root.google.devicesandservices.health.v4.CreateSubscriberPayload.decode(reader, reader.uint32()); break; } - case 16: { - message.autoRunningStrideLengthMm = reader.int32(); + case 3: { + message.subscriberId = reader.string(); break; } default: @@ -32603,206 +33048,146 @@ }; /** - * Decodes a Profile message from the specified reader or buffer, length delimited. + * Decodes a CreateSubscriberRequest message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.devicesandservices.health.v4.Profile + * @memberof google.devicesandservices.health.v4.CreateSubscriberRequest * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.devicesandservices.health.v4.Profile} Profile + * @returns {google.devicesandservices.health.v4.CreateSubscriberRequest} CreateSubscriberRequest * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - Profile.decodeDelimited = function decodeDelimited(reader) { + CreateSubscriberRequest.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies a Profile message. + * Verifies a CreateSubscriberRequest message. * @function verify - * @memberof google.devicesandservices.health.v4.Profile + * @memberof google.devicesandservices.health.v4.CreateSubscriberRequest * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - Profile.verify = function verify(message) { + CreateSubscriberRequest.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - var properties = {}; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.age != null && message.hasOwnProperty("age")) - if (!$util.isInteger(message.age)) - return "age: integer expected"; - if (message.membershipStartDate != null && message.hasOwnProperty("membershipStartDate")) { - var error = $root.google.type.Date.verify(message.membershipStartDate); + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.subscriber != null && message.hasOwnProperty("subscriber")) { + var error = $root.google.devicesandservices.health.v4.CreateSubscriberPayload.verify(message.subscriber); if (error) - return "membershipStartDate." + error; - } - if (message.userConfiguredWalkingStrideLengthMm != null && message.hasOwnProperty("userConfiguredWalkingStrideLengthMm")) { - properties._userConfiguredWalkingStrideLengthMm = 1; - if (!$util.isInteger(message.userConfiguredWalkingStrideLengthMm)) - return "userConfiguredWalkingStrideLengthMm: integer expected"; - } - if (message.userConfiguredRunningStrideLengthMm != null && message.hasOwnProperty("userConfiguredRunningStrideLengthMm")) { - properties._userConfiguredRunningStrideLengthMm = 1; - if (!$util.isInteger(message.userConfiguredRunningStrideLengthMm)) - return "userConfiguredRunningStrideLengthMm: integer expected"; - } - if (message.autoWalkingStrideLengthMm != null && message.hasOwnProperty("autoWalkingStrideLengthMm")) { - properties._autoWalkingStrideLengthMm = 1; - if (!$util.isInteger(message.autoWalkingStrideLengthMm)) - return "autoWalkingStrideLengthMm: integer expected"; - } - if (message.autoRunningStrideLengthMm != null && message.hasOwnProperty("autoRunningStrideLengthMm")) { - properties._autoRunningStrideLengthMm = 1; - if (!$util.isInteger(message.autoRunningStrideLengthMm)) - return "autoRunningStrideLengthMm: integer expected"; + return "subscriber." + error; } + if (message.subscriberId != null && message.hasOwnProperty("subscriberId")) + if (!$util.isString(message.subscriberId)) + return "subscriberId: string expected"; return null; }; /** - * Creates a Profile message from a plain object. Also converts values to their respective internal types. + * Creates a CreateSubscriberRequest message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.devicesandservices.health.v4.Profile + * @memberof google.devicesandservices.health.v4.CreateSubscriberRequest * @static * @param {Object.} object Plain object - * @returns {google.devicesandservices.health.v4.Profile} Profile + * @returns {google.devicesandservices.health.v4.CreateSubscriberRequest} CreateSubscriberRequest */ - Profile.fromObject = function fromObject(object) { - if (object instanceof $root.google.devicesandservices.health.v4.Profile) + CreateSubscriberRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.devicesandservices.health.v4.CreateSubscriberRequest) return object; - var message = new $root.google.devicesandservices.health.v4.Profile(); - if (object.name != null) - message.name = String(object.name); - if (object.age != null) - message.age = object.age | 0; - if (object.membershipStartDate != null) { - if (typeof object.membershipStartDate !== "object") - throw TypeError(".google.devicesandservices.health.v4.Profile.membershipStartDate: object expected"); - message.membershipStartDate = $root.google.type.Date.fromObject(object.membershipStartDate); + var message = new $root.google.devicesandservices.health.v4.CreateSubscriberRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.subscriber != null) { + if (typeof object.subscriber !== "object") + throw TypeError(".google.devicesandservices.health.v4.CreateSubscriberRequest.subscriber: object expected"); + message.subscriber = $root.google.devicesandservices.health.v4.CreateSubscriberPayload.fromObject(object.subscriber); } - if (object.userConfiguredWalkingStrideLengthMm != null) - message.userConfiguredWalkingStrideLengthMm = object.userConfiguredWalkingStrideLengthMm | 0; - if (object.userConfiguredRunningStrideLengthMm != null) - message.userConfiguredRunningStrideLengthMm = object.userConfiguredRunningStrideLengthMm | 0; - if (object.autoWalkingStrideLengthMm != null) - message.autoWalkingStrideLengthMm = object.autoWalkingStrideLengthMm | 0; - if (object.autoRunningStrideLengthMm != null) - message.autoRunningStrideLengthMm = object.autoRunningStrideLengthMm | 0; + if (object.subscriberId != null) + message.subscriberId = String(object.subscriberId); return message; }; /** - * Creates a plain object from a Profile message. Also converts values to other types if specified. + * Creates a plain object from a CreateSubscriberRequest message. Also converts values to other types if specified. * @function toObject - * @memberof google.devicesandservices.health.v4.Profile + * @memberof google.devicesandservices.health.v4.CreateSubscriberRequest * @static - * @param {google.devicesandservices.health.v4.Profile} message Profile + * @param {google.devicesandservices.health.v4.CreateSubscriberRequest} message CreateSubscriberRequest * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - Profile.toObject = function toObject(message, options) { + CreateSubscriberRequest.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.name = ""; - object.age = 0; - object.membershipStartDate = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.age != null && message.hasOwnProperty("age")) - object.age = message.age; - if (message.membershipStartDate != null && message.hasOwnProperty("membershipStartDate")) - object.membershipStartDate = $root.google.type.Date.toObject(message.membershipStartDate, options); - if (message.userConfiguredWalkingStrideLengthMm != null && message.hasOwnProperty("userConfiguredWalkingStrideLengthMm")) { - object.userConfiguredWalkingStrideLengthMm = message.userConfiguredWalkingStrideLengthMm; - if (options.oneofs) - object._userConfiguredWalkingStrideLengthMm = "userConfiguredWalkingStrideLengthMm"; - } - if (message.userConfiguredRunningStrideLengthMm != null && message.hasOwnProperty("userConfiguredRunningStrideLengthMm")) { - object.userConfiguredRunningStrideLengthMm = message.userConfiguredRunningStrideLengthMm; - if (options.oneofs) - object._userConfiguredRunningStrideLengthMm = "userConfiguredRunningStrideLengthMm"; - } - if (message.autoWalkingStrideLengthMm != null && message.hasOwnProperty("autoWalkingStrideLengthMm")) { - object.autoWalkingStrideLengthMm = message.autoWalkingStrideLengthMm; - if (options.oneofs) - object._autoWalkingStrideLengthMm = "autoWalkingStrideLengthMm"; - } - if (message.autoRunningStrideLengthMm != null && message.hasOwnProperty("autoRunningStrideLengthMm")) { - object.autoRunningStrideLengthMm = message.autoRunningStrideLengthMm; - if (options.oneofs) - object._autoRunningStrideLengthMm = "autoRunningStrideLengthMm"; + object.parent = ""; + object.subscriber = null; + object.subscriberId = ""; } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.subscriber != null && message.hasOwnProperty("subscriber")) + object.subscriber = $root.google.devicesandservices.health.v4.CreateSubscriberPayload.toObject(message.subscriber, options); + if (message.subscriberId != null && message.hasOwnProperty("subscriberId")) + object.subscriberId = message.subscriberId; return object; }; /** - * Converts this Profile to JSON. + * Converts this CreateSubscriberRequest to JSON. * @function toJSON - * @memberof google.devicesandservices.health.v4.Profile + * @memberof google.devicesandservices.health.v4.CreateSubscriberRequest * @instance * @returns {Object.} JSON object */ - Profile.prototype.toJSON = function toJSON() { + CreateSubscriberRequest.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for Profile + * Gets the default type url for CreateSubscriberRequest * @function getTypeUrl - * @memberof google.devicesandservices.health.v4.Profile + * @memberof google.devicesandservices.health.v4.CreateSubscriberRequest * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - Profile.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + CreateSubscriberRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.devicesandservices.health.v4.Profile"; + return typeUrlPrefix + "/google.devicesandservices.health.v4.CreateSubscriberRequest"; }; - return Profile; + return CreateSubscriberRequest; })(); - v4.Settings = (function() { + v4.ListSubscribersRequest = (function() { /** - * Properties of a Settings. + * Properties of a ListSubscribersRequest. * @memberof google.devicesandservices.health.v4 - * @interface ISettings - * @property {string|null} [name] Settings name - * @property {boolean|null} [autoStrideEnabled] Settings autoStrideEnabled - * @property {google.devicesandservices.health.v4.Settings.DistanceUnit|null} [distanceUnit] Settings distanceUnit - * @property {google.devicesandservices.health.v4.Settings.GlucoseUnit|null} [glucoseUnit] Settings glucoseUnit - * @property {google.devicesandservices.health.v4.Settings.HeightUnit|null} [heightUnit] Settings heightUnit - * @property {string|null} [languageLocale] Settings languageLocale - * @property {google.protobuf.IDuration|null} [utcOffset] Settings utcOffset - * @property {google.devicesandservices.health.v4.Settings.StrideLengthType|null} [strideLengthWalkingType] Settings strideLengthWalkingType - * @property {google.devicesandservices.health.v4.Settings.StrideLengthType|null} [strideLengthRunningType] Settings strideLengthRunningType - * @property {google.devicesandservices.health.v4.Settings.SwimUnit|null} [swimUnit] Settings swimUnit - * @property {google.devicesandservices.health.v4.Settings.TemperatureUnit|null} [temperatureUnit] Settings temperatureUnit - * @property {string|null} [timeZone] Settings timeZone - * @property {google.devicesandservices.health.v4.Settings.WeightUnit|null} [weightUnit] Settings weightUnit - * @property {google.devicesandservices.health.v4.Settings.WaterUnit|null} [waterUnit] Settings waterUnit + * @interface IListSubscribersRequest + * @property {string|null} [parent] ListSubscribersRequest parent + * @property {number|null} [pageSize] ListSubscribersRequest pageSize + * @property {string|null} [pageToken] ListSubscribersRequest pageToken */ /** - * Constructs a new Settings. + * Constructs a new ListSubscribersRequest. * @memberof google.devicesandservices.health.v4 - * @classdesc Represents a Settings. - * @implements ISettings + * @classdesc Represents a ListSubscribersRequest. + * @implements IListSubscribersRequest * @constructor - * @param {google.devicesandservices.health.v4.ISettings=} [properties] Properties to set + * @param {google.devicesandservices.health.v4.IListSubscribersRequest=} [properties] Properties to set */ - function Settings(properties) { + function ListSubscribersRequest(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -32810,8 +33195,3358 @@ } /** - * Settings name. - * @member {string} name + * ListSubscribersRequest parent. + * @member {string} parent + * @memberof google.devicesandservices.health.v4.ListSubscribersRequest + * @instance + */ + ListSubscribersRequest.prototype.parent = ""; + + /** + * ListSubscribersRequest pageSize. + * @member {number} pageSize + * @memberof google.devicesandservices.health.v4.ListSubscribersRequest + * @instance + */ + ListSubscribersRequest.prototype.pageSize = 0; + + /** + * ListSubscribersRequest pageToken. + * @member {string} pageToken + * @memberof google.devicesandservices.health.v4.ListSubscribersRequest + * @instance + */ + ListSubscribersRequest.prototype.pageToken = ""; + + /** + * Creates a new ListSubscribersRequest instance using the specified properties. + * @function create + * @memberof google.devicesandservices.health.v4.ListSubscribersRequest + * @static + * @param {google.devicesandservices.health.v4.IListSubscribersRequest=} [properties] Properties to set + * @returns {google.devicesandservices.health.v4.ListSubscribersRequest} ListSubscribersRequest instance + */ + ListSubscribersRequest.create = function create(properties) { + return new ListSubscribersRequest(properties); + }; + + /** + * Encodes the specified ListSubscribersRequest message. Does not implicitly {@link google.devicesandservices.health.v4.ListSubscribersRequest.verify|verify} messages. + * @function encode + * @memberof google.devicesandservices.health.v4.ListSubscribersRequest + * @static + * @param {google.devicesandservices.health.v4.IListSubscribersRequest} message ListSubscribersRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSubscribersRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListSubscribersRequest message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.ListSubscribersRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devicesandservices.health.v4.ListSubscribersRequest + * @static + * @param {google.devicesandservices.health.v4.IListSubscribersRequest} message ListSubscribersRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSubscribersRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSubscribersRequest message from the specified reader or buffer. + * @function decode + * @memberof google.devicesandservices.health.v4.ListSubscribersRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devicesandservices.health.v4.ListSubscribersRequest} ListSubscribersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSubscribersRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devicesandservices.health.v4.ListSubscribersRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSubscribersRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devicesandservices.health.v4.ListSubscribersRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devicesandservices.health.v4.ListSubscribersRequest} ListSubscribersRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSubscribersRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSubscribersRequest message. + * @function verify + * @memberof google.devicesandservices.health.v4.ListSubscribersRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSubscribersRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListSubscribersRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devicesandservices.health.v4.ListSubscribersRequest + * @static + * @param {Object.} object Plain object + * @returns {google.devicesandservices.health.v4.ListSubscribersRequest} ListSubscribersRequest + */ + ListSubscribersRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.devicesandservices.health.v4.ListSubscribersRequest) + return object; + var message = new $root.google.devicesandservices.health.v4.ListSubscribersRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListSubscribersRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devicesandservices.health.v4.ListSubscribersRequest + * @static + * @param {google.devicesandservices.health.v4.ListSubscribersRequest} message ListSubscribersRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSubscribersRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListSubscribersRequest to JSON. + * @function toJSON + * @memberof google.devicesandservices.health.v4.ListSubscribersRequest + * @instance + * @returns {Object.} JSON object + */ + ListSubscribersRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSubscribersRequest + * @function getTypeUrl + * @memberof google.devicesandservices.health.v4.ListSubscribersRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSubscribersRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devicesandservices.health.v4.ListSubscribersRequest"; + }; + + return ListSubscribersRequest; + })(); + + v4.ListSubscribersResponse = (function() { + + /** + * Properties of a ListSubscribersResponse. + * @memberof google.devicesandservices.health.v4 + * @interface IListSubscribersResponse + * @property {Array.|null} [subscribers] ListSubscribersResponse subscribers + * @property {string|null} [nextPageToken] ListSubscribersResponse nextPageToken + * @property {number|null} [totalSize] ListSubscribersResponse totalSize + */ + + /** + * Constructs a new ListSubscribersResponse. + * @memberof google.devicesandservices.health.v4 + * @classdesc Represents a ListSubscribersResponse. + * @implements IListSubscribersResponse + * @constructor + * @param {google.devicesandservices.health.v4.IListSubscribersResponse=} [properties] Properties to set + */ + function ListSubscribersResponse(properties) { + this.subscribers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListSubscribersResponse subscribers. + * @member {Array.} subscribers + * @memberof google.devicesandservices.health.v4.ListSubscribersResponse + * @instance + */ + ListSubscribersResponse.prototype.subscribers = $util.emptyArray; + + /** + * ListSubscribersResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.devicesandservices.health.v4.ListSubscribersResponse + * @instance + */ + ListSubscribersResponse.prototype.nextPageToken = ""; + + /** + * ListSubscribersResponse totalSize. + * @member {number} totalSize + * @memberof google.devicesandservices.health.v4.ListSubscribersResponse + * @instance + */ + ListSubscribersResponse.prototype.totalSize = 0; + + /** + * Creates a new ListSubscribersResponse instance using the specified properties. + * @function create + * @memberof google.devicesandservices.health.v4.ListSubscribersResponse + * @static + * @param {google.devicesandservices.health.v4.IListSubscribersResponse=} [properties] Properties to set + * @returns {google.devicesandservices.health.v4.ListSubscribersResponse} ListSubscribersResponse instance + */ + ListSubscribersResponse.create = function create(properties) { + return new ListSubscribersResponse(properties); + }; + + /** + * Encodes the specified ListSubscribersResponse message. Does not implicitly {@link google.devicesandservices.health.v4.ListSubscribersResponse.verify|verify} messages. + * @function encode + * @memberof google.devicesandservices.health.v4.ListSubscribersResponse + * @static + * @param {google.devicesandservices.health.v4.IListSubscribersResponse} message ListSubscribersResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSubscribersResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.subscribers != null && message.subscribers.length) + for (var i = 0; i < message.subscribers.length; ++i) + $root.google.devicesandservices.health.v4.Subscriber.encode(message.subscribers[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.totalSize != null && Object.hasOwnProperty.call(message, "totalSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSize); + return writer; + }; + + /** + * Encodes the specified ListSubscribersResponse message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.ListSubscribersResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devicesandservices.health.v4.ListSubscribersResponse + * @static + * @param {google.devicesandservices.health.v4.IListSubscribersResponse} message ListSubscribersResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSubscribersResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSubscribersResponse message from the specified reader or buffer. + * @function decode + * @memberof google.devicesandservices.health.v4.ListSubscribersResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devicesandservices.health.v4.ListSubscribersResponse} ListSubscribersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSubscribersResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devicesandservices.health.v4.ListSubscribersResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.subscribers && message.subscribers.length)) + message.subscribers = []; + message.subscribers.push($root.google.devicesandservices.health.v4.Subscriber.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + message.totalSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSubscribersResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devicesandservices.health.v4.ListSubscribersResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devicesandservices.health.v4.ListSubscribersResponse} ListSubscribersResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSubscribersResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSubscribersResponse message. + * @function verify + * @memberof google.devicesandservices.health.v4.ListSubscribersResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSubscribersResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.subscribers != null && message.hasOwnProperty("subscribers")) { + if (!Array.isArray(message.subscribers)) + return "subscribers: array expected"; + for (var i = 0; i < message.subscribers.length; ++i) { + var error = $root.google.devicesandservices.health.v4.Subscriber.verify(message.subscribers[i]); + if (error) + return "subscribers." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + if (!$util.isInteger(message.totalSize)) + return "totalSize: integer expected"; + return null; + }; + + /** + * Creates a ListSubscribersResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devicesandservices.health.v4.ListSubscribersResponse + * @static + * @param {Object.} object Plain object + * @returns {google.devicesandservices.health.v4.ListSubscribersResponse} ListSubscribersResponse + */ + ListSubscribersResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.devicesandservices.health.v4.ListSubscribersResponse) + return object; + var message = new $root.google.devicesandservices.health.v4.ListSubscribersResponse(); + if (object.subscribers) { + if (!Array.isArray(object.subscribers)) + throw TypeError(".google.devicesandservices.health.v4.ListSubscribersResponse.subscribers: array expected"); + message.subscribers = []; + for (var i = 0; i < object.subscribers.length; ++i) { + if (typeof object.subscribers[i] !== "object") + throw TypeError(".google.devicesandservices.health.v4.ListSubscribersResponse.subscribers: object expected"); + message.subscribers[i] = $root.google.devicesandservices.health.v4.Subscriber.fromObject(object.subscribers[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.totalSize != null) + message.totalSize = object.totalSize | 0; + return message; + }; + + /** + * Creates a plain object from a ListSubscribersResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devicesandservices.health.v4.ListSubscribersResponse + * @static + * @param {google.devicesandservices.health.v4.ListSubscribersResponse} message ListSubscribersResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSubscribersResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.subscribers = []; + if (options.defaults) { + object.nextPageToken = ""; + object.totalSize = 0; + } + if (message.subscribers && message.subscribers.length) { + object.subscribers = []; + for (var j = 0; j < message.subscribers.length; ++j) + object.subscribers[j] = $root.google.devicesandservices.health.v4.Subscriber.toObject(message.subscribers[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.totalSize != null && message.hasOwnProperty("totalSize")) + object.totalSize = message.totalSize; + return object; + }; + + /** + * Converts this ListSubscribersResponse to JSON. + * @function toJSON + * @memberof google.devicesandservices.health.v4.ListSubscribersResponse + * @instance + * @returns {Object.} JSON object + */ + ListSubscribersResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSubscribersResponse + * @function getTypeUrl + * @memberof google.devicesandservices.health.v4.ListSubscribersResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSubscribersResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devicesandservices.health.v4.ListSubscribersResponse"; + }; + + return ListSubscribersResponse; + })(); + + v4.UpdateSubscriberRequest = (function() { + + /** + * Properties of an UpdateSubscriberRequest. + * @memberof google.devicesandservices.health.v4 + * @interface IUpdateSubscriberRequest + * @property {google.devicesandservices.health.v4.ISubscriber|null} [subscriber] UpdateSubscriberRequest subscriber + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateSubscriberRequest updateMask + */ + + /** + * Constructs a new UpdateSubscriberRequest. + * @memberof google.devicesandservices.health.v4 + * @classdesc Represents an UpdateSubscriberRequest. + * @implements IUpdateSubscriberRequest + * @constructor + * @param {google.devicesandservices.health.v4.IUpdateSubscriberRequest=} [properties] Properties to set + */ + function UpdateSubscriberRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateSubscriberRequest subscriber. + * @member {google.devicesandservices.health.v4.ISubscriber|null|undefined} subscriber + * @memberof google.devicesandservices.health.v4.UpdateSubscriberRequest + * @instance + */ + UpdateSubscriberRequest.prototype.subscriber = null; + + /** + * UpdateSubscriberRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.devicesandservices.health.v4.UpdateSubscriberRequest + * @instance + */ + UpdateSubscriberRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateSubscriberRequest instance using the specified properties. + * @function create + * @memberof google.devicesandservices.health.v4.UpdateSubscriberRequest + * @static + * @param {google.devicesandservices.health.v4.IUpdateSubscriberRequest=} [properties] Properties to set + * @returns {google.devicesandservices.health.v4.UpdateSubscriberRequest} UpdateSubscriberRequest instance + */ + UpdateSubscriberRequest.create = function create(properties) { + return new UpdateSubscriberRequest(properties); + }; + + /** + * Encodes the specified UpdateSubscriberRequest message. Does not implicitly {@link google.devicesandservices.health.v4.UpdateSubscriberRequest.verify|verify} messages. + * @function encode + * @memberof google.devicesandservices.health.v4.UpdateSubscriberRequest + * @static + * @param {google.devicesandservices.health.v4.IUpdateSubscriberRequest} message UpdateSubscriberRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSubscriberRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.subscriber != null && Object.hasOwnProperty.call(message, "subscriber")) + $root.google.devicesandservices.health.v4.Subscriber.encode(message.subscriber, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateSubscriberRequest message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.UpdateSubscriberRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devicesandservices.health.v4.UpdateSubscriberRequest + * @static + * @param {google.devicesandservices.health.v4.IUpdateSubscriberRequest} message UpdateSubscriberRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSubscriberRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateSubscriberRequest message from the specified reader or buffer. + * @function decode + * @memberof google.devicesandservices.health.v4.UpdateSubscriberRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devicesandservices.health.v4.UpdateSubscriberRequest} UpdateSubscriberRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSubscriberRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devicesandservices.health.v4.UpdateSubscriberRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.subscriber = $root.google.devicesandservices.health.v4.Subscriber.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateSubscriberRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devicesandservices.health.v4.UpdateSubscriberRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devicesandservices.health.v4.UpdateSubscriberRequest} UpdateSubscriberRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSubscriberRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateSubscriberRequest message. + * @function verify + * @memberof google.devicesandservices.health.v4.UpdateSubscriberRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateSubscriberRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.subscriber != null && message.hasOwnProperty("subscriber")) { + var error = $root.google.devicesandservices.health.v4.Subscriber.verify(message.subscriber); + if (error) + return "subscriber." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateSubscriberRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devicesandservices.health.v4.UpdateSubscriberRequest + * @static + * @param {Object.} object Plain object + * @returns {google.devicesandservices.health.v4.UpdateSubscriberRequest} UpdateSubscriberRequest + */ + UpdateSubscriberRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.devicesandservices.health.v4.UpdateSubscriberRequest) + return object; + var message = new $root.google.devicesandservices.health.v4.UpdateSubscriberRequest(); + if (object.subscriber != null) { + if (typeof object.subscriber !== "object") + throw TypeError(".google.devicesandservices.health.v4.UpdateSubscriberRequest.subscriber: object expected"); + message.subscriber = $root.google.devicesandservices.health.v4.Subscriber.fromObject(object.subscriber); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.devicesandservices.health.v4.UpdateSubscriberRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateSubscriberRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devicesandservices.health.v4.UpdateSubscriberRequest + * @static + * @param {google.devicesandservices.health.v4.UpdateSubscriberRequest} message UpdateSubscriberRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateSubscriberRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.subscriber = null; + object.updateMask = null; + } + if (message.subscriber != null && message.hasOwnProperty("subscriber")) + object.subscriber = $root.google.devicesandservices.health.v4.Subscriber.toObject(message.subscriber, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateSubscriberRequest to JSON. + * @function toJSON + * @memberof google.devicesandservices.health.v4.UpdateSubscriberRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateSubscriberRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateSubscriberRequest + * @function getTypeUrl + * @memberof google.devicesandservices.health.v4.UpdateSubscriberRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateSubscriberRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devicesandservices.health.v4.UpdateSubscriberRequest"; + }; + + return UpdateSubscriberRequest; + })(); + + v4.DeleteSubscriberRequest = (function() { + + /** + * Properties of a DeleteSubscriberRequest. + * @memberof google.devicesandservices.health.v4 + * @interface IDeleteSubscriberRequest + * @property {string|null} [name] DeleteSubscriberRequest name + * @property {boolean|null} [force] DeleteSubscriberRequest force + */ + + /** + * Constructs a new DeleteSubscriberRequest. + * @memberof google.devicesandservices.health.v4 + * @classdesc Represents a DeleteSubscriberRequest. + * @implements IDeleteSubscriberRequest + * @constructor + * @param {google.devicesandservices.health.v4.IDeleteSubscriberRequest=} [properties] Properties to set + */ + function DeleteSubscriberRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteSubscriberRequest name. + * @member {string} name + * @memberof google.devicesandservices.health.v4.DeleteSubscriberRequest + * @instance + */ + DeleteSubscriberRequest.prototype.name = ""; + + /** + * DeleteSubscriberRequest force. + * @member {boolean} force + * @memberof google.devicesandservices.health.v4.DeleteSubscriberRequest + * @instance + */ + DeleteSubscriberRequest.prototype.force = false; + + /** + * Creates a new DeleteSubscriberRequest instance using the specified properties. + * @function create + * @memberof google.devicesandservices.health.v4.DeleteSubscriberRequest + * @static + * @param {google.devicesandservices.health.v4.IDeleteSubscriberRequest=} [properties] Properties to set + * @returns {google.devicesandservices.health.v4.DeleteSubscriberRequest} DeleteSubscriberRequest instance + */ + DeleteSubscriberRequest.create = function create(properties) { + return new DeleteSubscriberRequest(properties); + }; + + /** + * Encodes the specified DeleteSubscriberRequest message. Does not implicitly {@link google.devicesandservices.health.v4.DeleteSubscriberRequest.verify|verify} messages. + * @function encode + * @memberof google.devicesandservices.health.v4.DeleteSubscriberRequest + * @static + * @param {google.devicesandservices.health.v4.IDeleteSubscriberRequest} message DeleteSubscriberRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSubscriberRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.force); + return writer; + }; + + /** + * Encodes the specified DeleteSubscriberRequest message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.DeleteSubscriberRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devicesandservices.health.v4.DeleteSubscriberRequest + * @static + * @param {google.devicesandservices.health.v4.IDeleteSubscriberRequest} message DeleteSubscriberRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSubscriberRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteSubscriberRequest message from the specified reader or buffer. + * @function decode + * @memberof google.devicesandservices.health.v4.DeleteSubscriberRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devicesandservices.health.v4.DeleteSubscriberRequest} DeleteSubscriberRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSubscriberRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devicesandservices.health.v4.DeleteSubscriberRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.force = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteSubscriberRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devicesandservices.health.v4.DeleteSubscriberRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devicesandservices.health.v4.DeleteSubscriberRequest} DeleteSubscriberRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSubscriberRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteSubscriberRequest message. + * @function verify + * @memberof google.devicesandservices.health.v4.DeleteSubscriberRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteSubscriberRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; + return null; + }; + + /** + * Creates a DeleteSubscriberRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devicesandservices.health.v4.DeleteSubscriberRequest + * @static + * @param {Object.} object Plain object + * @returns {google.devicesandservices.health.v4.DeleteSubscriberRequest} DeleteSubscriberRequest + */ + DeleteSubscriberRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.devicesandservices.health.v4.DeleteSubscriberRequest) + return object; + var message = new $root.google.devicesandservices.health.v4.DeleteSubscriberRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.force != null) + message.force = Boolean(object.force); + return message; + }; + + /** + * Creates a plain object from a DeleteSubscriberRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devicesandservices.health.v4.DeleteSubscriberRequest + * @static + * @param {google.devicesandservices.health.v4.DeleteSubscriberRequest} message DeleteSubscriberRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteSubscriberRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.force = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; + return object; + }; + + /** + * Converts this DeleteSubscriberRequest to JSON. + * @function toJSON + * @memberof google.devicesandservices.health.v4.DeleteSubscriberRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteSubscriberRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteSubscriberRequest + * @function getTypeUrl + * @memberof google.devicesandservices.health.v4.DeleteSubscriberRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteSubscriberRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devicesandservices.health.v4.DeleteSubscriberRequest"; + }; + + return DeleteSubscriberRequest; + })(); + + v4.Subscriber = (function() { + + /** + * Properties of a Subscriber. + * @memberof google.devicesandservices.health.v4 + * @interface ISubscriber + * @property {string|null} [name] Subscriber name + * @property {string|null} [endpointUri] Subscriber endpointUri + * @property {google.protobuf.ITimestamp|null} [createTime] Subscriber createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] Subscriber updateTime + * @property {Array.|null} [subscriberConfigs] Subscriber subscriberConfigs + * @property {google.devicesandservices.health.v4.IEndpointAuthorization|null} [endpointAuthorization] Subscriber endpointAuthorization + * @property {google.devicesandservices.health.v4.Subscriber.State|null} [state] Subscriber state + */ + + /** + * Constructs a new Subscriber. + * @memberof google.devicesandservices.health.v4 + * @classdesc Represents a Subscriber. + * @implements ISubscriber + * @constructor + * @param {google.devicesandservices.health.v4.ISubscriber=} [properties] Properties to set + */ + function Subscriber(properties) { + this.subscriberConfigs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Subscriber name. + * @member {string} name + * @memberof google.devicesandservices.health.v4.Subscriber + * @instance + */ + Subscriber.prototype.name = ""; + + /** + * Subscriber endpointUri. + * @member {string} endpointUri + * @memberof google.devicesandservices.health.v4.Subscriber + * @instance + */ + Subscriber.prototype.endpointUri = ""; + + /** + * Subscriber createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.devicesandservices.health.v4.Subscriber + * @instance + */ + Subscriber.prototype.createTime = null; + + /** + * Subscriber updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.devicesandservices.health.v4.Subscriber + * @instance + */ + Subscriber.prototype.updateTime = null; + + /** + * Subscriber subscriberConfigs. + * @member {Array.} subscriberConfigs + * @memberof google.devicesandservices.health.v4.Subscriber + * @instance + */ + Subscriber.prototype.subscriberConfigs = $util.emptyArray; + + /** + * Subscriber endpointAuthorization. + * @member {google.devicesandservices.health.v4.IEndpointAuthorization|null|undefined} endpointAuthorization + * @memberof google.devicesandservices.health.v4.Subscriber + * @instance + */ + Subscriber.prototype.endpointAuthorization = null; + + /** + * Subscriber state. + * @member {google.devicesandservices.health.v4.Subscriber.State} state + * @memberof google.devicesandservices.health.v4.Subscriber + * @instance + */ + Subscriber.prototype.state = 0; + + /** + * Creates a new Subscriber instance using the specified properties. + * @function create + * @memberof google.devicesandservices.health.v4.Subscriber + * @static + * @param {google.devicesandservices.health.v4.ISubscriber=} [properties] Properties to set + * @returns {google.devicesandservices.health.v4.Subscriber} Subscriber instance + */ + Subscriber.create = function create(properties) { + return new Subscriber(properties); + }; + + /** + * Encodes the specified Subscriber message. Does not implicitly {@link google.devicesandservices.health.v4.Subscriber.verify|verify} messages. + * @function encode + * @memberof google.devicesandservices.health.v4.Subscriber + * @static + * @param {google.devicesandservices.health.v4.ISubscriber} message Subscriber message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Subscriber.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.endpointUri != null && Object.hasOwnProperty.call(message, "endpointUri")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.endpointUri); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.subscriberConfigs != null && message.subscriberConfigs.length) + for (var i = 0; i < message.subscriberConfigs.length; ++i) + $root.google.devicesandservices.health.v4.SubscriberConfig.encode(message.subscriberConfigs[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.state); + if (message.endpointAuthorization != null && Object.hasOwnProperty.call(message, "endpointAuthorization")) + $root.google.devicesandservices.health.v4.EndpointAuthorization.encode(message.endpointAuthorization, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Subscriber message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.Subscriber.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devicesandservices.health.v4.Subscriber + * @static + * @param {google.devicesandservices.health.v4.ISubscriber} message Subscriber message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Subscriber.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Subscriber message from the specified reader or buffer. + * @function decode + * @memberof google.devicesandservices.health.v4.Subscriber + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devicesandservices.health.v4.Subscriber} Subscriber + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Subscriber.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devicesandservices.health.v4.Subscriber(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.endpointUri = reader.string(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + if (!(message.subscriberConfigs && message.subscriberConfigs.length)) + message.subscriberConfigs = []; + message.subscriberConfigs.push($root.google.devicesandservices.health.v4.SubscriberConfig.decode(reader, reader.uint32())); + break; + } + case 7: { + message.endpointAuthorization = $root.google.devicesandservices.health.v4.EndpointAuthorization.decode(reader, reader.uint32()); + break; + } + case 6: { + message.state = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Subscriber message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devicesandservices.health.v4.Subscriber + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devicesandservices.health.v4.Subscriber} Subscriber + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Subscriber.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Subscriber message. + * @function verify + * @memberof google.devicesandservices.health.v4.Subscriber + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Subscriber.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.endpointUri != null && message.hasOwnProperty("endpointUri")) + if (!$util.isString(message.endpointUri)) + return "endpointUri: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.subscriberConfigs != null && message.hasOwnProperty("subscriberConfigs")) { + if (!Array.isArray(message.subscriberConfigs)) + return "subscriberConfigs: array expected"; + for (var i = 0; i < message.subscriberConfigs.length; ++i) { + var error = $root.google.devicesandservices.health.v4.SubscriberConfig.verify(message.subscriberConfigs[i]); + if (error) + return "subscriberConfigs." + error; + } + } + if (message.endpointAuthorization != null && message.hasOwnProperty("endpointAuthorization")) { + var error = $root.google.devicesandservices.health.v4.EndpointAuthorization.verify(message.endpointAuthorization); + if (error) + return "endpointAuthorization." + error; + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates a Subscriber message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devicesandservices.health.v4.Subscriber + * @static + * @param {Object.} object Plain object + * @returns {google.devicesandservices.health.v4.Subscriber} Subscriber + */ + Subscriber.fromObject = function fromObject(object) { + if (object instanceof $root.google.devicesandservices.health.v4.Subscriber) + return object; + var message = new $root.google.devicesandservices.health.v4.Subscriber(); + if (object.name != null) + message.name = String(object.name); + if (object.endpointUri != null) + message.endpointUri = String(object.endpointUri); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.devicesandservices.health.v4.Subscriber.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.devicesandservices.health.v4.Subscriber.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.subscriberConfigs) { + if (!Array.isArray(object.subscriberConfigs)) + throw TypeError(".google.devicesandservices.health.v4.Subscriber.subscriberConfigs: array expected"); + message.subscriberConfigs = []; + for (var i = 0; i < object.subscriberConfigs.length; ++i) { + if (typeof object.subscriberConfigs[i] !== "object") + throw TypeError(".google.devicesandservices.health.v4.Subscriber.subscriberConfigs: object expected"); + message.subscriberConfigs[i] = $root.google.devicesandservices.health.v4.SubscriberConfig.fromObject(object.subscriberConfigs[i]); + } + } + if (object.endpointAuthorization != null) { + if (typeof object.endpointAuthorization !== "object") + throw TypeError(".google.devicesandservices.health.v4.Subscriber.endpointAuthorization: object expected"); + message.endpointAuthorization = $root.google.devicesandservices.health.v4.EndpointAuthorization.fromObject(object.endpointAuthorization); + } + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "UNVERIFIED": + case 1: + message.state = 1; + break; + case "ACTIVE": + case 2: + message.state = 2; + break; + case "INACTIVE": + case 3: + message.state = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a Subscriber message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devicesandservices.health.v4.Subscriber + * @static + * @param {google.devicesandservices.health.v4.Subscriber} message Subscriber + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Subscriber.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.subscriberConfigs = []; + if (options.defaults) { + object.name = ""; + object.endpointUri = ""; + object.createTime = null; + object.updateTime = null; + object.state = options.enums === String ? "STATE_UNSPECIFIED" : 0; + object.endpointAuthorization = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.endpointUri != null && message.hasOwnProperty("endpointUri")) + object.endpointUri = message.endpointUri; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.subscriberConfigs && message.subscriberConfigs.length) { + object.subscriberConfigs = []; + for (var j = 0; j < message.subscriberConfigs.length; ++j) + object.subscriberConfigs[j] = $root.google.devicesandservices.health.v4.SubscriberConfig.toObject(message.subscriberConfigs[j], options); + } + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.devicesandservices.health.v4.Subscriber.State[message.state] === undefined ? message.state : $root.google.devicesandservices.health.v4.Subscriber.State[message.state] : message.state; + if (message.endpointAuthorization != null && message.hasOwnProperty("endpointAuthorization")) + object.endpointAuthorization = $root.google.devicesandservices.health.v4.EndpointAuthorization.toObject(message.endpointAuthorization, options); + return object; + }; + + /** + * Converts this Subscriber to JSON. + * @function toJSON + * @memberof google.devicesandservices.health.v4.Subscriber + * @instance + * @returns {Object.} JSON object + */ + Subscriber.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Subscriber + * @function getTypeUrl + * @memberof google.devicesandservices.health.v4.Subscriber + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Subscriber.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devicesandservices.health.v4.Subscriber"; + }; + + /** + * State enum. + * @name google.devicesandservices.health.v4.Subscriber.State + * @enum {number} + * @property {number} STATE_UNSPECIFIED=0 STATE_UNSPECIFIED value + * @property {number} UNVERIFIED=1 UNVERIFIED value + * @property {number} ACTIVE=2 ACTIVE value + * @property {number} INACTIVE=3 INACTIVE value + */ + Subscriber.State = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "UNVERIFIED"] = 1; + values[valuesById[2] = "ACTIVE"] = 2; + values[valuesById[3] = "INACTIVE"] = 3; + return values; + })(); + + return Subscriber; + })(); + + v4.SubscriberConfig = (function() { + + /** + * Properties of a SubscriberConfig. + * @memberof google.devicesandservices.health.v4 + * @interface ISubscriberConfig + * @property {Array.|null} [dataTypes] SubscriberConfig dataTypes + * @property {google.devicesandservices.health.v4.SubscriberConfig.SubscriptionCreatePolicy|null} [subscriptionCreatePolicy] SubscriberConfig subscriptionCreatePolicy + */ + + /** + * Constructs a new SubscriberConfig. + * @memberof google.devicesandservices.health.v4 + * @classdesc Represents a SubscriberConfig. + * @implements ISubscriberConfig + * @constructor + * @param {google.devicesandservices.health.v4.ISubscriberConfig=} [properties] Properties to set + */ + function SubscriberConfig(properties) { + this.dataTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SubscriberConfig dataTypes. + * @member {Array.} dataTypes + * @memberof google.devicesandservices.health.v4.SubscriberConfig + * @instance + */ + SubscriberConfig.prototype.dataTypes = $util.emptyArray; + + /** + * SubscriberConfig subscriptionCreatePolicy. + * @member {google.devicesandservices.health.v4.SubscriberConfig.SubscriptionCreatePolicy} subscriptionCreatePolicy + * @memberof google.devicesandservices.health.v4.SubscriberConfig + * @instance + */ + SubscriberConfig.prototype.subscriptionCreatePolicy = 0; + + /** + * Creates a new SubscriberConfig instance using the specified properties. + * @function create + * @memberof google.devicesandservices.health.v4.SubscriberConfig + * @static + * @param {google.devicesandservices.health.v4.ISubscriberConfig=} [properties] Properties to set + * @returns {google.devicesandservices.health.v4.SubscriberConfig} SubscriberConfig instance + */ + SubscriberConfig.create = function create(properties) { + return new SubscriberConfig(properties); + }; + + /** + * Encodes the specified SubscriberConfig message. Does not implicitly {@link google.devicesandservices.health.v4.SubscriberConfig.verify|verify} messages. + * @function encode + * @memberof google.devicesandservices.health.v4.SubscriberConfig + * @static + * @param {google.devicesandservices.health.v4.ISubscriberConfig} message SubscriberConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SubscriberConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dataTypes != null && message.dataTypes.length) + for (var i = 0; i < message.dataTypes.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.dataTypes[i]); + if (message.subscriptionCreatePolicy != null && Object.hasOwnProperty.call(message, "subscriptionCreatePolicy")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.subscriptionCreatePolicy); + return writer; + }; + + /** + * Encodes the specified SubscriberConfig message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.SubscriberConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devicesandservices.health.v4.SubscriberConfig + * @static + * @param {google.devicesandservices.health.v4.ISubscriberConfig} message SubscriberConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SubscriberConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SubscriberConfig message from the specified reader or buffer. + * @function decode + * @memberof google.devicesandservices.health.v4.SubscriberConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devicesandservices.health.v4.SubscriberConfig} SubscriberConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SubscriberConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devicesandservices.health.v4.SubscriberConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.dataTypes && message.dataTypes.length)) + message.dataTypes = []; + message.dataTypes.push(reader.string()); + break; + } + case 2: { + message.subscriptionCreatePolicy = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SubscriberConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devicesandservices.health.v4.SubscriberConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devicesandservices.health.v4.SubscriberConfig} SubscriberConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SubscriberConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SubscriberConfig message. + * @function verify + * @memberof google.devicesandservices.health.v4.SubscriberConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SubscriberConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dataTypes != null && message.hasOwnProperty("dataTypes")) { + if (!Array.isArray(message.dataTypes)) + return "dataTypes: array expected"; + for (var i = 0; i < message.dataTypes.length; ++i) + if (!$util.isString(message.dataTypes[i])) + return "dataTypes: string[] expected"; + } + if (message.subscriptionCreatePolicy != null && message.hasOwnProperty("subscriptionCreatePolicy")) + switch (message.subscriptionCreatePolicy) { + default: + return "subscriptionCreatePolicy: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a SubscriberConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devicesandservices.health.v4.SubscriberConfig + * @static + * @param {Object.} object Plain object + * @returns {google.devicesandservices.health.v4.SubscriberConfig} SubscriberConfig + */ + SubscriberConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.devicesandservices.health.v4.SubscriberConfig) + return object; + var message = new $root.google.devicesandservices.health.v4.SubscriberConfig(); + if (object.dataTypes) { + if (!Array.isArray(object.dataTypes)) + throw TypeError(".google.devicesandservices.health.v4.SubscriberConfig.dataTypes: array expected"); + message.dataTypes = []; + for (var i = 0; i < object.dataTypes.length; ++i) + message.dataTypes[i] = String(object.dataTypes[i]); + } + switch (object.subscriptionCreatePolicy) { + default: + if (typeof object.subscriptionCreatePolicy === "number") { + message.subscriptionCreatePolicy = object.subscriptionCreatePolicy; + break; + } + break; + case "SUBSCRIPTION_CREATE_POLICY_UNSPECIFIED": + case 0: + message.subscriptionCreatePolicy = 0; + break; + case "AUTOMATIC": + case 1: + message.subscriptionCreatePolicy = 1; + break; + case "MANUAL": + case 2: + message.subscriptionCreatePolicy = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a SubscriberConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devicesandservices.health.v4.SubscriberConfig + * @static + * @param {google.devicesandservices.health.v4.SubscriberConfig} message SubscriberConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SubscriberConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.dataTypes = []; + if (options.defaults) + object.subscriptionCreatePolicy = options.enums === String ? "SUBSCRIPTION_CREATE_POLICY_UNSPECIFIED" : 0; + if (message.dataTypes && message.dataTypes.length) { + object.dataTypes = []; + for (var j = 0; j < message.dataTypes.length; ++j) + object.dataTypes[j] = message.dataTypes[j]; + } + if (message.subscriptionCreatePolicy != null && message.hasOwnProperty("subscriptionCreatePolicy")) + object.subscriptionCreatePolicy = options.enums === String ? $root.google.devicesandservices.health.v4.SubscriberConfig.SubscriptionCreatePolicy[message.subscriptionCreatePolicy] === undefined ? message.subscriptionCreatePolicy : $root.google.devicesandservices.health.v4.SubscriberConfig.SubscriptionCreatePolicy[message.subscriptionCreatePolicy] : message.subscriptionCreatePolicy; + return object; + }; + + /** + * Converts this SubscriberConfig to JSON. + * @function toJSON + * @memberof google.devicesandservices.health.v4.SubscriberConfig + * @instance + * @returns {Object.} JSON object + */ + SubscriberConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SubscriberConfig + * @function getTypeUrl + * @memberof google.devicesandservices.health.v4.SubscriberConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SubscriberConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devicesandservices.health.v4.SubscriberConfig"; + }; + + /** + * SubscriptionCreatePolicy enum. + * @name google.devicesandservices.health.v4.SubscriberConfig.SubscriptionCreatePolicy + * @enum {number} + * @property {number} SUBSCRIPTION_CREATE_POLICY_UNSPECIFIED=0 SUBSCRIPTION_CREATE_POLICY_UNSPECIFIED value + * @property {number} AUTOMATIC=1 AUTOMATIC value + * @property {number} MANUAL=2 MANUAL value + */ + SubscriberConfig.SubscriptionCreatePolicy = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SUBSCRIPTION_CREATE_POLICY_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTOMATIC"] = 1; + values[valuesById[2] = "MANUAL"] = 2; + return values; + })(); + + return SubscriberConfig; + })(); + + v4.EndpointAuthorization = (function() { + + /** + * Properties of an EndpointAuthorization. + * @memberof google.devicesandservices.health.v4 + * @interface IEndpointAuthorization + * @property {string|null} [secret] EndpointAuthorization secret + * @property {boolean|null} [secretSet] EndpointAuthorization secretSet + */ + + /** + * Constructs a new EndpointAuthorization. + * @memberof google.devicesandservices.health.v4 + * @classdesc Represents an EndpointAuthorization. + * @implements IEndpointAuthorization + * @constructor + * @param {google.devicesandservices.health.v4.IEndpointAuthorization=} [properties] Properties to set + */ + function EndpointAuthorization(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EndpointAuthorization secret. + * @member {string} secret + * @memberof google.devicesandservices.health.v4.EndpointAuthorization + * @instance + */ + EndpointAuthorization.prototype.secret = ""; + + /** + * EndpointAuthorization secretSet. + * @member {boolean} secretSet + * @memberof google.devicesandservices.health.v4.EndpointAuthorization + * @instance + */ + EndpointAuthorization.prototype.secretSet = false; + + /** + * Creates a new EndpointAuthorization instance using the specified properties. + * @function create + * @memberof google.devicesandservices.health.v4.EndpointAuthorization + * @static + * @param {google.devicesandservices.health.v4.IEndpointAuthorization=} [properties] Properties to set + * @returns {google.devicesandservices.health.v4.EndpointAuthorization} EndpointAuthorization instance + */ + EndpointAuthorization.create = function create(properties) { + return new EndpointAuthorization(properties); + }; + + /** + * Encodes the specified EndpointAuthorization message. Does not implicitly {@link google.devicesandservices.health.v4.EndpointAuthorization.verify|verify} messages. + * @function encode + * @memberof google.devicesandservices.health.v4.EndpointAuthorization + * @static + * @param {google.devicesandservices.health.v4.IEndpointAuthorization} message EndpointAuthorization message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EndpointAuthorization.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.secret != null && Object.hasOwnProperty.call(message, "secret")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.secret); + if (message.secretSet != null && Object.hasOwnProperty.call(message, "secretSet")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.secretSet); + return writer; + }; + + /** + * Encodes the specified EndpointAuthorization message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.EndpointAuthorization.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devicesandservices.health.v4.EndpointAuthorization + * @static + * @param {google.devicesandservices.health.v4.IEndpointAuthorization} message EndpointAuthorization message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EndpointAuthorization.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EndpointAuthorization message from the specified reader or buffer. + * @function decode + * @memberof google.devicesandservices.health.v4.EndpointAuthorization + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devicesandservices.health.v4.EndpointAuthorization} EndpointAuthorization + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EndpointAuthorization.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devicesandservices.health.v4.EndpointAuthorization(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.secret = reader.string(); + break; + } + case 2: { + message.secretSet = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EndpointAuthorization message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devicesandservices.health.v4.EndpointAuthorization + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devicesandservices.health.v4.EndpointAuthorization} EndpointAuthorization + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EndpointAuthorization.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EndpointAuthorization message. + * @function verify + * @memberof google.devicesandservices.health.v4.EndpointAuthorization + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EndpointAuthorization.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.secret != null && message.hasOwnProperty("secret")) + if (!$util.isString(message.secret)) + return "secret: string expected"; + if (message.secretSet != null && message.hasOwnProperty("secretSet")) + if (typeof message.secretSet !== "boolean") + return "secretSet: boolean expected"; + return null; + }; + + /** + * Creates an EndpointAuthorization message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devicesandservices.health.v4.EndpointAuthorization + * @static + * @param {Object.} object Plain object + * @returns {google.devicesandservices.health.v4.EndpointAuthorization} EndpointAuthorization + */ + EndpointAuthorization.fromObject = function fromObject(object) { + if (object instanceof $root.google.devicesandservices.health.v4.EndpointAuthorization) + return object; + var message = new $root.google.devicesandservices.health.v4.EndpointAuthorization(); + if (object.secret != null) + message.secret = String(object.secret); + if (object.secretSet != null) + message.secretSet = Boolean(object.secretSet); + return message; + }; + + /** + * Creates a plain object from an EndpointAuthorization message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devicesandservices.health.v4.EndpointAuthorization + * @static + * @param {google.devicesandservices.health.v4.EndpointAuthorization} message EndpointAuthorization + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EndpointAuthorization.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.secret = ""; + object.secretSet = false; + } + if (message.secret != null && message.hasOwnProperty("secret")) + object.secret = message.secret; + if (message.secretSet != null && message.hasOwnProperty("secretSet")) + object.secretSet = message.secretSet; + return object; + }; + + /** + * Converts this EndpointAuthorization to JSON. + * @function toJSON + * @memberof google.devicesandservices.health.v4.EndpointAuthorization + * @instance + * @returns {Object.} JSON object + */ + EndpointAuthorization.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EndpointAuthorization + * @function getTypeUrl + * @memberof google.devicesandservices.health.v4.EndpointAuthorization + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EndpointAuthorization.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devicesandservices.health.v4.EndpointAuthorization"; + }; + + return EndpointAuthorization; + })(); + + v4.CreateSubscriberPayload = (function() { + + /** + * Properties of a CreateSubscriberPayload. + * @memberof google.devicesandservices.health.v4 + * @interface ICreateSubscriberPayload + * @property {string|null} [endpointUri] CreateSubscriberPayload endpointUri + * @property {Array.|null} [subscriberConfigs] CreateSubscriberPayload subscriberConfigs + * @property {google.devicesandservices.health.v4.IEndpointAuthorization|null} [endpointAuthorization] CreateSubscriberPayload endpointAuthorization + */ + + /** + * Constructs a new CreateSubscriberPayload. + * @memberof google.devicesandservices.health.v4 + * @classdesc Represents a CreateSubscriberPayload. + * @implements ICreateSubscriberPayload + * @constructor + * @param {google.devicesandservices.health.v4.ICreateSubscriberPayload=} [properties] Properties to set + */ + function CreateSubscriberPayload(properties) { + this.subscriberConfigs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateSubscriberPayload endpointUri. + * @member {string} endpointUri + * @memberof google.devicesandservices.health.v4.CreateSubscriberPayload + * @instance + */ + CreateSubscriberPayload.prototype.endpointUri = ""; + + /** + * CreateSubscriberPayload subscriberConfigs. + * @member {Array.} subscriberConfigs + * @memberof google.devicesandservices.health.v4.CreateSubscriberPayload + * @instance + */ + CreateSubscriberPayload.prototype.subscriberConfigs = $util.emptyArray; + + /** + * CreateSubscriberPayload endpointAuthorization. + * @member {google.devicesandservices.health.v4.IEndpointAuthorization|null|undefined} endpointAuthorization + * @memberof google.devicesandservices.health.v4.CreateSubscriberPayload + * @instance + */ + CreateSubscriberPayload.prototype.endpointAuthorization = null; + + /** + * Creates a new CreateSubscriberPayload instance using the specified properties. + * @function create + * @memberof google.devicesandservices.health.v4.CreateSubscriberPayload + * @static + * @param {google.devicesandservices.health.v4.ICreateSubscriberPayload=} [properties] Properties to set + * @returns {google.devicesandservices.health.v4.CreateSubscriberPayload} CreateSubscriberPayload instance + */ + CreateSubscriberPayload.create = function create(properties) { + return new CreateSubscriberPayload(properties); + }; + + /** + * Encodes the specified CreateSubscriberPayload message. Does not implicitly {@link google.devicesandservices.health.v4.CreateSubscriberPayload.verify|verify} messages. + * @function encode + * @memberof google.devicesandservices.health.v4.CreateSubscriberPayload + * @static + * @param {google.devicesandservices.health.v4.ICreateSubscriberPayload} message CreateSubscriberPayload message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSubscriberPayload.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.endpointUri != null && Object.hasOwnProperty.call(message, "endpointUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.endpointUri); + if (message.subscriberConfigs != null && message.subscriberConfigs.length) + for (var i = 0; i < message.subscriberConfigs.length; ++i) + $root.google.devicesandservices.health.v4.SubscriberConfig.encode(message.subscriberConfigs[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.endpointAuthorization != null && Object.hasOwnProperty.call(message, "endpointAuthorization")) + $root.google.devicesandservices.health.v4.EndpointAuthorization.encode(message.endpointAuthorization, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateSubscriberPayload message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.CreateSubscriberPayload.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devicesandservices.health.v4.CreateSubscriberPayload + * @static + * @param {google.devicesandservices.health.v4.ICreateSubscriberPayload} message CreateSubscriberPayload message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSubscriberPayload.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateSubscriberPayload message from the specified reader or buffer. + * @function decode + * @memberof google.devicesandservices.health.v4.CreateSubscriberPayload + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devicesandservices.health.v4.CreateSubscriberPayload} CreateSubscriberPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSubscriberPayload.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devicesandservices.health.v4.CreateSubscriberPayload(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.endpointUri = reader.string(); + break; + } + case 2: { + if (!(message.subscriberConfigs && message.subscriberConfigs.length)) + message.subscriberConfigs = []; + message.subscriberConfigs.push($root.google.devicesandservices.health.v4.SubscriberConfig.decode(reader, reader.uint32())); + break; + } + case 3: { + message.endpointAuthorization = $root.google.devicesandservices.health.v4.EndpointAuthorization.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateSubscriberPayload message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devicesandservices.health.v4.CreateSubscriberPayload + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devicesandservices.health.v4.CreateSubscriberPayload} CreateSubscriberPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSubscriberPayload.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateSubscriberPayload message. + * @function verify + * @memberof google.devicesandservices.health.v4.CreateSubscriberPayload + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateSubscriberPayload.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.endpointUri != null && message.hasOwnProperty("endpointUri")) + if (!$util.isString(message.endpointUri)) + return "endpointUri: string expected"; + if (message.subscriberConfigs != null && message.hasOwnProperty("subscriberConfigs")) { + if (!Array.isArray(message.subscriberConfigs)) + return "subscriberConfigs: array expected"; + for (var i = 0; i < message.subscriberConfigs.length; ++i) { + var error = $root.google.devicesandservices.health.v4.SubscriberConfig.verify(message.subscriberConfigs[i]); + if (error) + return "subscriberConfigs." + error; + } + } + if (message.endpointAuthorization != null && message.hasOwnProperty("endpointAuthorization")) { + var error = $root.google.devicesandservices.health.v4.EndpointAuthorization.verify(message.endpointAuthorization); + if (error) + return "endpointAuthorization." + error; + } + return null; + }; + + /** + * Creates a CreateSubscriberPayload message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devicesandservices.health.v4.CreateSubscriberPayload + * @static + * @param {Object.} object Plain object + * @returns {google.devicesandservices.health.v4.CreateSubscriberPayload} CreateSubscriberPayload + */ + CreateSubscriberPayload.fromObject = function fromObject(object) { + if (object instanceof $root.google.devicesandservices.health.v4.CreateSubscriberPayload) + return object; + var message = new $root.google.devicesandservices.health.v4.CreateSubscriberPayload(); + if (object.endpointUri != null) + message.endpointUri = String(object.endpointUri); + if (object.subscriberConfigs) { + if (!Array.isArray(object.subscriberConfigs)) + throw TypeError(".google.devicesandservices.health.v4.CreateSubscriberPayload.subscriberConfigs: array expected"); + message.subscriberConfigs = []; + for (var i = 0; i < object.subscriberConfigs.length; ++i) { + if (typeof object.subscriberConfigs[i] !== "object") + throw TypeError(".google.devicesandservices.health.v4.CreateSubscriberPayload.subscriberConfigs: object expected"); + message.subscriberConfigs[i] = $root.google.devicesandservices.health.v4.SubscriberConfig.fromObject(object.subscriberConfigs[i]); + } + } + if (object.endpointAuthorization != null) { + if (typeof object.endpointAuthorization !== "object") + throw TypeError(".google.devicesandservices.health.v4.CreateSubscriberPayload.endpointAuthorization: object expected"); + message.endpointAuthorization = $root.google.devicesandservices.health.v4.EndpointAuthorization.fromObject(object.endpointAuthorization); + } + return message; + }; + + /** + * Creates a plain object from a CreateSubscriberPayload message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devicesandservices.health.v4.CreateSubscriberPayload + * @static + * @param {google.devicesandservices.health.v4.CreateSubscriberPayload} message CreateSubscriberPayload + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateSubscriberPayload.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.subscriberConfigs = []; + if (options.defaults) { + object.endpointUri = ""; + object.endpointAuthorization = null; + } + if (message.endpointUri != null && message.hasOwnProperty("endpointUri")) + object.endpointUri = message.endpointUri; + if (message.subscriberConfigs && message.subscriberConfigs.length) { + object.subscriberConfigs = []; + for (var j = 0; j < message.subscriberConfigs.length; ++j) + object.subscriberConfigs[j] = $root.google.devicesandservices.health.v4.SubscriberConfig.toObject(message.subscriberConfigs[j], options); + } + if (message.endpointAuthorization != null && message.hasOwnProperty("endpointAuthorization")) + object.endpointAuthorization = $root.google.devicesandservices.health.v4.EndpointAuthorization.toObject(message.endpointAuthorization, options); + return object; + }; + + /** + * Converts this CreateSubscriberPayload to JSON. + * @function toJSON + * @memberof google.devicesandservices.health.v4.CreateSubscriberPayload + * @instance + * @returns {Object.} JSON object + */ + CreateSubscriberPayload.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateSubscriberPayload + * @function getTypeUrl + * @memberof google.devicesandservices.health.v4.CreateSubscriberPayload + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateSubscriberPayload.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devicesandservices.health.v4.CreateSubscriberPayload"; + }; + + return CreateSubscriberPayload; + })(); + + v4.CreateSubscriberMetadata = (function() { + + /** + * Properties of a CreateSubscriberMetadata. + * @memberof google.devicesandservices.health.v4 + * @interface ICreateSubscriberMetadata + */ + + /** + * Constructs a new CreateSubscriberMetadata. + * @memberof google.devicesandservices.health.v4 + * @classdesc Represents a CreateSubscriberMetadata. + * @implements ICreateSubscriberMetadata + * @constructor + * @param {google.devicesandservices.health.v4.ICreateSubscriberMetadata=} [properties] Properties to set + */ + function CreateSubscriberMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new CreateSubscriberMetadata instance using the specified properties. + * @function create + * @memberof google.devicesandservices.health.v4.CreateSubscriberMetadata + * @static + * @param {google.devicesandservices.health.v4.ICreateSubscriberMetadata=} [properties] Properties to set + * @returns {google.devicesandservices.health.v4.CreateSubscriberMetadata} CreateSubscriberMetadata instance + */ + CreateSubscriberMetadata.create = function create(properties) { + return new CreateSubscriberMetadata(properties); + }; + + /** + * Encodes the specified CreateSubscriberMetadata message. Does not implicitly {@link google.devicesandservices.health.v4.CreateSubscriberMetadata.verify|verify} messages. + * @function encode + * @memberof google.devicesandservices.health.v4.CreateSubscriberMetadata + * @static + * @param {google.devicesandservices.health.v4.ICreateSubscriberMetadata} message CreateSubscriberMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSubscriberMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified CreateSubscriberMetadata message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.CreateSubscriberMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devicesandservices.health.v4.CreateSubscriberMetadata + * @static + * @param {google.devicesandservices.health.v4.ICreateSubscriberMetadata} message CreateSubscriberMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSubscriberMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateSubscriberMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.devicesandservices.health.v4.CreateSubscriberMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devicesandservices.health.v4.CreateSubscriberMetadata} CreateSubscriberMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSubscriberMetadata.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devicesandservices.health.v4.CreateSubscriberMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateSubscriberMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devicesandservices.health.v4.CreateSubscriberMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devicesandservices.health.v4.CreateSubscriberMetadata} CreateSubscriberMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSubscriberMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateSubscriberMetadata message. + * @function verify + * @memberof google.devicesandservices.health.v4.CreateSubscriberMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateSubscriberMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a CreateSubscriberMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devicesandservices.health.v4.CreateSubscriberMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.devicesandservices.health.v4.CreateSubscriberMetadata} CreateSubscriberMetadata + */ + CreateSubscriberMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.devicesandservices.health.v4.CreateSubscriberMetadata) + return object; + return new $root.google.devicesandservices.health.v4.CreateSubscriberMetadata(); + }; + + /** + * Creates a plain object from a CreateSubscriberMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devicesandservices.health.v4.CreateSubscriberMetadata + * @static + * @param {google.devicesandservices.health.v4.CreateSubscriberMetadata} message CreateSubscriberMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateSubscriberMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this CreateSubscriberMetadata to JSON. + * @function toJSON + * @memberof google.devicesandservices.health.v4.CreateSubscriberMetadata + * @instance + * @returns {Object.} JSON object + */ + CreateSubscriberMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateSubscriberMetadata + * @function getTypeUrl + * @memberof google.devicesandservices.health.v4.CreateSubscriberMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateSubscriberMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devicesandservices.health.v4.CreateSubscriberMetadata"; + }; + + return CreateSubscriberMetadata; + })(); + + v4.UpdateSubscriberMetadata = (function() { + + /** + * Properties of an UpdateSubscriberMetadata. + * @memberof google.devicesandservices.health.v4 + * @interface IUpdateSubscriberMetadata + */ + + /** + * Constructs a new UpdateSubscriberMetadata. + * @memberof google.devicesandservices.health.v4 + * @classdesc Represents an UpdateSubscriberMetadata. + * @implements IUpdateSubscriberMetadata + * @constructor + * @param {google.devicesandservices.health.v4.IUpdateSubscriberMetadata=} [properties] Properties to set + */ + function UpdateSubscriberMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new UpdateSubscriberMetadata instance using the specified properties. + * @function create + * @memberof google.devicesandservices.health.v4.UpdateSubscriberMetadata + * @static + * @param {google.devicesandservices.health.v4.IUpdateSubscriberMetadata=} [properties] Properties to set + * @returns {google.devicesandservices.health.v4.UpdateSubscriberMetadata} UpdateSubscriberMetadata instance + */ + UpdateSubscriberMetadata.create = function create(properties) { + return new UpdateSubscriberMetadata(properties); + }; + + /** + * Encodes the specified UpdateSubscriberMetadata message. Does not implicitly {@link google.devicesandservices.health.v4.UpdateSubscriberMetadata.verify|verify} messages. + * @function encode + * @memberof google.devicesandservices.health.v4.UpdateSubscriberMetadata + * @static + * @param {google.devicesandservices.health.v4.IUpdateSubscriberMetadata} message UpdateSubscriberMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSubscriberMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified UpdateSubscriberMetadata message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.UpdateSubscriberMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devicesandservices.health.v4.UpdateSubscriberMetadata + * @static + * @param {google.devicesandservices.health.v4.IUpdateSubscriberMetadata} message UpdateSubscriberMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSubscriberMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateSubscriberMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.devicesandservices.health.v4.UpdateSubscriberMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devicesandservices.health.v4.UpdateSubscriberMetadata} UpdateSubscriberMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSubscriberMetadata.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devicesandservices.health.v4.UpdateSubscriberMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateSubscriberMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devicesandservices.health.v4.UpdateSubscriberMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devicesandservices.health.v4.UpdateSubscriberMetadata} UpdateSubscriberMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSubscriberMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateSubscriberMetadata message. + * @function verify + * @memberof google.devicesandservices.health.v4.UpdateSubscriberMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateSubscriberMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an UpdateSubscriberMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devicesandservices.health.v4.UpdateSubscriberMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.devicesandservices.health.v4.UpdateSubscriberMetadata} UpdateSubscriberMetadata + */ + UpdateSubscriberMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.devicesandservices.health.v4.UpdateSubscriberMetadata) + return object; + return new $root.google.devicesandservices.health.v4.UpdateSubscriberMetadata(); + }; + + /** + * Creates a plain object from an UpdateSubscriberMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devicesandservices.health.v4.UpdateSubscriberMetadata + * @static + * @param {google.devicesandservices.health.v4.UpdateSubscriberMetadata} message UpdateSubscriberMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateSubscriberMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this UpdateSubscriberMetadata to JSON. + * @function toJSON + * @memberof google.devicesandservices.health.v4.UpdateSubscriberMetadata + * @instance + * @returns {Object.} JSON object + */ + UpdateSubscriberMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateSubscriberMetadata + * @function getTypeUrl + * @memberof google.devicesandservices.health.v4.UpdateSubscriberMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateSubscriberMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devicesandservices.health.v4.UpdateSubscriberMetadata"; + }; + + return UpdateSubscriberMetadata; + })(); + + v4.DeleteSubscriberMetadata = (function() { + + /** + * Properties of a DeleteSubscriberMetadata. + * @memberof google.devicesandservices.health.v4 + * @interface IDeleteSubscriberMetadata + */ + + /** + * Constructs a new DeleteSubscriberMetadata. + * @memberof google.devicesandservices.health.v4 + * @classdesc Represents a DeleteSubscriberMetadata. + * @implements IDeleteSubscriberMetadata + * @constructor + * @param {google.devicesandservices.health.v4.IDeleteSubscriberMetadata=} [properties] Properties to set + */ + function DeleteSubscriberMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new DeleteSubscriberMetadata instance using the specified properties. + * @function create + * @memberof google.devicesandservices.health.v4.DeleteSubscriberMetadata + * @static + * @param {google.devicesandservices.health.v4.IDeleteSubscriberMetadata=} [properties] Properties to set + * @returns {google.devicesandservices.health.v4.DeleteSubscriberMetadata} DeleteSubscriberMetadata instance + */ + DeleteSubscriberMetadata.create = function create(properties) { + return new DeleteSubscriberMetadata(properties); + }; + + /** + * Encodes the specified DeleteSubscriberMetadata message. Does not implicitly {@link google.devicesandservices.health.v4.DeleteSubscriberMetadata.verify|verify} messages. + * @function encode + * @memberof google.devicesandservices.health.v4.DeleteSubscriberMetadata + * @static + * @param {google.devicesandservices.health.v4.IDeleteSubscriberMetadata} message DeleteSubscriberMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSubscriberMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified DeleteSubscriberMetadata message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.DeleteSubscriberMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devicesandservices.health.v4.DeleteSubscriberMetadata + * @static + * @param {google.devicesandservices.health.v4.IDeleteSubscriberMetadata} message DeleteSubscriberMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSubscriberMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteSubscriberMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.devicesandservices.health.v4.DeleteSubscriberMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devicesandservices.health.v4.DeleteSubscriberMetadata} DeleteSubscriberMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSubscriberMetadata.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devicesandservices.health.v4.DeleteSubscriberMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteSubscriberMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devicesandservices.health.v4.DeleteSubscriberMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devicesandservices.health.v4.DeleteSubscriberMetadata} DeleteSubscriberMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSubscriberMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteSubscriberMetadata message. + * @function verify + * @memberof google.devicesandservices.health.v4.DeleteSubscriberMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteSubscriberMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a DeleteSubscriberMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devicesandservices.health.v4.DeleteSubscriberMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.devicesandservices.health.v4.DeleteSubscriberMetadata} DeleteSubscriberMetadata + */ + DeleteSubscriberMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.devicesandservices.health.v4.DeleteSubscriberMetadata) + return object; + return new $root.google.devicesandservices.health.v4.DeleteSubscriberMetadata(); + }; + + /** + * Creates a plain object from a DeleteSubscriberMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devicesandservices.health.v4.DeleteSubscriberMetadata + * @static + * @param {google.devicesandservices.health.v4.DeleteSubscriberMetadata} message DeleteSubscriberMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteSubscriberMetadata.toObject = function toObject() { + return {}; + }; + + /** + * Converts this DeleteSubscriberMetadata to JSON. + * @function toJSON + * @memberof google.devicesandservices.health.v4.DeleteSubscriberMetadata + * @instance + * @returns {Object.} JSON object + */ + DeleteSubscriberMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteSubscriberMetadata + * @function getTypeUrl + * @memberof google.devicesandservices.health.v4.DeleteSubscriberMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteSubscriberMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devicesandservices.health.v4.DeleteSubscriberMetadata"; + }; + + return DeleteSubscriberMetadata; + })(); + + v4.HealthProfileService = (function() { + + /** + * Constructs a new HealthProfileService service. + * @memberof google.devicesandservices.health.v4 + * @classdesc Represents a HealthProfileService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function HealthProfileService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (HealthProfileService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = HealthProfileService; + + /** + * Creates new HealthProfileService service using the specified rpc implementation. + * @function create + * @memberof google.devicesandservices.health.v4.HealthProfileService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {HealthProfileService} RPC service. Useful where requests and/or responses are streamed. + */ + HealthProfileService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|getProfile}. + * @memberof google.devicesandservices.health.v4.HealthProfileService + * @typedef GetProfileCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.devicesandservices.health.v4.Profile} [response] Profile + */ + + /** + * Calls GetProfile. + * @function getProfile + * @memberof google.devicesandservices.health.v4.HealthProfileService + * @instance + * @param {google.devicesandservices.health.v4.IGetProfileRequest} request GetProfileRequest message or plain object + * @param {google.devicesandservices.health.v4.HealthProfileService.GetProfileCallback} callback Node-style callback called with the error, if any, and Profile + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(HealthProfileService.prototype.getProfile = function getProfile(request, callback) { + return this.rpcCall(getProfile, $root.google.devicesandservices.health.v4.GetProfileRequest, $root.google.devicesandservices.health.v4.Profile, request, callback); + }, "name", { value: "GetProfile" }); + + /** + * Calls GetProfile. + * @function getProfile + * @memberof google.devicesandservices.health.v4.HealthProfileService + * @instance + * @param {google.devicesandservices.health.v4.IGetProfileRequest} request GetProfileRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|updateProfile}. + * @memberof google.devicesandservices.health.v4.HealthProfileService + * @typedef UpdateProfileCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.devicesandservices.health.v4.Profile} [response] Profile + */ + + /** + * Calls UpdateProfile. + * @function updateProfile + * @memberof google.devicesandservices.health.v4.HealthProfileService + * @instance + * @param {google.devicesandservices.health.v4.IUpdateProfileRequest} request UpdateProfileRequest message or plain object + * @param {google.devicesandservices.health.v4.HealthProfileService.UpdateProfileCallback} callback Node-style callback called with the error, if any, and Profile + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(HealthProfileService.prototype.updateProfile = function updateProfile(request, callback) { + return this.rpcCall(updateProfile, $root.google.devicesandservices.health.v4.UpdateProfileRequest, $root.google.devicesandservices.health.v4.Profile, request, callback); + }, "name", { value: "UpdateProfile" }); + + /** + * Calls UpdateProfile. + * @function updateProfile + * @memberof google.devicesandservices.health.v4.HealthProfileService + * @instance + * @param {google.devicesandservices.health.v4.IUpdateProfileRequest} request UpdateProfileRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|getSettings}. + * @memberof google.devicesandservices.health.v4.HealthProfileService + * @typedef GetSettingsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.devicesandservices.health.v4.Settings} [response] Settings + */ + + /** + * Calls GetSettings. + * @function getSettings + * @memberof google.devicesandservices.health.v4.HealthProfileService + * @instance + * @param {google.devicesandservices.health.v4.IGetSettingsRequest} request GetSettingsRequest message or plain object + * @param {google.devicesandservices.health.v4.HealthProfileService.GetSettingsCallback} callback Node-style callback called with the error, if any, and Settings + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(HealthProfileService.prototype.getSettings = function getSettings(request, callback) { + return this.rpcCall(getSettings, $root.google.devicesandservices.health.v4.GetSettingsRequest, $root.google.devicesandservices.health.v4.Settings, request, callback); + }, "name", { value: "GetSettings" }); + + /** + * Calls GetSettings. + * @function getSettings + * @memberof google.devicesandservices.health.v4.HealthProfileService + * @instance + * @param {google.devicesandservices.health.v4.IGetSettingsRequest} request GetSettingsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|updateSettings}. + * @memberof google.devicesandservices.health.v4.HealthProfileService + * @typedef UpdateSettingsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.devicesandservices.health.v4.Settings} [response] Settings + */ + + /** + * Calls UpdateSettings. + * @function updateSettings + * @memberof google.devicesandservices.health.v4.HealthProfileService + * @instance + * @param {google.devicesandservices.health.v4.IUpdateSettingsRequest} request UpdateSettingsRequest message or plain object + * @param {google.devicesandservices.health.v4.HealthProfileService.UpdateSettingsCallback} callback Node-style callback called with the error, if any, and Settings + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(HealthProfileService.prototype.updateSettings = function updateSettings(request, callback) { + return this.rpcCall(updateSettings, $root.google.devicesandservices.health.v4.UpdateSettingsRequest, $root.google.devicesandservices.health.v4.Settings, request, callback); + }, "name", { value: "UpdateSettings" }); + + /** + * Calls UpdateSettings. + * @function updateSettings + * @memberof google.devicesandservices.health.v4.HealthProfileService + * @instance + * @param {google.devicesandservices.health.v4.IUpdateSettingsRequest} request UpdateSettingsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.devicesandservices.health.v4.HealthProfileService|getIdentity}. + * @memberof google.devicesandservices.health.v4.HealthProfileService + * @typedef GetIdentityCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.devicesandservices.health.v4.Identity} [response] Identity + */ + + /** + * Calls GetIdentity. + * @function getIdentity + * @memberof google.devicesandservices.health.v4.HealthProfileService + * @instance + * @param {google.devicesandservices.health.v4.IGetIdentityRequest} request GetIdentityRequest message or plain object + * @param {google.devicesandservices.health.v4.HealthProfileService.GetIdentityCallback} callback Node-style callback called with the error, if any, and Identity + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(HealthProfileService.prototype.getIdentity = function getIdentity(request, callback) { + return this.rpcCall(getIdentity, $root.google.devicesandservices.health.v4.GetIdentityRequest, $root.google.devicesandservices.health.v4.Identity, request, callback); + }, "name", { value: "GetIdentity" }); + + /** + * Calls GetIdentity. + * @function getIdentity + * @memberof google.devicesandservices.health.v4.HealthProfileService + * @instance + * @param {google.devicesandservices.health.v4.IGetIdentityRequest} request GetIdentityRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return HealthProfileService; + })(); + + v4.Profile = (function() { + + /** + * Properties of a Profile. + * @memberof google.devicesandservices.health.v4 + * @interface IProfile + * @property {string|null} [name] Profile name + * @property {number|null} [age] Profile age + * @property {google.type.IDate|null} [membershipStartDate] Profile membershipStartDate + * @property {number|null} [userConfiguredWalkingStrideLengthMm] Profile userConfiguredWalkingStrideLengthMm + * @property {number|null} [userConfiguredRunningStrideLengthMm] Profile userConfiguredRunningStrideLengthMm + * @property {number|null} [autoWalkingStrideLengthMm] Profile autoWalkingStrideLengthMm + * @property {number|null} [autoRunningStrideLengthMm] Profile autoRunningStrideLengthMm + */ + + /** + * Constructs a new Profile. + * @memberof google.devicesandservices.health.v4 + * @classdesc Represents a Profile. + * @implements IProfile + * @constructor + * @param {google.devicesandservices.health.v4.IProfile=} [properties] Properties to set + */ + function Profile(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Profile name. + * @member {string} name + * @memberof google.devicesandservices.health.v4.Profile + * @instance + */ + Profile.prototype.name = ""; + + /** + * Profile age. + * @member {number} age + * @memberof google.devicesandservices.health.v4.Profile + * @instance + */ + Profile.prototype.age = 0; + + /** + * Profile membershipStartDate. + * @member {google.type.IDate|null|undefined} membershipStartDate + * @memberof google.devicesandservices.health.v4.Profile + * @instance + */ + Profile.prototype.membershipStartDate = null; + + /** + * Profile userConfiguredWalkingStrideLengthMm. + * @member {number|null|undefined} userConfiguredWalkingStrideLengthMm + * @memberof google.devicesandservices.health.v4.Profile + * @instance + */ + Profile.prototype.userConfiguredWalkingStrideLengthMm = null; + + /** + * Profile userConfiguredRunningStrideLengthMm. + * @member {number|null|undefined} userConfiguredRunningStrideLengthMm + * @memberof google.devicesandservices.health.v4.Profile + * @instance + */ + Profile.prototype.userConfiguredRunningStrideLengthMm = null; + + /** + * Profile autoWalkingStrideLengthMm. + * @member {number|null|undefined} autoWalkingStrideLengthMm + * @memberof google.devicesandservices.health.v4.Profile + * @instance + */ + Profile.prototype.autoWalkingStrideLengthMm = null; + + /** + * Profile autoRunningStrideLengthMm. + * @member {number|null|undefined} autoRunningStrideLengthMm + * @memberof google.devicesandservices.health.v4.Profile + * @instance + */ + Profile.prototype.autoRunningStrideLengthMm = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Profile.prototype, "_userConfiguredWalkingStrideLengthMm", { + get: $util.oneOfGetter($oneOfFields = ["userConfiguredWalkingStrideLengthMm"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Profile.prototype, "_userConfiguredRunningStrideLengthMm", { + get: $util.oneOfGetter($oneOfFields = ["userConfiguredRunningStrideLengthMm"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Profile.prototype, "_autoWalkingStrideLengthMm", { + get: $util.oneOfGetter($oneOfFields = ["autoWalkingStrideLengthMm"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Profile.prototype, "_autoRunningStrideLengthMm", { + get: $util.oneOfGetter($oneOfFields = ["autoRunningStrideLengthMm"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Profile instance using the specified properties. + * @function create + * @memberof google.devicesandservices.health.v4.Profile + * @static + * @param {google.devicesandservices.health.v4.IProfile=} [properties] Properties to set + * @returns {google.devicesandservices.health.v4.Profile} Profile instance + */ + Profile.create = function create(properties) { + return new Profile(properties); + }; + + /** + * Encodes the specified Profile message. Does not implicitly {@link google.devicesandservices.health.v4.Profile.verify|verify} messages. + * @function encode + * @memberof google.devicesandservices.health.v4.Profile + * @static + * @param {google.devicesandservices.health.v4.IProfile} message Profile message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Profile.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.age != null && Object.hasOwnProperty.call(message, "age")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.age); + if (message.membershipStartDate != null && Object.hasOwnProperty.call(message, "membershipStartDate")) + $root.google.type.Date.encode(message.membershipStartDate, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.userConfiguredWalkingStrideLengthMm != null && Object.hasOwnProperty.call(message, "userConfiguredWalkingStrideLengthMm")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.userConfiguredWalkingStrideLengthMm); + if (message.userConfiguredRunningStrideLengthMm != null && Object.hasOwnProperty.call(message, "userConfiguredRunningStrideLengthMm")) + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.userConfiguredRunningStrideLengthMm); + if (message.autoWalkingStrideLengthMm != null && Object.hasOwnProperty.call(message, "autoWalkingStrideLengthMm")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.autoWalkingStrideLengthMm); + if (message.autoRunningStrideLengthMm != null && Object.hasOwnProperty.call(message, "autoRunningStrideLengthMm")) + writer.uint32(/* id 16, wireType 0 =*/128).int32(message.autoRunningStrideLengthMm); + return writer; + }; + + /** + * Encodes the specified Profile message, length delimited. Does not implicitly {@link google.devicesandservices.health.v4.Profile.verify|verify} messages. + * @function encodeDelimited + * @memberof google.devicesandservices.health.v4.Profile + * @static + * @param {google.devicesandservices.health.v4.IProfile} message Profile message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Profile.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Profile message from the specified reader or buffer. + * @function decode + * @memberof google.devicesandservices.health.v4.Profile + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.devicesandservices.health.v4.Profile} Profile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Profile.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.devicesandservices.health.v4.Profile(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 6: { + message.age = reader.int32(); + break; + } + case 9: { + message.membershipStartDate = $root.google.type.Date.decode(reader, reader.uint32()); + break; + } + case 13: { + message.userConfiguredWalkingStrideLengthMm = reader.int32(); + break; + } + case 14: { + message.userConfiguredRunningStrideLengthMm = reader.int32(); + break; + } + case 15: { + message.autoWalkingStrideLengthMm = reader.int32(); + break; + } + case 16: { + message.autoRunningStrideLengthMm = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Profile message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.devicesandservices.health.v4.Profile + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.devicesandservices.health.v4.Profile} Profile + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Profile.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Profile message. + * @function verify + * @memberof google.devicesandservices.health.v4.Profile + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Profile.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.age != null && message.hasOwnProperty("age")) + if (!$util.isInteger(message.age)) + return "age: integer expected"; + if (message.membershipStartDate != null && message.hasOwnProperty("membershipStartDate")) { + var error = $root.google.type.Date.verify(message.membershipStartDate); + if (error) + return "membershipStartDate." + error; + } + if (message.userConfiguredWalkingStrideLengthMm != null && message.hasOwnProperty("userConfiguredWalkingStrideLengthMm")) { + properties._userConfiguredWalkingStrideLengthMm = 1; + if (!$util.isInteger(message.userConfiguredWalkingStrideLengthMm)) + return "userConfiguredWalkingStrideLengthMm: integer expected"; + } + if (message.userConfiguredRunningStrideLengthMm != null && message.hasOwnProperty("userConfiguredRunningStrideLengthMm")) { + properties._userConfiguredRunningStrideLengthMm = 1; + if (!$util.isInteger(message.userConfiguredRunningStrideLengthMm)) + return "userConfiguredRunningStrideLengthMm: integer expected"; + } + if (message.autoWalkingStrideLengthMm != null && message.hasOwnProperty("autoWalkingStrideLengthMm")) { + properties._autoWalkingStrideLengthMm = 1; + if (!$util.isInteger(message.autoWalkingStrideLengthMm)) + return "autoWalkingStrideLengthMm: integer expected"; + } + if (message.autoRunningStrideLengthMm != null && message.hasOwnProperty("autoRunningStrideLengthMm")) { + properties._autoRunningStrideLengthMm = 1; + if (!$util.isInteger(message.autoRunningStrideLengthMm)) + return "autoRunningStrideLengthMm: integer expected"; + } + return null; + }; + + /** + * Creates a Profile message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.devicesandservices.health.v4.Profile + * @static + * @param {Object.} object Plain object + * @returns {google.devicesandservices.health.v4.Profile} Profile + */ + Profile.fromObject = function fromObject(object) { + if (object instanceof $root.google.devicesandservices.health.v4.Profile) + return object; + var message = new $root.google.devicesandservices.health.v4.Profile(); + if (object.name != null) + message.name = String(object.name); + if (object.age != null) + message.age = object.age | 0; + if (object.membershipStartDate != null) { + if (typeof object.membershipStartDate !== "object") + throw TypeError(".google.devicesandservices.health.v4.Profile.membershipStartDate: object expected"); + message.membershipStartDate = $root.google.type.Date.fromObject(object.membershipStartDate); + } + if (object.userConfiguredWalkingStrideLengthMm != null) + message.userConfiguredWalkingStrideLengthMm = object.userConfiguredWalkingStrideLengthMm | 0; + if (object.userConfiguredRunningStrideLengthMm != null) + message.userConfiguredRunningStrideLengthMm = object.userConfiguredRunningStrideLengthMm | 0; + if (object.autoWalkingStrideLengthMm != null) + message.autoWalkingStrideLengthMm = object.autoWalkingStrideLengthMm | 0; + if (object.autoRunningStrideLengthMm != null) + message.autoRunningStrideLengthMm = object.autoRunningStrideLengthMm | 0; + return message; + }; + + /** + * Creates a plain object from a Profile message. Also converts values to other types if specified. + * @function toObject + * @memberof google.devicesandservices.health.v4.Profile + * @static + * @param {google.devicesandservices.health.v4.Profile} message Profile + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Profile.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.age = 0; + object.membershipStartDate = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.age != null && message.hasOwnProperty("age")) + object.age = message.age; + if (message.membershipStartDate != null && message.hasOwnProperty("membershipStartDate")) + object.membershipStartDate = $root.google.type.Date.toObject(message.membershipStartDate, options); + if (message.userConfiguredWalkingStrideLengthMm != null && message.hasOwnProperty("userConfiguredWalkingStrideLengthMm")) { + object.userConfiguredWalkingStrideLengthMm = message.userConfiguredWalkingStrideLengthMm; + if (options.oneofs) + object._userConfiguredWalkingStrideLengthMm = "userConfiguredWalkingStrideLengthMm"; + } + if (message.userConfiguredRunningStrideLengthMm != null && message.hasOwnProperty("userConfiguredRunningStrideLengthMm")) { + object.userConfiguredRunningStrideLengthMm = message.userConfiguredRunningStrideLengthMm; + if (options.oneofs) + object._userConfiguredRunningStrideLengthMm = "userConfiguredRunningStrideLengthMm"; + } + if (message.autoWalkingStrideLengthMm != null && message.hasOwnProperty("autoWalkingStrideLengthMm")) { + object.autoWalkingStrideLengthMm = message.autoWalkingStrideLengthMm; + if (options.oneofs) + object._autoWalkingStrideLengthMm = "autoWalkingStrideLengthMm"; + } + if (message.autoRunningStrideLengthMm != null && message.hasOwnProperty("autoRunningStrideLengthMm")) { + object.autoRunningStrideLengthMm = message.autoRunningStrideLengthMm; + if (options.oneofs) + object._autoRunningStrideLengthMm = "autoRunningStrideLengthMm"; + } + return object; + }; + + /** + * Converts this Profile to JSON. + * @function toJSON + * @memberof google.devicesandservices.health.v4.Profile + * @instance + * @returns {Object.} JSON object + */ + Profile.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Profile + * @function getTypeUrl + * @memberof google.devicesandservices.health.v4.Profile + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Profile.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.devicesandservices.health.v4.Profile"; + }; + + return Profile; + })(); + + v4.Settings = (function() { + + /** + * Properties of a Settings. + * @memberof google.devicesandservices.health.v4 + * @interface ISettings + * @property {string|null} [name] Settings name + * @property {boolean|null} [autoStrideEnabled] Settings autoStrideEnabled + * @property {google.devicesandservices.health.v4.Settings.DistanceUnit|null} [distanceUnit] Settings distanceUnit + * @property {google.devicesandservices.health.v4.Settings.GlucoseUnit|null} [glucoseUnit] Settings glucoseUnit + * @property {google.devicesandservices.health.v4.Settings.HeightUnit|null} [heightUnit] Settings heightUnit + * @property {string|null} [languageLocale] Settings languageLocale + * @property {google.protobuf.IDuration|null} [utcOffset] Settings utcOffset + * @property {google.devicesandservices.health.v4.Settings.StrideLengthType|null} [strideLengthWalkingType] Settings strideLengthWalkingType + * @property {google.devicesandservices.health.v4.Settings.StrideLengthType|null} [strideLengthRunningType] Settings strideLengthRunningType + * @property {google.devicesandservices.health.v4.Settings.SwimUnit|null} [swimUnit] Settings swimUnit + * @property {google.devicesandservices.health.v4.Settings.TemperatureUnit|null} [temperatureUnit] Settings temperatureUnit + * @property {string|null} [timeZone] Settings timeZone + * @property {google.devicesandservices.health.v4.Settings.WeightUnit|null} [weightUnit] Settings weightUnit + * @property {google.devicesandservices.health.v4.Settings.WaterUnit|null} [waterUnit] Settings waterUnit + */ + + /** + * Constructs a new Settings. + * @memberof google.devicesandservices.health.v4 + * @classdesc Represents a Settings. + * @implements ISettings + * @constructor + * @param {google.devicesandservices.health.v4.ISettings=} [properties] Properties to set + */ + function Settings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Settings name. + * @member {string} name * @memberof google.devicesandservices.health.v4.Settings * @instance */ @@ -36918,6 +40653,7 @@ * @interface ICommonLanguageSettings * @property {string|null} [referenceDocsUri] CommonLanguageSettings referenceDocsUri * @property {Array.|null} [destinations] CommonLanguageSettings destinations + * @property {google.api.ISelectiveGapicGeneration|null} [selectiveGapicGeneration] CommonLanguageSettings selectiveGapicGeneration */ /** @@ -36952,6 +40688,14 @@ */ CommonLanguageSettings.prototype.destinations = $util.emptyArray; + /** + * CommonLanguageSettings selectiveGapicGeneration. + * @member {google.api.ISelectiveGapicGeneration|null|undefined} selectiveGapicGeneration + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.selectiveGapicGeneration = null; + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @function create @@ -36984,6 +40728,8 @@ writer.int32(message.destinations[i]); writer.ldelim(); } + if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) + $root.google.api.SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -37035,6 +40781,10 @@ message.destinations.push(reader.int32()); break; } + case 3: { + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -37086,6 +40836,11 @@ break; } } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) { + var error = $root.google.api.SelectiveGapicGeneration.verify(message.selectiveGapicGeneration); + if (error) + return "selectiveGapicGeneration." + error; + } return null; }; @@ -37128,6 +40883,11 @@ break; } } + if (object.selectiveGapicGeneration != null) { + if (typeof object.selectiveGapicGeneration !== "object") + throw TypeError(".google.api.CommonLanguageSettings.selectiveGapicGeneration: object expected"); + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.fromObject(object.selectiveGapicGeneration); + } return message; }; @@ -37146,8 +40906,10 @@ var object = {}; if (options.arrays || options.defaults) object.destinations = []; - if (options.defaults) + if (options.defaults) { object.referenceDocsUri = ""; + object.selectiveGapicGeneration = null; + } if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) object.referenceDocsUri = message.referenceDocsUri; if (message.destinations && message.destinations.length) { @@ -37155,6 +40917,8 @@ for (var j = 0; j < message.destinations.length; ++j) object.destinations[j] = options.enums === String ? $root.google.api.ClientLibraryDestination[message.destinations[j]] === undefined ? message.destinations[j] : $root.google.api.ClientLibraryDestination[message.destinations[j]] : message.destinations[j]; } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) + object.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.toObject(message.selectiveGapicGeneration, options); return object; }; @@ -38977,6 +42741,7 @@ * @memberof google.api * @interface IPythonSettings * @property {google.api.ICommonLanguageSettings|null} [common] PythonSettings common + * @property {google.api.PythonSettings.IExperimentalFeatures|null} [experimentalFeatures] PythonSettings experimentalFeatures */ /** @@ -39002,6 +42767,14 @@ */ PythonSettings.prototype.common = null; + /** + * PythonSettings experimentalFeatures. + * @member {google.api.PythonSettings.IExperimentalFeatures|null|undefined} experimentalFeatures + * @memberof google.api.PythonSettings + * @instance + */ + PythonSettings.prototype.experimentalFeatures = null; + /** * Creates a new PythonSettings instance using the specified properties. * @function create @@ -39028,6 +42801,8 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) + $root.google.api.PythonSettings.ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -39068,6 +42843,10 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -39108,6 +42887,11 @@ if (error) return "common." + error; } + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) { + var error = $root.google.api.PythonSettings.ExperimentalFeatures.verify(message.experimentalFeatures); + if (error) + return "experimentalFeatures." + error; + } return null; }; @@ -39128,6 +42912,11 @@ throw TypeError(".google.api.PythonSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.experimentalFeatures != null) { + if (typeof object.experimentalFeatures !== "object") + throw TypeError(".google.api.PythonSettings.experimentalFeatures: object expected"); + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.fromObject(object.experimentalFeatures); + } return message; }; @@ -39144,10 +42933,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.common = null; + object.experimentalFeatures = null; + } if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) + object.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.toObject(message.experimentalFeatures, options); return object; }; @@ -39177,6 +42970,258 @@ return typeUrlPrefix + "/google.api.PythonSettings"; }; + PythonSettings.ExperimentalFeatures = (function() { + + /** + * Properties of an ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @interface IExperimentalFeatures + * @property {boolean|null} [restAsyncIoEnabled] ExperimentalFeatures restAsyncIoEnabled + * @property {boolean|null} [protobufPythonicTypesEnabled] ExperimentalFeatures protobufPythonicTypesEnabled + * @property {boolean|null} [unversionedPackageDisabled] ExperimentalFeatures unversionedPackageDisabled + */ + + /** + * Constructs a new ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @classdesc Represents an ExperimentalFeatures. + * @implements IExperimentalFeatures + * @constructor + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + */ + function ExperimentalFeatures(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExperimentalFeatures restAsyncIoEnabled. + * @member {boolean} restAsyncIoEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.restAsyncIoEnabled = false; + + /** + * ExperimentalFeatures protobufPythonicTypesEnabled. + * @member {boolean} protobufPythonicTypesEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.protobufPythonicTypesEnabled = false; + + /** + * ExperimentalFeatures unversionedPackageDisabled. + * @member {boolean} unversionedPackageDisabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.unversionedPackageDisabled = false; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @function create + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures instance + */ + ExperimentalFeatures.create = function create(properties) { + return new ExperimentalFeatures(properties); + }; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.restAsyncIoEnabled); + if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.protobufPythonicTypesEnabled); + if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.unversionedPackageDisabled); + return writer; + }; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @function decode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.restAsyncIoEnabled = reader.bool(); + break; + } + case 2: { + message.protobufPythonicTypesEnabled = reader.bool(); + break; + } + case 3: { + message.unversionedPackageDisabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExperimentalFeatures message. + * @function verify + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExperimentalFeatures.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + if (typeof message.restAsyncIoEnabled !== "boolean") + return "restAsyncIoEnabled: boolean expected"; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + if (typeof message.protobufPythonicTypesEnabled !== "boolean") + return "protobufPythonicTypesEnabled: boolean expected"; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + if (typeof message.unversionedPackageDisabled !== "boolean") + return "unversionedPackageDisabled: boolean expected"; + return null; + }; + + /** + * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} object Plain object + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + */ + ExperimentalFeatures.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PythonSettings.ExperimentalFeatures) + return object; + var message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + if (object.restAsyncIoEnabled != null) + message.restAsyncIoEnabled = Boolean(object.restAsyncIoEnabled); + if (object.protobufPythonicTypesEnabled != null) + message.protobufPythonicTypesEnabled = Boolean(object.protobufPythonicTypesEnabled); + if (object.unversionedPackageDisabled != null) + message.unversionedPackageDisabled = Boolean(object.unversionedPackageDisabled); + return message; + }; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.ExperimentalFeatures} message ExperimentalFeatures + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExperimentalFeatures.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.restAsyncIoEnabled = false; + object.protobufPythonicTypesEnabled = false; + object.unversionedPackageDisabled = false; + } + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + object.restAsyncIoEnabled = message.restAsyncIoEnabled; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + object.protobufPythonicTypesEnabled = message.protobufPythonicTypesEnabled; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + object.unversionedPackageDisabled = message.unversionedPackageDisabled; + return object; + }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @function toJSON + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + * @returns {Object.} JSON object + */ + ExperimentalFeatures.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExperimentalFeatures + * @function getTypeUrl + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExperimentalFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PythonSettings.ExperimentalFeatures"; + }; + + return ExperimentalFeatures; + })(); + return PythonSettings; })(); @@ -40053,6 +44098,7 @@ * @memberof google.api * @interface IGoSettings * @property {google.api.ICommonLanguageSettings|null} [common] GoSettings common + * @property {Object.|null} [renamedServices] GoSettings renamedServices */ /** @@ -40064,6 +44110,7 @@ * @param {google.api.IGoSettings=} [properties] Properties to set */ function GoSettings(properties) { + this.renamedServices = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -40078,6 +44125,14 @@ */ GoSettings.prototype.common = null; + /** + * GoSettings renamedServices. + * @member {Object.} renamedServices + * @memberof google.api.GoSettings + * @instance + */ + GoSettings.prototype.renamedServices = $util.emptyObject; + /** * Creates a new GoSettings instance using the specified properties. * @function create @@ -40104,6 +44159,9 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) + for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); return writer; }; @@ -40134,7 +44192,7 @@ GoSettings.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(), key, value; while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) @@ -40144,6 +44202,29 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + if (message.renamedServices === $util.emptyObject) + message.renamedServices = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.renamedServices[key] = value; + break; + } default: reader.skipType(tag & 7); break; @@ -40184,6 +44265,14 @@ if (error) return "common." + error; } + if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { + if (!$util.isObject(message.renamedServices)) + return "renamedServices: object expected"; + var key = Object.keys(message.renamedServices); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedServices[key[i]])) + return "renamedServices: string{k:string} expected"; + } return null; }; @@ -40204,6 +44293,13 @@ throw TypeError(".google.api.GoSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.renamedServices) { + if (typeof object.renamedServices !== "object") + throw TypeError(".google.api.GoSettings.renamedServices: object expected"); + message.renamedServices = {}; + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) + message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } return message; }; @@ -40220,10 +44316,18 @@ if (!options) options = {}; var object = {}; + if (options.objects || options.defaults) + object.renamedServices = {}; if (options.defaults) object.common = null; if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + var keys2; + if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { + object.renamedServices = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } return object; }; @@ -40862,6 +44966,251 @@ return values; })(); + api.SelectiveGapicGeneration = (function() { + + /** + * Properties of a SelectiveGapicGeneration. + * @memberof google.api + * @interface ISelectiveGapicGeneration + * @property {Array.|null} [methods] SelectiveGapicGeneration methods + * @property {boolean|null} [generateOmittedAsInternal] SelectiveGapicGeneration generateOmittedAsInternal + */ + + /** + * Constructs a new SelectiveGapicGeneration. + * @memberof google.api + * @classdesc Represents a SelectiveGapicGeneration. + * @implements ISelectiveGapicGeneration + * @constructor + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + */ + function SelectiveGapicGeneration(properties) { + this.methods = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SelectiveGapicGeneration methods. + * @member {Array.} methods + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.methods = $util.emptyArray; + + /** + * SelectiveGapicGeneration generateOmittedAsInternal. + * @member {boolean} generateOmittedAsInternal + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.generateOmittedAsInternal = false; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @function create + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration instance + */ + SelectiveGapicGeneration.create = function create(properties) { + return new SelectiveGapicGeneration(properties); + }; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.methods != null && message.methods.length) + for (var i = 0; i < message.methods.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.methods[i]); + if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.generateOmittedAsInternal); + return writer; + }; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @function decode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.SelectiveGapicGeneration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.methods && message.methods.length)) + message.methods = []; + message.methods.push(reader.string()); + break; + } + case 2: { + message.generateOmittedAsInternal = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SelectiveGapicGeneration message. + * @function verify + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SelectiveGapicGeneration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.methods != null && message.hasOwnProperty("methods")) { + if (!Array.isArray(message.methods)) + return "methods: array expected"; + for (var i = 0; i < message.methods.length; ++i) + if (!$util.isString(message.methods[i])) + return "methods: string[] expected"; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + if (typeof message.generateOmittedAsInternal !== "boolean") + return "generateOmittedAsInternal: boolean expected"; + return null; + }; + + /** + * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} object Plain object + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + */ + SelectiveGapicGeneration.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.SelectiveGapicGeneration) + return object; + var message = new $root.google.api.SelectiveGapicGeneration(); + if (object.methods) { + if (!Array.isArray(object.methods)) + throw TypeError(".google.api.SelectiveGapicGeneration.methods: array expected"); + message.methods = []; + for (var i = 0; i < object.methods.length; ++i) + message.methods[i] = String(object.methods[i]); + } + if (object.generateOmittedAsInternal != null) + message.generateOmittedAsInternal = Boolean(object.generateOmittedAsInternal); + return message; + }; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.SelectiveGapicGeneration} message SelectiveGapicGeneration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SelectiveGapicGeneration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.methods = []; + if (options.defaults) + object.generateOmittedAsInternal = false; + if (message.methods && message.methods.length) { + object.methods = []; + for (var j = 0; j < message.methods.length; ++j) + object.methods[j] = message.methods[j]; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + object.generateOmittedAsInternal = message.generateOmittedAsInternal; + return object; + }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @function toJSON + * @memberof google.api.SelectiveGapicGeneration + * @instance + * @returns {Object.} JSON object + */ + SelectiveGapicGeneration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @function getTypeUrl + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SelectiveGapicGeneration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.SelectiveGapicGeneration"; + }; + + return SelectiveGapicGeneration; + })(); + /** * LaunchStage enum. * @name google.api.LaunchStage @@ -41131,6 +45480,7 @@ * @name google.protobuf.Edition * @enum {number} * @property {number} EDITION_UNKNOWN=0 EDITION_UNKNOWN value + * @property {number} EDITION_LEGACY=900 EDITION_LEGACY value * @property {number} EDITION_PROTO2=998 EDITION_PROTO2 value * @property {number} EDITION_PROTO3=999 EDITION_PROTO3 value * @property {number} EDITION_2023=1000 EDITION_2023 value @@ -41145,6 +45495,7 @@ protobuf.Edition = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "EDITION_UNKNOWN"] = 0; + values[valuesById[900] = "EDITION_LEGACY"] = 900; values[valuesById[998] = "EDITION_PROTO2"] = 998; values[valuesById[999] = "EDITION_PROTO3"] = 999; values[valuesById[1000] = "EDITION_2023"] = 1000; @@ -41169,6 +45520,7 @@ * @property {Array.|null} [dependency] FileDescriptorProto dependency * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [optionDependency] FileDescriptorProto optionDependency * @property {Array.|null} [messageType] FileDescriptorProto messageType * @property {Array.|null} [enumType] FileDescriptorProto enumType * @property {Array.|null} [service] FileDescriptorProto service @@ -41191,6 +45543,7 @@ this.dependency = []; this.publicDependency = []; this.weakDependency = []; + this.optionDependency = []; this.messageType = []; this.enumType = []; this.service = []; @@ -41241,6 +45594,14 @@ */ FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + /** + * FileDescriptorProto optionDependency. + * @member {Array.} optionDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.optionDependency = $util.emptyArray; + /** * FileDescriptorProto messageType. * @member {Array.} messageType @@ -41362,6 +45723,9 @@ writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 14, wireType 0 =*/112).int32(message.edition); + if (message.optionDependency != null && message.optionDependency.length) + for (var i = 0; i < message.optionDependency.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.optionDependency[i]); return writer; }; @@ -41434,6 +45798,12 @@ message.weakDependency.push(reader.int32()); break; } + case 15: { + if (!(message.optionDependency && message.optionDependency.length)) + message.optionDependency = []; + message.optionDependency.push(reader.string()); + break; + } case 4: { if (!(message.messageType && message.messageType.length)) message.messageType = []; @@ -41536,6 +45906,13 @@ if (!$util.isInteger(message.weakDependency[i])) return "weakDependency: integer[] expected"; } + if (message.optionDependency != null && message.hasOwnProperty("optionDependency")) { + if (!Array.isArray(message.optionDependency)) + return "optionDependency: array expected"; + for (var i = 0; i < message.optionDependency.length; ++i) + if (!$util.isString(message.optionDependency[i])) + return "optionDependency: string[] expected"; + } if (message.messageType != null && message.hasOwnProperty("messageType")) { if (!Array.isArray(message.messageType)) return "messageType: array expected"; @@ -41590,6 +45967,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -41642,6 +46020,13 @@ for (var i = 0; i < object.weakDependency.length; ++i) message.weakDependency[i] = object.weakDependency[i] | 0; } + if (object.optionDependency) { + if (!Array.isArray(object.optionDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.optionDependency: array expected"); + message.optionDependency = []; + for (var i = 0; i < object.optionDependency.length; ++i) + message.optionDependency[i] = String(object.optionDependency[i]); + } if (object.messageType) { if (!Array.isArray(object.messageType)) throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); @@ -41705,6 +46090,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -41770,6 +46159,7 @@ object.extension = []; object.publicDependency = []; object.weakDependency = []; + object.optionDependency = []; } if (options.defaults) { object.name = ""; @@ -41826,6 +46216,11 @@ object.syntax = message.syntax; if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.optionDependency && message.optionDependency.length) { + object.optionDependency = []; + for (var j = 0; j < message.optionDependency.length; ++j) + object.optionDependency[j] = message.optionDependency[j]; + } return object; }; @@ -41874,6 +46269,7 @@ * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options * @property {Array.|null} [reservedRange] DescriptorProto reservedRange * @property {Array.|null} [reservedName] DescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] DescriptorProto visibility */ /** @@ -41979,6 +46375,14 @@ */ DescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * DescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.visibility = 0; + /** * Creates a new DescriptorProto instance using the specified properties. * @function create @@ -42031,6 +46435,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.visibility); return writer; }; @@ -42123,6 +46529,10 @@ message.reservedName.push(reader.string()); break; } + case 11: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -42236,6 +46646,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -42335,6 +46754,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -42364,6 +46803,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -42409,6 +46849,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -44453,6 +48895,7 @@ * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] EnumDescriptorProto visibility */ /** @@ -44513,6 +48956,14 @@ */ EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * EnumDescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.visibility = 0; + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @function create @@ -44550,6 +49001,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.visibility); return writer; }; @@ -44612,6 +49065,10 @@ message.reservedName.push(reader.string()); break; } + case 6: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -44680,6 +49137,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -44729,6 +49195,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -44753,6 +49239,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -44773,6 +49260,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -47091,6 +51580,7 @@ * @property {Array.|null} [targets] FieldOptions targets * @property {Array.|null} [editionDefaults] FieldOptions editionDefaults * @property {google.protobuf.IFeatureSet|null} [features] FieldOptions features + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] FieldOptions featureSupport * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference @@ -47211,6 +51701,14 @@ */ FieldOptions.prototype.features = null; + /** + * FieldOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.featureSupport = null; + /** * FieldOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -47285,6 +51783,8 @@ $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); if (message.features != null && Object.hasOwnProperty.call(message, "features")) $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -47386,6 +51886,10 @@ message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } + case 22: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -47521,6 +52025,11 @@ if (error) return "features." + error; } + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -47709,6 +52218,11 @@ throw TypeError(".google.protobuf.FieldOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); } + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.FieldOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); @@ -47806,6 +52320,7 @@ object.debugRedact = false; object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; object.features = null; + object.featureSupport = null; object[".google.api.resourceReference"] = null; } if (message.ctype != null && message.hasOwnProperty("ctype")) @@ -47838,6 +52353,8 @@ } if (message.features != null && message.hasOwnProperty("features")) object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -47911,71 +52428,371 @@ return values; })(); - /** - * OptionRetention enum. - * @name google.protobuf.FieldOptions.OptionRetention - * @enum {number} - * @property {number} RETENTION_UNKNOWN=0 RETENTION_UNKNOWN value - * @property {number} RETENTION_RUNTIME=1 RETENTION_RUNTIME value - * @property {number} RETENTION_SOURCE=2 RETENTION_SOURCE value - */ - FieldOptions.OptionRetention = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RETENTION_UNKNOWN"] = 0; - values[valuesById[1] = "RETENTION_RUNTIME"] = 1; - values[valuesById[2] = "RETENTION_SOURCE"] = 2; - return values; - })(); + /** + * OptionRetention enum. + * @name google.protobuf.FieldOptions.OptionRetention + * @enum {number} + * @property {number} RETENTION_UNKNOWN=0 RETENTION_UNKNOWN value + * @property {number} RETENTION_RUNTIME=1 RETENTION_RUNTIME value + * @property {number} RETENTION_SOURCE=2 RETENTION_SOURCE value + */ + FieldOptions.OptionRetention = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RETENTION_UNKNOWN"] = 0; + values[valuesById[1] = "RETENTION_RUNTIME"] = 1; + values[valuesById[2] = "RETENTION_SOURCE"] = 2; + return values; + })(); + + /** + * OptionTargetType enum. + * @name google.protobuf.FieldOptions.OptionTargetType + * @enum {number} + * @property {number} TARGET_TYPE_UNKNOWN=0 TARGET_TYPE_UNKNOWN value + * @property {number} TARGET_TYPE_FILE=1 TARGET_TYPE_FILE value + * @property {number} TARGET_TYPE_EXTENSION_RANGE=2 TARGET_TYPE_EXTENSION_RANGE value + * @property {number} TARGET_TYPE_MESSAGE=3 TARGET_TYPE_MESSAGE value + * @property {number} TARGET_TYPE_FIELD=4 TARGET_TYPE_FIELD value + * @property {number} TARGET_TYPE_ONEOF=5 TARGET_TYPE_ONEOF value + * @property {number} TARGET_TYPE_ENUM=6 TARGET_TYPE_ENUM value + * @property {number} TARGET_TYPE_ENUM_ENTRY=7 TARGET_TYPE_ENUM_ENTRY value + * @property {number} TARGET_TYPE_SERVICE=8 TARGET_TYPE_SERVICE value + * @property {number} TARGET_TYPE_METHOD=9 TARGET_TYPE_METHOD value + */ + FieldOptions.OptionTargetType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TARGET_TYPE_UNKNOWN"] = 0; + values[valuesById[1] = "TARGET_TYPE_FILE"] = 1; + values[valuesById[2] = "TARGET_TYPE_EXTENSION_RANGE"] = 2; + values[valuesById[3] = "TARGET_TYPE_MESSAGE"] = 3; + values[valuesById[4] = "TARGET_TYPE_FIELD"] = 4; + values[valuesById[5] = "TARGET_TYPE_ONEOF"] = 5; + values[valuesById[6] = "TARGET_TYPE_ENUM"] = 6; + values[valuesById[7] = "TARGET_TYPE_ENUM_ENTRY"] = 7; + values[valuesById[8] = "TARGET_TYPE_SERVICE"] = 8; + values[valuesById[9] = "TARGET_TYPE_METHOD"] = 9; + return values; + })(); + + FieldOptions.EditionDefault = (function() { + + /** + * Properties of an EditionDefault. + * @memberof google.protobuf.FieldOptions + * @interface IEditionDefault + * @property {google.protobuf.Edition|null} [edition] EditionDefault edition + * @property {string|null} [value] EditionDefault value + */ + + /** + * Constructs a new EditionDefault. + * @memberof google.protobuf.FieldOptions + * @classdesc Represents an EditionDefault. + * @implements IEditionDefault + * @constructor + * @param {google.protobuf.FieldOptions.IEditionDefault=} [properties] Properties to set + */ + function EditionDefault(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EditionDefault edition. + * @member {google.protobuf.Edition} edition + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + */ + EditionDefault.prototype.edition = 0; + + /** + * EditionDefault value. + * @member {string} value + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + */ + EditionDefault.prototype.value = ""; + + /** + * Creates a new EditionDefault instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.IEditionDefault=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault instance + */ + EditionDefault.create = function create(properties) { + return new EditionDefault(properties); + }; + + /** + * Encodes the specified EditionDefault message. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EditionDefault.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + return writer; + }; + + /** + * Encodes the specified EditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EditionDefault.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EditionDefault message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EditionDefault.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.EditionDefault(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 3: { + message.edition = reader.int32(); + break; + } + case 2: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EditionDefault message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EditionDefault.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EditionDefault message. + * @function verify + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EditionDefault.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates an EditionDefault message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + */ + EditionDefault.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions.EditionDefault) + return object; + var message = new $root.google.protobuf.FieldOptions.EditionDefault(); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.edition = 0; + break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; + case "EDITION_PROTO2": + case 998: + message.edition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EditionDefault.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + return object; + }; + + /** + * Converts this EditionDefault to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + * @returns {Object.} JSON object + */ + EditionDefault.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EditionDefault + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + }; - /** - * OptionTargetType enum. - * @name google.protobuf.FieldOptions.OptionTargetType - * @enum {number} - * @property {number} TARGET_TYPE_UNKNOWN=0 TARGET_TYPE_UNKNOWN value - * @property {number} TARGET_TYPE_FILE=1 TARGET_TYPE_FILE value - * @property {number} TARGET_TYPE_EXTENSION_RANGE=2 TARGET_TYPE_EXTENSION_RANGE value - * @property {number} TARGET_TYPE_MESSAGE=3 TARGET_TYPE_MESSAGE value - * @property {number} TARGET_TYPE_FIELD=4 TARGET_TYPE_FIELD value - * @property {number} TARGET_TYPE_ONEOF=5 TARGET_TYPE_ONEOF value - * @property {number} TARGET_TYPE_ENUM=6 TARGET_TYPE_ENUM value - * @property {number} TARGET_TYPE_ENUM_ENTRY=7 TARGET_TYPE_ENUM_ENTRY value - * @property {number} TARGET_TYPE_SERVICE=8 TARGET_TYPE_SERVICE value - * @property {number} TARGET_TYPE_METHOD=9 TARGET_TYPE_METHOD value - */ - FieldOptions.OptionTargetType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TARGET_TYPE_UNKNOWN"] = 0; - values[valuesById[1] = "TARGET_TYPE_FILE"] = 1; - values[valuesById[2] = "TARGET_TYPE_EXTENSION_RANGE"] = 2; - values[valuesById[3] = "TARGET_TYPE_MESSAGE"] = 3; - values[valuesById[4] = "TARGET_TYPE_FIELD"] = 4; - values[valuesById[5] = "TARGET_TYPE_ONEOF"] = 5; - values[valuesById[6] = "TARGET_TYPE_ENUM"] = 6; - values[valuesById[7] = "TARGET_TYPE_ENUM_ENTRY"] = 7; - values[valuesById[8] = "TARGET_TYPE_SERVICE"] = 8; - values[valuesById[9] = "TARGET_TYPE_METHOD"] = 9; - return values; + return EditionDefault; })(); - FieldOptions.EditionDefault = (function() { + FieldOptions.FeatureSupport = (function() { /** - * Properties of an EditionDefault. + * Properties of a FeatureSupport. * @memberof google.protobuf.FieldOptions - * @interface IEditionDefault - * @property {google.protobuf.Edition|null} [edition] EditionDefault edition - * @property {string|null} [value] EditionDefault value + * @interface IFeatureSupport + * @property {google.protobuf.Edition|null} [editionIntroduced] FeatureSupport editionIntroduced + * @property {google.protobuf.Edition|null} [editionDeprecated] FeatureSupport editionDeprecated + * @property {string|null} [deprecationWarning] FeatureSupport deprecationWarning + * @property {google.protobuf.Edition|null} [editionRemoved] FeatureSupport editionRemoved */ /** - * Constructs a new EditionDefault. + * Constructs a new FeatureSupport. * @memberof google.protobuf.FieldOptions - * @classdesc Represents an EditionDefault. - * @implements IEditionDefault + * @classdesc Represents a FeatureSupport. + * @implements IFeatureSupport * @constructor - * @param {google.protobuf.FieldOptions.IEditionDefault=} [properties] Properties to set + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set */ - function EditionDefault(properties) { + function FeatureSupport(properties) { if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -47983,91 +52800,119 @@ } /** - * EditionDefault edition. - * @member {google.protobuf.Edition} edition - * @memberof google.protobuf.FieldOptions.EditionDefault + * FeatureSupport editionIntroduced. + * @member {google.protobuf.Edition} editionIntroduced + * @memberof google.protobuf.FieldOptions.FeatureSupport * @instance */ - EditionDefault.prototype.edition = 0; + FeatureSupport.prototype.editionIntroduced = 0; /** - * EditionDefault value. - * @member {string} value - * @memberof google.protobuf.FieldOptions.EditionDefault + * FeatureSupport editionDeprecated. + * @member {google.protobuf.Edition} editionDeprecated + * @memberof google.protobuf.FieldOptions.FeatureSupport * @instance */ - EditionDefault.prototype.value = ""; + FeatureSupport.prototype.editionDeprecated = 0; /** - * Creates a new EditionDefault instance using the specified properties. + * FeatureSupport deprecationWarning. + * @member {string} deprecationWarning + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.deprecationWarning = ""; + + /** + * FeatureSupport editionRemoved. + * @member {google.protobuf.Edition} editionRemoved + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionRemoved = 0; + + /** + * Creates a new FeatureSupport instance using the specified properties. * @function create - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static - * @param {google.protobuf.FieldOptions.IEditionDefault=} [properties] Properties to set - * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault instance + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport instance */ - EditionDefault.create = function create(properties) { - return new EditionDefault(properties); + FeatureSupport.create = function create(properties) { + return new FeatureSupport(properties); }; /** - * Encodes the specified EditionDefault message. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. * @function encode - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static - * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EditionDefault.encode = function encode(message, writer) { + FeatureSupport.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.editionIntroduced); + if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.editionDeprecated); + if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.deprecationWarning); + if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.editionRemoved); return writer; }; /** - * Encodes the specified EditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. * @function encodeDelimited - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static - * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode * @param {$protobuf.Writer} [writer] Writer to encode to * @returns {$protobuf.Writer} Writer */ - EditionDefault.encodeDelimited = function encodeDelimited(message, writer) { + FeatureSupport.encodeDelimited = function encodeDelimited(message, writer) { return this.encode(message, writer).ldelim(); }; /** - * Decodes an EditionDefault message from the specified reader or buffer. + * Decodes a FeatureSupport message from the specified reader or buffer. * @function decode - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EditionDefault.decode = function decode(reader, length, error) { + FeatureSupport.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.EditionDefault(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.FeatureSupport(); while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) break; switch (tag >>> 3) { - case 3: { - message.edition = reader.int32(); + case 1: { + message.editionIntroduced = reader.int32(); break; } case 2: { - message.value = reader.string(); + message.editionDeprecated = reader.int32(); + break; + } + case 3: { + message.deprecationWarning = reader.string(); + break; + } + case 4: { + message.editionRemoved = reader.int32(); break; } default: @@ -48079,37 +52924,77 @@ }; /** - * Decodes an EditionDefault message from the specified reader or buffer, length delimited. + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. * @function decodeDelimited - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ - EditionDefault.decodeDelimited = function decodeDelimited(reader) { + FeatureSupport.decodeDelimited = function decodeDelimited(reader) { if (!(reader instanceof $Reader)) reader = new $Reader(reader); return this.decode(reader, reader.uint32()); }; /** - * Verifies an EditionDefault message. + * Verifies a FeatureSupport message. * @function verify - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {Object.} message Plain object to verify * @returns {string|null} `null` if valid, otherwise the reason why it is not */ - EditionDefault.verify = function verify(message) { + FeatureSupport.verify = function verify(message) { if (typeof message !== "object" || message === null) return "object expected"; - if (message.edition != null && message.hasOwnProperty("edition")) - switch (message.edition) { + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + switch (message.editionIntroduced) { default: - return "edition: enum value expected"; + return "editionIntroduced: enum value expected"; case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + switch (message.editionDeprecated) { + default: + return "editionDeprecated: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + if (!$util.isString(message.deprecationWarning)) + return "deprecationWarning: string expected"; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + switch (message.editionRemoved) { + default: + return "editionRemoved: enum value expected"; + case 0: + case 900: case 998: case 999: case 1000: @@ -48122,132 +53007,251 @@ case 2147483647: break; } - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; return null; }; /** - * Creates an EditionDefault message from a plain object. Also converts values to their respective internal types. + * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. * @function fromObject - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {Object.} object Plain object - * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport */ - EditionDefault.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldOptions.EditionDefault) + FeatureSupport.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions.FeatureSupport) return object; - var message = new $root.google.protobuf.FieldOptions.EditionDefault(); - switch (object.edition) { + var message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + switch (object.editionIntroduced) { default: - if (typeof object.edition === "number") { - message.edition = object.edition; + if (typeof object.editionIntroduced === "number") { + message.editionIntroduced = object.editionIntroduced; break; } break; case "EDITION_UNKNOWN": case 0: - message.edition = 0; + message.editionIntroduced = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionIntroduced = 900; break; case "EDITION_PROTO2": case 998: - message.edition = 998; + message.editionIntroduced = 998; break; case "EDITION_PROTO3": case 999: - message.edition = 999; + message.editionIntroduced = 999; break; case "EDITION_2023": case 1000: - message.edition = 1000; + message.editionIntroduced = 1000; break; case "EDITION_2024": case 1001: - message.edition = 1001; + message.editionIntroduced = 1001; break; case "EDITION_1_TEST_ONLY": case 1: - message.edition = 1; + message.editionIntroduced = 1; break; case "EDITION_2_TEST_ONLY": case 2: - message.edition = 2; + message.editionIntroduced = 2; break; case "EDITION_99997_TEST_ONLY": case 99997: - message.edition = 99997; + message.editionIntroduced = 99997; break; case "EDITION_99998_TEST_ONLY": case 99998: - message.edition = 99998; + message.editionIntroduced = 99998; break; case "EDITION_99999_TEST_ONLY": case 99999: - message.edition = 99999; + message.editionIntroduced = 99999; break; case "EDITION_MAX": case 2147483647: - message.edition = 2147483647; + message.editionIntroduced = 2147483647; + break; + } + switch (object.editionDeprecated) { + default: + if (typeof object.editionDeprecated === "number") { + message.editionDeprecated = object.editionDeprecated; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionDeprecated = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionDeprecated = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionDeprecated = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionDeprecated = 999; + break; + case "EDITION_2023": + case 1000: + message.editionDeprecated = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionDeprecated = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionDeprecated = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionDeprecated = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionDeprecated = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionDeprecated = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionDeprecated = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionDeprecated = 2147483647; + break; + } + if (object.deprecationWarning != null) + message.deprecationWarning = String(object.deprecationWarning); + switch (object.editionRemoved) { + default: + if (typeof object.editionRemoved === "number") { + message.editionRemoved = object.editionRemoved; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionRemoved = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionRemoved = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionRemoved = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionRemoved = 999; + break; + case "EDITION_2023": + case 1000: + message.editionRemoved = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionRemoved = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionRemoved = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionRemoved = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionRemoved = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionRemoved = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionRemoved = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionRemoved = 2147483647; break; } - if (object.value != null) - message.value = String(object.value); return message; }; /** - * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. * @function toObject - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static - * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {google.protobuf.FieldOptions.FeatureSupport} message FeatureSupport * @param {$protobuf.IConversionOptions} [options] Conversion options * @returns {Object.} Plain object */ - EditionDefault.toObject = function toObject(message, options) { + FeatureSupport.toObject = function toObject(message, options) { if (!options) options = {}; var object = {}; if (options.defaults) { - object.value = ""; - object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; - } - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.edition != null && message.hasOwnProperty("edition")) - object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + object.editionIntroduced = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.editionDeprecated = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.deprecationWarning = ""; + object.editionRemoved = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + object.editionIntroduced = options.enums === String ? $root.google.protobuf.Edition[message.editionIntroduced] === undefined ? message.editionIntroduced : $root.google.protobuf.Edition[message.editionIntroduced] : message.editionIntroduced; + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + object.editionDeprecated = options.enums === String ? $root.google.protobuf.Edition[message.editionDeprecated] === undefined ? message.editionDeprecated : $root.google.protobuf.Edition[message.editionDeprecated] : message.editionDeprecated; + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + object.deprecationWarning = message.deprecationWarning; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + object.editionRemoved = options.enums === String ? $root.google.protobuf.Edition[message.editionRemoved] === undefined ? message.editionRemoved : $root.google.protobuf.Edition[message.editionRemoved] : message.editionRemoved; return object; }; /** - * Converts this EditionDefault to JSON. + * Converts this FeatureSupport to JSON. * @function toJSON - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @instance * @returns {Object.} JSON object */ - EditionDefault.prototype.toJSON = function toJSON() { + FeatureSupport.prototype.toJSON = function toJSON() { return this.constructor.toObject(this, $protobuf.util.toJSONOptions); }; /** - * Gets the default type url for EditionDefault + * Gets the default type url for FeatureSupport * @function getTypeUrl - * @memberof google.protobuf.FieldOptions.EditionDefault + * @memberof google.protobuf.FieldOptions.FeatureSupport * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ - EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + FeatureSupport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } - return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + return typeUrlPrefix + "/google.protobuf.FieldOptions.FeatureSupport"; }; - return EditionDefault; + return FeatureSupport; })(); return FieldOptions; @@ -48842,6 +53846,7 @@ * @property {boolean|null} [deprecated] EnumValueOptions deprecated * @property {google.protobuf.IFeatureSet|null} [features] EnumValueOptions features * @property {boolean|null} [debugRedact] EnumValueOptions debugRedact + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] EnumValueOptions featureSupport * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption */ @@ -48885,6 +53890,14 @@ */ EnumValueOptions.prototype.debugRedact = false; + /** + * EnumValueOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.featureSupport = null; + /** * EnumValueOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -48923,6 +53936,8 @@ $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.debugRedact); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -48974,6 +53989,10 @@ message.debugRedact = reader.bool(); break; } + case 4: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -49026,6 +54045,11 @@ if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) if (typeof message.debugRedact !== "boolean") return "debugRedact: boolean expected"; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -49059,6 +54083,11 @@ } if (object.debugRedact != null) message.debugRedact = Boolean(object.debugRedact); + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); @@ -49091,6 +54120,7 @@ object.deprecated = false; object.features = null; object.debugRedact = false; + object.featureSupport = null; } if (message.deprecated != null && message.hasOwnProperty("deprecated")) object.deprecated = message.deprecated; @@ -49098,6 +54128,8 @@ object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) object.debugRedact = message.debugRedact; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -50565,6 +55597,8 @@ * @property {google.protobuf.FeatureSet.Utf8Validation|null} [utf8Validation] FeatureSet utf8Validation * @property {google.protobuf.FeatureSet.MessageEncoding|null} [messageEncoding] FeatureSet messageEncoding * @property {google.protobuf.FeatureSet.JsonFormat|null} [jsonFormat] FeatureSet jsonFormat + * @property {google.protobuf.FeatureSet.EnforceNamingStyle|null} [enforceNamingStyle] FeatureSet enforceNamingStyle + * @property {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null} [defaultSymbolVisibility] FeatureSet defaultSymbolVisibility */ /** @@ -50630,6 +55664,22 @@ */ FeatureSet.prototype.jsonFormat = 0; + /** + * FeatureSet enforceNamingStyle. + * @member {google.protobuf.FeatureSet.EnforceNamingStyle} enforceNamingStyle + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.enforceNamingStyle = 0; + + /** + * FeatureSet defaultSymbolVisibility. + * @member {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility} defaultSymbolVisibility + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.defaultSymbolVisibility = 0; + /** * Creates a new FeatureSet instance using the specified properties. * @function create @@ -50666,6 +55716,10 @@ writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageEncoding); if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jsonFormat); + if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.enforceNamingStyle); + if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.defaultSymbolVisibility); return writer; }; @@ -50726,6 +55780,14 @@ message.jsonFormat = reader.int32(); break; } + case 7: { + message.enforceNamingStyle = reader.int32(); + break; + } + case 8: { + message.defaultSymbolVisibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -50816,6 +55878,26 @@ case 2: break; } + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + switch (message.enforceNamingStyle) { + default: + return "enforceNamingStyle: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + switch (message.defaultSymbolVisibility) { + default: + return "defaultSymbolVisibility: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } return null; }; @@ -50955,6 +56037,54 @@ message.jsonFormat = 2; break; } + switch (object.enforceNamingStyle) { + default: + if (typeof object.enforceNamingStyle === "number") { + message.enforceNamingStyle = object.enforceNamingStyle; + break; + } + break; + case "ENFORCE_NAMING_STYLE_UNKNOWN": + case 0: + message.enforceNamingStyle = 0; + break; + case "STYLE2024": + case 1: + message.enforceNamingStyle = 1; + break; + case "STYLE_LEGACY": + case 2: + message.enforceNamingStyle = 2; + break; + } + switch (object.defaultSymbolVisibility) { + default: + if (typeof object.defaultSymbolVisibility === "number") { + message.defaultSymbolVisibility = object.defaultSymbolVisibility; + break; + } + break; + case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": + case 0: + message.defaultSymbolVisibility = 0; + break; + case "EXPORT_ALL": + case 1: + message.defaultSymbolVisibility = 1; + break; + case "EXPORT_TOP_LEVEL": + case 2: + message.defaultSymbolVisibility = 2; + break; + case "LOCAL_ALL": + case 3: + message.defaultSymbolVisibility = 3; + break; + case "STRICT": + case 4: + message.defaultSymbolVisibility = 4; + break; + } return message; }; @@ -50978,6 +56108,8 @@ object.utf8Validation = options.enums === String ? "UTF8_VALIDATION_UNKNOWN" : 0; object.messageEncoding = options.enums === String ? "MESSAGE_ENCODING_UNKNOWN" : 0; object.jsonFormat = options.enums === String ? "JSON_FORMAT_UNKNOWN" : 0; + object.enforceNamingStyle = options.enums === String ? "ENFORCE_NAMING_STYLE_UNKNOWN" : 0; + object.defaultSymbolVisibility = options.enums === String ? "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN" : 0; } if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; @@ -50991,6 +56123,10 @@ object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + object.enforceNamingStyle = options.enums === String ? $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] === undefined ? message.enforceNamingStyle : $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] : message.enforceNamingStyle; + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + object.defaultSymbolVisibility = options.enums === String ? $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] === undefined ? message.defaultSymbolVisibility : $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] : message.defaultSymbolVisibility; return object; }; @@ -51118,6 +56254,219 @@ return values; })(); + /** + * EnforceNamingStyle enum. + * @name google.protobuf.FeatureSet.EnforceNamingStyle + * @enum {number} + * @property {number} ENFORCE_NAMING_STYLE_UNKNOWN=0 ENFORCE_NAMING_STYLE_UNKNOWN value + * @property {number} STYLE2024=1 STYLE2024 value + * @property {number} STYLE_LEGACY=2 STYLE_LEGACY value + */ + FeatureSet.EnforceNamingStyle = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENFORCE_NAMING_STYLE_UNKNOWN"] = 0; + values[valuesById[1] = "STYLE2024"] = 1; + values[valuesById[2] = "STYLE_LEGACY"] = 2; + return values; + })(); + + FeatureSet.VisibilityFeature = (function() { + + /** + * Properties of a VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @interface IVisibilityFeature + */ + + /** + * Constructs a new VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @classdesc Represents a VisibilityFeature. + * @implements IVisibilityFeature + * @constructor + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + */ + function VisibilityFeature(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature instance + */ + VisibilityFeature.create = function create(properties) { + return new VisibilityFeature(properties); + }; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet.VisibilityFeature(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VisibilityFeature message. + * @function verify + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VisibilityFeature.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + */ + VisibilityFeature.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSet.VisibilityFeature) + return object; + return new $root.google.protobuf.FeatureSet.VisibilityFeature(); + }; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.VisibilityFeature} message VisibilityFeature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VisibilityFeature.toObject = function toObject() { + return {}; + }; + + /** + * Converts this VisibilityFeature to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @instance + * @returns {Object.} JSON object + */ + VisibilityFeature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VisibilityFeature + * @function getTypeUrl + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VisibilityFeature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSet.VisibilityFeature"; + }; + + /** + * DefaultSymbolVisibility enum. + * @name google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility + * @enum {number} + * @property {number} DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0 DEFAULT_SYMBOL_VISIBILITY_UNKNOWN value + * @property {number} EXPORT_ALL=1 EXPORT_ALL value + * @property {number} EXPORT_TOP_LEVEL=2 EXPORT_TOP_LEVEL value + * @property {number} LOCAL_ALL=3 LOCAL_ALL value + * @property {number} STRICT=4 STRICT value + */ + VisibilityFeature.DefaultSymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0; + values[valuesById[1] = "EXPORT_ALL"] = 1; + values[valuesById[2] = "EXPORT_TOP_LEVEL"] = 2; + values[valuesById[3] = "LOCAL_ALL"] = 3; + values[valuesById[4] = "STRICT"] = 4; + return values; + })(); + + return VisibilityFeature; + })(); + return FeatureSet; })(); @@ -51302,6 +56651,7 @@ default: return "minimumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -51319,6 +56669,7 @@ default: return "maximumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -51367,6 +56718,10 @@ case 0: message.minimumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.minimumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.minimumEdition = 998; @@ -51419,6 +56774,10 @@ case 0: message.maximumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.maximumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.maximumEdition = 998; @@ -51527,7 +56886,8 @@ * @memberof google.protobuf.FeatureSetDefaults * @interface IFeatureSetEditionDefault * @property {google.protobuf.Edition|null} [edition] FeatureSetEditionDefault edition - * @property {google.protobuf.IFeatureSet|null} [features] FeatureSetEditionDefault features + * @property {google.protobuf.IFeatureSet|null} [overridableFeatures] FeatureSetEditionDefault overridableFeatures + * @property {google.protobuf.IFeatureSet|null} [fixedFeatures] FeatureSetEditionDefault fixedFeatures */ /** @@ -51554,12 +56914,20 @@ FeatureSetEditionDefault.prototype.edition = 0; /** - * FeatureSetEditionDefault features. - * @member {google.protobuf.IFeatureSet|null|undefined} features + * FeatureSetEditionDefault overridableFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} overridableFeatures + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.overridableFeatures = null; + + /** + * FeatureSetEditionDefault fixedFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} fixedFeatures * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @instance */ - FeatureSetEditionDefault.prototype.features = null; + FeatureSetEditionDefault.prototype.fixedFeatures = null; /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -51585,10 +56953,12 @@ FeatureSetEditionDefault.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) + $root.google.protobuf.FeatureSet.encode(message.overridableFeatures, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) + $root.google.protobuf.FeatureSet.encode(message.fixedFeatures, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -51629,8 +56999,12 @@ message.edition = reader.int32(); break; } - case 2: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + case 4: { + message.overridableFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 5: { + message.fixedFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } default: @@ -51673,6 +57047,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -51685,10 +57060,15 @@ case 2147483647: break; } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.overridableFeatures); + if (error) + return "overridableFeatures." + error; + } + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.fixedFeatures); if (error) - return "features." + error; + return "fixedFeatures." + error; } return null; }; @@ -51716,6 +57096,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -51757,10 +57141,15 @@ message.edition = 2147483647; break; } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + if (object.overridableFeatures != null) { + if (typeof object.overridableFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridableFeatures: object expected"); + message.overridableFeatures = $root.google.protobuf.FeatureSet.fromObject(object.overridableFeatures); + } + if (object.fixedFeatures != null) { + if (typeof object.fixedFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixedFeatures: object expected"); + message.fixedFeatures = $root.google.protobuf.FeatureSet.fromObject(object.fixedFeatures); } return message; }; @@ -51779,13 +57168,16 @@ options = {}; var object = {}; if (options.defaults) { - object.features = null; object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.overridableFeatures = null; + object.fixedFeatures = null; } - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) + object.overridableFeatures = $root.google.protobuf.FeatureSet.toObject(message.overridableFeatures, options); + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) + object.fixedFeatures = $root.google.protobuf.FeatureSet.toObject(message.fixedFeatures, options); return object; }; @@ -53000,6 +58392,22 @@ return GeneratedCodeInfo; })(); + /** + * SymbolVisibility enum. + * @name google.protobuf.SymbolVisibility + * @enum {number} + * @property {number} VISIBILITY_UNSET=0 VISIBILITY_UNSET value + * @property {number} VISIBILITY_LOCAL=1 VISIBILITY_LOCAL value + * @property {number} VISIBILITY_EXPORT=2 VISIBILITY_EXPORT value + */ + protobuf.SymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VISIBILITY_UNSET"] = 0; + values[valuesById[1] = "VISIBILITY_LOCAL"] = 1; + values[valuesById[2] = "VISIBILITY_EXPORT"] = 2; + return values; + })(); + protobuf.Duration = (function() { /** diff --git a/packages/google-devicesandservices-health/protos/protos.json b/packages/google-devicesandservices-health/protos/protos.json index 2dfb8b5a57f1..8e42fa2565c7 100644 --- a/packages/google-devicesandservices-health/protos/protos.json +++ b/packages/google-devicesandservices-health/protos/protos.json @@ -193,6 +193,13 @@ } }, "ActiveZoneMinutes": { + "oneofs": { + "_activeZoneMinutes": { + "oneof": [ + "activeZoneMinutes" + ] + } + }, "fields": { "interval": { "type": "ObservationTimeInterval", @@ -212,7 +219,8 @@ "type": "int64", "id": 3, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } } }, @@ -228,18 +236,44 @@ } }, "ActiveZoneMinutesRollupValue": { + "oneofs": { + "_sumInCardioHeartZone": { + "oneof": [ + "sumInCardioHeartZone" + ] + }, + "_sumInPeakHeartZone": { + "oneof": [ + "sumInPeakHeartZone" + ] + }, + "_sumInFatBurnHeartZone": { + "oneof": [ + "sumInFatBurnHeartZone" + ] + } + }, "fields": { "sumInCardioHeartZone": { "type": "int64", - "id": 1 + "id": 1, + "options": { + "proto3_optional": true + } }, "sumInPeakHeartZone": { "type": "int64", - "id": 2 + "id": 2, + "options": { + "proto3_optional": true + } }, "sumInFatBurnHeartZone": { "type": "int64", - "id": 3 + "id": 3, + "options": { + "proto3_optional": true + } } } }, @@ -263,6 +297,13 @@ }, "nested": { "ActiveMinutesByActivityLevel": { + "oneofs": { + "_activeMinutes": { + "oneof": [ + "activeMinutes" + ] + } + }, "fields": { "activityLevel": { "type": "ActivityLevel", @@ -275,7 +316,8 @@ "type": "int64", "id": 2, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } } } @@ -300,6 +342,13 @@ }, "nested": { "ActiveMinutesRollupByActivityLevel": { + "oneofs": { + "_activeMinutesSum": { + "oneof": [ + "activeMinutesSum" + ] + } + }, "fields": { "activityLevel": { "type": "ActiveMinutes.ActivityLevel", @@ -307,7 +356,10 @@ }, "activeMinutesSum": { "type": "int64", - "id": 2 + "id": 2, + "options": { + "proto3_optional": true + } } } } @@ -366,6 +418,13 @@ } }, "Altitude": { + "oneofs": { + "_gainMillimeters": { + "oneof": [ + "gainMillimeters" + ] + } + }, "fields": { "interval": { "type": "ObservationTimeInterval", @@ -378,12 +437,20 @@ "type": "int64", "id": 3, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } } } }, "BasalEnergyBurned": { + "oneofs": { + "_kcal": { + "oneof": [ + "kcal" + ] + } + }, "fields": { "interval": { "type": "ObservationTimeInterval", @@ -396,12 +463,20 @@ "type": "double", "id": 2, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } } } }, "BodyFat": { + "oneofs": { + "_percentage": { + "oneof": [ + "percentage" + ] + } + }, "fields": { "sampleTime": { "type": "ObservationSampleTime", @@ -414,16 +489,27 @@ "type": "double", "id": 3, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } } } }, "BodyFatRollupValue": { + "oneofs": { + "_bodyFatPercentageAvg": { + "oneof": [ + "bodyFatPercentageAvg" + ] + } + }, "fields": { "bodyFatPercentageAvg": { "type": "double", - "id": 1 + "id": 1, + "options": { + "proto3_optional": true + } } } }, @@ -437,6 +523,13 @@ }, "nested": { "CaloriesInHeartRateZoneValue": { + "oneofs": { + "_kcal": { + "oneof": [ + "kcal" + ] + } + }, "fields": { "heartRateZone": { "type": "HeartRateZoneType", @@ -444,7 +537,10 @@ }, "kcal": { "type": "double", - "id": 2 + "id": 2, + "options": { + "proto3_optional": true + } } } } @@ -470,6 +566,18 @@ }, "nested": { "HeartRateZone": { + "oneofs": { + "_minBeatsPerMinute": { + "oneof": [ + "minBeatsPerMinute" + ] + }, + "_maxBeatsPerMinute": { + "oneof": [ + "maxBeatsPerMinute" + ] + } + }, "fields": { "heartRateZoneType": { "type": "HeartRateZoneType", @@ -482,14 +590,16 @@ "type": "int64", "id": 2, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } }, "maxBeatsPerMinute": { "type": "int64", "id": 3, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } } } @@ -562,6 +672,13 @@ } }, "DailyRespiratoryRate": { + "oneofs": { + "_breathsPerMinute": { + "oneof": [ + "breathsPerMinute" + ] + } + }, "fields": { "date": { "type": "google.type.Date", @@ -574,12 +691,35 @@ "type": "double", "id": 2, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } } } }, "DailyOxygenSaturation": { + "oneofs": { + "_averagePercentage": { + "oneof": [ + "averagePercentage" + ] + }, + "_lowerBoundPercentage": { + "oneof": [ + "lowerBoundPercentage" + ] + }, + "_upperBoundPercentage": { + "oneof": [ + "upperBoundPercentage" + ] + }, + "_standardDeviationPercentage": { + "oneof": [ + "standardDeviationPercentage" + ] + } + }, "fields": { "date": { "type": "google.type.Date", @@ -592,33 +732,44 @@ "type": "double", "id": 2, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } }, "lowerBoundPercentage": { "type": "double", "id": 3, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } }, "upperBoundPercentage": { "type": "double", "id": 4, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } }, "standardDeviationPercentage": { "type": "double", "id": 5, "options": { - "(google.api.field_behavior)": "OPTIONAL" + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true } } } }, "DailyRestingHeartRate": { + "oneofs": { + "_beatsPerMinute": { + "oneof": [ + "beatsPerMinute" + ] + } + }, "fields": { "date": { "type": "google.type.Date", @@ -631,7 +782,8 @@ "type": "int64", "id": 4, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } }, "dailyRestingHeartRateMetadata": { @@ -666,6 +818,23 @@ } }, "DailySleepTemperatureDerivations": { + "oneofs": { + "_nightlyTemperatureCelsius": { + "oneof": [ + "nightlyTemperatureCelsius" + ] + }, + "_baselineTemperatureCelsius": { + "oneof": [ + "baselineTemperatureCelsius" + ] + }, + "_relativeNightlyStddev_30dCelsius": { + "oneof": [ + "relativeNightlyStddev_30dCelsius" + ] + } + }, "fields": { "date": { "type": "google.type.Date", @@ -678,26 +847,41 @@ "type": "double", "id": 2, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } }, "baselineTemperatureCelsius": { "type": "double", "id": 3, "options": { - "(google.api.field_behavior)": "OPTIONAL" + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true } }, "relativeNightlyStddev_30dCelsius": { "type": "double", "id": 4, "options": { - "(google.api.field_behavior)": "OPTIONAL" + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true } } } }, "DailyVO2Max": { + "oneofs": { + "_vo2Max": { + "oneof": [ + "vo2Max" + ] + }, + "_vo2MaxCovariance": { + "oneof": [ + "vo2MaxCovariance" + ] + } + }, "fields": { "date": { "type": "google.type.Date", @@ -710,7 +894,8 @@ "type": "double", "id": 2, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } }, "estimated": { @@ -731,7 +916,8 @@ "type": "double", "id": 5, "options": { - "(google.api.field_behavior)": "OPTIONAL" + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true } } }, @@ -750,6 +936,13 @@ } }, "Distance": { + "oneofs": { + "_millimeters": { + "oneof": [ + "millimeters" + ] + } + }, "fields": { "interval": { "type": "ObservationTimeInterval", @@ -762,16 +955,27 @@ "type": "int64", "id": 3, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } } } }, "DistanceRollupValue": { + "oneofs": { + "_millimetersSum": { + "oneof": [ + "millimetersSum" + ] + } + }, "fields": { "millimetersSum": { "type": "int64", - "id": 1 + "id": 1, + "options": { + "proto3_optional": true + } } } }, @@ -969,12 +1173,20 @@ } }, "ExerciseMetadata": { + "oneofs": { + "_poolLengthMillimeters": { + "oneof": [ + "poolLengthMillimeters" + ] + } + }, "fields": { "poolLengthMillimeters": { "type": "int64", "id": 1, "options": { - "(google.api.field_behavior)": "OPTIONAL" + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true } }, "hasGps": { @@ -1006,6 +1218,13 @@ } }, "Floors": { + "oneofs": { + "_count": { + "oneof": [ + "count" + ] + } + }, "fields": { "interval": { "type": "ObservationTimeInterval", @@ -1018,28 +1237,56 @@ "type": "int64", "id": 4, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } } } }, "FloorsRollupValue": { + "oneofs": { + "_countSum": { + "oneof": [ + "countSum" + ] + } + }, "fields": { "countSum": { "type": "int64", - "id": 1 + "id": 1, + "options": { + "proto3_optional": true + } } } }, "AltitudeRollupValue": { + "oneofs": { + "_gainMillimetersSum": { + "oneof": [ + "gainMillimetersSum" + ] + } + }, "fields": { "gainMillimetersSum": { "type": "int64", - "id": 1 + "id": 1, + "options": { + "proto3_optional": true + } } } }, "HeartRate": { + "oneofs": { + "_beatsPerMinute": { + "oneof": [ + "beatsPerMinute" + ] + } + }, "fields": { "sampleTime": { "type": "ObservationSampleTime", @@ -1052,7 +1299,8 @@ "type": "int64", "id": 4, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } }, "metadata": { @@ -1147,22 +1395,55 @@ } }, "RunVO2MaxRollupValue": { - "fields": { - "rateMin": { - "type": "double", - "id": 1 + "oneofs": { + "_rateMin": { + "oneof": [ + "rateMin" + ] }, - "rateMax": { - "type": "double", - "id": 2 + "_rateMax": { + "oneof": [ + "rateMax" + ] + }, + "_rateAvg": { + "oneof": [ + "rateAvg" + ] + } + }, + "fields": { + "rateMin": { + "type": "double", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "rateMax": { + "type": "double", + "id": 2, + "options": { + "proto3_optional": true + } }, "rateAvg": { "type": "double", - "id": 3 + "id": 3, + "options": { + "proto3_optional": true + } } } }, "RunVO2Max": { + "oneofs": { + "_runVo2Max": { + "oneof": [ + "runVo2Max" + ] + } + }, "fields": { "sampleTime": { "type": "ObservationSampleTime", @@ -1175,7 +1456,8 @@ "type": "double", "id": 2, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } } } @@ -1211,6 +1493,13 @@ } }, "Height": { + "oneofs": { + "_heightMillimeters": { + "oneof": [ + "heightMillimeters" + ] + } + }, "fields": { "sampleTime": { "type": "ObservationSampleTime", @@ -1223,12 +1512,25 @@ "type": "int64", "id": 2, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } } } }, "HeartRateVariability": { + "oneofs": { + "_rootMeanSquareOfSuccessiveDifferencesMilliseconds": { + "oneof": [ + "rootMeanSquareOfSuccessiveDifferencesMilliseconds" + ] + }, + "_standardDeviationMilliseconds": { + "oneof": [ + "standardDeviationMilliseconds" + ] + } + }, "fields": { "sampleTime": { "type": "ObservationSampleTime", @@ -1241,25 +1543,35 @@ "type": "double", "id": 2, "options": { - "(google.api.field_behavior)": "OPTIONAL" + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true } }, "standardDeviationMilliseconds": { "type": "double", "id": 3, "options": { - "(google.api.field_behavior)": "OPTIONAL" + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true } } } }, "VolumeQuantity": { + "oneofs": { + "_milliliters": { + "oneof": [ + "milliliters" + ] + } + }, "fields": { "milliliters": { "type": "double", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } }, "userProvidedUnit": { @@ -1298,12 +1610,20 @@ }, "nested": { "VolumeQuantityRollup": { + "oneofs": { + "_millilitersSum": { + "oneof": [ + "millilitersSum" + ] + } + }, "fields": { "millilitersSum": { "type": "double", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } }, "userProvidedUnitLast": { @@ -1567,6 +1887,13 @@ } }, "OxygenSaturation": { + "oneofs": { + "_percentage": { + "oneof": [ + "percentage" + ] + } + }, "fields": { "sampleTime": { "type": "ObservationSampleTime", @@ -1579,7 +1906,8 @@ "type": "double", "id": 2, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } } } @@ -1654,26 +1982,46 @@ }, "nested": { "RespiratoryRateSleepSummaryStatistics": { + "oneofs": { + "_breathsPerMinute": { + "oneof": [ + "breathsPerMinute" + ] + }, + "_standardDeviation": { + "oneof": [ + "standardDeviation" + ] + }, + "_signalToNoise": { + "oneof": [ + "signalToNoise" + ] + } + }, "fields": { "breathsPerMinute": { "type": "double", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } }, "standardDeviation": { "type": "double", "id": 2, "options": { - "(google.api.field_behavior)": "OPTIONAL" + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true } }, "signalToNoise": { "type": "double", "id": 3, "options": { - "(google.api.field_behavior)": "OPTIONAL" + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true } } } @@ -1962,6 +2310,18 @@ }, "nested": { "StageSummary": { + "oneofs": { + "_minutes": { + "oneof": [ + "minutes" + ] + }, + "_count": { + "oneof": [ + "count" + ] + } + }, "fields": { "type": { "type": "SleepStageType", @@ -1974,14 +2334,16 @@ "type": "int64", "id": 2, "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true } }, "count": { "type": "int64", "id": 3, "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true } } } @@ -2009,6 +2371,13 @@ } }, "Steps": { + "oneofs": { + "_count": { + "oneof": [ + "count" + ] + } + }, "fields": { "interval": { "type": "ObservationTimeInterval", @@ -2021,20 +2390,38 @@ "type": "int64", "id": 4, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } } } }, "StepsRollupValue": { + "oneofs": { + "_countSum": { + "oneof": [ + "countSum" + ] + } + }, "fields": { "countSum": { "type": "int64", - "id": 1 + "id": 1, + "options": { + "proto3_optional": true + } } } }, "SwimLengthsData": { + "oneofs": { + "_strokeCount": { + "oneof": [ + "strokeCount" + ] + } + }, "fields": { "interval": { "type": "ObservationTimeInterval", @@ -2054,7 +2441,8 @@ "type": "int64", "id": 3, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } } }, @@ -2071,10 +2459,20 @@ } }, "SwimLengthsDataRollupValue": { + "oneofs": { + "_strokeCountSum": { + "oneof": [ + "strokeCountSum" + ] + } + }, "fields": { "strokeCountSum": { "type": "int64", - "id": 1 + "id": 1, + "options": { + "proto3_optional": true + } } } }, @@ -2120,14 +2518,31 @@ } }, "TotalCaloriesRollupValue": { + "oneofs": { + "_kcalSum": { + "oneof": [ + "kcalSum" + ] + } + }, "fields": { "kcalSum": { "type": "double", - "id": 1 + "id": 1, + "options": { + "proto3_optional": true + } } } }, "VO2Max": { + "oneofs": { + "_vo2Max": { + "oneof": [ + "vo2Max" + ] + } + }, "fields": { "sampleTime": { "type": "ObservationSampleTime", @@ -2140,7 +2555,8 @@ "type": "double", "id": 2, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } }, "measurementMethod": { @@ -2171,6 +2587,13 @@ } }, "Weight": { + "oneofs": { + "_weightGrams": { + "oneof": [ + "weightGrams" + ] + } + }, "fields": { "sampleTime": { "type": "ObservationSampleTime", @@ -2183,7 +2606,8 @@ "type": "double", "id": 3, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "REQUIRED", + "proto3_optional": true } }, "notes": { @@ -2196,10 +2620,20 @@ } }, "WeightRollupValue": { + "oneofs": { + "_weightGramsAvg": { + "oneof": [ + "weightGramsAvg" + ] + } + }, "fields": { "weightGramsAvg": { "type": "double", - "id": 1 + "id": 1, + "options": { + "proto3_optional": true + } } } }, @@ -3381,156 +3815,522 @@ } } }, - "ExportExerciseTcxRequest": { + "ExportExerciseTcxRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "health.googleapis.com/DataPoint" + } + }, + "partialData": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ExportExerciseTcxResponse": { + "fields": { + "tcxData": { + "type": "string", + "id": 2 + } + } + }, + "DataSource": { + "fields": { + "recordingMethod": { + "type": "RecordingMethod", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "device": { + "type": "Device", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "application": { + "type": "Application", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "platform": { + "type": "Platform", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "Device": { + "fields": { + "formFactor": { + "type": "FormFactor", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "manufacturer": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "displayName": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "FormFactor": { + "values": { + "FORM_FACTOR_UNSPECIFIED": 0, + "FITNESS_BAND": 1, + "WATCH": 2, + "PHONE": 3, + "RING": 4, + "CHEST_STRAP": 5, + "SCALE": 6, + "TABLET": 7, + "HEAD_MOUNTED": 8, + "SMART_DISPLAY": 9 + } + } + } + }, + "Application": { + "fields": { + "packageName": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "webClientId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "googleWebClientId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "RecordingMethod": { + "values": { + "RECORDING_METHOD_UNSPECIFIED": 0, + "MANUAL": 1, + "PASSIVELY_MEASURED": 2, + "DERIVED": 3, + "ACTIVELY_MEASURED": 4, + "UNKNOWN": 5 + } + }, + "Platform": { + "values": { + "PLATFORM_UNSPECIFIED": 0, + "FITBIT": 1, + "HEALTH_CONNECT": 2, + "HEALTH_KIT": 3, + "FIT": 4, + "FITBIT_WEB_API": 5, + "NEST": 6, + "GOOGLE_WEB_API": 7, + "GOOGLE_PARTNER_INTEGRATION": 8 + } + } + } + }, + "DataSubscriptionService": { + "options": { + "(google.api.default_host)": "health.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform" + }, + "methods": { + "CreateSubscriber": { + "requestType": "CreateSubscriberRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).post": "/v4/{parent=projects/*}/subscribers", + "(google.api.http).body": "subscriber", + "(google.api.method_signature)": "parent,subscriber,subscriber_id", + "(google.longrunning.operation_info).response_type": "Subscriber", + "(google.longrunning.operation_info).metadata_type": "CreateSubscriberMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v4/{parent=projects/*}/subscribers", + "body": "subscriber" + } + }, + { + "(google.api.method_signature)": "parent,subscriber,subscriber_id" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Subscriber", + "metadata_type": "CreateSubscriberMetadata" + } + } + ] + }, + "ListSubscribers": { + "requestType": "ListSubscribersRequest", + "responseType": "ListSubscribersResponse", + "options": { + "(google.api.http).get": "/v4/{parent=projects/*}/subscribers", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v4/{parent=projects/*}/subscribers" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateSubscriber": { + "requestType": "UpdateSubscriberRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).patch": "/v4/{subscriber.name=projects/*/subscribers/*}", + "(google.api.http).body": "subscriber", + "(google.api.method_signature)": "subscriber,update_mask", + "(google.longrunning.operation_info).response_type": "Subscriber", + "(google.longrunning.operation_info).metadata_type": "UpdateSubscriberMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v4/{subscriber.name=projects/*/subscribers/*}", + "body": "subscriber" + } + }, + { + "(google.api.method_signature)": "subscriber,update_mask" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "Subscriber", + "metadata_type": "UpdateSubscriberMetadata" + } + } + ] + }, + "DeleteSubscriber": { + "requestType": "DeleteSubscriberRequest", + "responseType": "google.longrunning.Operation", + "options": { + "(google.api.http).delete": "/v4/{name=projects/*/subscribers/*}", + "(google.api.method_signature)": "name", + "(google.longrunning.operation_info).response_type": "google.protobuf.Empty", + "(google.longrunning.operation_info).metadata_type": "DeleteSubscriberMetadata" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v4/{name=projects/*/subscribers/*}" + } + }, + { + "(google.api.method_signature)": "name" + }, + { + "(google.longrunning.operation_info)": { + "response_type": "google.protobuf.Empty", + "metadata_type": "DeleteSubscriberMetadata" + } + } + ] + } + } + }, + "CreateSubscriberRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "health.googleapis.com/Subscriber" + } + }, + "subscriber": { + "type": "CreateSubscriberPayload", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "subscriberId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListSubscribersRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "health.googleapis.com/Subscriber" + } + }, + "pageSize": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pageToken": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ListSubscribersResponse": { + "fields": { + "subscribers": { + "rule": "repeated", + "type": "Subscriber", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "totalSize": { + "type": "int32", + "id": 3 + } + } + }, + "UpdateSubscriberRequest": { + "fields": { + "subscriber": { + "type": "Subscriber", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DeleteSubscriberRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "health.googleapis.com/Subscriber" + } + }, + "force": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "Subscriber": { + "options": { + "(google.api.resource).type": "health.googleapis.com/Subscriber", + "(google.api.resource).pattern": "projects/{project}/subscribers/{subscriber}", + "(google.api.resource).plural": "subscribers", + "(google.api.resource).singular": "subscriber" + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "IDENTIFIER" + } + }, + "endpointUri": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "updateTime": { + "type": "google.protobuf.Timestamp", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "subscriberConfigs": { + "rule": "repeated", + "type": "SubscriberConfig", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "endpointAuthorization": { + "type": "EndpointAuthorization", + "id": 7, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "state": { + "type": "State", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "State": { + "values": { + "STATE_UNSPECIFIED": 0, + "UNVERIFIED": 1, + "ACTIVE": 2, + "INACTIVE": 3 + } + } + } + }, + "SubscriberConfig": { + "fields": { + "dataTypes": { + "rule": "repeated", + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "health.googleapis.com/DataType" + } + }, + "subscriptionCreatePolicy": { + "type": "SubscriptionCreatePolicy", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + }, + "nested": { + "SubscriptionCreatePolicy": { + "values": { + "SUBSCRIPTION_CREATE_POLICY_UNSPECIFIED": 0, + "AUTOMATIC": 1, + "MANUAL": 2 + } + } + } + }, + "EndpointAuthorization": { "fields": { - "name": { + "secret": { "type": "string", "id": 1, "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "health.googleapis.com/DataPoint" + "(google.api.field_behavior)": "INPUT_ONLY" } }, - "partialData": { + "secretSet": { "type": "bool", "id": 2, "options": { - "(google.api.field_behavior)": "OPTIONAL" + "(google.api.field_behavior)": "OUTPUT_ONLY" } } } }, - "ExportExerciseTcxResponse": { + "CreateSubscriberPayload": { "fields": { - "tcxData": { + "endpointUri": { "type": "string", - "id": 2 - } - } - }, - "DataSource": { - "fields": { - "recordingMethod": { - "type": "RecordingMethod", "id": 1, "options": { - "(google.api.field_behavior)": "OPTIONAL" + "(google.api.field_behavior)": "REQUIRED" } }, - "device": { - "type": "Device", + "subscriberConfigs": { + "rule": "repeated", + "type": "SubscriberConfig", "id": 2, "options": { "(google.api.field_behavior)": "OPTIONAL" } }, - "application": { - "type": "Application", + "endpointAuthorization": { + "type": "EndpointAuthorization", "id": 3, "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "platform": { - "type": "Platform", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - }, - "nested": { - "Device": { - "fields": { - "formFactor": { - "type": "FormFactor", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "manufacturer": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "displayName": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "FormFactor": { - "values": { - "FORM_FACTOR_UNSPECIFIED": 0, - "FITNESS_BAND": 1, - "WATCH": 2, - "PHONE": 3, - "RING": 4, - "CHEST_STRAP": 5, - "SCALE": 6, - "TABLET": 7, - "HEAD_MOUNTED": 8, - "SMART_DISPLAY": 9 - } - } - } - }, - "Application": { - "fields": { - "packageName": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "webClientId": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "googleWebClientId": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - } - }, - "RecordingMethod": { - "values": { - "RECORDING_METHOD_UNSPECIFIED": 0, - "MANUAL": 1, - "PASSIVELY_MEASURED": 2, - "DERIVED": 3, - "ACTIVELY_MEASURED": 4, - "UNKNOWN": 5 - } - }, - "Platform": { - "values": { - "PLATFORM_UNSPECIFIED": 0, - "FITBIT": 1, - "HEALTH_CONNECT": 2, - "HEALTH_KIT": 3, - "FIT": 4, - "FITBIT_WEB_API": 5, - "NEST": 6, - "GOOGLE_WEB_API": 7, - "GOOGLE_PARTNER_INTEGRATION": 8 + "(google.api.field_behavior)": "REQUIRED" } } } }, + "CreateSubscriberMetadata": { + "fields": {} + }, + "UpdateSubscriberMetadata": { + "fields": {} + }, + "DeleteSubscriberMetadata": { + "fields": {} + }, "HealthProfileService": { "options": { "(google.api.default_host)": "health.googleapis.com", @@ -4013,8 +4813,7 @@ "java_multiple_files": true, "java_outer_classname": "LaunchStageProto", "java_package": "com.google.api", - "objc_class_prefix": "GAPI", - "cc_enable_arenas": true + "objc_class_prefix": "GAPI" }, "nested": { "fieldBehavior": { @@ -4237,6 +5036,10 @@ "rule": "repeated", "type": "ClientLibraryDestination", "id": 2 + }, + "selectiveGapicGeneration": { + "type": "SelectiveGapicGeneration", + "id": 3 } } }, @@ -4377,6 +5180,28 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "experimentalFeatures": { + "type": "ExperimentalFeatures", + "id": 2 + } + }, + "nested": { + "ExperimentalFeatures": { + "fields": { + "restAsyncIoEnabled": { + "type": "bool", + "id": 1 + }, + "protobufPythonicTypesEnabled": { + "type": "bool", + "id": 2 + }, + "unversionedPackageDisabled": { + "type": "bool", + "id": 3 + } + } } } }, @@ -4434,6 +5259,11 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "renamedServices": { + "keyType": "string", + "type": "string", + "id": 2 } } }, @@ -4495,6 +5325,19 @@ "PACKAGE_MANAGER": 20 } }, + "SelectiveGapicGeneration": { + "fields": { + "methods": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "generateOmittedAsInternal": { + "type": "bool", + "id": 2 + } + } + }, "LaunchStage": { "values": { "LAUNCH_STAGE_UNSPECIFIED": 0, @@ -4528,12 +5371,19 @@ "type": "FileDescriptorProto", "id": 1 } - } + }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ] }, "Edition": { "edition": "proto2", "values": { "EDITION_UNKNOWN": 0, + "EDITION_LEGACY": 900, "EDITION_PROTO2": 998, "EDITION_PROTO3": 999, "EDITION_2023": 1000, @@ -4572,6 +5422,11 @@ "type": "int32", "id": 11 }, + "optionDependency": { + "rule": "repeated", + "type": "string", + "id": 15 + }, "messageType": { "rule": "repeated", "type": "DescriptorProto", @@ -4660,6 +5515,10 @@ "rule": "repeated", "type": "string", "id": 10 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 11 } }, "nested": { @@ -4885,6 +5744,10 @@ "rule": "repeated", "type": "string", "id": 5 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 6 } }, "nested": { @@ -4935,7 +5798,14 @@ "type": "ServiceOptions", "id": 3 } - } + }, + "reserved": [ + [ + 4, + 4 + ], + "stream" + ] }, "MethodDescriptorProto": { "edition": "proto2", @@ -5099,6 +5969,7 @@ 42, 42 ], + "php_generic_services", [ 38, 38 @@ -5234,7 +6105,8 @@ "type": "bool", "id": 10, "options": { - "default": false + "default": false, + "deprecated": true } }, "debugRedact": { @@ -5262,6 +6134,10 @@ "type": "FeatureSet", "id": 21 }, + "featureSupport": { + "type": "FeatureSupport", + "id": 22 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -5331,6 +6207,26 @@ "id": 2 } } + }, + "FeatureSupport": { + "fields": { + "editionIntroduced": { + "type": "Edition", + "id": 1 + }, + "editionDeprecated": { + "type": "Edition", + "id": 2 + }, + "deprecationWarning": { + "type": "string", + "id": 3 + }, + "editionRemoved": { + "type": "Edition", + "id": 4 + } + } } } }, @@ -5419,6 +6315,10 @@ "default": false } }, + "featureSupport": { + "type": "FieldOptions.FeatureSupport", + "id": 4 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -5561,6 +6461,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_2023", "edition_defaults.value": "EXPLICIT" } @@ -5571,6 +6472,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "OPEN" } @@ -5581,6 +6483,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "PACKED" } @@ -5591,6 +6494,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "VERIFY" } @@ -5601,7 +6505,8 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", - "edition_defaults.edition": "EDITION_PROTO2", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_LEGACY", "edition_defaults.value": "LENGTH_PREFIXED" } }, @@ -5611,27 +6516,38 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "ALLOW" } + }, + "enforceNamingStyle": { + "type": "EnforceNamingStyle", + "id": 7, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_METHOD", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "STYLE2024" + } + }, + "defaultSymbolVisibility": { + "type": "VisibilityFeature.DefaultSymbolVisibility", + "id": 8, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "EXPORT_TOP_LEVEL" + } } }, "extensions": [ [ 1000, - 1000 - ], - [ - 1001, - 1001 - ], - [ - 1002, - 1002 - ], - [ - 9990, - 9990 + 9994 ], [ 9995, @@ -5676,7 +6592,13 @@ "UTF8_VALIDATION_UNKNOWN": 0, "VERIFY": 2, "NONE": 3 - } + }, + "reserved": [ + [ + 1, + 1 + ] + ] }, "MessageEncoding": { "values": { @@ -5691,6 +6613,33 @@ "ALLOW": 1, "LEGACY_BEST_EFFORT": 2 } + }, + "EnforceNamingStyle": { + "values": { + "ENFORCE_NAMING_STYLE_UNKNOWN": 0, + "STYLE2024": 1, + "STYLE_LEGACY": 2 + } + }, + "VisibilityFeature": { + "fields": {}, + "reserved": [ + [ + 1, + 536870911 + ] + ], + "nested": { + "DefaultSymbolVisibility": { + "values": { + "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": 0, + "EXPORT_ALL": 1, + "EXPORT_TOP_LEVEL": 2, + "LOCAL_ALL": 3, + "STRICT": 4 + } + } + } } } }, @@ -5718,11 +6667,26 @@ "type": "Edition", "id": 3 }, - "features": { + "overridableFeatures": { "type": "FeatureSet", - "id": 2 + "id": 4 + }, + "fixedFeatures": { + "type": "FeatureSet", + "id": 5 } - } + }, + "reserved": [ + [ + 1, + 1 + ], + [ + 2, + 2 + ], + "features" + ] } } }, @@ -5735,6 +6699,12 @@ "id": 1 } }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ], "nested": { "Location": { "fields": { @@ -5820,6 +6790,14 @@ } } }, + "SymbolVisibility": { + "edition": "proto2", + "values": { + "VISIBILITY_UNSET": 0, + "VISIBILITY_LOCAL": 1, + "VISIBILITY_EXPORT": 2 + } + }, "Duration": { "fields": { "seconds": { @@ -5938,6 +6916,7 @@ "java_multiple_files": true, "java_outer_classname": "OperationsProto", "java_package": "com.google.longrunning", + "objc_class_prefix": "GLRUN", "php_namespace": "Google\\LongRunning" }, "nested": { diff --git a/packages/google-devicesandservices-health/samples/generated/v4/data_points_service.list_data_points.js b/packages/google-devicesandservices-health/samples/generated/v4/data_points_service.list_data_points.js index 6ef809647b8b..888f6ad4259a 100644 --- a/packages/google-devicesandservices-health/samples/generated/v4/data_points_service.list_data_points.js +++ b/packages/google-devicesandservices-health/samples/generated/v4/data_points_service.list_data_points.js @@ -100,8 +100,16 @@ function main(parent) { * - 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 start time (**ECG specific**): + * - Pattern: `electrocardiogram.interval.start_time` + * - Supported comparison operators: `>=` + * - Timestamp literal expected in RFC-3339 format + * - Example: + * - `electrocardiogram.interval.start_time >= "2024-08-14T12:34:56Z"` + * - Note: Only filtering by start time is supported for ECG. Filtering + * by end time (e.g., `electrocardiogram.interval.end_time`) is not + * supported. * - Session civil start time (**Excluding Sleep**): * - Pattern: `{session_data_type}.interval.civil_start_time` * - Supported comparison operators: `>=`, `<` diff --git a/packages/google-devicesandservices-health/samples/generated/v4/data_subscription_service.create_subscriber.js b/packages/google-devicesandservices-health/samples/generated/v4/data_subscription_service.create_subscriber.js new file mode 100644 index 000000000000..9949a5deaeb1 --- /dev/null +++ b/packages/google-devicesandservices-health/samples/generated/v4/data_subscription_service.create_subscriber.js @@ -0,0 +1,76 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, subscriber) { + // [START health_v4_generated_DataSubscriptionService_CreateSubscriber_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource where this subscriber will be created. + * Format: projects/{project} + * Example: projects/my-project-123 + */ + // const parent = 'abc123' + /** + * Required. The subscriber to create. + */ + // const subscriber = {} + /** + * 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])/. + */ + // const subscriberId = 'abc123' + + // Imports the Health library + const {DataSubscriptionServiceClient} = require('@google-cloud/health').v4; + + // Instantiates a client + const healthClient = new DataSubscriptionServiceClient(); + + async function callCreateSubscriber() { + // Construct request + const request = { + parent, + subscriber, + }; + + // Run request + const [operation] = await healthClient.createSubscriber(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateSubscriber(); + // [END health_v4_generated_DataSubscriptionService_CreateSubscriber_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-devicesandservices-health/samples/generated/v4/data_subscription_service.delete_subscriber.js b/packages/google-devicesandservices-health/samples/generated/v4/data_subscription_service.delete_subscriber.js new file mode 100644 index 000000000000..567d67d7ac85 --- /dev/null +++ b/packages/google-devicesandservices-health/samples/generated/v4/data_subscription_service.delete_subscriber.js @@ -0,0 +1,73 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START health_v4_generated_DataSubscriptionService_DeleteSubscriber_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * 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. + */ + // const name = 'abc123' + /** + * 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. + */ + // const force = true + + // Imports the Health library + const {DataSubscriptionServiceClient} = require('@google-cloud/health').v4; + + // Instantiates a client + const healthClient = new DataSubscriptionServiceClient(); + + async function callDeleteSubscriber() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await healthClient.deleteSubscriber(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteSubscriber(); + // [END health_v4_generated_DataSubscriptionService_DeleteSubscriber_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-devicesandservices-health/samples/generated/v4/data_subscription_service.list_subscribers.js b/packages/google-devicesandservices-health/samples/generated/v4/data_subscription_service.list_subscribers.js new file mode 100644 index 000000000000..db22e3799d77 --- /dev/null +++ b/packages/google-devicesandservices-health/samples/generated/v4/data_subscription_service.list_subscribers.js @@ -0,0 +1,78 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START health_v4_generated_DataSubscriptionService_ListSubscribers_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent, which owns this collection of subscribers. + * Format: projects/{project} + */ + // const parent = 'abc123' + /** + * 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. + */ + // const pageSize = 1234 + /** + * 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. + */ + // const pageToken = 'abc123' + + // Imports the Health library + const {DataSubscriptionServiceClient} = require('@google-cloud/health').v4; + + // Instantiates a client + const healthClient = new DataSubscriptionServiceClient(); + + async function callListSubscribers() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = healthClient.listSubscribersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSubscribers(); + // [END health_v4_generated_DataSubscriptionService_ListSubscribers_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-devicesandservices-health/samples/generated/v4/data_subscription_service.update_subscriber.js b/packages/google-devicesandservices-health/samples/generated/v4/data_subscription_service.update_subscriber.js new file mode 100644 index 000000000000..8086cce97ac0 --- /dev/null +++ b/packages/google-devicesandservices-health/samples/generated/v4/data_subscription_service.update_subscriber.js @@ -0,0 +1,75 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(subscriber) { + // [START health_v4_generated_DataSubscriptionService_UpdateSubscriber_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The subscriber resource to update. Its 'name' field is mapped to + * the URI, and the value of the 'name' field should be of the form: + * "projects/{project}/subscribers/{subscriber_id}". + * The remaining fields of the Subscriber object represent the new values + * for the corresponding fields in the existing subscriber resource. + */ + // const subscriber = {} + /** + * 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 + */ + // const updateMask = {} + + // Imports the Health library + const {DataSubscriptionServiceClient} = require('@google-cloud/health').v4; + + // Instantiates a client + const healthClient = new DataSubscriptionServiceClient(); + + async function callUpdateSubscriber() { + // Construct request + const request = { + subscriber, + }; + + // Run request + const [operation] = await healthClient.updateSubscriber(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateSubscriber(); + // [END health_v4_generated_DataSubscriptionService_UpdateSubscriber_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/packages/google-devicesandservices-health/samples/generated/v4/snippet_metadata_google.devicesandservices.health.v4.json b/packages/google-devicesandservices-health/samples/generated/v4/snippet_metadata_google.devicesandservices.health.v4.json index 168500281e25..dd930ac34475 100644 --- a/packages/google-devicesandservices-health/samples/generated/v4/snippet_metadata_google.devicesandservices.health.v4.json +++ b/packages/google-devicesandservices-health/samples/generated/v4/snippet_metadata_google.devicesandservices.health.v4.json @@ -62,7 +62,7 @@ "segments": [ { "start": 25, - "end": 156, + "end": 164, "type": "FULL" } ], @@ -411,7 +411,7 @@ "regionTag": "health_v4_generated_DataPointsService_ExportExerciseTcx_async", "title": "DataPointsService exportExerciseTcx Sample", "origin": "API_DEFINITION", - "description": " 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.", + "description": " Exports exercise data in TCX format. **IMPORTANT:** HTTP clients must append `?alt=media` to the request URL to download the raw TCX file. Example: `https://health.googleapis.com/v4/users/me/dataTypes/exercise/dataPoints/EXERCISE_ID:exportExerciseTcx?alt=media` Without `alt=media`, the server returns a JSON response (`ExportExerciseTcxResponse`) which is intended primarily for gRPC clients. **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.", "canonical": true, "file": "data_points_service.export_exercise_tcx.js", "language": "JAVASCRIPT", @@ -451,6 +451,190 @@ } } }, + { + "regionTag": "health_v4_generated_DataSubscriptionService_CreateSubscriber_async", + "title": "DataPointsService createSubscriber Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "data_subscription_service.create_subscriber.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSubscriber", + "fullName": "google.devicesandservices.health.v4.DataSubscriptionService.CreateSubscriber", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "subscriber", + "type": ".google.devicesandservices.health.v4.CreateSubscriberPayload" + }, + { + "name": "subscriber_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataSubscriptionServiceClient", + "fullName": "google.devicesandservices.health.v4.DataSubscriptionServiceClient" + }, + "method": { + "shortName": "CreateSubscriber", + "fullName": "google.devicesandservices.health.v4.DataSubscriptionService.CreateSubscriber", + "service": { + "shortName": "DataSubscriptionService", + "fullName": "google.devicesandservices.health.v4.DataSubscriptionService" + } + } + } + }, + { + "regionTag": "health_v4_generated_DataSubscriptionService_ListSubscribers_async", + "title": "DataPointsService listSubscribers Sample", + "origin": "API_DEFINITION", + "description": " Lists all subscribers registered within the owned Google Cloud Project.", + "canonical": true, + "file": "data_subscription_service.list_subscribers.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 70, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSubscribers", + "fullName": "google.devicesandservices.health.v4.DataSubscriptionService.ListSubscribers", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.devicesandservices.health.v4.ListSubscribersResponse", + "client": { + "shortName": "DataSubscriptionServiceClient", + "fullName": "google.devicesandservices.health.v4.DataSubscriptionServiceClient" + }, + "method": { + "shortName": "ListSubscribers", + "fullName": "google.devicesandservices.health.v4.DataSubscriptionService.ListSubscribers", + "service": { + "shortName": "DataSubscriptionService", + "fullName": "google.devicesandservices.health.v4.DataSubscriptionService" + } + } + } + }, + { + "regionTag": "health_v4_generated_DataSubscriptionService_UpdateSubscriber_async", + "title": "DataPointsService updateSubscriber Sample", + "origin": "API_DEFINITION", + "description": " 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.", + "canonical": true, + "file": "data_subscription_service.update_subscriber.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSubscriber", + "fullName": "google.devicesandservices.health.v4.DataSubscriptionService.UpdateSubscriber", + "async": true, + "parameters": [ + { + "name": "subscriber", + "type": ".google.devicesandservices.health.v4.Subscriber" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataSubscriptionServiceClient", + "fullName": "google.devicesandservices.health.v4.DataSubscriptionServiceClient" + }, + "method": { + "shortName": "UpdateSubscriber", + "fullName": "google.devicesandservices.health.v4.DataSubscriptionService.UpdateSubscriber", + "service": { + "shortName": "DataSubscriptionService", + "fullName": "google.devicesandservices.health.v4.DataSubscriptionService" + } + } + } + }, + { + "regionTag": "health_v4_generated_DataSubscriptionService_DeleteSubscriber_async", + "title": "DataPointsService deleteSubscriber Sample", + "origin": "API_DEFINITION", + "description": " Deletes a subscriber registration. This will stop all notifications to the subscriber's endpoint.", + "canonical": true, + "file": "data_subscription_service.delete_subscriber.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSubscriber", + "fullName": "google.devicesandservices.health.v4.DataSubscriptionService.DeleteSubscriber", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DataSubscriptionServiceClient", + "fullName": "google.devicesandservices.health.v4.DataSubscriptionServiceClient" + }, + "method": { + "shortName": "DeleteSubscriber", + "fullName": "google.devicesandservices.health.v4.DataSubscriptionService.DeleteSubscriber", + "service": { + "shortName": "DataSubscriptionService", + "fullName": "google.devicesandservices.health.v4.DataSubscriptionService" + } + } + } + }, { "regionTag": "health_v4_generated_HealthProfileService_GetProfile_async", "title": "DataPointsService getProfile Sample", diff --git a/packages/google-devicesandservices-health/src/index.ts b/packages/google-devicesandservices-health/src/index.ts index 971371911107..96eefaf9f95f 100644 --- a/packages/google-devicesandservices-health/src/index.ts +++ b/packages/google-devicesandservices-health/src/index.ts @@ -1,4 +1,4 @@ -// Copyright 2025 Google LLC +// Copyright 2026 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -20,10 +20,12 @@ import * as v4 from './v4'; const DataPointsServiceClient = v4.DataPointsServiceClient; type DataPointsServiceClient = v4.DataPointsServiceClient; +const DataSubscriptionServiceClient = v4.DataSubscriptionServiceClient; +type DataSubscriptionServiceClient = v4.DataSubscriptionServiceClient; const HealthProfileServiceClient = v4.HealthProfileServiceClient; type HealthProfileServiceClient = v4.HealthProfileServiceClient; -export {v4, DataPointsServiceClient, HealthProfileServiceClient}; -export default {v4, DataPointsServiceClient, HealthProfileServiceClient}; +export {v4, DataPointsServiceClient, DataSubscriptionServiceClient, HealthProfileServiceClient}; +export default {v4, DataPointsServiceClient, DataSubscriptionServiceClient, HealthProfileServiceClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/packages/google-devicesandservices-health/src/v4/data_points_service_client.ts b/packages/google-devicesandservices-health/src/v4/data_points_service_client.ts index c42e9b977193..8e8578e9d1df 100644 --- a/packages/google-devicesandservices-health/src/v4/data_points_service_client.ts +++ b/packages/google-devicesandservices-health/src/v4/data_points_service_client.ts @@ -18,11 +18,20 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -45,7 +54,7 @@ export class DataPointsServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('health'); @@ -58,10 +67,10 @@ export class DataPointsServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; operationsClient: gax.OperationsClient; - dataPointsServiceStub?: Promise<{[name: string]: Function}>; + dataPointsServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of DataPointsServiceClient. @@ -102,21 +111,42 @@ export class DataPointsServiceClient { * const client = new DataPointsServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof DataPointsServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'health.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -141,7 +171,7 @@ export class DataPointsServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -155,10 +185,7 @@ export class DataPointsServiceClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -180,19 +207,22 @@ export class DataPointsServiceClient { // Create useful helper objects for these. this.pathTemplates = { dataPointPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/dataTypes/{data_type}/dataPoints/{data_point}' + 'users/{user}/dataTypes/{data_type}/dataPoints/{data_point}', ), dataTypePathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/dataTypes/{data_type}' + 'users/{user}/dataTypes/{data_type}', ), identityPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/identity' + 'users/{user}/identity', ), profilePathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile' + 'users/{user}/profile', ), settingsPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/settings' + 'users/{user}/settings', + ), + subscriberPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/subscribers/{subscriber}', ), }; @@ -200,12 +230,21 @@ export class DataPointsServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listDataPoints: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'dataPoints'), - reconcileDataPoints: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'dataPoints'), - rollUpDataPoints: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'rollupDataPoints') + listDataPoints: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'dataPoints', + ), + reconcileDataPoints: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'dataPoints', + ), + rollUpDataPoints: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'rollupDataPoints', + ), }; const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); @@ -214,45 +253,63 @@ export class DataPointsServiceClient { // rather than holding a request open. const lroOptions: GrpcClientOptions = { auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, }; if (opts.fallback) { lroOptions.protoJson = protoFilesRoot; lroOptions.httpRules = []; } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); const createDataPointResponse = protoFilesRoot.lookup( - '.google.devicesandservices.health.v4.DataPoint') as gax.protobuf.Type; + '.google.devicesandservices.health.v4.DataPoint', + ) as gax.protobuf.Type; const createDataPointMetadata = protoFilesRoot.lookup( - '.google.devicesandservices.health.v4.CreateDataPointOperationMetadata') as gax.protobuf.Type; + '.google.devicesandservices.health.v4.CreateDataPointOperationMetadata', + ) as gax.protobuf.Type; const updateDataPointResponse = protoFilesRoot.lookup( - '.google.devicesandservices.health.v4.DataPoint') as gax.protobuf.Type; + '.google.devicesandservices.health.v4.DataPoint', + ) as gax.protobuf.Type; const updateDataPointMetadata = protoFilesRoot.lookup( - '.google.devicesandservices.health.v4.UpdateDataPointOperationMetadata') as gax.protobuf.Type; + '.google.devicesandservices.health.v4.UpdateDataPointOperationMetadata', + ) as gax.protobuf.Type; const batchDeleteDataPointsResponse = protoFilesRoot.lookup( - '.google.devicesandservices.health.v4.BatchDeleteDataPointsResponse') as gax.protobuf.Type; + '.google.devicesandservices.health.v4.BatchDeleteDataPointsResponse', + ) as gax.protobuf.Type; const batchDeleteDataPointsMetadata = protoFilesRoot.lookup( - '.google.devicesandservices.health.v4.BatchDeleteDataPointsOperationMetadata') as gax.protobuf.Type; + '.google.devicesandservices.health.v4.BatchDeleteDataPointsOperationMetadata', + ) as gax.protobuf.Type; this.descriptors.longrunning = { createDataPoint: new this._gaxModule.LongrunningDescriptor( this.operationsClient, createDataPointResponse.decode.bind(createDataPointResponse), - createDataPointMetadata.decode.bind(createDataPointMetadata)), + createDataPointMetadata.decode.bind(createDataPointMetadata), + ), updateDataPoint: new this._gaxModule.LongrunningDescriptor( this.operationsClient, updateDataPointResponse.decode.bind(updateDataPointResponse), - updateDataPointMetadata.decode.bind(updateDataPointMetadata)), + updateDataPointMetadata.decode.bind(updateDataPointMetadata), + ), batchDeleteDataPoints: new this._gaxModule.LongrunningDescriptor( this.operationsClient, - batchDeleteDataPointsResponse.decode.bind(batchDeleteDataPointsResponse), - batchDeleteDataPointsMetadata.decode.bind(batchDeleteDataPointsMetadata)) + batchDeleteDataPointsResponse.decode.bind( + batchDeleteDataPointsResponse, + ), + batchDeleteDataPointsMetadata.decode.bind( + batchDeleteDataPointsMetadata, + ), + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.devicesandservices.health.v4.DataPointsService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.devicesandservices.health.v4.DataPointsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -283,28 +340,44 @@ export class DataPointsServiceClient { // Put together the "service stub" for // google.devicesandservices.health.v4.DataPointsService. this.dataPointsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.devicesandservices.health.v4.DataPointsService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.devicesandservices.health.v4.DataPointsService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.devicesandservices.health.v4.DataPointsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.devicesandservices.health.v4 + .DataPointsService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const dataPointsServiceStubMethods = - ['getDataPoint', 'listDataPoints', 'createDataPoint', 'updateDataPoint', 'batchDeleteDataPoints', 'reconcileDataPoints', 'rollUpDataPoints', 'dailyRollUpDataPoints', 'exportExerciseTcx']; + const dataPointsServiceStubMethods = [ + 'getDataPoint', + 'listDataPoints', + 'createDataPoint', + 'updateDataPoint', + 'batchDeleteDataPoints', + 'reconcileDataPoints', + 'rollUpDataPoints', + 'dailyRollUpDataPoints', + 'exportExerciseTcx', + ]; for (const methodName of dataPointsServiceStubMethods) { const callPromise = this.dataPointsServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); const descriptor = this.descriptors.page[methodName] || @@ -314,7 +387,7 @@ export class DataPointsServiceClient { callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -329,8 +402,14 @@ export class DataPointsServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'health.googleapis.com'; } @@ -341,8 +420,14 @@ export class DataPointsServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'health.googleapis.com'; } @@ -377,7 +462,7 @@ export class DataPointsServiceClient { 'https://www.googleapis.com/auth/googlehealth.activity_and_fitness.readonly', 'https://www.googleapis.com/auth/googlehealth.health_metrics_and_measurements.readonly', 'https://www.googleapis.com/auth/googlehealth.location.readonly', - 'https://www.googleapis.com/auth/googlehealth.sleep.readonly' + 'https://www.googleapis.com/auth/googlehealth.sleep.readonly', ]; } @@ -387,8 +472,9 @@ export class DataPointsServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -399,888 +485,1264 @@ export class DataPointsServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Get a single identifyable data point. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the data point to retrieve. - * - * Format: `users/{user}/dataTypes/{data_type}/dataPoints/{data_point}` - * - * See - * {@link protos.google.devicesandservices.health.v4.DataPoint.name|DataPoint.name} - * for examples and possible values. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devicesandservices.health.v4.DataPoint|DataPoint}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v4/data_points_service.get_data_point.js - * region_tag:health_v4_generated_DataPointsService_GetDataPoint_async - */ + /** + * Get a single identifyable data point. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the data point to retrieve. + * + * Format: `users/{user}/dataTypes/{data_type}/dataPoints/{data_point}` + * + * See + * {@link protos.google.devicesandservices.health.v4.DataPoint.name|DataPoint.name} + * for examples and possible values. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devicesandservices.health.v4.DataPoint|DataPoint}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_points_service.get_data_point.js + * region_tag:health_v4_generated_DataPointsService_GetDataPoint_async + */ getDataPoint( - request?: protos.google.devicesandservices.health.v4.IGetDataPointRequest, - options?: CallOptions): - Promise<[ - protos.google.devicesandservices.health.v4.IDataPoint, - protos.google.devicesandservices.health.v4.IGetDataPointRequest|undefined, {}|undefined - ]>; + request?: protos.google.devicesandservices.health.v4.IGetDataPointRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IDataPoint, + ( + | protos.google.devicesandservices.health.v4.IGetDataPointRequest + | undefined + ), + {} | undefined, + ] + >; getDataPoint( - request: protos.google.devicesandservices.health.v4.IGetDataPointRequest, - options: CallOptions, - callback: Callback< - protos.google.devicesandservices.health.v4.IDataPoint, - protos.google.devicesandservices.health.v4.IGetDataPointRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IGetDataPointRequest, + options: CallOptions, + callback: Callback< + protos.google.devicesandservices.health.v4.IDataPoint, + | protos.google.devicesandservices.health.v4.IGetDataPointRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDataPoint( - request: protos.google.devicesandservices.health.v4.IGetDataPointRequest, - callback: Callback< - protos.google.devicesandservices.health.v4.IDataPoint, - protos.google.devicesandservices.health.v4.IGetDataPointRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IGetDataPointRequest, + callback: Callback< + protos.google.devicesandservices.health.v4.IDataPoint, + | protos.google.devicesandservices.health.v4.IGetDataPointRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDataPoint( - request?: protos.google.devicesandservices.health.v4.IGetDataPointRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devicesandservices.health.v4.IDataPoint, - protos.google.devicesandservices.health.v4.IGetDataPointRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.devicesandservices.health.v4.IGetDataPointRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.devicesandservices.health.v4.IDataPoint, - protos.google.devicesandservices.health.v4.IGetDataPointRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devicesandservices.health.v4.IDataPoint, - protos.google.devicesandservices.health.v4.IGetDataPointRequest|undefined, {}|undefined - ]>|void { + | protos.google.devicesandservices.health.v4.IGetDataPointRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.devicesandservices.health.v4.IDataPoint, + | protos.google.devicesandservices.health.v4.IGetDataPointRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IDataPoint, + ( + | protos.google.devicesandservices.health.v4.IGetDataPointRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getDataPoint request %j', request); - const wrappedCallback: Callback< - protos.google.devicesandservices.health.v4.IDataPoint, - protos.google.devicesandservices.health.v4.IGetDataPointRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.devicesandservices.health.v4.IDataPoint, + | protos.google.devicesandservices.health.v4.IGetDataPointRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getDataPoint response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getDataPoint(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.devicesandservices.health.v4.IDataPoint, - protos.google.devicesandservices.health.v4.IGetDataPointRequest|undefined, - {}|undefined - ]) => { - this._log.info('getDataPoint response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getDataPoint(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.devicesandservices.health.v4.IDataPoint, + ( + | protos.google.devicesandservices.health.v4.IGetDataPointRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getDataPoint response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Roll up data points over civil time intervals for supported data types. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.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][google.devicesandservices.health.v4.DailyRollupDataPoint] - * union field. - * @param {google.devicesandservices.health.v4.CivilTimeInterval} request.range - * 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. - * @param {number} [request.windowSizeDays] - * Optional. Aggregation window size, in number of days. Defaults to 1 if not - * specified. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {string} [request.dataSourceFamily] - * 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 - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devicesandservices.health.v4.DailyRollUpDataPointsResponse|DailyRollUpDataPointsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v4/data_points_service.daily_roll_up_data_points.js - * region_tag:health_v4_generated_DataPointsService_DailyRollUpDataPoints_async - */ + /** + * Roll up data points over civil time intervals for supported data types. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.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][google.devicesandservices.health.v4.DailyRollupDataPoint] + * union field. + * @param {google.devicesandservices.health.v4.CivilTimeInterval} request.range + * 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. + * @param {number} [request.windowSizeDays] + * Optional. Aggregation window size, in number of days. Defaults to 1 if not + * specified. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string} [request.dataSourceFamily] + * 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 + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devicesandservices.health.v4.DailyRollUpDataPointsResponse|DailyRollUpDataPointsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_points_service.daily_roll_up_data_points.js + * region_tag:health_v4_generated_DataPointsService_DailyRollUpDataPoints_async + */ dailyRollUpDataPoints( - request?: protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest, - options?: CallOptions): - Promise<[ - protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsResponse, - protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest|undefined, {}|undefined - ]>; + request?: protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsResponse, + ( + | protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest + | undefined + ), + {} | undefined, + ] + >; dailyRollUpDataPoints( - request: protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest, - options: CallOptions, - callback: Callback< - protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsResponse, - protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest, + options: CallOptions, + callback: Callback< + protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsResponse, + | protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; dailyRollUpDataPoints( - request: protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest, - callback: Callback< - protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsResponse, - protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest, + callback: Callback< + protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsResponse, + | protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; dailyRollUpDataPoints( - request?: protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsResponse, - protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsResponse, - protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsResponse, - protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest|undefined, {}|undefined - ]>|void { + | protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsResponse, + | protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsResponse, + ( + | protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('dailyRollUpDataPoints request %j', request); - const wrappedCallback: Callback< - protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsResponse, - protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsResponse, + | protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('dailyRollUpDataPoints response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.dailyRollUpDataPoints(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsResponse, - protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest|undefined, - {}|undefined - ]) => { - this._log.info('dailyRollUpDataPoints response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .dailyRollUpDataPoints(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsResponse, + ( + | protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('dailyRollUpDataPoints response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * 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 {Object} request - * The request object that will be sent. - * @param {string} request.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. - * @param {boolean} [request.partialData] - * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devicesandservices.health.v4.ExportExerciseTcxResponse|ExportExerciseTcxResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v4/data_points_service.export_exercise_tcx.js - * region_tag:health_v4_generated_DataPointsService_ExportExerciseTcx_async - */ + /** + * Exports exercise data in TCX format. + * + * **IMPORTANT:** HTTP clients must append `?alt=media` to the + * request URL to download the raw TCX file. + * + * Example: + * `https://health.googleapis.com/v4/users/me/dataTypes/exercise/dataPoints/EXERCISE_ID:exportExerciseTcx?alt=media` + * + * Without `alt=media`, the server returns a JSON response + * (`ExportExerciseTcxResponse`) + * which is intended primarily for gRPC clients. + * + * **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 {Object} request + * The request object that will be sent. + * @param {string} request.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. + * @param {boolean} [request.partialData] + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devicesandservices.health.v4.ExportExerciseTcxResponse|ExportExerciseTcxResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_points_service.export_exercise_tcx.js + * region_tag:health_v4_generated_DataPointsService_ExportExerciseTcx_async + */ exportExerciseTcx( - request?: protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest, - options?: CallOptions): - Promise<[ - protos.google.devicesandservices.health.v4.IExportExerciseTcxResponse, - protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest|undefined, {}|undefined - ]>; + request?: protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IExportExerciseTcxResponse, + ( + | protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest + | undefined + ), + {} | undefined, + ] + >; exportExerciseTcx( - request: protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest, - options: CallOptions, - callback: Callback< - protos.google.devicesandservices.health.v4.IExportExerciseTcxResponse, - protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest, + options: CallOptions, + callback: Callback< + protos.google.devicesandservices.health.v4.IExportExerciseTcxResponse, + | protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest + | null + | undefined, + {} | null | undefined + >, + ): void; exportExerciseTcx( - request: protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest, - callback: Callback< - protos.google.devicesandservices.health.v4.IExportExerciseTcxResponse, - protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest, + callback: Callback< + protos.google.devicesandservices.health.v4.IExportExerciseTcxResponse, + | protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest + | null + | undefined, + {} | null | undefined + >, + ): void; exportExerciseTcx( - request?: protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devicesandservices.health.v4.IExportExerciseTcxResponse, - protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.devicesandservices.health.v4.IExportExerciseTcxResponse, - protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devicesandservices.health.v4.IExportExerciseTcxResponse, - protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest|undefined, {}|undefined - ]>|void { + | protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.devicesandservices.health.v4.IExportExerciseTcxResponse, + | protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IExportExerciseTcxResponse, + ( + | protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('exportExerciseTcx request %j', request); - const wrappedCallback: Callback< - protos.google.devicesandservices.health.v4.IExportExerciseTcxResponse, - protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.devicesandservices.health.v4.IExportExerciseTcxResponse, + | protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('exportExerciseTcx response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.exportExerciseTcx(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.devicesandservices.health.v4.IExportExerciseTcxResponse, - protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest|undefined, - {}|undefined - ]) => { - this._log.info('exportExerciseTcx response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .exportExerciseTcx(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.devicesandservices.health.v4.IExportExerciseTcxResponse, + ( + | protos.google.devicesandservices.health.v4.IExportExerciseTcxRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('exportExerciseTcx response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a single identifiable data point. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource name where the data point will be created. - * Format: `users/{user}/dataTypes/{data_type}` - * @param {google.devicesandservices.health.v4.DataPoint} request.dataPoint - * Required. The data point to create. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v4/data_points_service.create_data_point.js - * region_tag:health_v4_generated_DataPointsService_CreateDataPoint_async - */ + /** + * Creates a single identifiable data point. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource name where the data point will be created. + * Format: `users/{user}/dataTypes/{data_type}` + * @param {google.devicesandservices.health.v4.DataPoint} request.dataPoint + * Required. The data point to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_points_service.create_data_point.js + * region_tag:health_v4_generated_DataPointsService_CreateDataPoint_async + */ createDataPoint( - request?: protos.google.devicesandservices.health.v4.ICreateDataPointRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.devicesandservices.health.v4.ICreateDataPointRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.ICreateDataPointOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; createDataPoint( - request: protos.google.devicesandservices.health.v4.ICreateDataPointRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.ICreateDataPointRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.ICreateDataPointOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createDataPoint( - request: protos.google.devicesandservices.health.v4.ICreateDataPointRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.ICreateDataPointRequest, + callback: Callback< + LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.ICreateDataPointOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; createDataPoint( - request?: protos.google.devicesandservices.health.v4.ICreateDataPointRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.devicesandservices.health.v4.ICreateDataPointRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.ICreateDataPointOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.ICreateDataPointOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.ICreateDataPointOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.ICreateDataPointOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('createDataPoint response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('createDataPoint request %j', request); - return this.innerApiCalls.createDataPoint(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('createDataPoint response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .createDataPoint(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.ICreateDataPointOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createDataPoint response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `createDataPoint()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v4/data_points_service.create_data_point.js - * region_tag:health_v4_generated_DataPointsService_CreateDataPoint_async - */ - async checkCreateDataPointProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `createDataPoint()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_points_service.create_data_point.js + * region_tag:health_v4_generated_DataPointsService_CreateDataPoint_async + */ + async checkCreateDataPointProgress( + name: string, + ): Promise< + LROperation< + protos.google.devicesandservices.health.v4.DataPoint, + protos.google.devicesandservices.health.v4.CreateDataPointOperationMetadata + > + > { this._log.info('createDataPoint long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createDataPoint, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createDataPoint, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.devicesandservices.health.v4.DataPoint, + protos.google.devicesandservices.health.v4.CreateDataPointOperationMetadata + >; } -/** - * Updates a single identifiable data point. If a data point with the - * specified `name` is not found, the request will fail. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devicesandservices.health.v4.DataPoint} request.dataPoint - * Required. The data point to update - * - * The data point's `name` field is used to identify the data point to update. - * - * Format: `users/{user}/dataTypes/{data_type}/dataPoints/{data_point}` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v4/data_points_service.update_data_point.js - * region_tag:health_v4_generated_DataPointsService_UpdateDataPoint_async - */ + /** + * Updates a single identifiable data point. If a data point with the + * specified `name` is not found, the request will fail. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devicesandservices.health.v4.DataPoint} request.dataPoint + * Required. The data point to update + * + * The data point's `name` field is used to identify the data point to update. + * + * Format: `users/{user}/dataTypes/{data_type}/dataPoints/{data_point}` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_points_service.update_data_point.js + * region_tag:health_v4_generated_DataPointsService_UpdateDataPoint_async + */ updateDataPoint( - request?: protos.google.devicesandservices.health.v4.IUpdateDataPointRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.devicesandservices.health.v4.IUpdateDataPointRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.IUpdateDataPointOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; updateDataPoint( - request: protos.google.devicesandservices.health.v4.IUpdateDataPointRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IUpdateDataPointRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.IUpdateDataPointOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateDataPoint( - request: protos.google.devicesandservices.health.v4.IUpdateDataPointRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IUpdateDataPointRequest, + callback: Callback< + LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.IUpdateDataPointOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; updateDataPoint( - request?: protos.google.devicesandservices.health.v4.IUpdateDataPointRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.devicesandservices.health.v4.IUpdateDataPointRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.IUpdateDataPointOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.IUpdateDataPointOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.IUpdateDataPointOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'data_point.name': request.dataPoint!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'data_point.name': request.dataPoint!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.IUpdateDataPointOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('updateDataPoint response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('updateDataPoint request %j', request); - return this.innerApiCalls.updateDataPoint(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('updateDataPoint response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .updateDataPoint(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.IUpdateDataPointOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateDataPoint response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `updateDataPoint()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v4/data_points_service.update_data_point.js - * region_tag:health_v4_generated_DataPointsService_UpdateDataPoint_async - */ - async checkUpdateDataPointProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `updateDataPoint()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_points_service.update_data_point.js + * region_tag:health_v4_generated_DataPointsService_UpdateDataPoint_async + */ + async checkUpdateDataPointProgress( + name: string, + ): Promise< + LROperation< + protos.google.devicesandservices.health.v4.DataPoint, + protos.google.devicesandservices.health.v4.UpdateDataPointOperationMetadata + > + > { this._log.info('updateDataPoint long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateDataPoint, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateDataPoint, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.devicesandservices.health.v4.DataPoint, + protos.google.devicesandservices.health.v4.UpdateDataPointOperationMetadata + >; } -/** - * Delete a batch of identifyable data points. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} [request.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][google.devicesandservices.health.v4.DataPoint] 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. - * @param {string[]} request.names - * Required. The names of the DataPoints to delete. - * A maximum of 10000 data points can be deleted in a single request. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v4/data_points_service.batch_delete_data_points.js - * region_tag:health_v4_generated_DataPointsService_BatchDeleteDataPoints_async - */ + /** + * Delete a batch of identifyable data points. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} [request.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][google.devicesandservices.health.v4.DataPoint] 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. + * @param {string[]} request.names + * Required. The names of the DataPoints to delete. + * A maximum of 10000 data points can be deleted in a single request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_points_service.batch_delete_data_points.js + * region_tag:health_v4_generated_DataPointsService_BatchDeleteDataPoints_async + */ batchDeleteDataPoints( - request?: protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; + request?: protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsResponse, + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; batchDeleteDataPoints( - request: protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsResponse, + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; batchDeleteDataPoints( - request: protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsRequest, + callback: Callback< + LROperation< + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsResponse, + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; batchDeleteDataPoints( - request?: protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { + request?: protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsResponse, + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsResponse, + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsResponse, + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + LROperation< + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsResponse, + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsOperationMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, rawResponse, _) => { this._log.info('batchDeleteDataPoints response %j', rawResponse); callback!(error, response, rawResponse, _); // We verified callback above. } : undefined; this._log.info('batchDeleteDataPoints request %j', request); - return this.innerApiCalls.batchDeleteDataPoints(request, options, wrappedCallback) - ?.then(([response, rawResponse, _]: [ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]) => { - this._log.info('batchDeleteDataPoints response %j', rawResponse); - return [response, rawResponse, _]; - }); + return this.innerApiCalls + .batchDeleteDataPoints(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsResponse, + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsOperationMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('batchDeleteDataPoints response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); } -/** - * Check the status of the long running operation returned by `batchDeleteDataPoints()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } - * for more details and examples. - * @example include:samples/generated/v4/data_points_service.batch_delete_data_points.js - * region_tag:health_v4_generated_DataPointsService_BatchDeleteDataPoints_async - */ - async checkBatchDeleteDataPointsProgress(name: string): Promise>{ + /** + * Check the status of the long running operation returned by `batchDeleteDataPoints()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_points_service.batch_delete_data_points.js + * region_tag:health_v4_generated_DataPointsService_BatchDeleteDataPoints_async + */ + async checkBatchDeleteDataPointsProgress( + name: string, + ): Promise< + LROperation< + protos.google.devicesandservices.health.v4.BatchDeleteDataPointsResponse, + protos.google.devicesandservices.health.v4.BatchDeleteDataPointsOperationMetadata + > + > { this._log.info('batchDeleteDataPoints long-running'); - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.batchDeleteDataPoints, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.batchDeleteDataPoints, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.devicesandservices.health.v4.BatchDeleteDataPointsResponse, + protos.google.devicesandservices.health.v4.BatchDeleteDataPointsOperationMetadata + >; } - /** - * Query user health and fitness data points. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.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][google.devicesandservices.health.v4.DataPoint] union - * field. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * Optional. The `next_page_token` from a previous request, if any. - * @param {string} [request.filter] - * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.devicesandservices.health.v4.DataPoint|DataPoint}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listDataPointsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Query user health and fitness data points. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.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][google.devicesandservices.health.v4.DataPoint] union + * field. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * Optional. The `next_page_token` from a previous request, if any. + * @param {string} [request.filter] + * 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_heart_rate_variability.date < "2024-08-15"` + * + * + * + * - Session start time (**ECG specific**): + * - Pattern: `electrocardiogram.interval.start_time` + * - Supported comparison operators: `>=` + * - Timestamp literal expected in RFC-3339 format + * - Example: + * - `electrocardiogram.interval.start_time >= "2024-08-14T12:34:56Z"` + * - Note: Only filtering by start time is supported for ECG. Filtering + * by end time (e.g., `electrocardiogram.interval.end_time`) is not + * supported. + * - 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.devicesandservices.health.v4.DataPoint|DataPoint}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listDataPointsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listDataPoints( - request?: protos.google.devicesandservices.health.v4.IListDataPointsRequest, - options?: CallOptions): - Promise<[ - protos.google.devicesandservices.health.v4.IDataPoint[], - protos.google.devicesandservices.health.v4.IListDataPointsRequest|null, - protos.google.devicesandservices.health.v4.IListDataPointsResponse - ]>; + request?: protos.google.devicesandservices.health.v4.IListDataPointsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IDataPoint[], + protos.google.devicesandservices.health.v4.IListDataPointsRequest | null, + protos.google.devicesandservices.health.v4.IListDataPointsResponse, + ] + >; listDataPoints( - request: protos.google.devicesandservices.health.v4.IListDataPointsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devicesandservices.health.v4.IListDataPointsRequest, - protos.google.devicesandservices.health.v4.IListDataPointsResponse|null|undefined, - protos.google.devicesandservices.health.v4.IDataPoint>): void; + request: protos.google.devicesandservices.health.v4.IListDataPointsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devicesandservices.health.v4.IListDataPointsRequest, + | protos.google.devicesandservices.health.v4.IListDataPointsResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.IDataPoint + >, + ): void; listDataPoints( - request: protos.google.devicesandservices.health.v4.IListDataPointsRequest, - callback: PaginationCallback< - protos.google.devicesandservices.health.v4.IListDataPointsRequest, - protos.google.devicesandservices.health.v4.IListDataPointsResponse|null|undefined, - protos.google.devicesandservices.health.v4.IDataPoint>): void; + request: protos.google.devicesandservices.health.v4.IListDataPointsRequest, + callback: PaginationCallback< + protos.google.devicesandservices.health.v4.IListDataPointsRequest, + | protos.google.devicesandservices.health.v4.IListDataPointsResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.IDataPoint + >, + ): void; listDataPoints( - request?: protos.google.devicesandservices.health.v4.IListDataPointsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devicesandservices.health.v4.IListDataPointsRequest, - protos.google.devicesandservices.health.v4.IListDataPointsResponse|null|undefined, - protos.google.devicesandservices.health.v4.IDataPoint>, - callback?: PaginationCallback< + request?: protos.google.devicesandservices.health.v4.IListDataPointsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.devicesandservices.health.v4.IListDataPointsRequest, - protos.google.devicesandservices.health.v4.IListDataPointsResponse|null|undefined, - protos.google.devicesandservices.health.v4.IDataPoint>): - Promise<[ - protos.google.devicesandservices.health.v4.IDataPoint[], - protos.google.devicesandservices.health.v4.IListDataPointsRequest|null, - protos.google.devicesandservices.health.v4.IListDataPointsResponse - ]>|void { + | protos.google.devicesandservices.health.v4.IListDataPointsResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.IDataPoint + >, + callback?: PaginationCallback< + protos.google.devicesandservices.health.v4.IListDataPointsRequest, + | protos.google.devicesandservices.health.v4.IListDataPointsResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.IDataPoint + >, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IDataPoint[], + protos.google.devicesandservices.health.v4.IListDataPointsRequest | null, + protos.google.devicesandservices.health.v4.IListDataPointsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.devicesandservices.health.v4.IListDataPointsRequest, - protos.google.devicesandservices.health.v4.IListDataPointsResponse|null|undefined, - protos.google.devicesandservices.health.v4.IDataPoint>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.devicesandservices.health.v4.IListDataPointsRequest, + | protos.google.devicesandservices.health.v4.IListDataPointsResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.IDataPoint + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listDataPoints values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1289,440 +1751,487 @@ export class DataPointsServiceClient { this._log.info('listDataPoints request %j', request); return this.innerApiCalls .listDataPoints(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.devicesandservices.health.v4.IDataPoint[], - protos.google.devicesandservices.health.v4.IListDataPointsRequest|null, - protos.google.devicesandservices.health.v4.IListDataPointsResponse - ]) => { - this._log.info('listDataPoints values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.devicesandservices.health.v4.IDataPoint[], + protos.google.devicesandservices.health.v4.IListDataPointsRequest | null, + protos.google.devicesandservices.health.v4.IListDataPointsResponse, + ]) => { + this._log.info('listDataPoints values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listDataPoints`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.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][google.devicesandservices.health.v4.DataPoint] union - * field. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * Optional. The `next_page_token` from a previous request, if any. - * @param {string} [request.filter] - * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.devicesandservices.health.v4.DataPoint|DataPoint} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listDataPointsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listDataPoints`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.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][google.devicesandservices.health.v4.DataPoint] union + * field. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * Optional. The `next_page_token` from a previous request, if any. + * @param {string} [request.filter] + * 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_heart_rate_variability.date < "2024-08-15"` + * + * + * + * - Session start time (**ECG specific**): + * - Pattern: `electrocardiogram.interval.start_time` + * - Supported comparison operators: `>=` + * - Timestamp literal expected in RFC-3339 format + * - Example: + * - `electrocardiogram.interval.start_time >= "2024-08-14T12:34:56Z"` + * - Note: Only filtering by start time is supported for ECG. Filtering + * by end time (e.g., `electrocardiogram.interval.end_time`) is not + * supported. + * - 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.devicesandservices.health.v4.DataPoint|DataPoint} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listDataPointsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listDataPointsStream( - request?: protos.google.devicesandservices.health.v4.IListDataPointsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.devicesandservices.health.v4.IListDataPointsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listDataPoints']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listDataPoints stream %j', request); return this.descriptors.page.listDataPoints.createStream( this.innerApiCalls.listDataPoints as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listDataPoints`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.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][google.devicesandservices.health.v4.DataPoint] union - * field. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * Optional. The `next_page_token` from a previous request, if any. - * @param {string} [request.filter] - * 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. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.devicesandservices.health.v4.DataPoint|DataPoint}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v4/data_points_service.list_data_points.js - * region_tag:health_v4_generated_DataPointsService_ListDataPoints_async - */ + /** + * Equivalent to `listDataPoints`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.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][google.devicesandservices.health.v4.DataPoint] union + * field. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * Optional. The `next_page_token` from a previous request, if any. + * @param {string} [request.filter] + * 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_heart_rate_variability.date < "2024-08-15"` + * + * + * + * - Session start time (**ECG specific**): + * - Pattern: `electrocardiogram.interval.start_time` + * - Supported comparison operators: `>=` + * - Timestamp literal expected in RFC-3339 format + * - Example: + * - `electrocardiogram.interval.start_time >= "2024-08-14T12:34:56Z"` + * - Note: Only filtering by start time is supported for ECG. Filtering + * by end time (e.g., `electrocardiogram.interval.end_time`) is not + * supported. + * - 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.devicesandservices.health.v4.DataPoint|DataPoint}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_points_service.list_data_points.js + * region_tag:health_v4_generated_DataPointsService_ListDataPoints_async + */ listDataPointsAsync( - request?: protos.google.devicesandservices.health.v4.IListDataPointsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.devicesandservices.health.v4.IListDataPointsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listDataPoints']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listDataPoints iterate %j', request); return this.descriptors.page.listDataPoints.asyncIterate( this.innerApiCalls['listDataPoints'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Reconcile data points from multiple data sources into a single data stream. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.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][google.devicesandservices.health.v4.DataPoint] union - * field. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * Optional. The `next_page_token` from a previous request, if any. - * @param {string} [request.filter] - * Optional. Filter expression based on https://aip.dev/160. - * - * A time range, either physical or civil, can be specified. - * See the - * {@link protos.google.devicesandservices.health.v4.ListDataPointsRequest.filter|ListDataPointsRequest.filter} - * for the supported fields and syntax. - * @param {string} [request.dataSourceFamily] - * 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 - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.devicesandservices.health.v4.ReconciledDataPoint|ReconciledDataPoint}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `reconcileDataPointsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Reconcile data points from multiple data sources into a single data stream. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.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][google.devicesandservices.health.v4.DataPoint] union + * field. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * Optional. The `next_page_token` from a previous request, if any. + * @param {string} [request.filter] + * Optional. Filter expression based on https://aip.dev/160. + * + * A time range, either physical or civil, can be specified. + * See the + * {@link protos.google.devicesandservices.health.v4.ListDataPointsRequest.filter|ListDataPointsRequest.filter} + * for the supported fields and syntax. + * @param {string} [request.dataSourceFamily] + * 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 + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.devicesandservices.health.v4.ReconciledDataPoint|ReconciledDataPoint}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `reconcileDataPointsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ reconcileDataPoints( - request?: protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, - options?: CallOptions): - Promise<[ - protos.google.devicesandservices.health.v4.IReconciledDataPoint[], - protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest|null, - protos.google.devicesandservices.health.v4.IReconcileDataPointsResponse - ]>; + request?: protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IReconciledDataPoint[], + protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest | null, + protos.google.devicesandservices.health.v4.IReconcileDataPointsResponse, + ] + >; reconcileDataPoints( - request: protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, - protos.google.devicesandservices.health.v4.IReconcileDataPointsResponse|null|undefined, - protos.google.devicesandservices.health.v4.IReconciledDataPoint>): void; + request: protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, + | protos.google.devicesandservices.health.v4.IReconcileDataPointsResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.IReconciledDataPoint + >, + ): void; reconcileDataPoints( - request: protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, - callback: PaginationCallback< - protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, - protos.google.devicesandservices.health.v4.IReconcileDataPointsResponse|null|undefined, - protos.google.devicesandservices.health.v4.IReconciledDataPoint>): void; + request: protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, + callback: PaginationCallback< + protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, + | protos.google.devicesandservices.health.v4.IReconcileDataPointsResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.IReconciledDataPoint + >, + ): void; reconcileDataPoints( - request?: protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, - protos.google.devicesandservices.health.v4.IReconcileDataPointsResponse|null|undefined, - protos.google.devicesandservices.health.v4.IReconciledDataPoint>, - callback?: PaginationCallback< + request?: protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, - protos.google.devicesandservices.health.v4.IReconcileDataPointsResponse|null|undefined, - protos.google.devicesandservices.health.v4.IReconciledDataPoint>): - Promise<[ - protos.google.devicesandservices.health.v4.IReconciledDataPoint[], - protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest|null, - protos.google.devicesandservices.health.v4.IReconcileDataPointsResponse - ]>|void { + | protos.google.devicesandservices.health.v4.IReconcileDataPointsResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.IReconciledDataPoint + >, + callback?: PaginationCallback< + protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, + | protos.google.devicesandservices.health.v4.IReconcileDataPointsResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.IReconciledDataPoint + >, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IReconciledDataPoint[], + protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest | null, + protos.google.devicesandservices.health.v4.IReconcileDataPointsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, - protos.google.devicesandservices.health.v4.IReconcileDataPointsResponse|null|undefined, - protos.google.devicesandservices.health.v4.IReconciledDataPoint>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, + | protos.google.devicesandservices.health.v4.IReconcileDataPointsResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.IReconciledDataPoint + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('reconcileDataPoints values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -1731,294 +2240,323 @@ export class DataPointsServiceClient { this._log.info('reconcileDataPoints request %j', request); return this.innerApiCalls .reconcileDataPoints(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.devicesandservices.health.v4.IReconciledDataPoint[], - protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest|null, - protos.google.devicesandservices.health.v4.IReconcileDataPointsResponse - ]) => { - this._log.info('reconcileDataPoints values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.devicesandservices.health.v4.IReconciledDataPoint[], + protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest | null, + protos.google.devicesandservices.health.v4.IReconcileDataPointsResponse, + ]) => { + this._log.info('reconcileDataPoints values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `reconcileDataPoints`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.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][google.devicesandservices.health.v4.DataPoint] union - * field. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * Optional. The `next_page_token` from a previous request, if any. - * @param {string} [request.filter] - * Optional. Filter expression based on https://aip.dev/160. - * - * A time range, either physical or civil, can be specified. - * See the - * {@link protos.google.devicesandservices.health.v4.ListDataPointsRequest.filter|ListDataPointsRequest.filter} - * for the supported fields and syntax. - * @param {string} [request.dataSourceFamily] - * 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 - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.devicesandservices.health.v4.ReconciledDataPoint|ReconciledDataPoint} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `reconcileDataPointsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `reconcileDataPoints`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.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][google.devicesandservices.health.v4.DataPoint] union + * field. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * Optional. The `next_page_token` from a previous request, if any. + * @param {string} [request.filter] + * Optional. Filter expression based on https://aip.dev/160. + * + * A time range, either physical or civil, can be specified. + * See the + * {@link protos.google.devicesandservices.health.v4.ListDataPointsRequest.filter|ListDataPointsRequest.filter} + * for the supported fields and syntax. + * @param {string} [request.dataSourceFamily] + * 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 + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.devicesandservices.health.v4.ReconciledDataPoint|ReconciledDataPoint} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `reconcileDataPointsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ reconcileDataPointsStream( - request?: protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['reconcileDataPoints']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('reconcileDataPoints stream %j', request); return this.descriptors.page.reconcileDataPoints.createStream( this.innerApiCalls.reconcileDataPoints as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `reconcileDataPoints`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.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][google.devicesandservices.health.v4.DataPoint] union - * field. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * Optional. The `next_page_token` from a previous request, if any. - * @param {string} [request.filter] - * Optional. Filter expression based on https://aip.dev/160. - * - * A time range, either physical or civil, can be specified. - * See the - * {@link protos.google.devicesandservices.health.v4.ListDataPointsRequest.filter|ListDataPointsRequest.filter} - * for the supported fields and syntax. - * @param {string} [request.dataSourceFamily] - * 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 - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.devicesandservices.health.v4.ReconciledDataPoint|ReconciledDataPoint}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v4/data_points_service.reconcile_data_points.js - * region_tag:health_v4_generated_DataPointsService_ReconcileDataPoints_async - */ + /** + * Equivalent to `reconcileDataPoints`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.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][google.devicesandservices.health.v4.DataPoint] union + * field. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * Optional. The `next_page_token` from a previous request, if any. + * @param {string} [request.filter] + * Optional. Filter expression based on https://aip.dev/160. + * + * A time range, either physical or civil, can be specified. + * See the + * {@link protos.google.devicesandservices.health.v4.ListDataPointsRequest.filter|ListDataPointsRequest.filter} + * for the supported fields and syntax. + * @param {string} [request.dataSourceFamily] + * 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 + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.devicesandservices.health.v4.ReconciledDataPoint|ReconciledDataPoint}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_points_service.reconcile_data_points.js + * region_tag:health_v4_generated_DataPointsService_ReconcileDataPoints_async + */ reconcileDataPointsAsync( - request?: protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.devicesandservices.health.v4.IReconcileDataPointsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['reconcileDataPoints']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('reconcileDataPoints iterate %j', request); return this.descriptors.page.reconcileDataPoints.asyncIterate( this.innerApiCalls['reconcileDataPoints'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } - /** - * Roll up data points over physical time intervals for supported data types. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.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][google.devicesandservices.health.v4.RollupDataPoint] - * union field. - * @param {google.type.Interval} request.range - * 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. - * @param {google.protobuf.Duration} request.windowSize - * Required. The size of the time window to group data points into before - * applying the aggregation functions. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {string} [request.dataSourceFamily] - * 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 - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.devicesandservices.health.v4.RollupDataPoint|RollupDataPoint}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `rollUpDataPointsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Roll up data points over physical time intervals for supported data types. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.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][google.devicesandservices.health.v4.RollupDataPoint] + * union field. + * @param {google.type.Interval} request.range + * 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. + * @param {google.protobuf.Duration} request.windowSize + * Required. The size of the time window to group data points into before + * applying the aggregation functions. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string} [request.dataSourceFamily] + * 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 + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.devicesandservices.health.v4.RollupDataPoint|RollupDataPoint}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `rollUpDataPointsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ rollUpDataPoints( - request?: protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, - options?: CallOptions): - Promise<[ - protos.google.devicesandservices.health.v4.IRollupDataPoint[], - protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest|null, - protos.google.devicesandservices.health.v4.IRollUpDataPointsResponse - ]>; + request?: protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IRollupDataPoint[], + protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest | null, + protos.google.devicesandservices.health.v4.IRollUpDataPointsResponse, + ] + >; rollUpDataPoints( - request: protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, - protos.google.devicesandservices.health.v4.IRollUpDataPointsResponse|null|undefined, - protos.google.devicesandservices.health.v4.IRollupDataPoint>): void; + request: protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, + | protos.google.devicesandservices.health.v4.IRollUpDataPointsResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.IRollupDataPoint + >, + ): void; rollUpDataPoints( - request: protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, - callback: PaginationCallback< - protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, - protos.google.devicesandservices.health.v4.IRollUpDataPointsResponse|null|undefined, - protos.google.devicesandservices.health.v4.IRollupDataPoint>): void; + request: protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, + callback: PaginationCallback< + protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, + | protos.google.devicesandservices.health.v4.IRollUpDataPointsResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.IRollupDataPoint + >, + ): void; rollUpDataPoints( - request?: protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, - protos.google.devicesandservices.health.v4.IRollUpDataPointsResponse|null|undefined, - protos.google.devicesandservices.health.v4.IRollupDataPoint>, - callback?: PaginationCallback< + request?: protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, - protos.google.devicesandservices.health.v4.IRollUpDataPointsResponse|null|undefined, - protos.google.devicesandservices.health.v4.IRollupDataPoint>): - Promise<[ - protos.google.devicesandservices.health.v4.IRollupDataPoint[], - protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest|null, - protos.google.devicesandservices.health.v4.IRollUpDataPointsResponse - ]>|void { + | protos.google.devicesandservices.health.v4.IRollUpDataPointsResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.IRollupDataPoint + >, + callback?: PaginationCallback< + protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, + | protos.google.devicesandservices.health.v4.IRollUpDataPointsResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.IRollupDataPoint + >, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IRollupDataPoint[], + protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest | null, + protos.google.devicesandservices.health.v4.IRollUpDataPointsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, - protos.google.devicesandservices.health.v4.IRollUpDataPointsResponse|null|undefined, - protos.google.devicesandservices.health.v4.IRollupDataPoint>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, + | protos.google.devicesandservices.health.v4.IRollUpDataPointsResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.IRollupDataPoint + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('rollUpDataPoints values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -2027,176 +2565,180 @@ export class DataPointsServiceClient { this._log.info('rollUpDataPoints request %j', request); return this.innerApiCalls .rollUpDataPoints(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.devicesandservices.health.v4.IRollupDataPoint[], - protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest|null, - protos.google.devicesandservices.health.v4.IRollUpDataPointsResponse - ]) => { - this._log.info('rollUpDataPoints values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.devicesandservices.health.v4.IRollupDataPoint[], + protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest | null, + protos.google.devicesandservices.health.v4.IRollUpDataPointsResponse, + ]) => { + this._log.info('rollUpDataPoints values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `rollUpDataPoints`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.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][google.devicesandservices.health.v4.RollupDataPoint] - * union field. - * @param {google.type.Interval} request.range - * 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. - * @param {google.protobuf.Duration} request.windowSize - * Required. The size of the time window to group data points into before - * applying the aggregation functions. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {string} [request.dataSourceFamily] - * 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 - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.devicesandservices.health.v4.RollupDataPoint|RollupDataPoint} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `rollUpDataPointsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `rollUpDataPoints`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.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][google.devicesandservices.health.v4.RollupDataPoint] + * union field. + * @param {google.type.Interval} request.range + * 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. + * @param {google.protobuf.Duration} request.windowSize + * Required. The size of the time window to group data points into before + * applying the aggregation functions. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string} [request.dataSourceFamily] + * 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 + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.devicesandservices.health.v4.RollupDataPoint|RollupDataPoint} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `rollUpDataPointsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ rollUpDataPointsStream( - request?: protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['rollUpDataPoints']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('rollUpDataPoints stream %j', request); return this.descriptors.page.rollUpDataPoints.createStream( this.innerApiCalls.rollUpDataPoints as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `rollUpDataPoints`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.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][google.devicesandservices.health.v4.RollupDataPoint] - * union field. - * @param {google.type.Interval} request.range - * 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. - * @param {google.protobuf.Duration} request.windowSize - * Required. The size of the time window to group data points into before - * applying the aggregation functions. - * @param {number} [request.pageSize] - * 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. - * @param {string} [request.pageToken] - * 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. - * @param {string} [request.dataSourceFamily] - * 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 - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.devicesandservices.health.v4.RollupDataPoint|RollupDataPoint}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v4/data_points_service.roll_up_data_points.js - * region_tag:health_v4_generated_DataPointsService_RollUpDataPoints_async - */ + /** + * Equivalent to `rollUpDataPoints`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.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][google.devicesandservices.health.v4.RollupDataPoint] + * union field. + * @param {google.type.Interval} request.range + * 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. + * @param {google.protobuf.Duration} request.windowSize + * Required. The size of the time window to group data points into before + * applying the aggregation functions. + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {string} [request.dataSourceFamily] + * 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 + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.devicesandservices.health.v4.RollupDataPoint|RollupDataPoint}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_points_service.roll_up_data_points.js + * region_tag:health_v4_generated_DataPointsService_RollUpDataPoints_async + */ rollUpDataPointsAsync( - request?: protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.devicesandservices.health.v4.IRollUpDataPointsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['rollUpDataPoints']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('rollUpDataPoints iterate %j', request); return this.descriptors.page.rollUpDataPoints.asyncIterate( this.innerApiCalls['rollUpDataPoints'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } // -------------------- @@ -2211,7 +2753,7 @@ export class DataPointsServiceClient { * @param {string} data_point * @returns {string} Resource name string. */ - dataPointPath(user:string,dataType:string,dataPoint:string) { + dataPointPath(user: string, dataType: string, dataPoint: string) { return this.pathTemplates.dataPointPathTemplate.render({ user: user, data_type: dataType, @@ -2238,7 +2780,8 @@ export class DataPointsServiceClient { * @returns {string} A string representing the data_type. */ matchDataTypeFromDataPointName(dataPointName: string) { - return this.pathTemplates.dataPointPathTemplate.match(dataPointName).data_type; + return this.pathTemplates.dataPointPathTemplate.match(dataPointName) + .data_type; } /** @@ -2249,7 +2792,8 @@ export class DataPointsServiceClient { * @returns {string} A string representing the data_point. */ matchDataPointFromDataPointName(dataPointName: string) { - return this.pathTemplates.dataPointPathTemplate.match(dataPointName).data_point; + return this.pathTemplates.dataPointPathTemplate.match(dataPointName) + .data_point; } /** @@ -2259,7 +2803,7 @@ export class DataPointsServiceClient { * @param {string} data_type * @returns {string} Resource name string. */ - dataTypePath(user:string,dataType:string) { + dataTypePath(user: string, dataType: string) { return this.pathTemplates.dataTypePathTemplate.render({ user: user, data_type: dataType, @@ -2285,7 +2829,8 @@ export class DataPointsServiceClient { * @returns {string} A string representing the data_type. */ matchDataTypeFromDataTypeName(dataTypeName: string) { - return this.pathTemplates.dataTypePathTemplate.match(dataTypeName).data_type; + return this.pathTemplates.dataTypePathTemplate.match(dataTypeName) + .data_type; } /** @@ -2294,7 +2839,7 @@ export class DataPointsServiceClient { * @param {string} user * @returns {string} Resource name string. */ - identityPath(user:string) { + identityPath(user: string) { return this.pathTemplates.identityPathTemplate.render({ user: user, }); @@ -2317,7 +2862,7 @@ export class DataPointsServiceClient { * @param {string} user * @returns {string} Resource name string. */ - profilePath(user:string) { + profilePath(user: string) { return this.pathTemplates.profilePathTemplate.render({ user: user, }); @@ -2340,7 +2885,7 @@ export class DataPointsServiceClient { * @param {string} user * @returns {string} Resource name string. */ - settingsPath(user:string) { + settingsPath(user: string) { return this.pathTemplates.settingsPathTemplate.render({ user: user, }); @@ -2357,6 +2902,44 @@ export class DataPointsServiceClient { return this.pathTemplates.settingsPathTemplate.match(settingsName).user; } + /** + * Return a fully-qualified subscriber resource name string. + * + * @param {string} project + * @param {string} subscriber + * @returns {string} Resource name string. + */ + subscriberPath(project: string, subscriber: string) { + return this.pathTemplates.subscriberPathTemplate.render({ + project: project, + subscriber: subscriber, + }); + } + + /** + * Parse the project from Subscriber resource. + * + * @param {string} subscriberName + * A fully-qualified path representing Subscriber resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSubscriberName(subscriberName: string) { + return this.pathTemplates.subscriberPathTemplate.match(subscriberName) + .project; + } + + /** + * Parse the subscriber from Subscriber resource. + * + * @param {string} subscriberName + * A fully-qualified path representing Subscriber resource. + * @returns {string} A string representing the subscriber. + */ + matchSubscriberFromSubscriberName(subscriberName: string) { + return this.pathTemplates.subscriberPathTemplate.match(subscriberName) + .subscriber; + } + /** * Terminate the gRPC channel and close the client. * @@ -2365,7 +2948,7 @@ export class DataPointsServiceClient { */ close(): Promise { if (this.dataPointsServiceStub && !this._terminated) { - return this.dataPointsServiceStub.then(stub => { + return this.dataPointsServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); @@ -2374,4 +2957,4 @@ export class DataPointsServiceClient { } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-devicesandservices-health/src/v4/data_points_service_client_config.json b/packages/google-devicesandservices-health/src/v4/data_points_service_client_config.json index 115cf1e2cb7e..32c12f29f8ae 100644 --- a/packages/google-devicesandservices-health/src/v4/data_points_service_client_config.json +++ b/packages/google-devicesandservices-health/src/v4/data_points_service_client_config.json @@ -33,8 +33,9 @@ }, "methods": { "GetDataPoint": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" }, "ListDataPoints": { "timeout_millis": 60000, diff --git a/packages/google-devicesandservices-health/src/v4/data_points_service_proto_list.json b/packages/google-devicesandservices-health/src/v4/data_points_service_proto_list.json index 83e0cabd2c8c..9f76dab553d3 100644 --- a/packages/google-devicesandservices-health/src/v4/data_points_service_proto_list.json +++ b/packages/google-devicesandservices-health/src/v4/data_points_service_proto_list.json @@ -3,6 +3,7 @@ "../../protos/google/devicesandservices/health/v4/data_model.proto", "../../protos/google/devicesandservices/health/v4/data_points.proto", "../../protos/google/devicesandservices/health/v4/data_source.proto", + "../../protos/google/devicesandservices/health/v4/data_subscription_service.proto", "../../protos/google/devicesandservices/health/v4/health_profile.proto", "../../protos/google/devicesandservices/health/v4/webhook_notification_cloud_log.proto" ] diff --git a/packages/google-devicesandservices-health/src/v4/data_subscription_service_client.ts b/packages/google-devicesandservices-health/src/v4/data_subscription_service_client.ts new file mode 100644 index 000000000000..21128cb0a520 --- /dev/null +++ b/packages/google-devicesandservices-health/src/v4/data_subscription_service_client.ts @@ -0,0 +1,1531 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + GrpcClientOptions, + LROperation, + PaginationCallback, + GaxCall, +} from 'google-gax'; +import { Transform } from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v4/data_subscription_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './data_subscription_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Data Subscription Service that allows clients (e.g., Fitbit 3P + * applications, internal Fitbit Services) to manage their subscriber endpoints. + * This service provides CRUD APIs for subscribers, + * and also offers functionalities for subscriber verification and statistics. + * @class + * @memberof v4 + */ +export class DataSubscriptionServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('health'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; + operationsClient: gax.OperationsClient; + dataSubscriptionServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of DataSubscriptionServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new DataSubscriptionServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this + .constructor as typeof DataSubscriptionServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'health.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + dataPointPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/dataTypes/{data_type}/dataPoints/{data_point}', + ), + dataTypePathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/dataTypes/{data_type}', + ), + identityPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/identity', + ), + profilePathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/profile', + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}', + ), + settingsPathTemplate: new this._gaxModule.PathTemplate( + 'users/{user}/settings', + ), + subscriberPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/subscribers/{subscriber}', + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listSubscribers: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'subscribers', + ), + }; + + const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = []; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createSubscriberResponse = protoFilesRoot.lookup( + '.google.devicesandservices.health.v4.Subscriber', + ) as gax.protobuf.Type; + const createSubscriberMetadata = protoFilesRoot.lookup( + '.google.devicesandservices.health.v4.CreateSubscriberMetadata', + ) as gax.protobuf.Type; + const updateSubscriberResponse = protoFilesRoot.lookup( + '.google.devicesandservices.health.v4.Subscriber', + ) as gax.protobuf.Type; + const updateSubscriberMetadata = protoFilesRoot.lookup( + '.google.devicesandservices.health.v4.UpdateSubscriberMetadata', + ) as gax.protobuf.Type; + const deleteSubscriberResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty', + ) as gax.protobuf.Type; + const deleteSubscriberMetadata = protoFilesRoot.lookup( + '.google.devicesandservices.health.v4.DeleteSubscriberMetadata', + ) as gax.protobuf.Type; + + this.descriptors.longrunning = { + createSubscriber: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createSubscriberResponse.decode.bind(createSubscriberResponse), + createSubscriberMetadata.decode.bind(createSubscriberMetadata), + ), + updateSubscriber: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateSubscriberResponse.decode.bind(updateSubscriberResponse), + updateSubscriberMetadata.decode.bind(updateSubscriberMetadata), + ), + deleteSubscriber: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteSubscriberResponse.decode.bind(deleteSubscriberResponse), + deleteSubscriberMetadata.decode.bind(deleteSubscriberMetadata), + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.devicesandservices.health.v4.DataSubscriptionService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.dataSubscriptionServiceStub) { + return this.dataSubscriptionServiceStub; + } + + // Put together the "service stub" for + // google.devicesandservices.health.v4.DataSubscriptionService. + this.dataSubscriptionServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.devicesandservices.health.v4.DataSubscriptionService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.devicesandservices.health.v4 + .DataSubscriptionService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const dataSubscriptionServiceStubMethods = [ + 'createSubscriber', + 'listSubscribers', + 'updateSubscriber', + 'deleteSubscriber', + ]; + for (const methodName of dataSubscriptionServiceStubMethods) { + const callPromise = this.dataSubscriptionServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.dataSubscriptionServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'health.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'health.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + /** + * 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 {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this subscriber will be created. + * Format: projects/{project} + * Example: projects/my-project-123 + * @param {google.devicesandservices.health.v4.CreateSubscriberPayload} request.subscriber + * Required. The subscriber to create. + * @param {string} [request.subscriberId] + * 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])/. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_subscription_service.create_subscriber.js + * region_tag:health_v4_generated_DataSubscriptionService_CreateSubscriber_async + */ + createSubscriber( + request?: protos.google.devicesandservices.health.v4.ICreateSubscriberRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.ICreateSubscriberMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + createSubscriber( + request: protos.google.devicesandservices.health.v4.ICreateSubscriberRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.ICreateSubscriberMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createSubscriber( + request: protos.google.devicesandservices.health.v4.ICreateSubscriberRequest, + callback: Callback< + LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.ICreateSubscriberMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + createSubscriber( + request?: protos.google.devicesandservices.health.v4.ICreateSubscriberRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.ICreateSubscriberMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.ICreateSubscriberMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.ICreateSubscriberMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.ICreateSubscriberMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('createSubscriber response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('createSubscriber request %j', request); + return this.innerApiCalls + .createSubscriber(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.ICreateSubscriberMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('createSubscriber response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `createSubscriber()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_subscription_service.create_subscriber.js + * region_tag:health_v4_generated_DataSubscriptionService_CreateSubscriber_async + */ + async checkCreateSubscriberProgress( + name: string, + ): Promise< + LROperation< + protos.google.devicesandservices.health.v4.Subscriber, + protos.google.devicesandservices.health.v4.CreateSubscriberMetadata + > + > { + this._log.info('createSubscriber long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.createSubscriber, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.devicesandservices.health.v4.Subscriber, + protos.google.devicesandservices.health.v4.CreateSubscriberMetadata + >; + } + /** + * 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 {Object} request + * The request object that will be sent. + * @param {google.devicesandservices.health.v4.Subscriber} request.subscriber + * Required. The subscriber resource to update. Its 'name' field is mapped to + * the URI, and the value of the 'name' field should be of the form: + * "projects/{project}/subscribers/{subscriber_id}". + * The remaining fields of the Subscriber object represent the new values + * for the corresponding fields in the existing subscriber resource. + * @param {google.protobuf.FieldMask} [request.updateMask] + * 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 + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_subscription_service.update_subscriber.js + * region_tag:health_v4_generated_DataSubscriptionService_UpdateSubscriber_async + */ + updateSubscriber( + request?: protos.google.devicesandservices.health.v4.IUpdateSubscriberRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.IUpdateSubscriberMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + updateSubscriber( + request: protos.google.devicesandservices.health.v4.IUpdateSubscriberRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.IUpdateSubscriberMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateSubscriber( + request: protos.google.devicesandservices.health.v4.IUpdateSubscriberRequest, + callback: Callback< + LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.IUpdateSubscriberMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + updateSubscriber( + request?: protos.google.devicesandservices.health.v4.IUpdateSubscriberRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.IUpdateSubscriberMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.IUpdateSubscriberMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.IUpdateSubscriberMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'subscriber.name': request.subscriber!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.IUpdateSubscriberMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('updateSubscriber response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('updateSubscriber request %j', request); + return this.innerApiCalls + .updateSubscriber(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.IUpdateSubscriberMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('updateSubscriber response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `updateSubscriber()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_subscription_service.update_subscriber.js + * region_tag:health_v4_generated_DataSubscriptionService_UpdateSubscriber_async + */ + async checkUpdateSubscriberProgress( + name: string, + ): Promise< + LROperation< + protos.google.devicesandservices.health.v4.Subscriber, + protos.google.devicesandservices.health.v4.UpdateSubscriberMetadata + > + > { + this._log.info('updateSubscriber long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.updateSubscriber, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.devicesandservices.health.v4.Subscriber, + protos.google.devicesandservices.health.v4.UpdateSubscriberMetadata + >; + } + /** + * Deletes a subscriber registration. This will stop all notifications + * to the subscriber's endpoint. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.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. + * @param {boolean} [request.force] + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_subscription_service.delete_subscriber.js + * region_tag:health_v4_generated_DataSubscriptionService_DeleteSubscriber_async + */ + deleteSubscriber( + request?: protos.google.devicesandservices.health.v4.IDeleteSubscriberRequest, + options?: CallOptions, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.devicesandservices.health.v4.IDeleteSubscriberMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + >; + deleteSubscriber( + request: protos.google.devicesandservices.health.v4.IDeleteSubscriberRequest, + options: CallOptions, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.devicesandservices.health.v4.IDeleteSubscriberMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteSubscriber( + request: protos.google.devicesandservices.health.v4.IDeleteSubscriberRequest, + callback: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.devicesandservices.health.v4.IDeleteSubscriberMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): void; + deleteSubscriber( + request?: protos.google.devicesandservices.health.v4.IDeleteSubscriberRequest, + optionsOrCallback?: + | CallOptions + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.devicesandservices.health.v4.IDeleteSubscriberMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + callback?: Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.devicesandservices.health.v4.IDeleteSubscriberMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.devicesandservices.health.v4.IDeleteSubscriberMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | Callback< + LROperation< + protos.google.protobuf.IEmpty, + protos.google.devicesandservices.health.v4.IDeleteSubscriberMetadata + >, + protos.google.longrunning.IOperation | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, rawResponse, _) => { + this._log.info('deleteSubscriber response %j', rawResponse); + callback!(error, response, rawResponse, _); // We verified callback above. + } + : undefined; + this._log.info('deleteSubscriber request %j', request); + return this.innerApiCalls + .deleteSubscriber(request, options, wrappedCallback) + ?.then( + ([response, rawResponse, _]: [ + LROperation< + protos.google.protobuf.IEmpty, + protos.google.devicesandservices.health.v4.IDeleteSubscriberMetadata + >, + protos.google.longrunning.IOperation | undefined, + {} | undefined, + ]) => { + this._log.info('deleteSubscriber response %j', rawResponse); + return [response, rawResponse, _]; + }, + ); + } + /** + * Check the status of the long running operation returned by `deleteSubscriber()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_subscription_service.delete_subscriber.js + * region_tag:health_v4_generated_DataSubscriptionService_DeleteSubscriber_async + */ + async checkDeleteSubscriberProgress( + name: string, + ): Promise< + LROperation< + protos.google.protobuf.Empty, + protos.google.devicesandservices.health.v4.DeleteSubscriberMetadata + > + > { + this._log.info('deleteSubscriber long-running'); + const request = + new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest( + { name }, + ); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation( + operation, + this.descriptors.longrunning.deleteSubscriber, + this._gaxModule.createDefaultBackoffSettings(), + ); + return decodeOperation as LROperation< + protos.google.protobuf.Empty, + protos.google.devicesandservices.health.v4.DeleteSubscriberMetadata + >; + } + /** + * Lists all subscribers registered within the owned Google Cloud Project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of subscribers. + * Format: projects/{project} + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.devicesandservices.health.v4.Subscriber|Subscriber}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listSubscribersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listSubscribers( + request?: protos.google.devicesandservices.health.v4.IListSubscribersRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.devicesandservices.health.v4.ISubscriber[], + protos.google.devicesandservices.health.v4.IListSubscribersRequest | null, + protos.google.devicesandservices.health.v4.IListSubscribersResponse, + ] + >; + listSubscribers( + request: protos.google.devicesandservices.health.v4.IListSubscribersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.devicesandservices.health.v4.IListSubscribersRequest, + | protos.google.devicesandservices.health.v4.IListSubscribersResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.ISubscriber + >, + ): void; + listSubscribers( + request: protos.google.devicesandservices.health.v4.IListSubscribersRequest, + callback: PaginationCallback< + protos.google.devicesandservices.health.v4.IListSubscribersRequest, + | protos.google.devicesandservices.health.v4.IListSubscribersResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.ISubscriber + >, + ): void; + listSubscribers( + request?: protos.google.devicesandservices.health.v4.IListSubscribersRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.devicesandservices.health.v4.IListSubscribersRequest, + | protos.google.devicesandservices.health.v4.IListSubscribersResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.ISubscriber + >, + callback?: PaginationCallback< + protos.google.devicesandservices.health.v4.IListSubscribersRequest, + | protos.google.devicesandservices.health.v4.IListSubscribersResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.ISubscriber + >, + ): Promise< + [ + protos.google.devicesandservices.health.v4.ISubscriber[], + protos.google.devicesandservices.health.v4.IListSubscribersRequest | null, + protos.google.devicesandservices.health.v4.IListSubscribersResponse, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.devicesandservices.health.v4.IListSubscribersRequest, + | protos.google.devicesandservices.health.v4.IListSubscribersResponse + | null + | undefined, + protos.google.devicesandservices.health.v4.ISubscriber + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listSubscribers values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listSubscribers request %j', request); + return this.innerApiCalls + .listSubscribers(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.devicesandservices.health.v4.ISubscriber[], + protos.google.devicesandservices.health.v4.IListSubscribersRequest | null, + protos.google.devicesandservices.health.v4.IListSubscribersResponse, + ]) => { + this._log.info('listSubscribers values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `listSubscribers`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of subscribers. + * Format: projects/{project} + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.devicesandservices.health.v4.Subscriber|Subscriber} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSubscribersAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listSubscribersStream( + request?: protos.google.devicesandservices.health.v4.IListSubscribersRequest, + options?: CallOptions, + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSubscribers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listSubscribers stream %j', request); + return this.descriptors.page.listSubscribers.createStream( + this.innerApiCalls.listSubscribers as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `listSubscribers`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent, which owns this collection of subscribers. + * Format: projects/{project} + * @param {number} [request.pageSize] + * 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. + * @param {string} [request.pageToken] + * 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. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.devicesandservices.health.v4.Subscriber|Subscriber}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v4/data_subscription_service.list_subscribers.js + * region_tag:health_v4_generated_DataSubscriptionService_ListSubscribers_async + */ + listSubscribersAsync( + request?: protos.google.devicesandservices.health.v4.IListSubscribersRequest, + options?: CallOptions, + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listSubscribers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listSubscribers iterate %j', request); + return this.descriptors.page.listSubscribers.asyncIterate( + this.innerApiCalls['listSubscribers'] as GaxCall, + request as {}, + callSettings, + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified dataPoint resource name string. + * + * @param {string} user + * @param {string} data_type + * @param {string} data_point + * @returns {string} Resource name string. + */ + dataPointPath(user: string, dataType: string, dataPoint: string) { + return this.pathTemplates.dataPointPathTemplate.render({ + user: user, + data_type: dataType, + data_point: dataPoint, + }); + } + + /** + * Parse the user from DataPoint resource. + * + * @param {string} dataPointName + * A fully-qualified path representing DataPoint resource. + * @returns {string} A string representing the user. + */ + matchUserFromDataPointName(dataPointName: string) { + return this.pathTemplates.dataPointPathTemplate.match(dataPointName).user; + } + + /** + * Parse the data_type from DataPoint resource. + * + * @param {string} dataPointName + * A fully-qualified path representing DataPoint resource. + * @returns {string} A string representing the data_type. + */ + matchDataTypeFromDataPointName(dataPointName: string) { + return this.pathTemplates.dataPointPathTemplate.match(dataPointName) + .data_type; + } + + /** + * Parse the data_point from DataPoint resource. + * + * @param {string} dataPointName + * A fully-qualified path representing DataPoint resource. + * @returns {string} A string representing the data_point. + */ + matchDataPointFromDataPointName(dataPointName: string) { + return this.pathTemplates.dataPointPathTemplate.match(dataPointName) + .data_point; + } + + /** + * Return a fully-qualified dataType resource name string. + * + * @param {string} user + * @param {string} data_type + * @returns {string} Resource name string. + */ + dataTypePath(user: string, dataType: string) { + return this.pathTemplates.dataTypePathTemplate.render({ + user: user, + data_type: dataType, + }); + } + + /** + * Parse the user from DataType resource. + * + * @param {string} dataTypeName + * A fully-qualified path representing DataType resource. + * @returns {string} A string representing the user. + */ + matchUserFromDataTypeName(dataTypeName: string) { + return this.pathTemplates.dataTypePathTemplate.match(dataTypeName).user; + } + + /** + * Parse the data_type from DataType resource. + * + * @param {string} dataTypeName + * A fully-qualified path representing DataType resource. + * @returns {string} A string representing the data_type. + */ + matchDataTypeFromDataTypeName(dataTypeName: string) { + return this.pathTemplates.dataTypePathTemplate.match(dataTypeName) + .data_type; + } + + /** + * Return a fully-qualified identity resource name string. + * + * @param {string} user + * @returns {string} Resource name string. + */ + identityPath(user: string) { + return this.pathTemplates.identityPathTemplate.render({ + user: user, + }); + } + + /** + * Parse the user from Identity resource. + * + * @param {string} identityName + * A fully-qualified path representing Identity resource. + * @returns {string} A string representing the user. + */ + matchUserFromIdentityName(identityName: string) { + return this.pathTemplates.identityPathTemplate.match(identityName).user; + } + + /** + * Return a fully-qualified profile resource name string. + * + * @param {string} user + * @returns {string} Resource name string. + */ + profilePath(user: string) { + return this.pathTemplates.profilePathTemplate.render({ + user: user, + }); + } + + /** + * Parse the user from Profile resource. + * + * @param {string} profileName + * A fully-qualified path representing Profile resource. + * @returns {string} A string representing the user. + */ + matchUserFromProfileName(profileName: string) { + return this.pathTemplates.profilePathTemplate.match(profileName).user; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified settings resource name string. + * + * @param {string} user + * @returns {string} Resource name string. + */ + settingsPath(user: string) { + return this.pathTemplates.settingsPathTemplate.render({ + user: user, + }); + } + + /** + * Parse the user from Settings resource. + * + * @param {string} settingsName + * A fully-qualified path representing Settings resource. + * @returns {string} A string representing the user. + */ + matchUserFromSettingsName(settingsName: string) { + return this.pathTemplates.settingsPathTemplate.match(settingsName).user; + } + + /** + * Return a fully-qualified subscriber resource name string. + * + * @param {string} project + * @param {string} subscriber + * @returns {string} Resource name string. + */ + subscriberPath(project: string, subscriber: string) { + return this.pathTemplates.subscriberPathTemplate.render({ + project: project, + subscriber: subscriber, + }); + } + + /** + * Parse the project from Subscriber resource. + * + * @param {string} subscriberName + * A fully-qualified path representing Subscriber resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSubscriberName(subscriberName: string) { + return this.pathTemplates.subscriberPathTemplate.match(subscriberName) + .project; + } + + /** + * Parse the subscriber from Subscriber resource. + * + * @param {string} subscriberName + * A fully-qualified path representing Subscriber resource. + * @returns {string} A string representing the subscriber. + */ + matchSubscriberFromSubscriberName(subscriberName: string) { + return this.pathTemplates.subscriberPathTemplate.match(subscriberName) + .subscriber; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.dataSubscriptionServiceStub && !this._terminated) { + return this.dataSubscriptionServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + void this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/packages/google-devicesandservices-health/src/v4/data_subscription_service_client_config.json b/packages/google-devicesandservices-health/src/v4/data_subscription_service_client_config.json new file mode 100644 index 000000000000..fe6998d224d7 --- /dev/null +++ b/packages/google-devicesandservices-health/src/v4/data_subscription_service_client_config.json @@ -0,0 +1,58 @@ +{ + "interfaces": { + "google.devicesandservices.health.v4.DataSubscriptionService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateSubscriber": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListSubscribers": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdateSubscriber": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteSubscriber": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/packages/google-devicesandservices-health/src/v4/data_subscription_service_proto_list.json b/packages/google-devicesandservices-health/src/v4/data_subscription_service_proto_list.json new file mode 100644 index 000000000000..9f76dab553d3 --- /dev/null +++ b/packages/google-devicesandservices-health/src/v4/data_subscription_service_proto_list.json @@ -0,0 +1,9 @@ +[ + "../../protos/google/devicesandservices/health/v4/data_coordinates.proto", + "../../protos/google/devicesandservices/health/v4/data_model.proto", + "../../protos/google/devicesandservices/health/v4/data_points.proto", + "../../protos/google/devicesandservices/health/v4/data_source.proto", + "../../protos/google/devicesandservices/health/v4/data_subscription_service.proto", + "../../protos/google/devicesandservices/health/v4/health_profile.proto", + "../../protos/google/devicesandservices/health/v4/webhook_notification_cloud_log.proto" +] diff --git a/packages/google-devicesandservices-health/src/v4/gapic_metadata.json b/packages/google-devicesandservices-health/src/v4/gapic_metadata.json index d68477a6bf05..74c2a1b1980d 100644 --- a/packages/google-devicesandservices-health/src/v4/gapic_metadata.json +++ b/packages/google-devicesandservices-health/src/v4/gapic_metadata.json @@ -121,6 +121,64 @@ } } }, + "DataSubscriptionService": { + "clients": { + "grpc": { + "libraryClient": "DataSubscriptionServiceClient", + "rpcs": { + "CreateSubscriber": { + "methods": [ + "createSubscriber" + ] + }, + "UpdateSubscriber": { + "methods": [ + "updateSubscriber" + ] + }, + "DeleteSubscriber": { + "methods": [ + "deleteSubscriber" + ] + }, + "ListSubscribers": { + "methods": [ + "listSubscribers", + "listSubscribersStream", + "listSubscribersAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DataSubscriptionServiceClient", + "rpcs": { + "CreateSubscriber": { + "methods": [ + "createSubscriber" + ] + }, + "UpdateSubscriber": { + "methods": [ + "updateSubscriber" + ] + }, + "DeleteSubscriber": { + "methods": [ + "deleteSubscriber" + ] + }, + "ListSubscribers": { + "methods": [ + "listSubscribers", + "listSubscribersStream", + "listSubscribersAsync" + ] + } + } + } + } + }, "HealthProfileService": { "clients": { "grpc": { diff --git a/packages/google-devicesandservices-health/src/v4/health_profile_service_client.ts b/packages/google-devicesandservices-health/src/v4/health_profile_service_client.ts index d00ca6d2fbe3..884506ae6de6 100644 --- a/packages/google-devicesandservices-health/src/v4/health_profile_service_client.ts +++ b/packages/google-devicesandservices-health/src/v4/health_profile_service_client.ts @@ -18,11 +18,16 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +49,7 @@ export class HealthProfileServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('health'); @@ -57,9 +62,9 @@ export class HealthProfileServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - healthProfileServiceStub?: Promise<{[name: string]: Function}>; + innerApiCalls: { [name: string]: Function }; + pathTemplates: { [name: string]: gax.PathTemplate }; + healthProfileServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of HealthProfileServiceClient. @@ -100,21 +105,42 @@ export class HealthProfileServiceClient { * const client = new HealthProfileServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof HealthProfileServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'health.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -139,7 +165,7 @@ export class HealthProfileServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -153,10 +179,7 @@ export class HealthProfileServiceClient { } // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -178,26 +201,32 @@ export class HealthProfileServiceClient { // Create useful helper objects for these. this.pathTemplates = { dataPointPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/dataTypes/{data_type}/dataPoints/{data_point}' + 'users/{user}/dataTypes/{data_type}/dataPoints/{data_point}', ), dataTypePathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/dataTypes/{data_type}' + 'users/{user}/dataTypes/{data_type}', ), identityPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/identity' + 'users/{user}/identity', ), profilePathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/profile' + 'users/{user}/profile', ), settingsPathTemplate: new this._gaxModule.PathTemplate( - 'users/{user}/settings' + 'users/{user}/settings', + ), + subscriberPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/subscribers/{subscriber}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.devicesandservices.health.v4.HealthProfileService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.devicesandservices.health.v4.HealthProfileService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -228,36 +257,47 @@ export class HealthProfileServiceClient { // Put together the "service stub" for // google.devicesandservices.health.v4.HealthProfileService. this.healthProfileServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.devicesandservices.health.v4.HealthProfileService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.devicesandservices.health.v4.HealthProfileService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.devicesandservices.health.v4.HealthProfileService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.devicesandservices.health.v4 + .HealthProfileService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const healthProfileServiceStubMethods = - ['getProfile', 'updateProfile', 'getSettings', 'updateSettings', 'getIdentity']; + const healthProfileServiceStubMethods = [ + 'getProfile', + 'updateProfile', + 'getSettings', + 'updateSettings', + 'getIdentity', + ]; for (const methodName of healthProfileServiceStubMethods) { const callPromise = this.healthProfileServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -272,8 +312,14 @@ export class HealthProfileServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'health.googleapis.com'; } @@ -284,8 +330,14 @@ export class HealthProfileServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'health.googleapis.com'; } @@ -321,7 +373,7 @@ export class HealthProfileServiceClient { 'https://www.googleapis.com/auth/googlehealth.health_metrics_and_measurements.readonly', 'https://www.googleapis.com/auth/googlehealth.profile.readonly', 'https://www.googleapis.com/auth/googlehealth.settings.readonly', - 'https://www.googleapis.com/auth/googlehealth.sleep.readonly' + 'https://www.googleapis.com/auth/googlehealth.sleep.readonly', ]; } @@ -331,8 +383,9 @@ export class HealthProfileServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -343,482 +396,721 @@ export class HealthProfileServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Returns user Profile details. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Profile. - * Format: `users/me/profile`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devicesandservices.health.v4.Profile|Profile}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v4/health_profile_service.get_profile.js - * region_tag:health_v4_generated_HealthProfileService_GetProfile_async - */ + /** + * Returns user Profile details. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Profile. + * Format: `users/me/profile`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devicesandservices.health.v4.Profile|Profile}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v4/health_profile_service.get_profile.js + * region_tag:health_v4_generated_HealthProfileService_GetProfile_async + */ getProfile( - request?: protos.google.devicesandservices.health.v4.IGetProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.devicesandservices.health.v4.IProfile, - protos.google.devicesandservices.health.v4.IGetProfileRequest|undefined, {}|undefined - ]>; + request?: protos.google.devicesandservices.health.v4.IGetProfileRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IProfile, + protos.google.devicesandservices.health.v4.IGetProfileRequest | undefined, + {} | undefined, + ] + >; getProfile( - request: protos.google.devicesandservices.health.v4.IGetProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.devicesandservices.health.v4.IProfile, - protos.google.devicesandservices.health.v4.IGetProfileRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IGetProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.devicesandservices.health.v4.IProfile, + | protos.google.devicesandservices.health.v4.IGetProfileRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getProfile( - request: protos.google.devicesandservices.health.v4.IGetProfileRequest, - callback: Callback< - protos.google.devicesandservices.health.v4.IProfile, - protos.google.devicesandservices.health.v4.IGetProfileRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IGetProfileRequest, + callback: Callback< + protos.google.devicesandservices.health.v4.IProfile, + | protos.google.devicesandservices.health.v4.IGetProfileRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getProfile( - request?: protos.google.devicesandservices.health.v4.IGetProfileRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.devicesandservices.health.v4.IGetProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.devicesandservices.health.v4.IProfile, - protos.google.devicesandservices.health.v4.IGetProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devicesandservices.health.v4.IProfile, - protos.google.devicesandservices.health.v4.IGetProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devicesandservices.health.v4.IProfile, - protos.google.devicesandservices.health.v4.IGetProfileRequest|undefined, {}|undefined - ]>|void { + | protos.google.devicesandservices.health.v4.IGetProfileRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.devicesandservices.health.v4.IProfile, + | protos.google.devicesandservices.health.v4.IGetProfileRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IProfile, + protos.google.devicesandservices.health.v4.IGetProfileRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getProfile request %j', request); - const wrappedCallback: Callback< - protos.google.devicesandservices.health.v4.IProfile, - protos.google.devicesandservices.health.v4.IGetProfileRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.devicesandservices.health.v4.IProfile, + | protos.google.devicesandservices.health.v4.IGetProfileRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getProfile response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getProfile(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.devicesandservices.health.v4.IProfile, - protos.google.devicesandservices.health.v4.IGetProfileRequest|undefined, - {}|undefined - ]) => { - this._log.info('getProfile response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getProfile(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.devicesandservices.health.v4.IProfile, + ( + | protos.google.devicesandservices.health.v4.IGetProfileRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getProfile response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates the user's profile details. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devicesandservices.health.v4.Profile} request.profile - * Required. Profile details. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to be updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devicesandservices.health.v4.Profile|Profile}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v4/health_profile_service.update_profile.js - * region_tag:health_v4_generated_HealthProfileService_UpdateProfile_async - */ + /** + * Updates the user's profile details. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devicesandservices.health.v4.Profile} request.profile + * Required. Profile details. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devicesandservices.health.v4.Profile|Profile}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v4/health_profile_service.update_profile.js + * region_tag:health_v4_generated_HealthProfileService_UpdateProfile_async + */ updateProfile( - request?: protos.google.devicesandservices.health.v4.IUpdateProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.devicesandservices.health.v4.IProfile, - protos.google.devicesandservices.health.v4.IUpdateProfileRequest|undefined, {}|undefined - ]>; + request?: protos.google.devicesandservices.health.v4.IUpdateProfileRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IProfile, + ( + | protos.google.devicesandservices.health.v4.IUpdateProfileRequest + | undefined + ), + {} | undefined, + ] + >; updateProfile( - request: protos.google.devicesandservices.health.v4.IUpdateProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.devicesandservices.health.v4.IProfile, - protos.google.devicesandservices.health.v4.IUpdateProfileRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IUpdateProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.devicesandservices.health.v4.IProfile, + | protos.google.devicesandservices.health.v4.IUpdateProfileRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateProfile( - request: protos.google.devicesandservices.health.v4.IUpdateProfileRequest, - callback: Callback< - protos.google.devicesandservices.health.v4.IProfile, - protos.google.devicesandservices.health.v4.IUpdateProfileRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IUpdateProfileRequest, + callback: Callback< + protos.google.devicesandservices.health.v4.IProfile, + | protos.google.devicesandservices.health.v4.IUpdateProfileRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateProfile( - request?: protos.google.devicesandservices.health.v4.IUpdateProfileRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.devicesandservices.health.v4.IUpdateProfileRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.devicesandservices.health.v4.IProfile, - protos.google.devicesandservices.health.v4.IUpdateProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devicesandservices.health.v4.IProfile, - protos.google.devicesandservices.health.v4.IUpdateProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devicesandservices.health.v4.IProfile, - protos.google.devicesandservices.health.v4.IUpdateProfileRequest|undefined, {}|undefined - ]>|void { + | protos.google.devicesandservices.health.v4.IUpdateProfileRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.devicesandservices.health.v4.IProfile, + | protos.google.devicesandservices.health.v4.IUpdateProfileRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IProfile, + ( + | protos.google.devicesandservices.health.v4.IUpdateProfileRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'profile.name': request.profile!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'profile.name': request.profile!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateProfile request %j', request); - const wrappedCallback: Callback< - protos.google.devicesandservices.health.v4.IProfile, - protos.google.devicesandservices.health.v4.IUpdateProfileRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.devicesandservices.health.v4.IProfile, + | protos.google.devicesandservices.health.v4.IUpdateProfileRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateProfile response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateProfile(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.devicesandservices.health.v4.IProfile, - protos.google.devicesandservices.health.v4.IUpdateProfileRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateProfile response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .updateProfile(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.devicesandservices.health.v4.IProfile, + ( + | protos.google.devicesandservices.health.v4.IUpdateProfileRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('updateProfile response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Returns user settings details. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Settings. - * Format: `users/me/settings`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devicesandservices.health.v4.Settings|Settings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v4/health_profile_service.get_settings.js - * region_tag:health_v4_generated_HealthProfileService_GetSettings_async - */ + /** + * Returns user settings details. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Settings. + * Format: `users/me/settings`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devicesandservices.health.v4.Settings|Settings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v4/health_profile_service.get_settings.js + * region_tag:health_v4_generated_HealthProfileService_GetSettings_async + */ getSettings( - request?: protos.google.devicesandservices.health.v4.IGetSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.devicesandservices.health.v4.ISettings, - protos.google.devicesandservices.health.v4.IGetSettingsRequest|undefined, {}|undefined - ]>; + request?: protos.google.devicesandservices.health.v4.IGetSettingsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.devicesandservices.health.v4.ISettings, + ( + | protos.google.devicesandservices.health.v4.IGetSettingsRequest + | undefined + ), + {} | undefined, + ] + >; getSettings( - request: protos.google.devicesandservices.health.v4.IGetSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.devicesandservices.health.v4.ISettings, - protos.google.devicesandservices.health.v4.IGetSettingsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IGetSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.devicesandservices.health.v4.ISettings, + | protos.google.devicesandservices.health.v4.IGetSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSettings( - request: protos.google.devicesandservices.health.v4.IGetSettingsRequest, - callback: Callback< - protos.google.devicesandservices.health.v4.ISettings, - protos.google.devicesandservices.health.v4.IGetSettingsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IGetSettingsRequest, + callback: Callback< + protos.google.devicesandservices.health.v4.ISettings, + | protos.google.devicesandservices.health.v4.IGetSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getSettings( - request?: protos.google.devicesandservices.health.v4.IGetSettingsRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.devicesandservices.health.v4.IGetSettingsRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.devicesandservices.health.v4.ISettings, - protos.google.devicesandservices.health.v4.IGetSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devicesandservices.health.v4.ISettings, - protos.google.devicesandservices.health.v4.IGetSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devicesandservices.health.v4.ISettings, - protos.google.devicesandservices.health.v4.IGetSettingsRequest|undefined, {}|undefined - ]>|void { + | protos.google.devicesandservices.health.v4.IGetSettingsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.devicesandservices.health.v4.ISettings, + | protos.google.devicesandservices.health.v4.IGetSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.devicesandservices.health.v4.ISettings, + ( + | protos.google.devicesandservices.health.v4.IGetSettingsRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getSettings request %j', request); - const wrappedCallback: Callback< - protos.google.devicesandservices.health.v4.ISettings, - protos.google.devicesandservices.health.v4.IGetSettingsRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.devicesandservices.health.v4.ISettings, + | protos.google.devicesandservices.health.v4.IGetSettingsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getSettings response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getSettings(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.devicesandservices.health.v4.ISettings, - protos.google.devicesandservices.health.v4.IGetSettingsRequest|undefined, - {}|undefined - ]) => { - this._log.info('getSettings response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getSettings(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.devicesandservices.health.v4.ISettings, + ( + | protos.google.devicesandservices.health.v4.IGetSettingsRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getSettings response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates the user's settings details. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.devicesandservices.health.v4.Settings} request.settings - * Required. Settings details - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. The list of fields to be updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devicesandservices.health.v4.Settings|Settings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v4/health_profile_service.update_settings.js - * region_tag:health_v4_generated_HealthProfileService_UpdateSettings_async - */ + /** + * Updates the user's settings details. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.devicesandservices.health.v4.Settings} request.settings + * Required. Settings details + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. The list of fields to be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devicesandservices.health.v4.Settings|Settings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v4/health_profile_service.update_settings.js + * region_tag:health_v4_generated_HealthProfileService_UpdateSettings_async + */ updateSettings( - request?: protos.google.devicesandservices.health.v4.IUpdateSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.devicesandservices.health.v4.ISettings, - protos.google.devicesandservices.health.v4.IUpdateSettingsRequest|undefined, {}|undefined - ]>; + request?: protos.google.devicesandservices.health.v4.IUpdateSettingsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.devicesandservices.health.v4.ISettings, + ( + | protos.google.devicesandservices.health.v4.IUpdateSettingsRequest + | undefined + ), + {} | undefined, + ] + >; updateSettings( - request: protos.google.devicesandservices.health.v4.IUpdateSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.devicesandservices.health.v4.ISettings, - protos.google.devicesandservices.health.v4.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IUpdateSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.devicesandservices.health.v4.ISettings, + | protos.google.devicesandservices.health.v4.IUpdateSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateSettings( - request: protos.google.devicesandservices.health.v4.IUpdateSettingsRequest, - callback: Callback< - protos.google.devicesandservices.health.v4.ISettings, - protos.google.devicesandservices.health.v4.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IUpdateSettingsRequest, + callback: Callback< + protos.google.devicesandservices.health.v4.ISettings, + | protos.google.devicesandservices.health.v4.IUpdateSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; updateSettings( - request?: protos.google.devicesandservices.health.v4.IUpdateSettingsRequest, - optionsOrCallback?: CallOptions|Callback< + request?: protos.google.devicesandservices.health.v4.IUpdateSettingsRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.devicesandservices.health.v4.ISettings, - protos.google.devicesandservices.health.v4.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.devicesandservices.health.v4.ISettings, - protos.google.devicesandservices.health.v4.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devicesandservices.health.v4.ISettings, - protos.google.devicesandservices.health.v4.IUpdateSettingsRequest|undefined, {}|undefined - ]>|void { + | protos.google.devicesandservices.health.v4.IUpdateSettingsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.devicesandservices.health.v4.ISettings, + | protos.google.devicesandservices.health.v4.IUpdateSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.devicesandservices.health.v4.ISettings, + ( + | protos.google.devicesandservices.health.v4.IUpdateSettingsRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'settings.name': request.settings!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'settings.name': request.settings!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateSettings request %j', request); - const wrappedCallback: Callback< - protos.google.devicesandservices.health.v4.ISettings, - protos.google.devicesandservices.health.v4.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.devicesandservices.health.v4.ISettings, + | protos.google.devicesandservices.health.v4.IUpdateSettingsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateSettings response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateSettings(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.devicesandservices.health.v4.ISettings, - protos.google.devicesandservices.health.v4.IUpdateSettingsRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateSettings response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .updateSettings(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.devicesandservices.health.v4.ISettings, + ( + | protos.google.devicesandservices.health.v4.IUpdateSettingsRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('updateSettings response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * 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 {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the Identity. - * Format: `users/me/identity` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.devicesandservices.health.v4.Identity|Identity}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v4/health_profile_service.get_identity.js - * region_tag:health_v4_generated_HealthProfileService_GetIdentity_async - */ + /** + * 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 {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the Identity. + * Format: `users/me/identity` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.devicesandservices.health.v4.Identity|Identity}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v4/health_profile_service.get_identity.js + * region_tag:health_v4_generated_HealthProfileService_GetIdentity_async + */ getIdentity( - request?: protos.google.devicesandservices.health.v4.IGetIdentityRequest, - options?: CallOptions): - Promise<[ - protos.google.devicesandservices.health.v4.IIdentity, - protos.google.devicesandservices.health.v4.IGetIdentityRequest|undefined, {}|undefined - ]>; + request?: protos.google.devicesandservices.health.v4.IGetIdentityRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IIdentity, + ( + | protos.google.devicesandservices.health.v4.IGetIdentityRequest + | undefined + ), + {} | undefined, + ] + >; getIdentity( - request: protos.google.devicesandservices.health.v4.IGetIdentityRequest, - options: CallOptions, - callback: Callback< - protos.google.devicesandservices.health.v4.IIdentity, - protos.google.devicesandservices.health.v4.IGetIdentityRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IGetIdentityRequest, + options: CallOptions, + callback: Callback< + protos.google.devicesandservices.health.v4.IIdentity, + | protos.google.devicesandservices.health.v4.IGetIdentityRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getIdentity( - request: protos.google.devicesandservices.health.v4.IGetIdentityRequest, - callback: Callback< - protos.google.devicesandservices.health.v4.IIdentity, - protos.google.devicesandservices.health.v4.IGetIdentityRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.devicesandservices.health.v4.IGetIdentityRequest, + callback: Callback< + protos.google.devicesandservices.health.v4.IIdentity, + | protos.google.devicesandservices.health.v4.IGetIdentityRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getIdentity( - request?: protos.google.devicesandservices.health.v4.IGetIdentityRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.devicesandservices.health.v4.IIdentity, - protos.google.devicesandservices.health.v4.IGetIdentityRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.devicesandservices.health.v4.IGetIdentityRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.devicesandservices.health.v4.IIdentity, - protos.google.devicesandservices.health.v4.IGetIdentityRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.devicesandservices.health.v4.IIdentity, - protos.google.devicesandservices.health.v4.IGetIdentityRequest|undefined, {}|undefined - ]>|void { + | protos.google.devicesandservices.health.v4.IGetIdentityRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.devicesandservices.health.v4.IIdentity, + | protos.google.devicesandservices.health.v4.IGetIdentityRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.devicesandservices.health.v4.IIdentity, + ( + | protos.google.devicesandservices.health.v4.IGetIdentityRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getIdentity request %j', request); - const wrappedCallback: Callback< - protos.google.devicesandservices.health.v4.IIdentity, - protos.google.devicesandservices.health.v4.IGetIdentityRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.devicesandservices.health.v4.IIdentity, + | protos.google.devicesandservices.health.v4.IGetIdentityRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getIdentity response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getIdentity(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.devicesandservices.health.v4.IIdentity, - protos.google.devicesandservices.health.v4.IGetIdentityRequest|undefined, - {}|undefined - ]) => { - this._log.info('getIdentity response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getIdentity(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.devicesandservices.health.v4.IIdentity, + ( + | protos.google.devicesandservices.health.v4.IGetIdentityRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getIdentity response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); @@ -836,7 +1128,7 @@ export class HealthProfileServiceClient { * @param {string} data_point * @returns {string} Resource name string. */ - dataPointPath(user:string,dataType:string,dataPoint:string) { + dataPointPath(user: string, dataType: string, dataPoint: string) { return this.pathTemplates.dataPointPathTemplate.render({ user: user, data_type: dataType, @@ -863,7 +1155,8 @@ export class HealthProfileServiceClient { * @returns {string} A string representing the data_type. */ matchDataTypeFromDataPointName(dataPointName: string) { - return this.pathTemplates.dataPointPathTemplate.match(dataPointName).data_type; + return this.pathTemplates.dataPointPathTemplate.match(dataPointName) + .data_type; } /** @@ -874,7 +1167,8 @@ export class HealthProfileServiceClient { * @returns {string} A string representing the data_point. */ matchDataPointFromDataPointName(dataPointName: string) { - return this.pathTemplates.dataPointPathTemplate.match(dataPointName).data_point; + return this.pathTemplates.dataPointPathTemplate.match(dataPointName) + .data_point; } /** @@ -884,7 +1178,7 @@ export class HealthProfileServiceClient { * @param {string} data_type * @returns {string} Resource name string. */ - dataTypePath(user:string,dataType:string) { + dataTypePath(user: string, dataType: string) { return this.pathTemplates.dataTypePathTemplate.render({ user: user, data_type: dataType, @@ -910,7 +1204,8 @@ export class HealthProfileServiceClient { * @returns {string} A string representing the data_type. */ matchDataTypeFromDataTypeName(dataTypeName: string) { - return this.pathTemplates.dataTypePathTemplate.match(dataTypeName).data_type; + return this.pathTemplates.dataTypePathTemplate.match(dataTypeName) + .data_type; } /** @@ -919,7 +1214,7 @@ export class HealthProfileServiceClient { * @param {string} user * @returns {string} Resource name string. */ - identityPath(user:string) { + identityPath(user: string) { return this.pathTemplates.identityPathTemplate.render({ user: user, }); @@ -942,7 +1237,7 @@ export class HealthProfileServiceClient { * @param {string} user * @returns {string} Resource name string. */ - profilePath(user:string) { + profilePath(user: string) { return this.pathTemplates.profilePathTemplate.render({ user: user, }); @@ -965,7 +1260,7 @@ export class HealthProfileServiceClient { * @param {string} user * @returns {string} Resource name string. */ - settingsPath(user:string) { + settingsPath(user: string) { return this.pathTemplates.settingsPathTemplate.render({ user: user, }); @@ -982,6 +1277,44 @@ export class HealthProfileServiceClient { return this.pathTemplates.settingsPathTemplate.match(settingsName).user; } + /** + * Return a fully-qualified subscriber resource name string. + * + * @param {string} project + * @param {string} subscriber + * @returns {string} Resource name string. + */ + subscriberPath(project: string, subscriber: string) { + return this.pathTemplates.subscriberPathTemplate.render({ + project: project, + subscriber: subscriber, + }); + } + + /** + * Parse the project from Subscriber resource. + * + * @param {string} subscriberName + * A fully-qualified path representing Subscriber resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSubscriberName(subscriberName: string) { + return this.pathTemplates.subscriberPathTemplate.match(subscriberName) + .project; + } + + /** + * Parse the subscriber from Subscriber resource. + * + * @param {string} subscriberName + * A fully-qualified path representing Subscriber resource. + * @returns {string} A string representing the subscriber. + */ + matchSubscriberFromSubscriberName(subscriberName: string) { + return this.pathTemplates.subscriberPathTemplate.match(subscriberName) + .subscriber; + } + /** * Terminate the gRPC channel and close the client. * @@ -990,7 +1323,7 @@ export class HealthProfileServiceClient { */ close(): Promise { if (this.healthProfileServiceStub && !this._terminated) { - return this.healthProfileServiceStub.then(stub => { + return this.healthProfileServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); @@ -998,4 +1331,4 @@ export class HealthProfileServiceClient { } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-devicesandservices-health/src/v4/health_profile_service_client_config.json b/packages/google-devicesandservices-health/src/v4/health_profile_service_client_config.json index 1bbf177e8922..497df9af9780 100644 --- a/packages/google-devicesandservices-health/src/v4/health_profile_service_client_config.json +++ b/packages/google-devicesandservices-health/src/v4/health_profile_service_client_config.json @@ -53,8 +53,9 @@ "retry_params_name": "default" }, "GetIdentity": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" } } } diff --git a/packages/google-devicesandservices-health/src/v4/health_profile_service_proto_list.json b/packages/google-devicesandservices-health/src/v4/health_profile_service_proto_list.json index 83e0cabd2c8c..9f76dab553d3 100644 --- a/packages/google-devicesandservices-health/src/v4/health_profile_service_proto_list.json +++ b/packages/google-devicesandservices-health/src/v4/health_profile_service_proto_list.json @@ -3,6 +3,7 @@ "../../protos/google/devicesandservices/health/v4/data_model.proto", "../../protos/google/devicesandservices/health/v4/data_points.proto", "../../protos/google/devicesandservices/health/v4/data_source.proto", + "../../protos/google/devicesandservices/health/v4/data_subscription_service.proto", "../../protos/google/devicesandservices/health/v4/health_profile.proto", "../../protos/google/devicesandservices/health/v4/webhook_notification_cloud_log.proto" ] diff --git a/packages/google-devicesandservices-health/src/v4/index.ts b/packages/google-devicesandservices-health/src/v4/index.ts index ff65b47ecbeb..999fa5214042 100644 --- a/packages/google-devicesandservices-health/src/v4/index.ts +++ b/packages/google-devicesandservices-health/src/v4/index.ts @@ -16,5 +16,6 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {DataPointsServiceClient} from './data_points_service_client'; -export {HealthProfileServiceClient} from './health_profile_service_client'; +export { DataPointsServiceClient } from './data_points_service_client'; +export { DataSubscriptionServiceClient } from './data_subscription_service_client'; +export { HealthProfileServiceClient } from './health_profile_service_client'; diff --git a/packages/google-devicesandservices-health/system-test/fixtures/sample/src/index.js b/packages/google-devicesandservices-health/system-test/fixtures/sample/src/index.js index 9231dc3b7862..8633e2fe2ff2 100644 --- a/packages/google-devicesandservices-health/system-test/fixtures/sample/src/index.js +++ b/packages/google-devicesandservices-health/system-test/fixtures/sample/src/index.js @@ -22,6 +22,7 @@ const health = require('@google-cloud/health'); function main() { const dataPointsServiceClient = new health.DataPointsServiceClient(); + const dataSubscriptionServiceClient = new health.DataSubscriptionServiceClient(); const healthProfileServiceClient = new health.HealthProfileServiceClient(); } diff --git a/packages/google-devicesandservices-health/system-test/fixtures/sample/src/index.ts b/packages/google-devicesandservices-health/system-test/fixtures/sample/src/index.ts index 284ceef5762a..742222903e2a 100644 --- a/packages/google-devicesandservices-health/system-test/fixtures/sample/src/index.ts +++ b/packages/google-devicesandservices-health/system-test/fixtures/sample/src/index.ts @@ -16,13 +16,24 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {DataPointsServiceClient, HealthProfileServiceClient} from '@google-cloud/health'; +import { + DataPointsServiceClient, + DataSubscriptionServiceClient, + HealthProfileServiceClient, +} from '@google-cloud/health'; // check that the client class type name can be used function doStuffWithDataPointsServiceClient(client: DataPointsServiceClient) { client.close(); } -function doStuffWithHealthProfileServiceClient(client: HealthProfileServiceClient) { +function doStuffWithDataSubscriptionServiceClient( + client: DataSubscriptionServiceClient, +) { + client.close(); +} +function doStuffWithHealthProfileServiceClient( + client: HealthProfileServiceClient, +) { client.close(); } @@ -31,6 +42,9 @@ function main() { const dataPointsServiceClient = new DataPointsServiceClient(); doStuffWithDataPointsServiceClient(dataPointsServiceClient); // check that the client instance can be created + const dataSubscriptionServiceClient = new DataSubscriptionServiceClient(); + doStuffWithDataSubscriptionServiceClient(dataSubscriptionServiceClient); + // check that the client instance can be created const healthProfileServiceClient = new HealthProfileServiceClient(); doStuffWithHealthProfileServiceClient(healthProfileServiceClient); } diff --git a/packages/google-devicesandservices-health/system-test/install.ts b/packages/google-devicesandservices-health/system-test/install.ts index f66069aa3940..ccf167042d2e 100644 --- a/packages/google-devicesandservices-health/system-test/install.ts +++ b/packages/google-devicesandservices-health/system-test/install.ts @@ -16,34 +16,36 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { + it('TypeScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts', + ).toString(), + }, }; await packNTest(options); }); - it('JavaScript code', async function() { + it('JavaScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } + cjs: readFileSync( + './system-test/fixtures/sample/src/index.js', + ).toString(), + }, }; await packNTest(options); }); - }); diff --git a/packages/google-devicesandservices-health/test/gapic_data_points_service_v4.ts b/packages/google-devicesandservices-health/test/gapic_data_points_service_v4.ts index f8cbaf7c9677..6ef6b55778c8 100644 --- a/packages/google-devicesandservices-health/test/gapic_data_points_service_v4.ts +++ b/packages/google-devicesandservices-health/test/gapic_data_points_service_v4.ts @@ -19,1961 +19,2606 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as datapointsserviceModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LROperation, operationsProtos} from 'google-gax'; +import { protobuf, LROperation, operationsProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); } -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v4.DataPointsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'health.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = datapointsserviceModule.v4.DataPointsServiceClient.servicePath; - assert.strictEqual(servicePath, 'health.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = datapointsserviceModule.v4.DataPointsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'health.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'health.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'health.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new datapointsserviceModule.v4.DataPointsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'health.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new datapointsserviceModule.v4.DataPointsServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'health.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new datapointsserviceModule.v4.DataPointsServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); - - it('has port', () => { - const port = datapointsserviceModule.v4.DataPointsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'health.googleapis.com'); + }); - it('should create a client with no option', () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient(); - assert(client); - }); + it('has universeDomain', () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('should create a client with gRPC fallback', () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - fallback: true, - }); - assert(client); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + datapointsserviceModule.v4.DataPointsServiceClient.servicePath; + assert.strictEqual(servicePath, 'health.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + datapointsserviceModule.v4.DataPointsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'health.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'health.example.com'); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataPointsServiceStub, undefined); - await client.initialize(); - assert(client.dataPointsServiceStub); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'health.example.com'); + }); - it('has close method for the initialized client', done => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.dataPointsServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new datapointsserviceModule.v4.DataPointsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'health.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new datapointsserviceModule.v4.DataPointsServiceClient( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'health.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new datapointsserviceModule.v4.DataPointsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has close method for the non-initialized client', done => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.dataPointsServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has port', () => { + const port = datapointsserviceModule.v4.DataPointsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); + it('should create a client with no option', () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient(); + assert(client); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('should create a client with gRPC fallback', () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + fallback: true, + }); + assert(client); }); - describe('getDataPoint', () => { - it('invokes getDataPoint without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.GetDataPointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.GetDataPointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.devicesandservices.health.v4.DataPoint() - ); - client.innerApiCalls.getDataPoint = stubSimpleCall(expectedResponse); - const [response] = await client.getDataPoint(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDataPoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataPoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.dataPointsServiceStub, undefined); + await client.initialize(); + assert(client.dataPointsServiceStub); + }); - it('invokes getDataPoint without error using callback', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.GetDataPointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.GetDataPointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.devicesandservices.health.v4.DataPoint() - ); - client.innerApiCalls.getDataPoint = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDataPoint( - request, - (err?: Error|null, result?: protos.google.devicesandservices.health.v4.IDataPoint|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDataPoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataPoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the initialized client', (done) => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.dataPointsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getDataPoint with error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.GetDataPointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.GetDataPointRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDataPoint = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDataPoint(request), expectedError); - const actualRequest = (client.innerApiCalls.getDataPoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDataPoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.dataPointsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes getDataPoint with closed client', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.GetDataPointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.GetDataPointRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDataPoint(request), expectedError); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - describe('dailyRollUpDataPoints', () => { - it('invokes dailyRollUpDataPoints without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.DailyRollUpDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.DailyRollUpDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.devicesandservices.health.v4.DailyRollUpDataPointsResponse() - ); - client.innerApiCalls.dailyRollUpDataPoints = stubSimpleCall(expectedResponse); - const [response] = await client.dailyRollUpDataPoints(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.dailyRollUpDataPoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.dailyRollUpDataPoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getDataPoint', () => { + it('invokes getDataPoint without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.GetDataPointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.GetDataPointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.devicesandservices.health.v4.DataPoint(), + ); + client.innerApiCalls.getDataPoint = stubSimpleCall(expectedResponse); + const [response] = await client.getDataPoint(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDataPoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDataPoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes dailyRollUpDataPoints without error using callback', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.DailyRollUpDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.DailyRollUpDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.devicesandservices.health.v4.DailyRollUpDataPointsResponse() - ); - client.innerApiCalls.dailyRollUpDataPoints = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.dailyRollUpDataPoints( - request, - (err?: Error|null, result?: protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.dailyRollUpDataPoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.dailyRollUpDataPoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDataPoint without error using callback', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.GetDataPointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.GetDataPointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.devicesandservices.health.v4.DataPoint(), + ); + client.innerApiCalls.getDataPoint = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDataPoint( + request, + ( + err?: Error | null, + result?: protos.google.devicesandservices.health.v4.IDataPoint | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDataPoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDataPoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes dailyRollUpDataPoints with error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.DailyRollUpDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.DailyRollUpDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.dailyRollUpDataPoints = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.dailyRollUpDataPoints(request), expectedError); - const actualRequest = (client.innerApiCalls.dailyRollUpDataPoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.dailyRollUpDataPoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDataPoint with error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.GetDataPointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.GetDataPointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDataPoint = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getDataPoint(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDataPoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDataPoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes dailyRollUpDataPoints with closed client', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.DailyRollUpDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.DailyRollUpDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.dailyRollUpDataPoints(request), expectedError); - }); + it('invokes getDataPoint with closed client', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.GetDataPointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.GetDataPointRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getDataPoint(request), expectedError); + }); + }); + + describe('dailyRollUpDataPoints', () => { + it('invokes dailyRollUpDataPoints without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.DailyRollUpDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.DailyRollUpDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.devicesandservices.health.v4.DailyRollUpDataPointsResponse(), + ); + client.innerApiCalls.dailyRollUpDataPoints = + stubSimpleCall(expectedResponse); + const [response] = await client.dailyRollUpDataPoints(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.dailyRollUpDataPoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.dailyRollUpDataPoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('exportExerciseTcx', () => { - it('invokes exportExerciseTcx without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ExportExerciseTcxRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ExportExerciseTcxRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ExportExerciseTcxResponse() - ); - client.innerApiCalls.exportExerciseTcx = stubSimpleCall(expectedResponse); - const [response] = await client.exportExerciseTcx(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportExerciseTcx as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportExerciseTcx as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes dailyRollUpDataPoints without error using callback', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.DailyRollUpDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.DailyRollUpDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.devicesandservices.health.v4.DailyRollUpDataPointsResponse(), + ); + client.innerApiCalls.dailyRollUpDataPoints = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.dailyRollUpDataPoints( + request, + ( + err?: Error | null, + result?: protos.google.devicesandservices.health.v4.IDailyRollUpDataPointsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.dailyRollUpDataPoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.dailyRollUpDataPoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes exportExerciseTcx without error using callback', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ExportExerciseTcxRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ExportExerciseTcxRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ExportExerciseTcxResponse() - ); - client.innerApiCalls.exportExerciseTcx = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportExerciseTcx( - request, - (err?: Error|null, result?: protos.google.devicesandservices.health.v4.IExportExerciseTcxResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.exportExerciseTcx as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportExerciseTcx as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes dailyRollUpDataPoints with error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.DailyRollUpDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.DailyRollUpDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.dailyRollUpDataPoints = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.dailyRollUpDataPoints(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.dailyRollUpDataPoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.dailyRollUpDataPoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes exportExerciseTcx with error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ExportExerciseTcxRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ExportExerciseTcxRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.exportExerciseTcx = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.exportExerciseTcx(request), expectedError); - const actualRequest = (client.innerApiCalls.exportExerciseTcx as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.exportExerciseTcx as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes dailyRollUpDataPoints with closed client', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.DailyRollUpDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.DailyRollUpDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.dailyRollUpDataPoints(request), + expectedError, + ); + }); + }); + + describe('exportExerciseTcx', () => { + it('invokes exportExerciseTcx without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ExportExerciseTcxRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ExportExerciseTcxRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ExportExerciseTcxResponse(), + ); + client.innerApiCalls.exportExerciseTcx = stubSimpleCall(expectedResponse); + const [response] = await client.exportExerciseTcx(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.exportExerciseTcx as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportExerciseTcx as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes exportExerciseTcx with closed client', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ExportExerciseTcxRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ExportExerciseTcxRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.exportExerciseTcx(request), expectedError); - }); + it('invokes exportExerciseTcx without error using callback', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ExportExerciseTcxRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ExportExerciseTcxRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ExportExerciseTcxResponse(), + ); + client.innerApiCalls.exportExerciseTcx = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportExerciseTcx( + request, + ( + err?: Error | null, + result?: protos.google.devicesandservices.health.v4.IExportExerciseTcxResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.exportExerciseTcx as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportExerciseTcx as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createDataPoint', () => { - it('invokes createDataPoint without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.CreateDataPointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.CreateDataPointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createDataPoint = stubLongRunningCall(expectedResponse); - const [operation] = await client.createDataPoint(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDataPoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDataPoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes exportExerciseTcx with error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ExportExerciseTcxRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ExportExerciseTcxRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.exportExerciseTcx = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.exportExerciseTcx(request), expectedError); + const actualRequest = ( + client.innerApiCalls.exportExerciseTcx as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.exportExerciseTcx as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createDataPoint without error using callback', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.CreateDataPointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.CreateDataPointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createDataPoint = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createDataPoint( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createDataPoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDataPoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes exportExerciseTcx with closed client', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ExportExerciseTcxRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ExportExerciseTcxRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.exportExerciseTcx(request), expectedError); + }); + }); + + describe('createDataPoint', () => { + it('invokes createDataPoint without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.CreateDataPointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.CreateDataPointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createDataPoint = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createDataPoint(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDataPoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDataPoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createDataPoint with call error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.CreateDataPointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.CreateDataPointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDataPoint = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createDataPoint(request), expectedError); - const actualRequest = (client.innerApiCalls.createDataPoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDataPoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createDataPoint without error using callback', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.CreateDataPointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.CreateDataPointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createDataPoint = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createDataPoint( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.ICreateDataPointOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.ICreateDataPointOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createDataPoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDataPoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createDataPoint with LRO error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.CreateDataPointRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.CreateDataPointRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createDataPoint = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createDataPoint(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createDataPoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createDataPoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createDataPoint with call error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.CreateDataPointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.CreateDataPointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDataPoint = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createDataPoint(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createDataPoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDataPoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateDataPointProgress without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkCreateDataPointProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes createDataPoint with LRO error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.CreateDataPointRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.CreateDataPointRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createDataPoint = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createDataPoint(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createDataPoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createDataPoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkCreateDataPointProgress with error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkCreateDataPointProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkCreateDataPointProgress without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateDataPointProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); }); - describe('updateDataPoint', () => { - it('invokes updateDataPoint without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.UpdateDataPointRequest() - ); - request.dataPoint ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.UpdateDataPointRequest', ['dataPoint', 'name']); - request.dataPoint.name = defaultValue1; - const expectedHeaderRequestParams = `data_point.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateDataPoint = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateDataPoint(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDataPoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDataPoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkCreateDataPointProgress with error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateDataPointProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateDataPoint', () => { + it('invokes updateDataPoint without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.UpdateDataPointRequest(), + ); + request.dataPoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.UpdateDataPointRequest', + ['dataPoint', 'name'], + ); + request.dataPoint.name = defaultValue1; + const expectedHeaderRequestParams = `data_point.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateDataPoint = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateDataPoint(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDataPoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDataPoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateDataPoint without error using callback', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.UpdateDataPointRequest() - ); - request.dataPoint ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.UpdateDataPointRequest', ['dataPoint', 'name']); - request.dataPoint.name = defaultValue1; - const expectedHeaderRequestParams = `data_point.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateDataPoint = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateDataPoint( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateDataPoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDataPoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateDataPoint without error using callback', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.UpdateDataPointRequest(), + ); + request.dataPoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.UpdateDataPointRequest', + ['dataPoint', 'name'], + ); + request.dataPoint.name = defaultValue1; + const expectedHeaderRequestParams = `data_point.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateDataPoint = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateDataPoint( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.IUpdateDataPointOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.devicesandservices.health.v4.IDataPoint, + protos.google.devicesandservices.health.v4.IUpdateDataPointOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateDataPoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDataPoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateDataPoint with call error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.UpdateDataPointRequest() - ); - request.dataPoint ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.UpdateDataPointRequest', ['dataPoint', 'name']); - request.dataPoint.name = defaultValue1; - const expectedHeaderRequestParams = `data_point.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDataPoint = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateDataPoint(request), expectedError); - const actualRequest = (client.innerApiCalls.updateDataPoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDataPoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateDataPoint with call error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.UpdateDataPointRequest(), + ); + request.dataPoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.UpdateDataPointRequest', + ['dataPoint', 'name'], + ); + request.dataPoint.name = defaultValue1; + const expectedHeaderRequestParams = `data_point.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDataPoint = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateDataPoint(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateDataPoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDataPoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateDataPoint with LRO error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.UpdateDataPointRequest() - ); - request.dataPoint ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.UpdateDataPointRequest', ['dataPoint', 'name']); - request.dataPoint.name = defaultValue1; - const expectedHeaderRequestParams = `data_point.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateDataPoint = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateDataPoint(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateDataPoint as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateDataPoint as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateDataPoint with LRO error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.UpdateDataPointRequest(), + ); + request.dataPoint ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.UpdateDataPointRequest', + ['dataPoint', 'name'], + ); + request.dataPoint.name = defaultValue1; + const expectedHeaderRequestParams = `data_point.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateDataPoint = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateDataPoint(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateDataPoint as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateDataPoint as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkUpdateDataPointProgress without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkUpdateDataPointProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkUpdateDataPointProgress without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateDataPointProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkUpdateDataPointProgress with error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkUpdateDataPointProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes checkUpdateDataPointProgress with error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateDataPointProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('batchDeleteDataPoints', () => { + it('invokes batchDeleteDataPoints without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.BatchDeleteDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.BatchDeleteDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.batchDeleteDataPoints = + stubLongRunningCall(expectedResponse); + const [operation] = await client.batchDeleteDataPoints(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchDeleteDataPoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteDataPoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('batchDeleteDataPoints', () => { - it('invokes batchDeleteDataPoints without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.BatchDeleteDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.BatchDeleteDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.batchDeleteDataPoints = stubLongRunningCall(expectedResponse); - const [operation] = await client.batchDeleteDataPoints(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchDeleteDataPoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteDataPoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes batchDeleteDataPoints without error using callback', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.BatchDeleteDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.BatchDeleteDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.batchDeleteDataPoints = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.batchDeleteDataPoints( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsResponse, + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsOperationMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsResponse, + protos.google.devicesandservices.health.v4.IBatchDeleteDataPointsOperationMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.batchDeleteDataPoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteDataPoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes batchDeleteDataPoints without error using callback', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.BatchDeleteDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.BatchDeleteDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.batchDeleteDataPoints = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.batchDeleteDataPoints( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.batchDeleteDataPoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteDataPoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes batchDeleteDataPoints with call error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.BatchDeleteDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.BatchDeleteDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteDataPoints = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects( + client.batchDeleteDataPoints(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.batchDeleteDataPoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteDataPoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes batchDeleteDataPoints with call error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.BatchDeleteDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.BatchDeleteDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteDataPoints = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.batchDeleteDataPoints(request), expectedError); - const actualRequest = (client.innerApiCalls.batchDeleteDataPoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteDataPoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes batchDeleteDataPoints with LRO error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.BatchDeleteDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.BatchDeleteDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.batchDeleteDataPoints = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.batchDeleteDataPoints(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.batchDeleteDataPoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.batchDeleteDataPoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes batchDeleteDataPoints with LRO error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.BatchDeleteDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.BatchDeleteDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.batchDeleteDataPoints = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.batchDeleteDataPoints(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.batchDeleteDataPoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.batchDeleteDataPoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes checkBatchDeleteDataPointsProgress without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkBatchDeleteDataPointsProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); - it('invokes checkBatchDeleteDataPointsProgress without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - expectedResponse.name = 'test'; - expectedResponse.response = {type_url: 'url', value: Buffer.from('')}; - expectedResponse.metadata = {type_url: 'url', value: Buffer.from('')} - - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const decodedOperation = await client.checkBatchDeleteDataPointsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); + it('invokes checkBatchDeleteDataPointsProgress with error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkBatchDeleteDataPointsProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listDataPoints', () => { + it('invokes listDataPoints without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ListDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ListDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.devicesandservices.health.v4.DataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.DataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.DataPoint(), + ), + ]; + client.innerApiCalls.listDataPoints = stubSimpleCall(expectedResponse); + const [response] = await client.listDataPoints(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDataPoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDataPoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes checkBatchDeleteDataPointsProgress with error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const expectedError = new Error('expected'); - - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.checkBatchDeleteDataPointsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); + it('invokes listDataPoints without error using callback', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ListDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ListDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.devicesandservices.health.v4.DataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.DataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.DataPoint(), + ), + ]; + client.innerApiCalls.listDataPoints = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listDataPoints( + request, + ( + err?: Error | null, + result?: + | protos.google.devicesandservices.health.v4.IDataPoint[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listDataPoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDataPoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listDataPoints', () => { - it('invokes listDataPoints without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ListDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ListDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.devicesandservices.health.v4.DataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.DataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.DataPoint()), - ]; - client.innerApiCalls.listDataPoints = stubSimpleCall(expectedResponse); - const [response] = await client.listDataPoints(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDataPoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDataPoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listDataPoints with error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ListDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ListDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listDataPoints = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listDataPoints(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listDataPoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listDataPoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listDataPoints without error using callback', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ListDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ListDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.devicesandservices.health.v4.DataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.DataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.DataPoint()), - ]; - client.innerApiCalls.listDataPoints = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listDataPoints( - request, - (err?: Error|null, result?: protos.google.devicesandservices.health.v4.IDataPoint[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listDataPoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDataPoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listDataPointsStream without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ListDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ListDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.devicesandservices.health.v4.DataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.DataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.DataPoint(), + ), + ]; + client.descriptors.page.listDataPoints.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listDataPointsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devicesandservices.health.v4.DataPoint[] = + []; + stream.on( + 'data', + (response: protos.google.devicesandservices.health.v4.DataPoint) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listDataPoints.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listDataPoints, request), + ); + assert( + (client.descriptors.page.listDataPoints.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listDataPoints with error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ListDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ListDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listDataPoints = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listDataPoints(request), expectedError); - const actualRequest = (client.innerApiCalls.listDataPoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listDataPoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listDataPointsStream with error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ListDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ListDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDataPoints.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listDataPointsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devicesandservices.health.v4.DataPoint[] = + []; + stream.on( + 'data', + (response: protos.google.devicesandservices.health.v4.DataPoint) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listDataPoints.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listDataPoints, request), + ); + assert( + (client.descriptors.page.listDataPoints.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listDataPointsStream without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ListDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ListDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devicesandservices.health.v4.DataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.DataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.DataPoint()), - ]; - client.descriptors.page.listDataPoints.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listDataPointsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devicesandservices.health.v4.DataPoint[] = []; - stream.on('data', (response: protos.google.devicesandservices.health.v4.DataPoint) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listDataPoints.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDataPoints, request)); - assert( - (client.descriptors.page.listDataPoints.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listDataPoints without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ListDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ListDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.devicesandservices.health.v4.DataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.DataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.DataPoint(), + ), + ]; + client.descriptors.page.listDataPoints.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devicesandservices.health.v4.IDataPoint[] = + []; + const iterable = client.listDataPointsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listDataPoints.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listDataPoints.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listDataPointsStream with error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ListDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ListDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDataPoints.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listDataPointsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devicesandservices.health.v4.DataPoint[] = []; - stream.on('data', (response: protos.google.devicesandservices.health.v4.DataPoint) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listDataPoints.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listDataPoints, request)); - assert( - (client.descriptors.page.listDataPoints.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with listDataPoints with error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ListDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ListDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listDataPoints.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listDataPointsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devicesandservices.health.v4.IDataPoint[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listDataPoints.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listDataPoints.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('reconcileDataPoints', () => { + it('invokes reconcileDataPoints without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconcileDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ReconcileDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconciledDataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconciledDataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconciledDataPoint(), + ), + ]; + client.innerApiCalls.reconcileDataPoints = + stubSimpleCall(expectedResponse); + const [response] = await client.reconcileDataPoints(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.reconcileDataPoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reconcileDataPoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listDataPoints without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ListDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ListDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devicesandservices.health.v4.DataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.DataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.DataPoint()), - ]; - client.descriptors.page.listDataPoints.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devicesandservices.health.v4.IDataPoint[] = []; - const iterable = client.listDataPointsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes reconcileDataPoints without error using callback', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconcileDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ReconcileDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconciledDataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconciledDataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconciledDataPoint(), + ), + ]; + client.innerApiCalls.reconcileDataPoints = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reconcileDataPoints( + request, + ( + err?: Error | null, + result?: + | protos.google.devicesandservices.health.v4.IReconciledDataPoint[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listDataPoints.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDataPoints.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listDataPoints with error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ListDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ListDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listDataPoints.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listDataPointsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devicesandservices.health.v4.IDataPoint[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listDataPoints.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listDataPoints.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.reconcileDataPoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reconcileDataPoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('reconcileDataPoints', () => { - it('invokes reconcileDataPoints without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ReconcileDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ReconcileDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.devicesandservices.health.v4.ReconciledDataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.ReconciledDataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.ReconciledDataPoint()), - ]; - client.innerApiCalls.reconcileDataPoints = stubSimpleCall(expectedResponse); - const [response] = await client.reconcileDataPoints(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reconcileDataPoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reconcileDataPoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes reconcileDataPoints with error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconcileDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ReconcileDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reconcileDataPoints = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.reconcileDataPoints(request), expectedError); + const actualRequest = ( + client.innerApiCalls.reconcileDataPoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reconcileDataPoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes reconcileDataPoints without error using callback', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ReconcileDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ReconcileDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.devicesandservices.health.v4.ReconciledDataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.ReconciledDataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.ReconciledDataPoint()), - ]; - client.innerApiCalls.reconcileDataPoints = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reconcileDataPoints( - request, - (err?: Error|null, result?: protos.google.devicesandservices.health.v4.IReconciledDataPoint[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reconcileDataPoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reconcileDataPoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes reconcileDataPointsStream without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconcileDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ReconcileDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconciledDataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconciledDataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconciledDataPoint(), + ), + ]; + client.descriptors.page.reconcileDataPoints.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.reconcileDataPointsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devicesandservices.health.v4.ReconciledDataPoint[] = + []; + stream.on( + 'data', + ( + response: protos.google.devicesandservices.health.v4.ReconciledDataPoint, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.reconcileDataPoints.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.reconcileDataPoints, request), + ); + assert( + (client.descriptors.page.reconcileDataPoints.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes reconcileDataPoints with error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ReconcileDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ReconcileDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.reconcileDataPoints = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.reconcileDataPoints(request), expectedError); - const actualRequest = (client.innerApiCalls.reconcileDataPoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reconcileDataPoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes reconcileDataPointsStream with error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconcileDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ReconcileDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.reconcileDataPoints.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.reconcileDataPointsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devicesandservices.health.v4.ReconciledDataPoint[] = + []; + stream.on( + 'data', + ( + response: protos.google.devicesandservices.health.v4.ReconciledDataPoint, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.reconcileDataPoints.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.reconcileDataPoints, request), + ); + assert( + (client.descriptors.page.reconcileDataPoints.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes reconcileDataPointsStream without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ReconcileDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ReconcileDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devicesandservices.health.v4.ReconciledDataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.ReconciledDataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.ReconciledDataPoint()), - ]; - client.descriptors.page.reconcileDataPoints.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.reconcileDataPointsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devicesandservices.health.v4.ReconciledDataPoint[] = []; - stream.on('data', (response: protos.google.devicesandservices.health.v4.ReconciledDataPoint) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.reconcileDataPoints.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.reconcileDataPoints, request)); - assert( - (client.descriptors.page.reconcileDataPoints.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with reconcileDataPoints without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconcileDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ReconcileDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconciledDataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconciledDataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconciledDataPoint(), + ), + ]; + client.descriptors.page.reconcileDataPoints.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devicesandservices.health.v4.IReconciledDataPoint[] = + []; + const iterable = client.reconcileDataPointsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.reconcileDataPoints.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.reconcileDataPoints.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes reconcileDataPointsStream with error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ReconcileDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ReconcileDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.reconcileDataPoints.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.reconcileDataPointsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devicesandservices.health.v4.ReconciledDataPoint[] = []; - stream.on('data', (response: protos.google.devicesandservices.health.v4.ReconciledDataPoint) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.reconcileDataPoints.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.reconcileDataPoints, request)); - assert( - (client.descriptors.page.reconcileDataPoints.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with reconcileDataPoints with error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ReconcileDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ReconcileDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.reconcileDataPoints.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.reconcileDataPointsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devicesandservices.health.v4.IReconciledDataPoint[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.reconcileDataPoints.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.reconcileDataPoints.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('rollUpDataPoints', () => { + it('invokes rollUpDataPoints without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollUpDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.RollUpDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollupDataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollupDataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollupDataPoint(), + ), + ]; + client.innerApiCalls.rollUpDataPoints = stubSimpleCall(expectedResponse); + const [response] = await client.rollUpDataPoints(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rollUpDataPoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rollUpDataPoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with reconcileDataPoints without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ReconcileDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ReconcileDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devicesandservices.health.v4.ReconciledDataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.ReconciledDataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.ReconciledDataPoint()), - ]; - client.descriptors.page.reconcileDataPoints.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devicesandservices.health.v4.IReconciledDataPoint[] = []; - const iterable = client.reconcileDataPointsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes rollUpDataPoints without error using callback', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollUpDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.RollUpDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollupDataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollupDataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollupDataPoint(), + ), + ]; + client.innerApiCalls.rollUpDataPoints = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rollUpDataPoints( + request, + ( + err?: Error | null, + result?: + | protos.google.devicesandservices.health.v4.IRollupDataPoint[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.reconcileDataPoints.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.reconcileDataPoints.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with reconcileDataPoints with error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.ReconcileDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.ReconcileDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.reconcileDataPoints.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.reconcileDataPointsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devicesandservices.health.v4.IReconciledDataPoint[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.reconcileDataPoints.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.reconcileDataPoints.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rollUpDataPoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rollUpDataPoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('rollUpDataPoints', () => { - it('invokes rollUpDataPoints without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.RollUpDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.RollUpDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.devicesandservices.health.v4.RollupDataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.RollupDataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.RollupDataPoint()), - ]; - client.innerApiCalls.rollUpDataPoints = stubSimpleCall(expectedResponse); - const [response] = await client.rollUpDataPoints(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rollUpDataPoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollUpDataPoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollUpDataPoints without error using callback', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.RollUpDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.RollUpDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.devicesandservices.health.v4.RollupDataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.RollupDataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.RollupDataPoint()), - ]; - client.innerApiCalls.rollUpDataPoints = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rollUpDataPoints( - request, - (err?: Error|null, result?: protos.google.devicesandservices.health.v4.IRollupDataPoint[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rollUpDataPoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollUpDataPoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rollUpDataPoints with error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.RollUpDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.RollUpDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.rollUpDataPoints = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.rollUpDataPoints(request), expectedError); - const actualRequest = (client.innerApiCalls.rollUpDataPoints as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rollUpDataPoints as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes rollUpDataPoints with error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollUpDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.RollUpDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rollUpDataPoints = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.rollUpDataPoints(request), expectedError); + const actualRequest = ( + client.innerApiCalls.rollUpDataPoints as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rollUpDataPoints as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes rollUpDataPointsStream without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.RollUpDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.RollUpDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devicesandservices.health.v4.RollupDataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.RollupDataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.RollupDataPoint()), - ]; - client.descriptors.page.rollUpDataPoints.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.rollUpDataPointsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devicesandservices.health.v4.RollupDataPoint[] = []; - stream.on('data', (response: protos.google.devicesandservices.health.v4.RollupDataPoint) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.rollUpDataPoints.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.rollUpDataPoints, request)); - assert( - (client.descriptors.page.rollUpDataPoints.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes rollUpDataPointsStream without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollUpDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.RollUpDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollupDataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollupDataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollupDataPoint(), + ), + ]; + client.descriptors.page.rollUpDataPoints.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.rollUpDataPointsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devicesandservices.health.v4.RollupDataPoint[] = + []; + stream.on( + 'data', + ( + response: protos.google.devicesandservices.health.v4.RollupDataPoint, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.rollUpDataPoints.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.rollUpDataPoints, request), + ); + assert( + (client.descriptors.page.rollUpDataPoints.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes rollUpDataPointsStream with error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.RollUpDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.RollUpDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.rollUpDataPoints.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.rollUpDataPointsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.devicesandservices.health.v4.RollupDataPoint[] = []; - stream.on('data', (response: protos.google.devicesandservices.health.v4.RollupDataPoint) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.rollUpDataPoints.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.rollUpDataPoints, request)); - assert( - (client.descriptors.page.rollUpDataPoints.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes rollUpDataPointsStream with error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollUpDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.RollUpDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.rollUpDataPoints.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.rollUpDataPointsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devicesandservices.health.v4.RollupDataPoint[] = + []; + stream.on( + 'data', + ( + response: protos.google.devicesandservices.health.v4.RollupDataPoint, + ) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.rollUpDataPoints.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.rollUpDataPoints, request), + ); + assert( + (client.descriptors.page.rollUpDataPoints.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with rollUpDataPoints without error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.RollUpDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.RollUpDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.devicesandservices.health.v4.RollupDataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.RollupDataPoint()), - generateSampleMessage(new protos.google.devicesandservices.health.v4.RollupDataPoint()), - ]; - client.descriptors.page.rollUpDataPoints.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.devicesandservices.health.v4.IRollupDataPoint[] = []; - const iterable = client.rollUpDataPointsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.rollUpDataPoints.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.rollUpDataPoints.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with rollUpDataPoints without error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollUpDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.RollUpDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollupDataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollupDataPoint(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollupDataPoint(), + ), + ]; + client.descriptors.page.rollUpDataPoints.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devicesandservices.health.v4.IRollupDataPoint[] = + []; + const iterable = client.rollUpDataPointsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.rollUpDataPoints.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.rollUpDataPoints.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with rollUpDataPoints with error', async () => { - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.RollUpDataPointsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.RollUpDataPointsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.rollUpDataPoints.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.rollUpDataPointsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.devicesandservices.health.v4.IRollupDataPoint[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.rollUpDataPoints.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.rollUpDataPoints.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('uses async iteration with rollUpDataPoints with error', async () => { + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.RollUpDataPointsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.RollUpDataPointsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.rollUpDataPoints.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.rollUpDataPointsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devicesandservices.health.v4.IRollupDataPoint[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.rollUpDataPoints.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.rollUpDataPoints.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('Path templates', () => { + describe('dataPoint', async () => { + const fakePath = '/rendered/path/dataPoint'; + const expectedParameters = { + user: 'userValue', + data_type: 'dataTypeValue', + data_point: 'dataPointValue', + }; + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dataPointPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dataPointPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dataPointPath', () => { + const result = client.dataPointPath( + 'userValue', + 'dataTypeValue', + 'dataPointValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.dataPointPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchUserFromDataPointName', () => { + const result = client.matchUserFromDataPointName(fakePath); + assert.strictEqual(result, 'userValue'); + assert( + (client.pathTemplates.dataPointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDataTypeFromDataPointName', () => { + const result = client.matchDataTypeFromDataPointName(fakePath); + assert.strictEqual(result, 'dataTypeValue'); + assert( + (client.pathTemplates.dataPointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDataPointFromDataPointName', () => { + const result = client.matchDataPointFromDataPointName(fakePath); + assert.strictEqual(result, 'dataPointValue'); + assert( + (client.pathTemplates.dataPointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('dataPoint', async () => { - const fakePath = "/rendered/path/dataPoint"; - const expectedParameters = { - user: "userValue", - data_type: "dataTypeValue", - data_point: "dataPointValue", - }; - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dataPointPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dataPointPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dataPointPath', () => { - const result = client.dataPointPath("userValue", "dataTypeValue", "dataPointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dataPointPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromDataPointName', () => { - const result = client.matchUserFromDataPointName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.dataPointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDataTypeFromDataPointName', () => { - const result = client.matchDataTypeFromDataPointName(fakePath); - assert.strictEqual(result, "dataTypeValue"); - assert((client.pathTemplates.dataPointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDataPointFromDataPointName', () => { - const result = client.matchDataPointFromDataPointName(fakePath); - assert.strictEqual(result, "dataPointValue"); - assert((client.pathTemplates.dataPointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('dataType', async () => { + const fakePath = '/rendered/path/dataType'; + const expectedParameters = { + user: 'userValue', + data_type: 'dataTypeValue', + }; + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dataTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dataTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dataTypePath', () => { + const result = client.dataTypePath('userValue', 'dataTypeValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.dataTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchUserFromDataTypeName', () => { + const result = client.matchUserFromDataTypeName(fakePath); + assert.strictEqual(result, 'userValue'); + assert( + (client.pathTemplates.dataTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDataTypeFromDataTypeName', () => { + const result = client.matchDataTypeFromDataTypeName(fakePath); + assert.strictEqual(result, 'dataTypeValue'); + assert( + (client.pathTemplates.dataTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('dataType', async () => { - const fakePath = "/rendered/path/dataType"; - const expectedParameters = { - user: "userValue", - data_type: "dataTypeValue", - }; - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dataTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dataTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dataTypePath', () => { - const result = client.dataTypePath("userValue", "dataTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dataTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromDataTypeName', () => { - const result = client.matchUserFromDataTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.dataTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDataTypeFromDataTypeName', () => { - const result = client.matchDataTypeFromDataTypeName(fakePath); - assert.strictEqual(result, "dataTypeValue"); - assert((client.pathTemplates.dataTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('identity', async () => { + const fakePath = '/rendered/path/identity'; + const expectedParameters = { + user: 'userValue', + }; + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.identityPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.identityPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('identityPath', () => { + const result = client.identityPath('userValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.identityPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchUserFromIdentityName', () => { + const result = client.matchUserFromIdentityName(fakePath); + assert.strictEqual(result, 'userValue'); + assert( + (client.pathTemplates.identityPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('identity', async () => { - const fakePath = "/rendered/path/identity"; - const expectedParameters = { - user: "userValue", - }; - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.identityPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.identityPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('identityPath', () => { - const result = client.identityPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.identityPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromIdentityName', () => { - const result = client.matchUserFromIdentityName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.identityPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('profile', async () => { + const fakePath = '/rendered/path/profile'; + const expectedParameters = { + user: 'userValue', + }; + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.profilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.profilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('profilePath', () => { + const result = client.profilePath('userValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.profilePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchUserFromProfileName', () => { + const result = client.matchUserFromProfileName(fakePath); + assert.strictEqual(result, 'userValue'); + assert( + (client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('profile', async () => { - const fakePath = "/rendered/path/profile"; - const expectedParameters = { - user: "userValue", - }; - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.profilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.profilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('profilePath', () => { - const result = client.profilePath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.profilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromProfileName', () => { - const result = client.matchUserFromProfileName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.profilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('settings', async () => { + const fakePath = '/rendered/path/settings'; + const expectedParameters = { + user: 'userValue', + }; + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.settingsPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.settingsPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('settingsPath', () => { + const result = client.settingsPath('userValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.settingsPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchUserFromSettingsName', () => { + const result = client.matchUserFromSettingsName(fakePath); + assert.strictEqual(result, 'userValue'); + assert( + (client.pathTemplates.settingsPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - describe('settings', async () => { - const fakePath = "/rendered/path/settings"; - const expectedParameters = { - user: "userValue", - }; - const client = new datapointsserviceModule.v4.DataPointsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.settingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.settingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('settingsPath', () => { - const result = client.settingsPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.settingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchUserFromSettingsName', () => { - const result = client.matchUserFromSettingsName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.settingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('subscriber', async () => { + const fakePath = '/rendered/path/subscriber'; + const expectedParameters = { + project: 'projectValue', + subscriber: 'subscriberValue', + }; + const client = new datapointsserviceModule.v4.DataPointsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.subscriberPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.subscriberPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('subscriberPath', () => { + const result = client.subscriberPath('projectValue', 'subscriberValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.subscriberPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSubscriberName', () => { + const result = client.matchProjectFromSubscriberName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.subscriberPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSubscriberFromSubscriberName', () => { + const result = client.matchSubscriberFromSubscriberName(fakePath); + assert.strictEqual(result, 'subscriberValue'); + assert( + (client.pathTemplates.subscriberPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-devicesandservices-health/test/gapic_data_subscription_service_v4.ts b/packages/google-devicesandservices-health/test/gapic_data_subscription_service_v4.ts new file mode 100644 index 000000000000..a58493a7df67 --- /dev/null +++ b/packages/google-devicesandservices-health/test/gapic_data_subscription_service_v4.ts @@ -0,0 +1,1632 @@ +// Copyright 2026 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as datasubscriptionserviceModule from '../src'; + +import { PassThrough } from 'stream'; + +import { protobuf, LROperation, operationsProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().rejects(callError) + : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback( + response?: ResponseType, + callError?: Error, + lroError?: Error, +) { + const innerStub = lroError + ? sinon.stub().rejects(lroError) + : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError + ? sinon.stub().callsArgWith(2, callError) + : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v4.DataSubscriptionServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'health.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + datasubscriptionserviceModule.v4.DataSubscriptionServiceClient + .servicePath; + assert.strictEqual(servicePath, 'health.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + datasubscriptionserviceModule.v4.DataSubscriptionServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'health.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'health.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'health.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'health.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'health.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = + datasubscriptionserviceModule.v4.DataSubscriptionServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.dataSubscriptionServiceStub, undefined); + await client.initialize(); + assert(client.dataSubscriptionServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.dataSubscriptionServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.dataSubscriptionServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createSubscriber', () => { + it('invokes createSubscriber without error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.CreateSubscriberRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.CreateSubscriberRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSubscriber = + stubLongRunningCall(expectedResponse); + const [operation] = await client.createSubscriber(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSubscriber as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSubscriber as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSubscriber without error using callback', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.CreateSubscriberRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.CreateSubscriberRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.createSubscriber = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSubscriber( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.ICreateSubscriberMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.ICreateSubscriberMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createSubscriber as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSubscriber as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSubscriber with call error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.CreateSubscriberRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.CreateSubscriberRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSubscriber = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.createSubscriber(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createSubscriber as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSubscriber as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createSubscriber with LRO error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.CreateSubscriberRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.CreateSubscriberRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createSubscriber = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.createSubscriber(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.createSubscriber as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createSubscriber as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateSubscriberProgress without error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkCreateSubscriberProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateSubscriberProgress with error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkCreateSubscriberProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('updateSubscriber', () => { + it('invokes updateSubscriber without error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.UpdateSubscriberRequest(), + ); + request.subscriber ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.UpdateSubscriberRequest', + ['subscriber', 'name'], + ); + request.subscriber.name = defaultValue1; + const expectedHeaderRequestParams = `subscriber.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSubscriber = + stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSubscriber(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSubscriber as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSubscriber as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSubscriber without error using callback', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.UpdateSubscriberRequest(), + ); + request.subscriber ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.UpdateSubscriberRequest', + ['subscriber', 'name'], + ); + request.subscriber.name = defaultValue1; + const expectedHeaderRequestParams = `subscriber.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.updateSubscriber = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSubscriber( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.IUpdateSubscriberMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.devicesandservices.health.v4.ISubscriber, + protos.google.devicesandservices.health.v4.IUpdateSubscriberMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSubscriber as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSubscriber as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSubscriber with call error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.UpdateSubscriberRequest(), + ); + request.subscriber ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.UpdateSubscriberRequest', + ['subscriber', 'name'], + ); + request.subscriber.name = defaultValue1; + const expectedHeaderRequestParams = `subscriber.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSubscriber = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateSubscriber(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSubscriber as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSubscriber as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSubscriber with LRO error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.UpdateSubscriberRequest(), + ); + request.subscriber ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.UpdateSubscriberRequest', + ['subscriber', 'name'], + ); + request.subscriber.name = defaultValue1; + const expectedHeaderRequestParams = `subscriber.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSubscriber = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.updateSubscriber(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSubscriber as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSubscriber as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateSubscriberProgress without error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkUpdateSubscriberProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateSubscriberProgress with error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkUpdateSubscriberProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('deleteSubscriber', () => { + it('invokes deleteSubscriber without error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.DeleteSubscriberRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.DeleteSubscriberRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSubscriber = + stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSubscriber(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSubscriber as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSubscriber as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSubscriber without error using callback', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.DeleteSubscriberRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.DeleteSubscriberRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation(), + ); + client.innerApiCalls.deleteSubscriber = + stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSubscriber( + request, + ( + err?: Error | null, + result?: LROperation< + protos.google.protobuf.IEmpty, + protos.google.devicesandservices.health.v4.IDeleteSubscriberMetadata + > | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const operation = (await promise) as LROperation< + protos.google.protobuf.IEmpty, + protos.google.devicesandservices.health.v4.IDeleteSubscriberMetadata + >; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteSubscriber as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSubscriber as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSubscriber with call error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.DeleteSubscriberRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.DeleteSubscriberRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSubscriber = stubLongRunningCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteSubscriber(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSubscriber as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSubscriber as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteSubscriber with LRO error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.DeleteSubscriberRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.DeleteSubscriberRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSubscriber = stubLongRunningCall( + undefined, + undefined, + expectedError, + ); + const [operation] = await client.deleteSubscriber(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteSubscriber as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteSubscriber as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteSubscriberProgress without error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation(), + ); + expectedResponse.name = 'test'; + expectedResponse.response = { type_url: 'url', value: Buffer.from('') }; + expectedResponse.metadata = { type_url: 'url', value: Buffer.from('') }; + + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const decodedOperation = await client.checkDeleteSubscriberProgress( + expectedResponse.name, + ); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteSubscriberProgress with error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const expectedError = new Error('expected'); + + client.operationsClient.getOperation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.checkDeleteSubscriberProgress(''), + expectedError, + ); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + }); + + describe('listSubscribers', () => { + it('invokes listSubscribers without error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ListSubscribersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ListSubscribersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.devicesandservices.health.v4.Subscriber(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.Subscriber(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.Subscriber(), + ), + ]; + client.innerApiCalls.listSubscribers = stubSimpleCall(expectedResponse); + const [response] = await client.listSubscribers(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSubscribers as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSubscribers as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSubscribers without error using callback', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ListSubscribersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ListSubscribersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.devicesandservices.health.v4.Subscriber(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.Subscriber(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.Subscriber(), + ), + ]; + client.innerApiCalls.listSubscribers = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSubscribers( + request, + ( + err?: Error | null, + result?: + | protos.google.devicesandservices.health.v4.ISubscriber[] + | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listSubscribers as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSubscribers as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSubscribers with error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ListSubscribersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ListSubscribersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listSubscribers = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listSubscribers(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listSubscribers as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listSubscribers as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listSubscribersStream without error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ListSubscribersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ListSubscribersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.devicesandservices.health.v4.Subscriber(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.Subscriber(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.Subscriber(), + ), + ]; + client.descriptors.page.listSubscribers.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listSubscribersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devicesandservices.health.v4.Subscriber[] = + []; + stream.on( + 'data', + (response: protos.google.devicesandservices.health.v4.Subscriber) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listSubscribers.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSubscribers, request), + ); + assert( + (client.descriptors.page.listSubscribers.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listSubscribersStream with error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ListSubscribersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ListSubscribersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSubscribers.createStream = + stubPageStreamingCall(undefined, expectedError); + const stream = client.listSubscribersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.devicesandservices.health.v4.Subscriber[] = + []; + stream.on( + 'data', + (response: protos.google.devicesandservices.health.v4.Subscriber) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listSubscribers.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listSubscribers, request), + ); + assert( + (client.descriptors.page.listSubscribers.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listSubscribers without error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ListSubscribersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ListSubscribersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage( + new protos.google.devicesandservices.health.v4.Subscriber(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.Subscriber(), + ), + generateSampleMessage( + new protos.google.devicesandservices.health.v4.Subscriber(), + ), + ]; + client.descriptors.page.listSubscribers.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.devicesandservices.health.v4.ISubscriber[] = + []; + const iterable = client.listSubscribersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.descriptors.page.listSubscribers.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSubscribers.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listSubscribers with error', async () => { + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.ListSubscribersRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.ListSubscribersRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listSubscribers.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSubscribersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.devicesandservices.health.v4.ISubscriber[] = + []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.descriptors.page.listSubscribers.asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + (client.descriptors.page.listSubscribers.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + + describe('Path templates', () => { + describe('dataPoint', async () => { + const fakePath = '/rendered/path/dataPoint'; + const expectedParameters = { + user: 'userValue', + data_type: 'dataTypeValue', + data_point: 'dataPointValue', + }; + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dataPointPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dataPointPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dataPointPath', () => { + const result = client.dataPointPath( + 'userValue', + 'dataTypeValue', + 'dataPointValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.dataPointPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchUserFromDataPointName', () => { + const result = client.matchUserFromDataPointName(fakePath); + assert.strictEqual(result, 'userValue'); + assert( + (client.pathTemplates.dataPointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDataTypeFromDataPointName', () => { + const result = client.matchDataTypeFromDataPointName(fakePath); + assert.strictEqual(result, 'dataTypeValue'); + assert( + (client.pathTemplates.dataPointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDataPointFromDataPointName', () => { + const result = client.matchDataPointFromDataPointName(fakePath); + assert.strictEqual(result, 'dataPointValue'); + assert( + (client.pathTemplates.dataPointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('dataType', async () => { + const fakePath = '/rendered/path/dataType'; + const expectedParameters = { + user: 'userValue', + data_type: 'dataTypeValue', + }; + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dataTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dataTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dataTypePath', () => { + const result = client.dataTypePath('userValue', 'dataTypeValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.dataTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchUserFromDataTypeName', () => { + const result = client.matchUserFromDataTypeName(fakePath); + assert.strictEqual(result, 'userValue'); + assert( + (client.pathTemplates.dataTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDataTypeFromDataTypeName', () => { + const result = client.matchDataTypeFromDataTypeName(fakePath); + assert.strictEqual(result, 'dataTypeValue'); + assert( + (client.pathTemplates.dataTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('identity', async () => { + const fakePath = '/rendered/path/identity'; + const expectedParameters = { + user: 'userValue', + }; + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.identityPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.identityPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('identityPath', () => { + const result = client.identityPath('userValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.identityPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchUserFromIdentityName', () => { + const result = client.matchUserFromIdentityName(fakePath); + assert.strictEqual(result, 'userValue'); + assert( + (client.pathTemplates.identityPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('profile', async () => { + const fakePath = '/rendered/path/profile'; + const expectedParameters = { + user: 'userValue', + }; + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.profilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.profilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('profilePath', () => { + const result = client.profilePath('userValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.profilePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchUserFromProfileName', () => { + const result = client.matchUserFromProfileName(fakePath); + assert.strictEqual(result, 'userValue'); + assert( + (client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('settings', async () => { + const fakePath = '/rendered/path/settings'; + const expectedParameters = { + user: 'userValue', + }; + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.settingsPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.settingsPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('settingsPath', () => { + const result = client.settingsPath('userValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.settingsPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchUserFromSettingsName', () => { + const result = client.matchUserFromSettingsName(fakePath); + assert.strictEqual(result, 'userValue'); + assert( + (client.pathTemplates.settingsPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('subscriber', async () => { + const fakePath = '/rendered/path/subscriber'; + const expectedParameters = { + project: 'projectValue', + subscriber: 'subscriberValue', + }; + const client = + new datasubscriptionserviceModule.v4.DataSubscriptionServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.subscriberPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.subscriberPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('subscriberPath', () => { + const result = client.subscriberPath('projectValue', 'subscriberValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.subscriberPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSubscriberName', () => { + const result = client.matchProjectFromSubscriberName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.subscriberPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSubscriberFromSubscriberName', () => { + const result = client.matchSubscriberFromSubscriberName(fakePath); + assert.strictEqual(result, 'subscriberValue'); + assert( + (client.pathTemplates.subscriberPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/packages/google-devicesandservices-health/test/gapic_health_profile_service_v4.ts b/packages/google-devicesandservices-health/test/gapic_health_profile_service_v4.ts index e6948e7e08fa..51707c4908f7 100644 --- a/packages/google-devicesandservices-health/test/gapic_health_profile_service_v4.ts +++ b/packages/google-devicesandservices-health/test/gapic_health_profile_service_v4.ts @@ -19,921 +19,1224 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as healthprofileserviceModule from '../src'; -import {protobuf} from 'google-gax'; +import { protobuf } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } describe('v4.HealthProfileServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'health.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = healthprofileserviceModule.v4.HealthProfileServiceClient.servicePath; - assert.strictEqual(servicePath, 'health.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'health.googleapis.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = healthprofileserviceModule.v4.HealthProfileServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'health.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'health.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'health.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'health.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'health.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new healthprofileserviceModule.v4.HealthProfileServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + it('has universeDomain', () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + healthprofileserviceModule.v4.HealthProfileServiceClient.servicePath; + assert.strictEqual(servicePath, 'health.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + healthprofileserviceModule.v4.HealthProfileServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'health.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + universeDomain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'health.example.com'); + }); - it('has port', () => { - const port = healthprofileserviceModule.v4.HealthProfileServiceClient.port; - assert(port); - assert(typeof port === 'number'); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + universe_domain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'health.example.com'); + }); - it('should create a client with no option', () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient(); - assert(client); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'health.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('should create a client with gRPC fallback', () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - fallback: true, + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + universeDomain: 'configured.example.com', }); - assert(client); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'health.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.healthProfileServiceStub, undefined); - await client.initialize(); - assert(client.healthProfileServiceStub); + it('has port', () => { + const port = + healthprofileserviceModule.v4.HealthProfileServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + fallback: true, }); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.healthProfileServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has initialize method and supports deferred initialization', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.healthProfileServiceStub, undefined); + await client.initialize(); + assert(client.healthProfileServiceStub); + }); - it('has close method for the non-initialized client', done => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.healthProfileServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.healthProfileServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the non-initialized client', (done) => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.healthProfileServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - describe('getProfile', () => { - it('invokes getProfile without error', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.GetProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.GetProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.devicesandservices.health.v4.Profile() - ); - client.innerApiCalls.getProfile = stubSimpleCall(expectedResponse); - const [response] = await client.getProfile(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProfile without error using callback', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.GetProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.GetProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.devicesandservices.health.v4.Profile() - ); - client.innerApiCalls.getProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getProfile( - request, - (err?: Error|null, result?: protos.google.devicesandservices.health.v4.IProfile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProfile with error', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.GetProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.GetProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.getProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getProfile with closed client', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.GetProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.GetProfileRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getProfile(request), expectedError); - }); - }); - - describe('updateProfile', () => { - it('invokes updateProfile without error', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.UpdateProfileRequest() - ); - request.profile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.UpdateProfileRequest', ['profile', 'name']); - request.profile.name = defaultValue1; - const expectedHeaderRequestParams = `profile.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.devicesandservices.health.v4.Profile() - ); - client.innerApiCalls.updateProfile = stubSimpleCall(expectedResponse); - const [response] = await client.updateProfile(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProfile without error using callback', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.UpdateProfileRequest() - ); - request.profile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.UpdateProfileRequest', ['profile', 'name']); - request.profile.name = defaultValue1; - const expectedHeaderRequestParams = `profile.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.devicesandservices.health.v4.Profile() - ); - client.innerApiCalls.updateProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateProfile( - request, - (err?: Error|null, result?: protos.google.devicesandservices.health.v4.IProfile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProfile with error', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.UpdateProfileRequest() - ); - request.profile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.UpdateProfileRequest', ['profile', 'name']); - request.profile.name = defaultValue1; - const expectedHeaderRequestParams = `profile.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.updateProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateProfile with closed client', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.UpdateProfileRequest() - ); - request.profile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.UpdateProfileRequest', ['profile', 'name']); - request.profile.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateProfile(request), expectedError); - }); - }); - - describe('getSettings', () => { - it('invokes getSettings without error', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.devicesandservices.health.v4.Settings() - ); - client.innerApiCalls.getSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings without error using callback', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.devicesandservices.health.v4.Settings() - ); - client.innerApiCalls.getSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSettings( - request, - (err?: Error|null, result?: protos.google.devicesandservices.health.v4.ISettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings with error', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getSettings with closed client', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.GetSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.GetSettingsRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getSettings(request), expectedError); - }); - }); - - describe('updateSettings', () => { - it('invokes updateSettings without error', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.UpdateSettingsRequest() - ); - request.settings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.UpdateSettingsRequest', ['settings', 'name']); - request.settings.name = defaultValue1; - const expectedHeaderRequestParams = `settings.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.devicesandservices.health.v4.Settings() - ); - client.innerApiCalls.updateSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings without error using callback', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.UpdateSettingsRequest() - ); - request.settings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.UpdateSettingsRequest', ['settings', 'name']); - request.settings.name = defaultValue1; - const expectedHeaderRequestParams = `settings.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.devicesandservices.health.v4.Settings() - ); - client.innerApiCalls.updateSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSettings( - request, - (err?: Error|null, result?: protos.google.devicesandservices.health.v4.ISettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings with error', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.UpdateSettingsRequest() - ); - request.settings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.UpdateSettingsRequest', ['settings', 'name']); - request.settings.name = defaultValue1; - const expectedHeaderRequestParams = `settings.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateSettings with closed client', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.UpdateSettingsRequest() - ); - request.settings ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.UpdateSettingsRequest', ['settings', 'name']); - request.settings.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateSettings(request), expectedError); - }); - }); - - describe('getIdentity', () => { - it('invokes getIdentity without error', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.GetIdentityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.GetIdentityRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.devicesandservices.health.v4.Identity() - ); - client.innerApiCalls.getIdentity = stubSimpleCall(expectedResponse); - const [response] = await client.getIdentity(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIdentity as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIdentity as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIdentity without error using callback', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.GetIdentityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.GetIdentityRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.devicesandservices.health.v4.Identity() - ); - client.innerApiCalls.getIdentity = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIdentity( - request, - (err?: Error|null, result?: protos.google.devicesandservices.health.v4.IIdentity|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getIdentity as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIdentity as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIdentity with error', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.GetIdentityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.GetIdentityRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getIdentity = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIdentity(request), expectedError); - const actualRequest = (client.innerApiCalls.getIdentity as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getIdentity as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getIdentity with closed client', async () => { - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.devicesandservices.health.v4.GetIdentityRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.devicesandservices.health.v4.GetIdentityRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getIdentity(request), expectedError); - }); - }); - - describe('Path templates', () => { - - describe('dataPoint', async () => { - const fakePath = "/rendered/path/dataPoint"; - const expectedParameters = { - user: "userValue", - data_type: "dataTypeValue", - data_point: "dataPointValue", - }; - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dataPointPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dataPointPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dataPointPath', () => { - const result = client.dataPointPath("userValue", "dataTypeValue", "dataPointValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dataPointPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); - it('matchUserFromDataPointName', () => { - const result = client.matchUserFromDataPointName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.dataPointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('getProfile', () => { + it('invokes getProfile without error', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.GetProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.GetProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.devicesandservices.health.v4.Profile(), + ); + client.innerApiCalls.getProfile = stubSimpleCall(expectedResponse); + const [response] = await client.getProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchDataTypeFromDataPointName', () => { - const result = client.matchDataTypeFromDataPointName(fakePath); - assert.strictEqual(result, "dataTypeValue"); - assert((client.pathTemplates.dataPointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes getProfile without error using callback', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.GetProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.GetProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.devicesandservices.health.v4.Profile(), + ); + client.innerApiCalls.getProfile = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getProfile( + request, + ( + err?: Error | null, + result?: protos.google.devicesandservices.health.v4.IProfile | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchDataPointFromDataPointName', () => { - const result = client.matchDataPointFromDataPointName(fakePath); - assert.strictEqual(result, "dataPointValue"); - assert((client.pathTemplates.dataPointPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes getProfile with error', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.GetProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.GetProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getProfile = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getProfile(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('dataType', async () => { - const fakePath = "/rendered/path/dataType"; - const expectedParameters = { - user: "userValue", - data_type: "dataTypeValue", - }; - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.dataTypePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.dataTypePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('dataTypePath', () => { - const result = client.dataTypePath("userValue", "dataTypeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.dataTypePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes getProfile with closed client', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.GetProfileRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.GetProfileRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getProfile(request), expectedError); + }); + }); - it('matchUserFromDataTypeName', () => { - const result = client.matchUserFromDataTypeName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.dataTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('updateProfile', () => { + it('invokes updateProfile without error', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.UpdateProfileRequest(), + ); + request.profile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.UpdateProfileRequest', + ['profile', 'name'], + ); + request.profile.name = defaultValue1; + const expectedHeaderRequestParams = `profile.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.devicesandservices.health.v4.Profile(), + ); + client.innerApiCalls.updateProfile = stubSimpleCall(expectedResponse); + const [response] = await client.updateProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchDataTypeFromDataTypeName', () => { - const result = client.matchDataTypeFromDataTypeName(fakePath); - assert.strictEqual(result, "dataTypeValue"); - assert((client.pathTemplates.dataTypePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes updateProfile without error using callback', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.UpdateProfileRequest(), + ); + request.profile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.UpdateProfileRequest', + ['profile', 'name'], + ); + request.profile.name = defaultValue1; + const expectedHeaderRequestParams = `profile.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.devicesandservices.health.v4.Profile(), + ); + client.innerApiCalls.updateProfile = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateProfile( + request, + ( + err?: Error | null, + result?: protos.google.devicesandservices.health.v4.IProfile | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('identity', async () => { - const fakePath = "/rendered/path/identity"; - const expectedParameters = { - user: "userValue", - }; - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.identityPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.identityPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('identityPath', () => { - const result = client.identityPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.identityPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes updateProfile with error', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.UpdateProfileRequest(), + ); + request.profile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.UpdateProfileRequest', + ['profile', 'name'], + ); + request.profile.name = defaultValue1; + const expectedHeaderRequestParams = `profile.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateProfile = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateProfile(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateProfile as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateProfile as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchUserFromIdentityName', () => { - const result = client.matchUserFromIdentityName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.identityPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes updateProfile with closed client', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.UpdateProfileRequest(), + ); + request.profile ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.UpdateProfileRequest', + ['profile', 'name'], + ); + request.profile.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateProfile(request), expectedError); + }); + }); - describe('profile', async () => { - const fakePath = "/rendered/path/profile"; - const expectedParameters = { - user: "userValue", - }; - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.profilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.profilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('profilePath', () => { - const result = client.profilePath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.profilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('getSettings', () => { + it('invokes getSettings without error', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.GetSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.GetSettingsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.devicesandservices.health.v4.Settings(), + ); + client.innerApiCalls.getSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchUserFromProfileName', () => { - const result = client.matchUserFromProfileName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.profilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes getSettings without error using callback', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.GetSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.GetSettingsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.devicesandservices.health.v4.Settings(), + ); + client.innerApiCalls.getSettings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSettings( + request, + ( + err?: Error | null, + result?: protos.google.devicesandservices.health.v4.ISettings | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('settings', async () => { - const fakePath = "/rendered/path/settings"; - const expectedParameters = { - user: "userValue", - }; - const client = new healthprofileserviceModule.v4.HealthProfileServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.settingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.settingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('settingsPath', () => { - const result = client.settingsPath("userValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.settingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes getSettings with error', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.GetSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.GetSettingsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getSettings = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getSettings(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchUserFromSettingsName', () => { - const result = client.matchUserFromSettingsName(fakePath); - assert.strictEqual(result, "userValue"); - assert((client.pathTemplates.settingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes getSettings with closed client', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.GetSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.GetSettingsRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getSettings(request), expectedError); + }); + }); + + describe('updateSettings', () => { + it('invokes updateSettings without error', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.UpdateSettingsRequest(), + ); + request.settings ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.UpdateSettingsRequest', + ['settings', 'name'], + ); + request.settings.name = defaultValue1; + const expectedHeaderRequestParams = `settings.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.devicesandservices.health.v4.Settings(), + ); + client.innerApiCalls.updateSettings = stubSimpleCall(expectedResponse); + const [response] = await client.updateSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSettings without error using callback', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.UpdateSettingsRequest(), + ); + request.settings ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.UpdateSettingsRequest', + ['settings', 'name'], + ); + request.settings.name = defaultValue1; + const expectedHeaderRequestParams = `settings.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.devicesandservices.health.v4.Settings(), + ); + client.innerApiCalls.updateSettings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSettings( + request, + ( + err?: Error | null, + result?: protos.google.devicesandservices.health.v4.ISettings | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSettings with error', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.UpdateSettingsRequest(), + ); + request.settings ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.UpdateSettingsRequest', + ['settings', 'name'], + ); + request.settings.name = defaultValue1; + const expectedHeaderRequestParams = `settings.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSettings = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateSettings(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateSettings with closed client', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.UpdateSettingsRequest(), + ); + request.settings ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.UpdateSettingsRequest', + ['settings', 'name'], + ); + request.settings.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateSettings(request), expectedError); + }); + }); + + describe('getIdentity', () => { + it('invokes getIdentity without error', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.GetIdentityRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.GetIdentityRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.devicesandservices.health.v4.Identity(), + ); + client.innerApiCalls.getIdentity = stubSimpleCall(expectedResponse); + const [response] = await client.getIdentity(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getIdentity as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIdentity as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIdentity without error using callback', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.GetIdentityRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.GetIdentityRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.devicesandservices.health.v4.Identity(), + ); + client.innerApiCalls.getIdentity = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIdentity( + request, + ( + err?: Error | null, + result?: protos.google.devicesandservices.health.v4.IIdentity | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getIdentity as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIdentity as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIdentity with error', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.GetIdentityRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.GetIdentityRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getIdentity = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getIdentity(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getIdentity as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getIdentity as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getIdentity with closed client', async () => { + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.devicesandservices.health.v4.GetIdentityRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.devicesandservices.health.v4.GetIdentityRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getIdentity(request), expectedError); + }); + }); + + describe('Path templates', () => { + describe('dataPoint', async () => { + const fakePath = '/rendered/path/dataPoint'; + const expectedParameters = { + user: 'userValue', + data_type: 'dataTypeValue', + data_point: 'dataPointValue', + }; + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dataPointPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dataPointPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dataPointPath', () => { + const result = client.dataPointPath( + 'userValue', + 'dataTypeValue', + 'dataPointValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.dataPointPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchUserFromDataPointName', () => { + const result = client.matchUserFromDataPointName(fakePath); + assert.strictEqual(result, 'userValue'); + assert( + (client.pathTemplates.dataPointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDataTypeFromDataPointName', () => { + const result = client.matchDataTypeFromDataPointName(fakePath); + assert.strictEqual(result, 'dataTypeValue'); + assert( + (client.pathTemplates.dataPointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDataPointFromDataPointName', () => { + const result = client.matchDataPointFromDataPointName(fakePath); + assert.strictEqual(result, 'dataPointValue'); + assert( + (client.pathTemplates.dataPointPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('dataType', async () => { + const fakePath = '/rendered/path/dataType'; + const expectedParameters = { + user: 'userValue', + data_type: 'dataTypeValue', + }; + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.dataTypePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.dataTypePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('dataTypePath', () => { + const result = client.dataTypePath('userValue', 'dataTypeValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.dataTypePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchUserFromDataTypeName', () => { + const result = client.matchUserFromDataTypeName(fakePath); + assert.strictEqual(result, 'userValue'); + assert( + (client.pathTemplates.dataTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDataTypeFromDataTypeName', () => { + const result = client.matchDataTypeFromDataTypeName(fakePath); + assert.strictEqual(result, 'dataTypeValue'); + assert( + (client.pathTemplates.dataTypePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('identity', async () => { + const fakePath = '/rendered/path/identity'; + const expectedParameters = { + user: 'userValue', + }; + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.identityPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.identityPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('identityPath', () => { + const result = client.identityPath('userValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.identityPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchUserFromIdentityName', () => { + const result = client.matchUserFromIdentityName(fakePath); + assert.strictEqual(result, 'userValue'); + assert( + (client.pathTemplates.identityPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('profile', async () => { + const fakePath = '/rendered/path/profile'; + const expectedParameters = { + user: 'userValue', + }; + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + client.pathTemplates.profilePathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.profilePathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('profilePath', () => { + const result = client.profilePath('userValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.profilePathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchUserFromProfileName', () => { + const result = client.matchUserFromProfileName(fakePath); + assert.strictEqual(result, 'userValue'); + assert( + (client.pathTemplates.profilePathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('settings', async () => { + const fakePath = '/rendered/path/settings'; + const expectedParameters = { + user: 'userValue', + }; + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.settingsPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.settingsPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('settingsPath', () => { + const result = client.settingsPath('userValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.settingsPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchUserFromSettingsName', () => { + const result = client.matchUserFromSettingsName(fakePath); + assert.strictEqual(result, 'userValue'); + assert( + (client.pathTemplates.settingsPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('subscriber', async () => { + const fakePath = '/rendered/path/subscriber'; + const expectedParameters = { + project: 'projectValue', + subscriber: 'subscriberValue', + }; + const client = + new healthprofileserviceModule.v4.HealthProfileServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.subscriberPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.subscriberPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('subscriberPath', () => { + const result = client.subscriberPath('projectValue', 'subscriberValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.subscriberPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromSubscriberName', () => { + const result = client.matchProjectFromSubscriberName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.subscriberPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchSubscriberFromSubscriberName', () => { + const result = client.matchSubscriberFromSubscriberName(fakePath); + assert.strictEqual(result, 'subscriberValue'); + assert( + (client.pathTemplates.subscriberPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); });