exportExerciseTcx method
- String name, {
- bool? partialData,
- String? $fields,
- DownloadOptions downloadOptions = commons.DownloadOptions.metadata,
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.
Request parameters:
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.
Value must have pattern
^users/\[^/\]+/dataTypes/\[^/\]+/dataPoints/\[^/\]+$.
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.
$fields - Selector specifying which fields to include in a partial
response.
downloadOptions - Options for downloading. A download can be either a
Metadata (default) or Media download. Partial Media downloads are possible
as well.
Completes with a
-
ExportExerciseTcxResponse for Metadata downloads (see
downloadOptions). -
commons.Media for Media downloads (see
downloadOptions).
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<core.Object> exportExerciseTcx(
core.String name, {
core.bool? partialData,
core.String? $fields,
commons.DownloadOptions downloadOptions = commons.DownloadOptions.metadata,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'partialData': ?partialData == null ? null : ['${partialData}'],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'v4/' + core.Uri.encodeFull('$name') + ':exportExerciseTcx';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
downloadOptions: downloadOptions,
);
if (downloadOptions.isMetadataDownload) {
return ExportExerciseTcxResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
} else {
return response_ as commons.Media;
}
}