OLD | NEW |
(Empty) | |
| 1 library googleapis.fitness.v1; |
| 2 |
| 3 import "dart:core" as core; |
| 4 import "dart:collection" as collection; |
| 5 import "dart:async" as async; |
| 6 import "dart:convert" as convert; |
| 7 |
| 8 import "package:crypto/crypto.dart" as crypto; |
| 9 import 'package:http/http.dart' as http; |
| 10 import '../src/common_internal.dart' as common_internal; |
| 11 import '../common/common.dart' as common; |
| 12 |
| 13 export '../common/common.dart' show ApiRequestError; |
| 14 export '../common/common.dart' show DetailedApiRequestError; |
| 15 |
| 16 /** Google Fit API */ |
| 17 class FitnessApi { |
| 18 /** View your activity information in Google Fit */ |
| 19 static const FitnessActivityReadScope = "https://www.googleapis.com/auth/fitne
ss.activity.read"; |
| 20 |
| 21 /** View and store your activity information in Google Fit */ |
| 22 static const FitnessActivityWriteScope = "https://www.googleapis.com/auth/fitn
ess.activity.write"; |
| 23 |
| 24 /** View body sensor information in Google Fit */ |
| 25 static const FitnessBodyReadScope = "https://www.googleapis.com/auth/fitness.b
ody.read"; |
| 26 |
| 27 /** View and store body sensor data in Google Fit */ |
| 28 static const FitnessBodyWriteScope = "https://www.googleapis.com/auth/fitness.
body.write"; |
| 29 |
| 30 /** View your stored location data in Google Fit */ |
| 31 static const FitnessLocationReadScope = "https://www.googleapis.com/auth/fitne
ss.location.read"; |
| 32 |
| 33 /** View and store your location data in Google Fit */ |
| 34 static const FitnessLocationWriteScope = "https://www.googleapis.com/auth/fitn
ess.location.write"; |
| 35 |
| 36 |
| 37 final common_internal.ApiRequester _requester; |
| 38 |
| 39 UsersResourceApi get users => new UsersResourceApi(_requester); |
| 40 |
| 41 FitnessApi(http.Client client) : |
| 42 _requester = new common_internal.ApiRequester(client, "https://www.googlea
pis.com/", "fitness/v1/users/"); |
| 43 } |
| 44 |
| 45 |
| 46 /** Not documented yet. */ |
| 47 class UsersResourceApi { |
| 48 final common_internal.ApiRequester _requester; |
| 49 |
| 50 UsersDataSourcesResourceApi get dataSources => new UsersDataSourcesResourceApi
(_requester); |
| 51 UsersSessionsResourceApi get sessions => new UsersSessionsResourceApi(_request
er); |
| 52 |
| 53 UsersResourceApi(common_internal.ApiRequester client) : |
| 54 _requester = client; |
| 55 } |
| 56 |
| 57 |
| 58 /** Not documented yet. */ |
| 59 class UsersDataSourcesResourceApi { |
| 60 final common_internal.ApiRequester _requester; |
| 61 |
| 62 UsersDataSourcesDatasetsResourceApi get datasets => new UsersDataSourcesDatase
tsResourceApi(_requester); |
| 63 |
| 64 UsersDataSourcesResourceApi(common_internal.ApiRequester client) : |
| 65 _requester = client; |
| 66 |
| 67 /** |
| 68 * Creates a new data source that is unique across all data sources belonging |
| 69 * to this user. The data stream ID field can be omitted and will be generated |
| 70 * by the server with the correct format. The data stream ID is an ordered |
| 71 * combination of some fields from the data source. In addition to the data |
| 72 * source fields reflected into the data source ID, the developer project |
| 73 * number that is authenticated when creating the data source is included. |
| 74 * This developer project number is obfuscated when read by any other |
| 75 * developer reading public data types. |
| 76 * |
| 77 * [request] - The metadata request object. |
| 78 * |
| 79 * Request parameters: |
| 80 * |
| 81 * [userId] - Create the data source for the person identified. Use me to |
| 82 * indicate the authenticated user. Only me is supported at this time. |
| 83 * |
| 84 * Completes with a [DataSource]. |
| 85 * |
| 86 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 87 * error. |
| 88 * |
| 89 * If the used [http.Client] completes with an error when making a REST call, |
| 90 * this method will complete with the same error. |
| 91 */ |
| 92 async.Future<DataSource> create(DataSource request, core.String userId) { |
| 93 var _url = null; |
| 94 var _queryParams = new core.Map(); |
| 95 var _uploadMedia = null; |
| 96 var _uploadOptions = null; |
| 97 var _downloadOptions = common.DownloadOptions.Metadata; |
| 98 var _body = null; |
| 99 |
| 100 if (request != null) { |
| 101 _body = convert.JSON.encode((request).toJson()); |
| 102 } |
| 103 if (userId == null) { |
| 104 throw new core.ArgumentError("Parameter userId is required."); |
| 105 } |
| 106 |
| 107 |
| 108 _url = common_internal.Escaper.ecapeVariable('$userId') + '/dataSources'; |
| 109 |
| 110 var _response = _requester.request(_url, |
| 111 "POST", |
| 112 body: _body, |
| 113 queryParams: _queryParams, |
| 114 uploadOptions: _uploadOptions, |
| 115 uploadMedia: _uploadMedia, |
| 116 downloadOptions: _downloadOptions); |
| 117 return _response.then((data) => new DataSource.fromJson(data)); |
| 118 } |
| 119 |
| 120 /** |
| 121 * Returns a data source identified by a data stream ID. |
| 122 * |
| 123 * Request parameters: |
| 124 * |
| 125 * [userId] - Retrieve a data source for the person identified. Use me to |
| 126 * indicate the authenticated user. Only me is supported at this time. |
| 127 * |
| 128 * [dataSourceId] - The data stream ID of the data source to retrieve. |
| 129 * |
| 130 * Completes with a [DataSource]. |
| 131 * |
| 132 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 133 * error. |
| 134 * |
| 135 * If the used [http.Client] completes with an error when making a REST call, |
| 136 * this method will complete with the same error. |
| 137 */ |
| 138 async.Future<DataSource> get(core.String userId, core.String dataSourceId) { |
| 139 var _url = null; |
| 140 var _queryParams = new core.Map(); |
| 141 var _uploadMedia = null; |
| 142 var _uploadOptions = null; |
| 143 var _downloadOptions = common.DownloadOptions.Metadata; |
| 144 var _body = null; |
| 145 |
| 146 if (userId == null) { |
| 147 throw new core.ArgumentError("Parameter userId is required."); |
| 148 } |
| 149 if (dataSourceId == null) { |
| 150 throw new core.ArgumentError("Parameter dataSourceId is required."); |
| 151 } |
| 152 |
| 153 |
| 154 _url = common_internal.Escaper.ecapeVariable('$userId') + '/dataSources/' +
common_internal.Escaper.ecapeVariable('$dataSourceId'); |
| 155 |
| 156 var _response = _requester.request(_url, |
| 157 "GET", |
| 158 body: _body, |
| 159 queryParams: _queryParams, |
| 160 uploadOptions: _uploadOptions, |
| 161 uploadMedia: _uploadMedia, |
| 162 downloadOptions: _downloadOptions); |
| 163 return _response.then((data) => new DataSource.fromJson(data)); |
| 164 } |
| 165 |
| 166 /** |
| 167 * Lists all data sources that are visible to the developer, using the OAuth |
| 168 * scopes provided. The list is not exhaustive: the user may have private data |
| 169 * sources that are only visible to other developers or calls using other |
| 170 * scopes. |
| 171 * |
| 172 * Request parameters: |
| 173 * |
| 174 * [userId] - List data sources for the person identified. Use me to indicate |
| 175 * the authenticated user. Only me is supported at this time. |
| 176 * |
| 177 * [dataTypeName] - The names of data types to include in the list. If not |
| 178 * specified, all data sources will be returned. |
| 179 * |
| 180 * Completes with a [ListDataSourcesResponse]. |
| 181 * |
| 182 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 183 * error. |
| 184 * |
| 185 * If the used [http.Client] completes with an error when making a REST call, |
| 186 * this method will complete with the same error. |
| 187 */ |
| 188 async.Future<ListDataSourcesResponse> list(core.String userId, {core.List<core
.String> dataTypeName}) { |
| 189 var _url = null; |
| 190 var _queryParams = new core.Map(); |
| 191 var _uploadMedia = null; |
| 192 var _uploadOptions = null; |
| 193 var _downloadOptions = common.DownloadOptions.Metadata; |
| 194 var _body = null; |
| 195 |
| 196 if (userId == null) { |
| 197 throw new core.ArgumentError("Parameter userId is required."); |
| 198 } |
| 199 if (dataTypeName != null) { |
| 200 _queryParams["dataTypeName"] = dataTypeName; |
| 201 } |
| 202 |
| 203 |
| 204 _url = common_internal.Escaper.ecapeVariable('$userId') + '/dataSources'; |
| 205 |
| 206 var _response = _requester.request(_url, |
| 207 "GET", |
| 208 body: _body, |
| 209 queryParams: _queryParams, |
| 210 uploadOptions: _uploadOptions, |
| 211 uploadMedia: _uploadMedia, |
| 212 downloadOptions: _downloadOptions); |
| 213 return _response.then((data) => new ListDataSourcesResponse.fromJson(data)); |
| 214 } |
| 215 |
| 216 /** |
| 217 * Updates a given data source. It is an error to modify the data source's |
| 218 * data stream ID, data type, type, stream name or device information apart |
| 219 * from the device version. Changing these fields would require a new unique |
| 220 * data stream ID and separate data source. |
| 221 * |
| 222 * Data sources are identified by their data stream ID. This method supports |
| 223 * patch semantics. |
| 224 * |
| 225 * [request] - The metadata request object. |
| 226 * |
| 227 * Request parameters: |
| 228 * |
| 229 * [userId] - Update the data source for the person identified. Use me to |
| 230 * indicate the authenticated user. Only me is supported at this time. |
| 231 * |
| 232 * [dataSourceId] - The data stream ID of the data source to update. |
| 233 * |
| 234 * Completes with a [DataSource]. |
| 235 * |
| 236 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 237 * error. |
| 238 * |
| 239 * If the used [http.Client] completes with an error when making a REST call, |
| 240 * this method will complete with the same error. |
| 241 */ |
| 242 async.Future<DataSource> patch(DataSource request, core.String userId, core.St
ring dataSourceId) { |
| 243 var _url = null; |
| 244 var _queryParams = new core.Map(); |
| 245 var _uploadMedia = null; |
| 246 var _uploadOptions = null; |
| 247 var _downloadOptions = common.DownloadOptions.Metadata; |
| 248 var _body = null; |
| 249 |
| 250 if (request != null) { |
| 251 _body = convert.JSON.encode((request).toJson()); |
| 252 } |
| 253 if (userId == null) { |
| 254 throw new core.ArgumentError("Parameter userId is required."); |
| 255 } |
| 256 if (dataSourceId == null) { |
| 257 throw new core.ArgumentError("Parameter dataSourceId is required."); |
| 258 } |
| 259 |
| 260 |
| 261 _url = common_internal.Escaper.ecapeVariable('$userId') + '/dataSources/' +
common_internal.Escaper.ecapeVariable('$dataSourceId'); |
| 262 |
| 263 var _response = _requester.request(_url, |
| 264 "PATCH", |
| 265 body: _body, |
| 266 queryParams: _queryParams, |
| 267 uploadOptions: _uploadOptions, |
| 268 uploadMedia: _uploadMedia, |
| 269 downloadOptions: _downloadOptions); |
| 270 return _response.then((data) => new DataSource.fromJson(data)); |
| 271 } |
| 272 |
| 273 /** |
| 274 * Updates a given data source. It is an error to modify the data source's |
| 275 * data stream ID, data type, type, stream name or device information apart |
| 276 * from the device version. Changing these fields would require a new unique |
| 277 * data stream ID and separate data source. |
| 278 * |
| 279 * Data sources are identified by their data stream ID. |
| 280 * |
| 281 * [request] - The metadata request object. |
| 282 * |
| 283 * Request parameters: |
| 284 * |
| 285 * [userId] - Update the data source for the person identified. Use me to |
| 286 * indicate the authenticated user. Only me is supported at this time. |
| 287 * |
| 288 * [dataSourceId] - The data stream ID of the data source to update. |
| 289 * |
| 290 * Completes with a [DataSource]. |
| 291 * |
| 292 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 293 * error. |
| 294 * |
| 295 * If the used [http.Client] completes with an error when making a REST call, |
| 296 * this method will complete with the same error. |
| 297 */ |
| 298 async.Future<DataSource> update(DataSource request, core.String userId, core.S
tring dataSourceId) { |
| 299 var _url = null; |
| 300 var _queryParams = new core.Map(); |
| 301 var _uploadMedia = null; |
| 302 var _uploadOptions = null; |
| 303 var _downloadOptions = common.DownloadOptions.Metadata; |
| 304 var _body = null; |
| 305 |
| 306 if (request != null) { |
| 307 _body = convert.JSON.encode((request).toJson()); |
| 308 } |
| 309 if (userId == null) { |
| 310 throw new core.ArgumentError("Parameter userId is required."); |
| 311 } |
| 312 if (dataSourceId == null) { |
| 313 throw new core.ArgumentError("Parameter dataSourceId is required."); |
| 314 } |
| 315 |
| 316 |
| 317 _url = common_internal.Escaper.ecapeVariable('$userId') + '/dataSources/' +
common_internal.Escaper.ecapeVariable('$dataSourceId'); |
| 318 |
| 319 var _response = _requester.request(_url, |
| 320 "PUT", |
| 321 body: _body, |
| 322 queryParams: _queryParams, |
| 323 uploadOptions: _uploadOptions, |
| 324 uploadMedia: _uploadMedia, |
| 325 downloadOptions: _downloadOptions); |
| 326 return _response.then((data) => new DataSource.fromJson(data)); |
| 327 } |
| 328 |
| 329 } |
| 330 |
| 331 |
| 332 /** Not documented yet. */ |
| 333 class UsersDataSourcesDatasetsResourceApi { |
| 334 final common_internal.ApiRequester _requester; |
| 335 |
| 336 UsersDataSourcesDatasetsResourceApi(common_internal.ApiRequester client) : |
| 337 _requester = client; |
| 338 |
| 339 /** |
| 340 * Performs an inclusive delete of all data points whose start and end times |
| 341 * have any overlap with the time range specified by the dataset ID. For most |
| 342 * data types, the entire data point will be deleted. For data types where the |
| 343 * time span represents a consistent value (such as |
| 344 * com.google.activity.segment), and a data point straddles either end point |
| 345 * of the dataset, only the overlapping portion of the data point will be |
| 346 * deleted. |
| 347 * |
| 348 * Request parameters: |
| 349 * |
| 350 * [userId] - Delete a dataset for the person identified. Use me to indicate |
| 351 * the authenticated user. Only me is supported at this time. |
| 352 * |
| 353 * [dataSourceId] - The data stream ID of the data source that created the |
| 354 * dataset. |
| 355 * |
| 356 * [datasetId] - Dataset identifier that is a composite of the minimum data |
| 357 * point start time and maximum data point end time represented as nanoseconds |
| 358 * from the epoch. The ID is formatted like: "startTime-endTime" where |
| 359 * startTime and endTime are 64 bit integers. |
| 360 * |
| 361 * [currentTimeMillis] - The client's current time in milliseconds since |
| 362 * epoch. |
| 363 * |
| 364 * [modifiedTimeMillis] - When the operation was performed on the client. |
| 365 * |
| 366 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 367 * error. |
| 368 * |
| 369 * If the used [http.Client] completes with an error when making a REST call, |
| 370 * this method will complete with the same error. |
| 371 */ |
| 372 async.Future delete(core.String userId, core.String dataSourceId, core.String
datasetId, {core.String currentTimeMillis, core.String modifiedTimeMillis}) { |
| 373 var _url = null; |
| 374 var _queryParams = new core.Map(); |
| 375 var _uploadMedia = null; |
| 376 var _uploadOptions = null; |
| 377 var _downloadOptions = common.DownloadOptions.Metadata; |
| 378 var _body = null; |
| 379 |
| 380 if (userId == null) { |
| 381 throw new core.ArgumentError("Parameter userId is required."); |
| 382 } |
| 383 if (dataSourceId == null) { |
| 384 throw new core.ArgumentError("Parameter dataSourceId is required."); |
| 385 } |
| 386 if (datasetId == null) { |
| 387 throw new core.ArgumentError("Parameter datasetId is required."); |
| 388 } |
| 389 if (currentTimeMillis != null) { |
| 390 _queryParams["currentTimeMillis"] = [currentTimeMillis]; |
| 391 } |
| 392 if (modifiedTimeMillis != null) { |
| 393 _queryParams["modifiedTimeMillis"] = [modifiedTimeMillis]; |
| 394 } |
| 395 |
| 396 _downloadOptions = null; |
| 397 |
| 398 _url = common_internal.Escaper.ecapeVariable('$userId') + '/dataSources/' +
common_internal.Escaper.ecapeVariable('$dataSourceId') + '/datasets/' + common_i
nternal.Escaper.ecapeVariable('$datasetId'); |
| 399 |
| 400 var _response = _requester.request(_url, |
| 401 "DELETE", |
| 402 body: _body, |
| 403 queryParams: _queryParams, |
| 404 uploadOptions: _uploadOptions, |
| 405 uploadMedia: _uploadMedia, |
| 406 downloadOptions: _downloadOptions); |
| 407 return _response.then((data) => null); |
| 408 } |
| 409 |
| 410 /** |
| 411 * Returns a dataset containing all data points whose start and end times |
| 412 * overlap with the specified range of the dataset minimum start time and |
| 413 * maximum end time. Specifically, any data point whose start time is less |
| 414 * than or equal to the dataset end time and whose end time is greater than or |
| 415 * equal to the dataset start time. |
| 416 * |
| 417 * Request parameters: |
| 418 * |
| 419 * [userId] - Retrieve a dataset for the person identified. Use me to indicate |
| 420 * the authenticated user. Only me is supported at this time. |
| 421 * |
| 422 * [dataSourceId] - The data stream ID of the data source that created the |
| 423 * dataset. |
| 424 * |
| 425 * [datasetId] - Dataset identifier that is a composite of the minimum data |
| 426 * point start time and maximum data point end time represented as nanoseconds |
| 427 * from the epoch. The ID is formatted like: "startTime-endTime" where |
| 428 * startTime and endTime are 64 bit integers. |
| 429 * |
| 430 * Completes with a [Dataset]. |
| 431 * |
| 432 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 433 * error. |
| 434 * |
| 435 * If the used [http.Client] completes with an error when making a REST call, |
| 436 * this method will complete with the same error. |
| 437 */ |
| 438 async.Future<Dataset> get(core.String userId, core.String dataSourceId, core.S
tring datasetId) { |
| 439 var _url = null; |
| 440 var _queryParams = new core.Map(); |
| 441 var _uploadMedia = null; |
| 442 var _uploadOptions = null; |
| 443 var _downloadOptions = common.DownloadOptions.Metadata; |
| 444 var _body = null; |
| 445 |
| 446 if (userId == null) { |
| 447 throw new core.ArgumentError("Parameter userId is required."); |
| 448 } |
| 449 if (dataSourceId == null) { |
| 450 throw new core.ArgumentError("Parameter dataSourceId is required."); |
| 451 } |
| 452 if (datasetId == null) { |
| 453 throw new core.ArgumentError("Parameter datasetId is required."); |
| 454 } |
| 455 |
| 456 |
| 457 _url = common_internal.Escaper.ecapeVariable('$userId') + '/dataSources/' +
common_internal.Escaper.ecapeVariable('$dataSourceId') + '/datasets/' + common_i
nternal.Escaper.ecapeVariable('$datasetId'); |
| 458 |
| 459 var _response = _requester.request(_url, |
| 460 "GET", |
| 461 body: _body, |
| 462 queryParams: _queryParams, |
| 463 uploadOptions: _uploadOptions, |
| 464 uploadMedia: _uploadMedia, |
| 465 downloadOptions: _downloadOptions); |
| 466 return _response.then((data) => new Dataset.fromJson(data)); |
| 467 } |
| 468 |
| 469 /** |
| 470 * Adds data points to a dataset. The dataset need not be previously created. |
| 471 * All points within the given dataset will be returned with subsquent calls |
| 472 * to retrieve this dataset. Data points can belong to more than one dataset. |
| 473 * This method does not use patch semantics. |
| 474 * |
| 475 * [request] - The metadata request object. |
| 476 * |
| 477 * Request parameters: |
| 478 * |
| 479 * [userId] - Patch a dataset for the person identified. Use me to indicate |
| 480 * the authenticated user. Only me is supported at this time. |
| 481 * |
| 482 * [dataSourceId] - The data stream ID of the data source that created the |
| 483 * dataset. |
| 484 * |
| 485 * [datasetId] - Dataset identifier that is a composite of the minimum data |
| 486 * point start time and maximum data point end time represented as nanoseconds |
| 487 * from the epoch. The ID is formatted like: "startTime-endTime" where |
| 488 * startTime and endTime are 64 bit integers. |
| 489 * |
| 490 * [currentTimeMillis] - The client's current time in milliseconds since |
| 491 * epoch. Note that the minStartTimeNs and maxEndTimeNs properties in the |
| 492 * request body are in nanoseconds instead of milliseconds. |
| 493 * |
| 494 * Completes with a [Dataset]. |
| 495 * |
| 496 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 497 * error. |
| 498 * |
| 499 * If the used [http.Client] completes with an error when making a REST call, |
| 500 * this method will complete with the same error. |
| 501 */ |
| 502 async.Future<Dataset> patch(Dataset request, core.String userId, core.String d
ataSourceId, core.String datasetId, {core.String currentTimeMillis}) { |
| 503 var _url = null; |
| 504 var _queryParams = new core.Map(); |
| 505 var _uploadMedia = null; |
| 506 var _uploadOptions = null; |
| 507 var _downloadOptions = common.DownloadOptions.Metadata; |
| 508 var _body = null; |
| 509 |
| 510 if (request != null) { |
| 511 _body = convert.JSON.encode((request).toJson()); |
| 512 } |
| 513 if (userId == null) { |
| 514 throw new core.ArgumentError("Parameter userId is required."); |
| 515 } |
| 516 if (dataSourceId == null) { |
| 517 throw new core.ArgumentError("Parameter dataSourceId is required."); |
| 518 } |
| 519 if (datasetId == null) { |
| 520 throw new core.ArgumentError("Parameter datasetId is required."); |
| 521 } |
| 522 if (currentTimeMillis != null) { |
| 523 _queryParams["currentTimeMillis"] = [currentTimeMillis]; |
| 524 } |
| 525 |
| 526 |
| 527 _url = common_internal.Escaper.ecapeVariable('$userId') + '/dataSources/' +
common_internal.Escaper.ecapeVariable('$dataSourceId') + '/datasets/' + common_i
nternal.Escaper.ecapeVariable('$datasetId'); |
| 528 |
| 529 var _response = _requester.request(_url, |
| 530 "PATCH", |
| 531 body: _body, |
| 532 queryParams: _queryParams, |
| 533 uploadOptions: _uploadOptions, |
| 534 uploadMedia: _uploadMedia, |
| 535 downloadOptions: _downloadOptions); |
| 536 return _response.then((data) => new Dataset.fromJson(data)); |
| 537 } |
| 538 |
| 539 } |
| 540 |
| 541 |
| 542 /** Not documented yet. */ |
| 543 class UsersSessionsResourceApi { |
| 544 final common_internal.ApiRequester _requester; |
| 545 |
| 546 UsersSessionsResourceApi(common_internal.ApiRequester client) : |
| 547 _requester = client; |
| 548 |
| 549 /** |
| 550 * Deletes a session specified by the given session ID. |
| 551 * |
| 552 * Request parameters: |
| 553 * |
| 554 * [userId] - Delete a session for the person identified. Use me to indicate |
| 555 * the authenticated user. Only me is supported at this time. |
| 556 * |
| 557 * [sessionId] - The ID of the session to be deleted. |
| 558 * |
| 559 * [currentTimeMillis] - The client's current time in milliseconds since |
| 560 * epoch. |
| 561 * |
| 562 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 563 * error. |
| 564 * |
| 565 * If the used [http.Client] completes with an error when making a REST call, |
| 566 * this method will complete with the same error. |
| 567 */ |
| 568 async.Future delete(core.String userId, core.String sessionId, {core.String cu
rrentTimeMillis}) { |
| 569 var _url = null; |
| 570 var _queryParams = new core.Map(); |
| 571 var _uploadMedia = null; |
| 572 var _uploadOptions = null; |
| 573 var _downloadOptions = common.DownloadOptions.Metadata; |
| 574 var _body = null; |
| 575 |
| 576 if (userId == null) { |
| 577 throw new core.ArgumentError("Parameter userId is required."); |
| 578 } |
| 579 if (sessionId == null) { |
| 580 throw new core.ArgumentError("Parameter sessionId is required."); |
| 581 } |
| 582 if (currentTimeMillis != null) { |
| 583 _queryParams["currentTimeMillis"] = [currentTimeMillis]; |
| 584 } |
| 585 |
| 586 _downloadOptions = null; |
| 587 |
| 588 _url = common_internal.Escaper.ecapeVariable('$userId') + '/sessions/' + com
mon_internal.Escaper.ecapeVariable('$sessionId'); |
| 589 |
| 590 var _response = _requester.request(_url, |
| 591 "DELETE", |
| 592 body: _body, |
| 593 queryParams: _queryParams, |
| 594 uploadOptions: _uploadOptions, |
| 595 uploadMedia: _uploadMedia, |
| 596 downloadOptions: _downloadOptions); |
| 597 return _response.then((data) => null); |
| 598 } |
| 599 |
| 600 /** |
| 601 * Lists sessions previously created. |
| 602 * |
| 603 * Request parameters: |
| 604 * |
| 605 * [userId] - List sessions for the person identified. Use me to indicate the |
| 606 * authenticated user. Only me is supported at this time. |
| 607 * |
| 608 * [endTime] - An RFC3339 timestamp. Only sessions ending between the start |
| 609 * and end times will be included in the response. |
| 610 * |
| 611 * [includeDeleted] - If true, deleted sessions will be returned. When set to |
| 612 * true, sessions returned in this response will only have an ID and will not |
| 613 * have any other fields. |
| 614 * |
| 615 * [pageToken] - The continuation token, which is used to page through large |
| 616 * result sets. To get the next page of results, set this parameter to the |
| 617 * value of nextPageToken from the previous response. |
| 618 * |
| 619 * [startTime] - An RFC3339 timestamp. Only sessions ending between the start |
| 620 * and end times will be included in the response. |
| 621 * |
| 622 * Completes with a [ListSessionsResponse]. |
| 623 * |
| 624 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 625 * error. |
| 626 * |
| 627 * If the used [http.Client] completes with an error when making a REST call, |
| 628 * this method will complete with the same error. |
| 629 */ |
| 630 async.Future<ListSessionsResponse> list(core.String userId, {core.String endTi
me, core.bool includeDeleted, core.String pageToken, core.String startTime}) { |
| 631 var _url = null; |
| 632 var _queryParams = new core.Map(); |
| 633 var _uploadMedia = null; |
| 634 var _uploadOptions = null; |
| 635 var _downloadOptions = common.DownloadOptions.Metadata; |
| 636 var _body = null; |
| 637 |
| 638 if (userId == null) { |
| 639 throw new core.ArgumentError("Parameter userId is required."); |
| 640 } |
| 641 if (endTime != null) { |
| 642 _queryParams["endTime"] = [endTime]; |
| 643 } |
| 644 if (includeDeleted != null) { |
| 645 _queryParams["includeDeleted"] = ["${includeDeleted}"]; |
| 646 } |
| 647 if (pageToken != null) { |
| 648 _queryParams["pageToken"] = [pageToken]; |
| 649 } |
| 650 if (startTime != null) { |
| 651 _queryParams["startTime"] = [startTime]; |
| 652 } |
| 653 |
| 654 |
| 655 _url = common_internal.Escaper.ecapeVariable('$userId') + '/sessions'; |
| 656 |
| 657 var _response = _requester.request(_url, |
| 658 "GET", |
| 659 body: _body, |
| 660 queryParams: _queryParams, |
| 661 uploadOptions: _uploadOptions, |
| 662 uploadMedia: _uploadMedia, |
| 663 downloadOptions: _downloadOptions); |
| 664 return _response.then((data) => new ListSessionsResponse.fromJson(data)); |
| 665 } |
| 666 |
| 667 /** |
| 668 * Updates or insert a given session. |
| 669 * |
| 670 * [request] - The metadata request object. |
| 671 * |
| 672 * Request parameters: |
| 673 * |
| 674 * [userId] - Create sessions for the person identified. Use me to indicate |
| 675 * the authenticated user. Only me is supported at this time. |
| 676 * |
| 677 * [sessionId] - The ID of the session to be created. |
| 678 * |
| 679 * [currentTimeMillis] - The client's current time in milliseconds since |
| 680 * epoch. |
| 681 * |
| 682 * Completes with a [Session]. |
| 683 * |
| 684 * Completes with a [common.ApiRequestError] if the API endpoint returned an |
| 685 * error. |
| 686 * |
| 687 * If the used [http.Client] completes with an error when making a REST call, |
| 688 * this method will complete with the same error. |
| 689 */ |
| 690 async.Future<Session> update(Session request, core.String userId, core.String
sessionId, {core.String currentTimeMillis}) { |
| 691 var _url = null; |
| 692 var _queryParams = new core.Map(); |
| 693 var _uploadMedia = null; |
| 694 var _uploadOptions = null; |
| 695 var _downloadOptions = common.DownloadOptions.Metadata; |
| 696 var _body = null; |
| 697 |
| 698 if (request != null) { |
| 699 _body = convert.JSON.encode((request).toJson()); |
| 700 } |
| 701 if (userId == null) { |
| 702 throw new core.ArgumentError("Parameter userId is required."); |
| 703 } |
| 704 if (sessionId == null) { |
| 705 throw new core.ArgumentError("Parameter sessionId is required."); |
| 706 } |
| 707 if (currentTimeMillis != null) { |
| 708 _queryParams["currentTimeMillis"] = [currentTimeMillis]; |
| 709 } |
| 710 |
| 711 |
| 712 _url = common_internal.Escaper.ecapeVariable('$userId') + '/sessions/' + com
mon_internal.Escaper.ecapeVariable('$sessionId'); |
| 713 |
| 714 var _response = _requester.request(_url, |
| 715 "PUT", |
| 716 body: _body, |
| 717 queryParams: _queryParams, |
| 718 uploadOptions: _uploadOptions, |
| 719 uploadMedia: _uploadMedia, |
| 720 downloadOptions: _downloadOptions); |
| 721 return _response.then((data) => new Session.fromJson(data)); |
| 722 } |
| 723 |
| 724 } |
| 725 |
| 726 |
| 727 |
| 728 /** |
| 729 * See: google3/java/com/google/android/apps/heart/platform/api/Application.java |
| 730 */ |
| 731 class Application { |
| 732 /** An optional URI that can be used to link back to the application. */ |
| 733 core.String detailsUrl; |
| 734 |
| 735 /** |
| 736 * The name of this application. This is required for REST clients, but we do |
| 737 * not enforce uniqueness of this name. It is provided as a matter of |
| 738 * convenience for other developers who would like to identify which REST |
| 739 * created an Application or Data Source. |
| 740 */ |
| 741 core.String name; |
| 742 |
| 743 /** |
| 744 * Package name for this application. This is used as a unique identifier when |
| 745 * creaed by Android applications, but cannot be specified by REST clients. |
| 746 * REST clients will have their developer project number reflected into the |
| 747 * Data Source data stream IDs, instead of the packageName. |
| 748 */ |
| 749 core.String packageName; |
| 750 |
| 751 /** |
| 752 * Version of the application. You should update this field whenever the |
| 753 * application changes in a way that affects the computation of the data. |
| 754 */ |
| 755 core.String version; |
| 756 |
| 757 |
| 758 Application(); |
| 759 |
| 760 Application.fromJson(core.Map _json) { |
| 761 if (_json.containsKey("detailsUrl")) { |
| 762 detailsUrl = _json["detailsUrl"]; |
| 763 } |
| 764 if (_json.containsKey("name")) { |
| 765 name = _json["name"]; |
| 766 } |
| 767 if (_json.containsKey("packageName")) { |
| 768 packageName = _json["packageName"]; |
| 769 } |
| 770 if (_json.containsKey("version")) { |
| 771 version = _json["version"]; |
| 772 } |
| 773 } |
| 774 |
| 775 core.Map toJson() { |
| 776 var _json = new core.Map(); |
| 777 if (detailsUrl != null) { |
| 778 _json["detailsUrl"] = detailsUrl; |
| 779 } |
| 780 if (name != null) { |
| 781 _json["name"] = name; |
| 782 } |
| 783 if (packageName != null) { |
| 784 _json["packageName"] = packageName; |
| 785 } |
| 786 if (version != null) { |
| 787 _json["version"] = version; |
| 788 } |
| 789 return _json; |
| 790 } |
| 791 } |
| 792 |
| 793 |
| 794 /** |
| 795 * Represents a single data point, generated by a particular data source. A data |
| 796 * point holds a value for each field, an end timestamp and an optional start |
| 797 * time. The exact semantics of each of these attributes are specified in the |
| 798 * documentation for the particular data type. |
| 799 * |
| 800 * A data point can represent an instantaneous measurement, reading or input |
| 801 * observation, as well as averages or aggregates over a time interval. Check |
| 802 * the data type documentation to determine which is the case for a particular |
| 803 * data type. |
| 804 * |
| 805 * Data points always contain one value for each field of the data type. |
| 806 */ |
| 807 class DataPoint { |
| 808 /** |
| 809 * Used for version checking during transformation; that is, a datapoint can |
| 810 * only replace another datapoint that has an older computation time stamp. |
| 811 */ |
| 812 core.String computationTimeMillis; |
| 813 |
| 814 /** The data type defining the format of the values in this data point. */ |
| 815 core.String dataTypeName; |
| 816 |
| 817 /** |
| 818 * The end time of the interval represented by this data point, in nanoseconds |
| 819 * since epoch. |
| 820 */ |
| 821 core.String endTimeNanos; |
| 822 |
| 823 /** |
| 824 * Indicates the last time this data point was modified. Useful only in |
| 825 * contexts where we are listing the data changes, rather than representing |
| 826 * the current state of the data. |
| 827 */ |
| 828 core.String modifiedTimeMillis; |
| 829 |
| 830 /** |
| 831 * If the data point is contained in a dataset for a derived data source, this |
| 832 * field will be populated with the data source stream ID that created the |
| 833 * data point originally. |
| 834 */ |
| 835 core.String originDataSourceId; |
| 836 |
| 837 /** The raw timestamp from the original SensorEvent. */ |
| 838 core.String rawTimestampNanos; |
| 839 |
| 840 /** |
| 841 * The start time of the interval represented by this data point, in |
| 842 * nanoseconds since epoch. |
| 843 */ |
| 844 core.String startTimeNanos; |
| 845 |
| 846 /** |
| 847 * Values of each data type field for the data point. It is expected that each |
| 848 * value corresponding to a data type field will occur in the same order that |
| 849 * the field is listed with in the data type specified in a data source. |
| 850 * |
| 851 * Only one of integer and floating point fields will be populated, depending |
| 852 * on the format enum value within data source's type field. |
| 853 */ |
| 854 core.List<Value> value; |
| 855 |
| 856 |
| 857 DataPoint(); |
| 858 |
| 859 DataPoint.fromJson(core.Map _json) { |
| 860 if (_json.containsKey("computationTimeMillis")) { |
| 861 computationTimeMillis = _json["computationTimeMillis"]; |
| 862 } |
| 863 if (_json.containsKey("dataTypeName")) { |
| 864 dataTypeName = _json["dataTypeName"]; |
| 865 } |
| 866 if (_json.containsKey("endTimeNanos")) { |
| 867 endTimeNanos = _json["endTimeNanos"]; |
| 868 } |
| 869 if (_json.containsKey("modifiedTimeMillis")) { |
| 870 modifiedTimeMillis = _json["modifiedTimeMillis"]; |
| 871 } |
| 872 if (_json.containsKey("originDataSourceId")) { |
| 873 originDataSourceId = _json["originDataSourceId"]; |
| 874 } |
| 875 if (_json.containsKey("rawTimestampNanos")) { |
| 876 rawTimestampNanos = _json["rawTimestampNanos"]; |
| 877 } |
| 878 if (_json.containsKey("startTimeNanos")) { |
| 879 startTimeNanos = _json["startTimeNanos"]; |
| 880 } |
| 881 if (_json.containsKey("value")) { |
| 882 value = _json["value"].map((value) => new Value.fromJson(value)).toList(); |
| 883 } |
| 884 } |
| 885 |
| 886 core.Map toJson() { |
| 887 var _json = new core.Map(); |
| 888 if (computationTimeMillis != null) { |
| 889 _json["computationTimeMillis"] = computationTimeMillis; |
| 890 } |
| 891 if (dataTypeName != null) { |
| 892 _json["dataTypeName"] = dataTypeName; |
| 893 } |
| 894 if (endTimeNanos != null) { |
| 895 _json["endTimeNanos"] = endTimeNanos; |
| 896 } |
| 897 if (modifiedTimeMillis != null) { |
| 898 _json["modifiedTimeMillis"] = modifiedTimeMillis; |
| 899 } |
| 900 if (originDataSourceId != null) { |
| 901 _json["originDataSourceId"] = originDataSourceId; |
| 902 } |
| 903 if (rawTimestampNanos != null) { |
| 904 _json["rawTimestampNanos"] = rawTimestampNanos; |
| 905 } |
| 906 if (startTimeNanos != null) { |
| 907 _json["startTimeNanos"] = startTimeNanos; |
| 908 } |
| 909 if (value != null) { |
| 910 _json["value"] = value.map((value) => (value).toJson()).toList(); |
| 911 } |
| 912 return _json; |
| 913 } |
| 914 } |
| 915 |
| 916 |
| 917 /** |
| 918 * Definition of a unique source of sensor data. Data sources can expose raw |
| 919 * data coming from hardware sensors on local or companion devices. They can |
| 920 * also expose derived data, created by transforming or merging other data |
| 921 * sources. Multiple data sources can exist for the same data type. Every data |
| 922 * point inserted into or read from this service has an associated data source. |
| 923 * |
| 924 * The data source contains enough information to uniquely identify its data, |
| 925 * including the hardware device and the application that collected and/or |
| 926 * transformed the data. It also holds useful metadata, such as the hardware and |
| 927 * application versions, and the device type. |
| 928 * |
| 929 * Each data source produces a unique stream of data, with a unique identifier. |
| 930 * Not all changes to data source affect the stream identifier, so that data |
| 931 * collected by updated versions of the same application/device can still be |
| 932 * considered to belong to the same data stream. |
| 933 */ |
| 934 class DataSource { |
| 935 /** |
| 936 * Information about an application which feeds sensor data into the platform. |
| 937 */ |
| 938 Application application; |
| 939 |
| 940 /** |
| 941 * A unique identifier for the data stream produced by this data source. The |
| 942 * identifier includes: |
| 943 * |
| 944 * |
| 945 * - The physical device's manufacturer, model, and serial number (UID). |
| 946 * - The application's package name or name. Package name is used when the |
| 947 * data source was created by an Android application. The developer project |
| 948 * number is used when the data source was created by a REST client. |
| 949 * - The data source's type. |
| 950 * - The data source's stream name. Note that not all attributes of the data |
| 951 * source are used as part of the stream identifier. In particular, the |
| 952 * version of the hardware/the application isn't used. This allows us to |
| 953 * preserve the same stream through version updates. This also means that two |
| 954 * DataSource objects may represent the same data stream even if they're not |
| 955 * equal. |
| 956 * |
| 957 * The exact format of the data stream ID created by an Android application |
| 958 * is: |
| 959 * type:dataType.name:application.packageName:device.manufacturer:device.model
:device.uid:dataStreamName |
| 960 * |
| 961 * The exact format of the data stream ID created by a REST client is: |
| 962 * type:dataType.name:developer project |
| 963 * number:device.manufacturer:device.model:device.uid:dataStreamName |
| 964 * |
| 965 * When any of the optional fields that comprise of the data stream ID are |
| 966 * blank, they will be omitted from the data stream ID. The minnimum viable |
| 967 * data stream ID would be: type:dataType.name:developer project number |
| 968 * |
| 969 * Finally, the developer project number is obfuscated when read by any REST |
| 970 * or Android client that did not create the data source. Only the data source |
| 971 * creator will see the developer project number in clear and normal form. |
| 972 */ |
| 973 core.String dataStreamId; |
| 974 |
| 975 /** |
| 976 * The stream name uniquely identifies this particular data source among other |
| 977 * data sources of the same type from the same underlying producer. Setting |
| 978 * the stream name is optional, but should be done whenever an application |
| 979 * exposes two streams for the same data type, or when a device has two |
| 980 * equivalent sensors. |
| 981 */ |
| 982 core.String dataStreamName; |
| 983 |
| 984 /** |
| 985 * The data type defines the schema for a stream of data being collected by, |
| 986 * inserted into, or queried from the Fitness API. |
| 987 */ |
| 988 DataType dataType; |
| 989 |
| 990 /** |
| 991 * Representation of an integrated device (such as a phone or a wearable) that |
| 992 * can hold sensors. |
| 993 */ |
| 994 Device device; |
| 995 |
| 996 /** An end-user visible name for this data source. */ |
| 997 core.String name; |
| 998 |
| 999 /** |
| 1000 * A constant describing the type of this data source. Indicates whether this |
| 1001 * data source produces raw or derived data. |
| 1002 * Possible string values are: |
| 1003 * - "derived" |
| 1004 * - "raw" |
| 1005 */ |
| 1006 core.String type; |
| 1007 |
| 1008 |
| 1009 DataSource(); |
| 1010 |
| 1011 DataSource.fromJson(core.Map _json) { |
| 1012 if (_json.containsKey("application")) { |
| 1013 application = new Application.fromJson(_json["application"]); |
| 1014 } |
| 1015 if (_json.containsKey("dataStreamId")) { |
| 1016 dataStreamId = _json["dataStreamId"]; |
| 1017 } |
| 1018 if (_json.containsKey("dataStreamName")) { |
| 1019 dataStreamName = _json["dataStreamName"]; |
| 1020 } |
| 1021 if (_json.containsKey("dataType")) { |
| 1022 dataType = new DataType.fromJson(_json["dataType"]); |
| 1023 } |
| 1024 if (_json.containsKey("device")) { |
| 1025 device = new Device.fromJson(_json["device"]); |
| 1026 } |
| 1027 if (_json.containsKey("name")) { |
| 1028 name = _json["name"]; |
| 1029 } |
| 1030 if (_json.containsKey("type")) { |
| 1031 type = _json["type"]; |
| 1032 } |
| 1033 } |
| 1034 |
| 1035 core.Map toJson() { |
| 1036 var _json = new core.Map(); |
| 1037 if (application != null) { |
| 1038 _json["application"] = (application).toJson(); |
| 1039 } |
| 1040 if (dataStreamId != null) { |
| 1041 _json["dataStreamId"] = dataStreamId; |
| 1042 } |
| 1043 if (dataStreamName != null) { |
| 1044 _json["dataStreamName"] = dataStreamName; |
| 1045 } |
| 1046 if (dataType != null) { |
| 1047 _json["dataType"] = (dataType).toJson(); |
| 1048 } |
| 1049 if (device != null) { |
| 1050 _json["device"] = (device).toJson(); |
| 1051 } |
| 1052 if (name != null) { |
| 1053 _json["name"] = name; |
| 1054 } |
| 1055 if (type != null) { |
| 1056 _json["type"] = type; |
| 1057 } |
| 1058 return _json; |
| 1059 } |
| 1060 } |
| 1061 |
| 1062 |
| 1063 /** |
| 1064 * See: google3/java/com/google/android/apps/heart/platform/api/DataType.java |
| 1065 */ |
| 1066 class DataType { |
| 1067 /** A field represents one dimension of a data type. */ |
| 1068 core.List<DataTypeField> field; |
| 1069 |
| 1070 /** |
| 1071 * Each data type has a unique, namespaced, name. All data types in the |
| 1072 * com.google namespace are shared as part of the platform. |
| 1073 */ |
| 1074 core.String name; |
| 1075 |
| 1076 |
| 1077 DataType(); |
| 1078 |
| 1079 DataType.fromJson(core.Map _json) { |
| 1080 if (_json.containsKey("field")) { |
| 1081 field = _json["field"].map((value) => new DataTypeField.fromJson(value)).t
oList(); |
| 1082 } |
| 1083 if (_json.containsKey("name")) { |
| 1084 name = _json["name"]; |
| 1085 } |
| 1086 } |
| 1087 |
| 1088 core.Map toJson() { |
| 1089 var _json = new core.Map(); |
| 1090 if (field != null) { |
| 1091 _json["field"] = field.map((value) => (value).toJson()).toList(); |
| 1092 } |
| 1093 if (name != null) { |
| 1094 _json["name"] = name; |
| 1095 } |
| 1096 return _json; |
| 1097 } |
| 1098 } |
| 1099 |
| 1100 |
| 1101 /** |
| 1102 * In case of multi-dimensional data (such as an accelerometer with x, y, and z |
| 1103 * axes) each field represents one dimension. Each data type field has a unique |
| 1104 * name which identifies it. The field also defines the format of the data (int, |
| 1105 * float, etc.). |
| 1106 * |
| 1107 * This message is only instantiated in code and not used for wire comms or |
| 1108 * stored in any way. |
| 1109 */ |
| 1110 class DataTypeField { |
| 1111 /** |
| 1112 * The different supported formats for each field in a data type. |
| 1113 * Possible string values are: |
| 1114 * - "floatPoint" |
| 1115 * - "integer" |
| 1116 */ |
| 1117 core.String format; |
| 1118 |
| 1119 /** |
| 1120 * Defines the name and format of data. Unlike data type names, field names |
| 1121 * are not namespaced, and only need to be unique within the data type. |
| 1122 */ |
| 1123 core.String name; |
| 1124 |
| 1125 |
| 1126 DataTypeField(); |
| 1127 |
| 1128 DataTypeField.fromJson(core.Map _json) { |
| 1129 if (_json.containsKey("format")) { |
| 1130 format = _json["format"]; |
| 1131 } |
| 1132 if (_json.containsKey("name")) { |
| 1133 name = _json["name"]; |
| 1134 } |
| 1135 } |
| 1136 |
| 1137 core.Map toJson() { |
| 1138 var _json = new core.Map(); |
| 1139 if (format != null) { |
| 1140 _json["format"] = format; |
| 1141 } |
| 1142 if (name != null) { |
| 1143 _json["name"] = name; |
| 1144 } |
| 1145 return _json; |
| 1146 } |
| 1147 } |
| 1148 |
| 1149 |
| 1150 /** |
| 1151 * A dataset represents a projection container for data points. They do not |
| 1152 * carry any info of their own. Datasets represent a set of data points from a |
| 1153 * particular data source. A data point can be found in more than one dataset. |
| 1154 */ |
| 1155 class Dataset { |
| 1156 /** |
| 1157 * The data stream ID of the data source that created the points in this |
| 1158 * dataset. |
| 1159 */ |
| 1160 core.String dataSourceId; |
| 1161 |
| 1162 /** |
| 1163 * The largest end time of all data points in this possibly partial |
| 1164 * representation of the dataset. Time is in nanoseconds from epoch. This |
| 1165 * should also match the first part of the dataset identifier. |
| 1166 */ |
| 1167 core.String maxEndTimeNs; |
| 1168 |
| 1169 /** |
| 1170 * The smallest start time of all data points in this possibly partial |
| 1171 * representation of the dataset. Time is in nanoseconds from epoch. This |
| 1172 * should also match the first part of the dataset identifier. |
| 1173 */ |
| 1174 core.String minStartTimeNs; |
| 1175 |
| 1176 /** |
| 1177 * A partial list of data points contained in the dataset. This list is |
| 1178 * considered complete when retrieving a dataset and partial when patching a |
| 1179 * dataset. |
| 1180 */ |
| 1181 core.List<DataPoint> point; |
| 1182 |
| 1183 |
| 1184 Dataset(); |
| 1185 |
| 1186 Dataset.fromJson(core.Map _json) { |
| 1187 if (_json.containsKey("dataSourceId")) { |
| 1188 dataSourceId = _json["dataSourceId"]; |
| 1189 } |
| 1190 if (_json.containsKey("maxEndTimeNs")) { |
| 1191 maxEndTimeNs = _json["maxEndTimeNs"]; |
| 1192 } |
| 1193 if (_json.containsKey("minStartTimeNs")) { |
| 1194 minStartTimeNs = _json["minStartTimeNs"]; |
| 1195 } |
| 1196 if (_json.containsKey("point")) { |
| 1197 point = _json["point"].map((value) => new DataPoint.fromJson(value)).toLis
t(); |
| 1198 } |
| 1199 } |
| 1200 |
| 1201 core.Map toJson() { |
| 1202 var _json = new core.Map(); |
| 1203 if (dataSourceId != null) { |
| 1204 _json["dataSourceId"] = dataSourceId; |
| 1205 } |
| 1206 if (maxEndTimeNs != null) { |
| 1207 _json["maxEndTimeNs"] = maxEndTimeNs; |
| 1208 } |
| 1209 if (minStartTimeNs != null) { |
| 1210 _json["minStartTimeNs"] = minStartTimeNs; |
| 1211 } |
| 1212 if (point != null) { |
| 1213 _json["point"] = point.map((value) => (value).toJson()).toList(); |
| 1214 } |
| 1215 return _json; |
| 1216 } |
| 1217 } |
| 1218 |
| 1219 |
| 1220 /** |
| 1221 * Representation of an integrated device (such as a phone or a wearable) that |
| 1222 * can hold sensors. Each sensor is exposed as a data source. |
| 1223 * |
| 1224 * The main purpose of the device information contained in this class is to |
| 1225 * identify the hardware of a particular data source. This can be useful in |
| 1226 * different ways, including: |
| 1227 * - Distinguishing two similar sensors on different devices (the step counter |
| 1228 * on two nexus 5 phones, for instance) |
| 1229 * - Display the source of data to the user (by using the device make / model) |
| 1230 * - Treat data differently depending on sensor type (accelerometers on a watch |
| 1231 * may give different patterns than those on a phone) |
| 1232 * - Build different analysis models for each device/version. |
| 1233 */ |
| 1234 class Device { |
| 1235 /** Manufacturer of the product/hardware. */ |
| 1236 core.String manufacturer; |
| 1237 |
| 1238 /** End-user visible model name for the device. */ |
| 1239 core.String model; |
| 1240 |
| 1241 /** |
| 1242 * A constant representing the type of the device. |
| 1243 * Possible string values are: |
| 1244 * - "chestStrap" |
| 1245 * - "phone" |
| 1246 * - "scale" |
| 1247 * - "tablet" |
| 1248 * - "unknown" |
| 1249 * - "watch" |
| 1250 */ |
| 1251 core.String type; |
| 1252 |
| 1253 /** |
| 1254 * The serial number or other unique ID for the hardware. This field is |
| 1255 * obfuscated when read by any REST or Android client that did not create the |
| 1256 * data source. Only the data source creator will see the uid field in clear |
| 1257 * and normal form. |
| 1258 */ |
| 1259 core.String uid; |
| 1260 |
| 1261 /** Version string for the device hardware/software. */ |
| 1262 core.String version; |
| 1263 |
| 1264 |
| 1265 Device(); |
| 1266 |
| 1267 Device.fromJson(core.Map _json) { |
| 1268 if (_json.containsKey("manufacturer")) { |
| 1269 manufacturer = _json["manufacturer"]; |
| 1270 } |
| 1271 if (_json.containsKey("model")) { |
| 1272 model = _json["model"]; |
| 1273 } |
| 1274 if (_json.containsKey("type")) { |
| 1275 type = _json["type"]; |
| 1276 } |
| 1277 if (_json.containsKey("uid")) { |
| 1278 uid = _json["uid"]; |
| 1279 } |
| 1280 if (_json.containsKey("version")) { |
| 1281 version = _json["version"]; |
| 1282 } |
| 1283 } |
| 1284 |
| 1285 core.Map toJson() { |
| 1286 var _json = new core.Map(); |
| 1287 if (manufacturer != null) { |
| 1288 _json["manufacturer"] = manufacturer; |
| 1289 } |
| 1290 if (model != null) { |
| 1291 _json["model"] = model; |
| 1292 } |
| 1293 if (type != null) { |
| 1294 _json["type"] = type; |
| 1295 } |
| 1296 if (uid != null) { |
| 1297 _json["uid"] = uid; |
| 1298 } |
| 1299 if (version != null) { |
| 1300 _json["version"] = version; |
| 1301 } |
| 1302 return _json; |
| 1303 } |
| 1304 } |
| 1305 |
| 1306 |
| 1307 /** Not documented yet. */ |
| 1308 class ListDataSourcesResponse { |
| 1309 /** A previously created data source. */ |
| 1310 core.List<DataSource> dataSource; |
| 1311 |
| 1312 |
| 1313 ListDataSourcesResponse(); |
| 1314 |
| 1315 ListDataSourcesResponse.fromJson(core.Map _json) { |
| 1316 if (_json.containsKey("dataSource")) { |
| 1317 dataSource = _json["dataSource"].map((value) => new DataSource.fromJson(va
lue)).toList(); |
| 1318 } |
| 1319 } |
| 1320 |
| 1321 core.Map toJson() { |
| 1322 var _json = new core.Map(); |
| 1323 if (dataSource != null) { |
| 1324 _json["dataSource"] = dataSource.map((value) => (value).toJson()).toList()
; |
| 1325 } |
| 1326 return _json; |
| 1327 } |
| 1328 } |
| 1329 |
| 1330 |
| 1331 /** Not documented yet. */ |
| 1332 class ListSessionsResponse { |
| 1333 /** |
| 1334 * If includeDeleted is set to true in the request, this list will contain |
| 1335 * sessions deleted with original end times that are within the startTime and |
| 1336 * endTime frame. |
| 1337 */ |
| 1338 core.List<Session> deletedSession; |
| 1339 |
| 1340 /** |
| 1341 * The continuation token, which is used to page through large result sets. |
| 1342 * Provide this value in a subsequent request to return the next page of |
| 1343 * results. |
| 1344 */ |
| 1345 core.String nextPageToken; |
| 1346 |
| 1347 /** |
| 1348 * Sessions with an end time that is between startTime and endTime of the |
| 1349 * request. |
| 1350 */ |
| 1351 core.List<Session> session; |
| 1352 |
| 1353 |
| 1354 ListSessionsResponse(); |
| 1355 |
| 1356 ListSessionsResponse.fromJson(core.Map _json) { |
| 1357 if (_json.containsKey("deletedSession")) { |
| 1358 deletedSession = _json["deletedSession"].map((value) => new Session.fromJs
on(value)).toList(); |
| 1359 } |
| 1360 if (_json.containsKey("nextPageToken")) { |
| 1361 nextPageToken = _json["nextPageToken"]; |
| 1362 } |
| 1363 if (_json.containsKey("session")) { |
| 1364 session = _json["session"].map((value) => new Session.fromJson(value)).toL
ist(); |
| 1365 } |
| 1366 } |
| 1367 |
| 1368 core.Map toJson() { |
| 1369 var _json = new core.Map(); |
| 1370 if (deletedSession != null) { |
| 1371 _json["deletedSession"] = deletedSession.map((value) => (value).toJson()).
toList(); |
| 1372 } |
| 1373 if (nextPageToken != null) { |
| 1374 _json["nextPageToken"] = nextPageToken; |
| 1375 } |
| 1376 if (session != null) { |
| 1377 _json["session"] = session.map((value) => (value).toJson()).toList(); |
| 1378 } |
| 1379 return _json; |
| 1380 } |
| 1381 } |
| 1382 |
| 1383 |
| 1384 /** |
| 1385 * Sessions contain metadata, such as a user-friendly name and time interval |
| 1386 * information. |
| 1387 */ |
| 1388 class Session { |
| 1389 /** The type of activity this session represents. */ |
| 1390 core.int activityType; |
| 1391 |
| 1392 /** The application that created the session. */ |
| 1393 Application application; |
| 1394 |
| 1395 /** A description for this session. */ |
| 1396 core.String description; |
| 1397 |
| 1398 /** An end time, in milliseconds since epoch, inclusive. */ |
| 1399 core.String endTimeMillis; |
| 1400 |
| 1401 /** |
| 1402 * A client-generated identifier that is unique across all sessions owned by |
| 1403 * this particular user. |
| 1404 */ |
| 1405 core.String id; |
| 1406 |
| 1407 /** A timestamp that indicates when the session was last modified. */ |
| 1408 core.String modifiedTimeMillis; |
| 1409 |
| 1410 /** A human readable name of the session. */ |
| 1411 core.String name; |
| 1412 |
| 1413 /** A start time, in milliseconds since epoch, inclusive. */ |
| 1414 core.String startTimeMillis; |
| 1415 |
| 1416 |
| 1417 Session(); |
| 1418 |
| 1419 Session.fromJson(core.Map _json) { |
| 1420 if (_json.containsKey("activityType")) { |
| 1421 activityType = _json["activityType"]; |
| 1422 } |
| 1423 if (_json.containsKey("application")) { |
| 1424 application = new Application.fromJson(_json["application"]); |
| 1425 } |
| 1426 if (_json.containsKey("description")) { |
| 1427 description = _json["description"]; |
| 1428 } |
| 1429 if (_json.containsKey("endTimeMillis")) { |
| 1430 endTimeMillis = _json["endTimeMillis"]; |
| 1431 } |
| 1432 if (_json.containsKey("id")) { |
| 1433 id = _json["id"]; |
| 1434 } |
| 1435 if (_json.containsKey("modifiedTimeMillis")) { |
| 1436 modifiedTimeMillis = _json["modifiedTimeMillis"]; |
| 1437 } |
| 1438 if (_json.containsKey("name")) { |
| 1439 name = _json["name"]; |
| 1440 } |
| 1441 if (_json.containsKey("startTimeMillis")) { |
| 1442 startTimeMillis = _json["startTimeMillis"]; |
| 1443 } |
| 1444 } |
| 1445 |
| 1446 core.Map toJson() { |
| 1447 var _json = new core.Map(); |
| 1448 if (activityType != null) { |
| 1449 _json["activityType"] = activityType; |
| 1450 } |
| 1451 if (application != null) { |
| 1452 _json["application"] = (application).toJson(); |
| 1453 } |
| 1454 if (description != null) { |
| 1455 _json["description"] = description; |
| 1456 } |
| 1457 if (endTimeMillis != null) { |
| 1458 _json["endTimeMillis"] = endTimeMillis; |
| 1459 } |
| 1460 if (id != null) { |
| 1461 _json["id"] = id; |
| 1462 } |
| 1463 if (modifiedTimeMillis != null) { |
| 1464 _json["modifiedTimeMillis"] = modifiedTimeMillis; |
| 1465 } |
| 1466 if (name != null) { |
| 1467 _json["name"] = name; |
| 1468 } |
| 1469 if (startTimeMillis != null) { |
| 1470 _json["startTimeMillis"] = startTimeMillis; |
| 1471 } |
| 1472 return _json; |
| 1473 } |
| 1474 } |
| 1475 |
| 1476 |
| 1477 /** |
| 1478 * Holder object for the value of a single field in a data point. |
| 1479 * |
| 1480 * A field value has a particular format and is only ever set to one of an |
| 1481 * integer or a floating point value. |
| 1482 */ |
| 1483 class Value { |
| 1484 /** Floating point value. */ |
| 1485 core.double fpVal; |
| 1486 |
| 1487 /** Integer value. */ |
| 1488 core.int intVal; |
| 1489 |
| 1490 |
| 1491 Value(); |
| 1492 |
| 1493 Value.fromJson(core.Map _json) { |
| 1494 if (_json.containsKey("fpVal")) { |
| 1495 fpVal = _json["fpVal"]; |
| 1496 } |
| 1497 if (_json.containsKey("intVal")) { |
| 1498 intVal = _json["intVal"]; |
| 1499 } |
| 1500 } |
| 1501 |
| 1502 core.Map toJson() { |
| 1503 var _json = new core.Map(); |
| 1504 if (fpVal != null) { |
| 1505 _json["fpVal"] = fpVal; |
| 1506 } |
| 1507 if (intVal != null) { |
| 1508 _json["intVal"] = intVal; |
| 1509 } |
| 1510 return _json; |
| 1511 } |
| 1512 } |
| 1513 |
| 1514 |
OLD | NEW |