1// Copyright 2019 Google LLC. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Code generated file. DO NOT EDIT. 6 7// Package fitness provides access to the Fitness. 8// 9// For product documentation, see: https://developers.google.com/fit/rest/ 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/fitness/v1" 16// ... 17// ctx := context.Background() 18// fitnessService, err := fitness.NewService(ctx) 19// 20// In this example, Google Application Default Credentials are used for authentication. 21// 22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 23// 24// Other authentication options 25// 26// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes: 27// 28// fitnessService, err := fitness.NewService(ctx, option.WithScopes(fitness.FitnessReproductiveHealthWriteScope)) 29// 30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 31// 32// fitnessService, err := fitness.NewService(ctx, option.WithAPIKey("AIza...")) 33// 34// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: 35// 36// config := &oauth2.Config{...} 37// // ... 38// token, err := config.Exchange(ctx, ...) 39// fitnessService, err := fitness.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 40// 41// See https://godoc.org/google.golang.org/api/option/ for details on options. 42package fitness // import "google.golang.org/api/fitness/v1" 43 44import ( 45 "bytes" 46 "context" 47 "encoding/json" 48 "errors" 49 "fmt" 50 "io" 51 "net/http" 52 "net/url" 53 "strconv" 54 "strings" 55 56 googleapi "google.golang.org/api/googleapi" 57 gensupport "google.golang.org/api/internal/gensupport" 58 option "google.golang.org/api/option" 59 htransport "google.golang.org/api/transport/http" 60) 61 62// Always reference these packages, just in case the auto-generated code 63// below doesn't. 64var _ = bytes.NewBuffer 65var _ = strconv.Itoa 66var _ = fmt.Sprintf 67var _ = json.NewDecoder 68var _ = io.Copy 69var _ = url.Parse 70var _ = gensupport.MarshalJSON 71var _ = googleapi.Version 72var _ = errors.New 73var _ = strings.Replace 74var _ = context.Canceled 75 76const apiId = "fitness:v1" 77const apiName = "fitness" 78const apiVersion = "v1" 79const basePath = "https://www.googleapis.com/fitness/v1/users/" 80 81// OAuth2 scopes used by this API. 82const ( 83 // Use Google Fit to see and store your physical activity data 84 FitnessActivityReadScope = "https://www.googleapis.com/auth/fitness.activity.read" 85 86 // See and add to your Google Fit physical activity data 87 FitnessActivityWriteScope = "https://www.googleapis.com/auth/fitness.activity.write" 88 89 // See info about your blood glucose in Google Fit 90 FitnessBloodGlucoseReadScope = "https://www.googleapis.com/auth/fitness.blood_glucose.read" 91 92 // See and add info about your blood glucose to Google Fit 93 FitnessBloodGlucoseWriteScope = "https://www.googleapis.com/auth/fitness.blood_glucose.write" 94 95 // See info about your blood pressure in Google Fit 96 FitnessBloodPressureReadScope = "https://www.googleapis.com/auth/fitness.blood_pressure.read" 97 98 // See and add info about your blood pressure in Google Fit 99 FitnessBloodPressureWriteScope = "https://www.googleapis.com/auth/fitness.blood_pressure.write" 100 101 // See info about your body measurements and heart rate in Google Fit 102 FitnessBodyReadScope = "https://www.googleapis.com/auth/fitness.body.read" 103 104 // See and add info about your body measurements and heart rate to 105 // Google Fit 106 FitnessBodyWriteScope = "https://www.googleapis.com/auth/fitness.body.write" 107 108 // See info about your body temperature in Google Fit 109 FitnessBodyTemperatureReadScope = "https://www.googleapis.com/auth/fitness.body_temperature.read" 110 111 // See and add to info about your body temperature in Google Fit 112 FitnessBodyTemperatureWriteScope = "https://www.googleapis.com/auth/fitness.body_temperature.write" 113 114 // See your Google Fit speed and distance data 115 FitnessLocationReadScope = "https://www.googleapis.com/auth/fitness.location.read" 116 117 // See and add to your Google Fit location data 118 FitnessLocationWriteScope = "https://www.googleapis.com/auth/fitness.location.write" 119 120 // See info about your nutrition in Google Fit 121 FitnessNutritionReadScope = "https://www.googleapis.com/auth/fitness.nutrition.read" 122 123 // See and add to info about your nutrition in Google Fit 124 FitnessNutritionWriteScope = "https://www.googleapis.com/auth/fitness.nutrition.write" 125 126 // See info about your oxygen saturation in Google Fit 127 FitnessOxygenSaturationReadScope = "https://www.googleapis.com/auth/fitness.oxygen_saturation.read" 128 129 // See and add info about your oxygen saturation in Google Fit 130 FitnessOxygenSaturationWriteScope = "https://www.googleapis.com/auth/fitness.oxygen_saturation.write" 131 132 // See info about your reproductive health in Google Fit 133 FitnessReproductiveHealthReadScope = "https://www.googleapis.com/auth/fitness.reproductive_health.read" 134 135 // See and add info about your reproductive health in Google Fit 136 FitnessReproductiveHealthWriteScope = "https://www.googleapis.com/auth/fitness.reproductive_health.write" 137) 138 139// NewService creates a new Service. 140func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 141 scopesOption := option.WithScopes( 142 "https://www.googleapis.com/auth/fitness.activity.read", 143 "https://www.googleapis.com/auth/fitness.activity.write", 144 "https://www.googleapis.com/auth/fitness.blood_glucose.read", 145 "https://www.googleapis.com/auth/fitness.blood_glucose.write", 146 "https://www.googleapis.com/auth/fitness.blood_pressure.read", 147 "https://www.googleapis.com/auth/fitness.blood_pressure.write", 148 "https://www.googleapis.com/auth/fitness.body.read", 149 "https://www.googleapis.com/auth/fitness.body.write", 150 "https://www.googleapis.com/auth/fitness.body_temperature.read", 151 "https://www.googleapis.com/auth/fitness.body_temperature.write", 152 "https://www.googleapis.com/auth/fitness.location.read", 153 "https://www.googleapis.com/auth/fitness.location.write", 154 "https://www.googleapis.com/auth/fitness.nutrition.read", 155 "https://www.googleapis.com/auth/fitness.nutrition.write", 156 "https://www.googleapis.com/auth/fitness.oxygen_saturation.read", 157 "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", 158 "https://www.googleapis.com/auth/fitness.reproductive_health.read", 159 "https://www.googleapis.com/auth/fitness.reproductive_health.write", 160 ) 161 // NOTE: prepend, so we don't override user-specified scopes. 162 opts = append([]option.ClientOption{scopesOption}, opts...) 163 client, endpoint, err := htransport.NewClient(ctx, opts...) 164 if err != nil { 165 return nil, err 166 } 167 s, err := New(client) 168 if err != nil { 169 return nil, err 170 } 171 if endpoint != "" { 172 s.BasePath = endpoint 173 } 174 return s, nil 175} 176 177// New creates a new Service. It uses the provided http.Client for requests. 178// 179// Deprecated: please use NewService instead. 180// To provide a custom HTTP client, use option.WithHTTPClient. 181// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 182func New(client *http.Client) (*Service, error) { 183 if client == nil { 184 return nil, errors.New("client is nil") 185 } 186 s := &Service{client: client, BasePath: basePath} 187 s.Users = NewUsersService(s) 188 return s, nil 189} 190 191type Service struct { 192 client *http.Client 193 BasePath string // API endpoint base URL 194 UserAgent string // optional additional User-Agent fragment 195 196 Users *UsersService 197} 198 199func (s *Service) userAgent() string { 200 if s.UserAgent == "" { 201 return googleapi.UserAgent 202 } 203 return googleapi.UserAgent + " " + s.UserAgent 204} 205 206func NewUsersService(s *Service) *UsersService { 207 rs := &UsersService{s: s} 208 rs.DataSources = NewUsersDataSourcesService(s) 209 rs.Dataset = NewUsersDatasetService(s) 210 rs.Sessions = NewUsersSessionsService(s) 211 return rs 212} 213 214type UsersService struct { 215 s *Service 216 217 DataSources *UsersDataSourcesService 218 219 Dataset *UsersDatasetService 220 221 Sessions *UsersSessionsService 222} 223 224func NewUsersDataSourcesService(s *Service) *UsersDataSourcesService { 225 rs := &UsersDataSourcesService{s: s} 226 rs.DataPointChanges = NewUsersDataSourcesDataPointChangesService(s) 227 rs.Datasets = NewUsersDataSourcesDatasetsService(s) 228 return rs 229} 230 231type UsersDataSourcesService struct { 232 s *Service 233 234 DataPointChanges *UsersDataSourcesDataPointChangesService 235 236 Datasets *UsersDataSourcesDatasetsService 237} 238 239func NewUsersDataSourcesDataPointChangesService(s *Service) *UsersDataSourcesDataPointChangesService { 240 rs := &UsersDataSourcesDataPointChangesService{s: s} 241 return rs 242} 243 244type UsersDataSourcesDataPointChangesService struct { 245 s *Service 246} 247 248func NewUsersDataSourcesDatasetsService(s *Service) *UsersDataSourcesDatasetsService { 249 rs := &UsersDataSourcesDatasetsService{s: s} 250 return rs 251} 252 253type UsersDataSourcesDatasetsService struct { 254 s *Service 255} 256 257func NewUsersDatasetService(s *Service) *UsersDatasetService { 258 rs := &UsersDatasetService{s: s} 259 return rs 260} 261 262type UsersDatasetService struct { 263 s *Service 264} 265 266func NewUsersSessionsService(s *Service) *UsersSessionsService { 267 rs := &UsersSessionsService{s: s} 268 return rs 269} 270 271type UsersSessionsService struct { 272 s *Service 273} 274 275type AggregateBucket struct { 276 // Activity: Available for Bucket.Type.ACTIVITY_TYPE, 277 // Bucket.Type.ACTIVITY_SEGMENT 278 Activity int64 `json:"activity,omitempty"` 279 280 // Dataset: There will be one dataset per AggregateBy in the request. 281 Dataset []*Dataset `json:"dataset,omitempty"` 282 283 // EndTimeMillis: The end time for the aggregated data, in milliseconds 284 // since epoch, inclusive. 285 EndTimeMillis int64 `json:"endTimeMillis,omitempty,string"` 286 287 // Session: Available for Bucket.Type.SESSION 288 Session *Session `json:"session,omitempty"` 289 290 // StartTimeMillis: The start time for the aggregated data, in 291 // milliseconds since epoch, inclusive. 292 StartTimeMillis int64 `json:"startTimeMillis,omitempty,string"` 293 294 // Type: The type of a bucket signifies how the data aggregation is 295 // performed in the bucket. 296 // 297 // Possible values: 298 // "activitySegment" 299 // "activityType" 300 // "session" 301 // "time" 302 // "unknown" 303 Type string `json:"type,omitempty"` 304 305 // ForceSendFields is a list of field names (e.g. "Activity") to 306 // unconditionally include in API requests. By default, fields with 307 // empty values are omitted from API requests. However, any non-pointer, 308 // non-interface field appearing in ForceSendFields will be sent to the 309 // server regardless of whether the field is empty or not. This may be 310 // used to include empty fields in Patch requests. 311 ForceSendFields []string `json:"-"` 312 313 // NullFields is a list of field names (e.g. "Activity") to include in 314 // API requests with the JSON null value. By default, fields with empty 315 // values are omitted from API requests. However, any field with an 316 // empty value appearing in NullFields will be sent to the server as 317 // null. It is an error if a field in this list has a non-empty value. 318 // This may be used to include null fields in Patch requests. 319 NullFields []string `json:"-"` 320} 321 322func (s *AggregateBucket) MarshalJSON() ([]byte, error) { 323 type NoMethod AggregateBucket 324 raw := NoMethod(*s) 325 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 326} 327 328// AggregateBy: The specification of which data to aggregate. 329type AggregateBy struct { 330 // DataSourceId: A data source ID to aggregate. Mutually exclusive of 331 // dataTypeName. Only data from the specified data source ID will be 332 // included in the aggregation. The dataset in the response will have 333 // the same data source ID. 334 DataSourceId string `json:"dataSourceId,omitempty"` 335 336 // DataTypeName: The data type to aggregate. All data sources providing 337 // this data type will contribute data to the aggregation. The response 338 // will contain a single dataset for this data type name. The dataset 339 // will have a data source ID of 340 // derived:com.google.:com.google.android.gms:aggregated 341 DataTypeName string `json:"dataTypeName,omitempty"` 342 343 // ForceSendFields is a list of field names (e.g. "DataSourceId") to 344 // unconditionally include in API requests. By default, fields with 345 // empty values are omitted from API requests. However, any non-pointer, 346 // non-interface field appearing in ForceSendFields will be sent to the 347 // server regardless of whether the field is empty or not. This may be 348 // used to include empty fields in Patch requests. 349 ForceSendFields []string `json:"-"` 350 351 // NullFields is a list of field names (e.g. "DataSourceId") to include 352 // in API requests with the JSON null value. By default, fields with 353 // empty values are omitted from API requests. However, any field with 354 // an empty value appearing in NullFields will be sent to the server as 355 // null. It is an error if a field in this list has a non-empty value. 356 // This may be used to include null fields in Patch requests. 357 NullFields []string `json:"-"` 358} 359 360func (s *AggregateBy) MarshalJSON() ([]byte, error) { 361 type NoMethod AggregateBy 362 raw := NoMethod(*s) 363 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 364} 365 366// AggregateRequest: Next id: 10 367type AggregateRequest struct { 368 // AggregateBy: The specification of data to be aggregated. At least one 369 // aggregateBy spec must be provided. All data that is specified will be 370 // aggregated using the same bucketing criteria. There will be one 371 // dataset in the response for every aggregateBy spec. 372 AggregateBy []*AggregateBy `json:"aggregateBy,omitempty"` 373 374 // BucketByActivitySegment: Specifies that data be aggregated each 375 // activity segment recored for a user. Similar to 376 // bucketByActivitySegment, but bucketing is done for each activity 377 // segment rather than all segments of the same type. Mutually exclusive 378 // of other bucketing specifications. 379 BucketByActivitySegment *BucketByActivity `json:"bucketByActivitySegment,omitempty"` 380 381 // BucketByActivityType: Specifies that data be aggregated by the type 382 // of activity being performed when the data was recorded. All data that 383 // was recorded during a certain activity type (for the given time 384 // range) will be aggregated into the same bucket. Data that was 385 // recorded while the user was not active will not be included in the 386 // response. Mutually exclusive of other bucketing specifications. 387 BucketByActivityType *BucketByActivity `json:"bucketByActivityType,omitempty"` 388 389 // BucketBySession: Specifies that data be aggregated by user sessions. 390 // Data that does not fall within the time range of a session will not 391 // be included in the response. Mutually exclusive of other bucketing 392 // specifications. 393 BucketBySession *BucketBySession `json:"bucketBySession,omitempty"` 394 395 // BucketByTime: Specifies that data be aggregated by a single time 396 // interval. Mutually exclusive of other bucketing specifications. 397 BucketByTime *BucketByTime `json:"bucketByTime,omitempty"` 398 399 // EndTimeMillis: The end of a window of time. Data that intersects with 400 // this time window will be aggregated. The time is in milliseconds 401 // since epoch, inclusive. 402 EndTimeMillis int64 `json:"endTimeMillis,omitempty,string"` 403 404 // FilteredDataQualityStandard: DO NOT POPULATE THIS FIELD. It is 405 // ignored. 406 // 407 // Possible values: 408 // "dataQualityBloodGlucoseIso151972003" 409 // "dataQualityBloodGlucoseIso151972013" 410 // "dataQualityBloodPressureAami" 411 // "dataQualityBloodPressureBhsAA" 412 // "dataQualityBloodPressureBhsAB" 413 // "dataQualityBloodPressureBhsBA" 414 // "dataQualityBloodPressureBhsBB" 415 // "dataQualityBloodPressureEsh2002" 416 // "dataQualityBloodPressureEsh2010" 417 // "dataQualityUnknown" 418 FilteredDataQualityStandard []string `json:"filteredDataQualityStandard,omitempty"` 419 420 // StartTimeMillis: The start of a window of time. Data that intersects 421 // with this time window will be aggregated. The time is in milliseconds 422 // since epoch, inclusive. 423 StartTimeMillis int64 `json:"startTimeMillis,omitempty,string"` 424 425 // ForceSendFields is a list of field names (e.g. "AggregateBy") to 426 // unconditionally include in API requests. By default, fields with 427 // empty values are omitted from API requests. However, any non-pointer, 428 // non-interface field appearing in ForceSendFields will be sent to the 429 // server regardless of whether the field is empty or not. This may be 430 // used to include empty fields in Patch requests. 431 ForceSendFields []string `json:"-"` 432 433 // NullFields is a list of field names (e.g. "AggregateBy") to include 434 // in API requests with the JSON null value. By default, fields with 435 // empty values are omitted from API requests. However, any field with 436 // an empty value appearing in NullFields will be sent to the server as 437 // null. It is an error if a field in this list has a non-empty value. 438 // This may be used to include null fields in Patch requests. 439 NullFields []string `json:"-"` 440} 441 442func (s *AggregateRequest) MarshalJSON() ([]byte, error) { 443 type NoMethod AggregateRequest 444 raw := NoMethod(*s) 445 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 446} 447 448type AggregateResponse struct { 449 // Bucket: A list of buckets containing the aggregated data. 450 Bucket []*AggregateBucket `json:"bucket,omitempty"` 451 452 // ServerResponse contains the HTTP response code and headers from the 453 // server. 454 googleapi.ServerResponse `json:"-"` 455 456 // ForceSendFields is a list of field names (e.g. "Bucket") to 457 // unconditionally include in API requests. By default, fields with 458 // empty values are omitted from API requests. However, any non-pointer, 459 // non-interface field appearing in ForceSendFields will be sent to the 460 // server regardless of whether the field is empty or not. This may be 461 // used to include empty fields in Patch requests. 462 ForceSendFields []string `json:"-"` 463 464 // NullFields is a list of field names (e.g. "Bucket") to include in API 465 // requests with the JSON null value. By default, fields with empty 466 // values are omitted from API requests. However, any field with an 467 // empty value appearing in NullFields will be sent to the server as 468 // null. It is an error if a field in this list has a non-empty value. 469 // This may be used to include null fields in Patch requests. 470 NullFields []string `json:"-"` 471} 472 473func (s *AggregateResponse) MarshalJSON() ([]byte, error) { 474 type NoMethod AggregateResponse 475 raw := NoMethod(*s) 476 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 477} 478 479type Application struct { 480 // DetailsUrl: An optional URI that can be used to link back to the 481 // application. 482 DetailsUrl string `json:"detailsUrl,omitempty"` 483 484 // Name: The name of this application. This is required for REST 485 // clients, but we do not enforce uniqueness of this name. It is 486 // provided as a matter of convenience for other developers who would 487 // like to identify which REST created an Application or Data Source. 488 Name string `json:"name,omitempty"` 489 490 // PackageName: Package name for this application. This is used as a 491 // unique identifier when created by Android applications, but cannot be 492 // specified by REST clients. REST clients will have their developer 493 // project number reflected into the Data Source data stream IDs, 494 // instead of the packageName. 495 PackageName string `json:"packageName,omitempty"` 496 497 // Version: Version of the application. You should update this field 498 // whenever the application changes in a way that affects the 499 // computation of the data. 500 Version string `json:"version,omitempty"` 501 502 // ForceSendFields is a list of field names (e.g. "DetailsUrl") to 503 // unconditionally include in API requests. By default, fields with 504 // empty values are omitted from API requests. However, any non-pointer, 505 // non-interface field appearing in ForceSendFields will be sent to the 506 // server regardless of whether the field is empty or not. This may be 507 // used to include empty fields in Patch requests. 508 ForceSendFields []string `json:"-"` 509 510 // NullFields is a list of field names (e.g. "DetailsUrl") to include in 511 // API requests with the JSON null value. By default, fields with empty 512 // values are omitted from API requests. However, any field with an 513 // empty value appearing in NullFields will be sent to the server as 514 // null. It is an error if a field in this list has a non-empty value. 515 // This may be used to include null fields in Patch requests. 516 NullFields []string `json:"-"` 517} 518 519func (s *Application) MarshalJSON() ([]byte, error) { 520 type NoMethod Application 521 raw := NoMethod(*s) 522 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 523} 524 525type BucketByActivity struct { 526 // ActivityDataSourceId: The default activity stream will be used if a 527 // specific activityDataSourceId is not specified. 528 ActivityDataSourceId string `json:"activityDataSourceId,omitempty"` 529 530 // MinDurationMillis: Specifies that only activity segments of duration 531 // longer than minDurationMillis are considered and used as a container 532 // for aggregated data. 533 MinDurationMillis int64 `json:"minDurationMillis,omitempty,string"` 534 535 // ForceSendFields is a list of field names (e.g. 536 // "ActivityDataSourceId") to unconditionally include in API requests. 537 // By default, fields with empty values are omitted from API requests. 538 // However, any non-pointer, non-interface field appearing in 539 // ForceSendFields will be sent to the server regardless of whether the 540 // field is empty or not. This may be used to include empty fields in 541 // Patch requests. 542 ForceSendFields []string `json:"-"` 543 544 // NullFields is a list of field names (e.g. "ActivityDataSourceId") to 545 // include in API requests with the JSON null value. By default, fields 546 // with empty values are omitted from API requests. However, any field 547 // with an empty value appearing in NullFields will be sent to the 548 // server as null. It is an error if a field in this list has a 549 // non-empty value. This may be used to include null fields in Patch 550 // requests. 551 NullFields []string `json:"-"` 552} 553 554func (s *BucketByActivity) MarshalJSON() ([]byte, error) { 555 type NoMethod BucketByActivity 556 raw := NoMethod(*s) 557 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 558} 559 560type BucketBySession struct { 561 // MinDurationMillis: Specifies that only sessions of duration longer 562 // than minDurationMillis are considered and used as a container for 563 // aggregated data. 564 MinDurationMillis int64 `json:"minDurationMillis,omitempty,string"` 565 566 // ForceSendFields is a list of field names (e.g. "MinDurationMillis") 567 // to unconditionally include in API requests. By default, fields with 568 // empty values are omitted from API requests. However, any non-pointer, 569 // non-interface field appearing in ForceSendFields will be sent to the 570 // server regardless of whether the field is empty or not. This may be 571 // used to include empty fields in Patch requests. 572 ForceSendFields []string `json:"-"` 573 574 // NullFields is a list of field names (e.g. "MinDurationMillis") to 575 // include in API requests with the JSON null value. By default, fields 576 // with empty values are omitted from API requests. However, any field 577 // with an empty value appearing in NullFields will be sent to the 578 // server as null. It is an error if a field in this list has a 579 // non-empty value. This may be used to include null fields in Patch 580 // requests. 581 NullFields []string `json:"-"` 582} 583 584func (s *BucketBySession) MarshalJSON() ([]byte, error) { 585 type NoMethod BucketBySession 586 raw := NoMethod(*s) 587 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 588} 589 590type BucketByTime struct { 591 // DurationMillis: Specifies that result buckets aggregate data by 592 // exactly durationMillis time frames. Time frames that contain no data 593 // will be included in the response with an empty dataset. 594 DurationMillis int64 `json:"durationMillis,omitempty,string"` 595 596 Period *BucketByTimePeriod `json:"period,omitempty"` 597 598 // ForceSendFields is a list of field names (e.g. "DurationMillis") to 599 // unconditionally include in API requests. By default, fields with 600 // empty values are omitted from API requests. However, any non-pointer, 601 // non-interface field appearing in ForceSendFields will be sent to the 602 // server regardless of whether the field is empty or not. This may be 603 // used to include empty fields in Patch requests. 604 ForceSendFields []string `json:"-"` 605 606 // NullFields is a list of field names (e.g. "DurationMillis") to 607 // include in API requests with the JSON null value. By default, fields 608 // with empty values are omitted from API requests. However, any field 609 // with an empty value appearing in NullFields will be sent to the 610 // server as null. It is an error if a field in this list has a 611 // non-empty value. This may be used to include null fields in Patch 612 // requests. 613 NullFields []string `json:"-"` 614} 615 616func (s *BucketByTime) MarshalJSON() ([]byte, error) { 617 type NoMethod BucketByTime 618 raw := NoMethod(*s) 619 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 620} 621 622type BucketByTimePeriod struct { 623 // TimeZoneId: org.joda.timezone.DateTimeZone 624 TimeZoneId string `json:"timeZoneId,omitempty"` 625 626 // Possible values: 627 // "day" 628 // "month" 629 // "week" 630 Type string `json:"type,omitempty"` 631 632 Value int64 `json:"value,omitempty"` 633 634 // ForceSendFields is a list of field names (e.g. "TimeZoneId") to 635 // unconditionally include in API requests. By default, fields with 636 // empty values are omitted from API requests. However, any non-pointer, 637 // non-interface field appearing in ForceSendFields will be sent to the 638 // server regardless of whether the field is empty or not. This may be 639 // used to include empty fields in Patch requests. 640 ForceSendFields []string `json:"-"` 641 642 // NullFields is a list of field names (e.g. "TimeZoneId") to include in 643 // API requests with the JSON null value. By default, fields with empty 644 // values are omitted from API requests. However, any field with an 645 // empty value appearing in NullFields will be sent to the server as 646 // null. It is an error if a field in this list has a non-empty value. 647 // This may be used to include null fields in Patch requests. 648 NullFields []string `json:"-"` 649} 650 651func (s *BucketByTimePeriod) MarshalJSON() ([]byte, error) { 652 type NoMethod BucketByTimePeriod 653 raw := NoMethod(*s) 654 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 655} 656 657// DataPoint: Represents a single data point, generated by a particular 658// data source. A data point holds a value for each field, an end 659// timestamp and an optional start time. The exact semantics of each of 660// these attributes are specified in the documentation for the 661// particular data type. 662// 663// A data point can represent an instantaneous measurement, reading or 664// input observation, as well as averages or aggregates over a time 665// interval. Check the data type documentation to determine which is the 666// case for a particular data type. 667// 668// Data points always contain one value for each field of the data type. 669type DataPoint struct { 670 // ComputationTimeMillis: DO NOT USE THIS FIELD. It is ignored, and not 671 // stored. 672 ComputationTimeMillis int64 `json:"computationTimeMillis,omitempty,string"` 673 674 // DataTypeName: The data type defining the format of the values in this 675 // data point. 676 DataTypeName string `json:"dataTypeName,omitempty"` 677 678 // EndTimeNanos: The end time of the interval represented by this data 679 // point, in nanoseconds since epoch. 680 EndTimeNanos int64 `json:"endTimeNanos,omitempty,string"` 681 682 // ModifiedTimeMillis: Indicates the last time this data point was 683 // modified. Useful only in contexts where we are listing the data 684 // changes, rather than representing the current state of the data. 685 ModifiedTimeMillis int64 `json:"modifiedTimeMillis,omitempty,string"` 686 687 // OriginDataSourceId: If the data point is contained in a dataset for a 688 // derived data source, this field will be populated with the data 689 // source stream ID that created the data point originally. 690 // 691 // WARNING: do not rely on this field for anything other than debugging. 692 // The value of this field, if it is set at all, is an implementation 693 // detail and is not guaranteed to remain consistent. 694 OriginDataSourceId string `json:"originDataSourceId,omitempty"` 695 696 // RawTimestampNanos: The raw timestamp from the original SensorEvent. 697 RawTimestampNanos int64 `json:"rawTimestampNanos,omitempty,string"` 698 699 // StartTimeNanos: The start time of the interval represented by this 700 // data point, in nanoseconds since epoch. 701 StartTimeNanos int64 `json:"startTimeNanos,omitempty,string"` 702 703 // Value: Values of each data type field for the data point. It is 704 // expected that each value corresponding to a data type field will 705 // occur in the same order that the field is listed with in the data 706 // type specified in a data source. 707 // 708 // Only one of integer and floating point fields will be populated, 709 // depending on the format enum value within data source's type field. 710 Value []*Value `json:"value,omitempty"` 711 712 // ForceSendFields is a list of field names (e.g. 713 // "ComputationTimeMillis") to unconditionally include in API requests. 714 // By default, fields with empty values are omitted from API requests. 715 // However, any non-pointer, non-interface field appearing in 716 // ForceSendFields will be sent to the server regardless of whether the 717 // field is empty or not. This may be used to include empty fields in 718 // Patch requests. 719 ForceSendFields []string `json:"-"` 720 721 // NullFields is a list of field names (e.g. "ComputationTimeMillis") to 722 // include in API requests with the JSON null value. By default, fields 723 // with empty values are omitted from API requests. However, any field 724 // with an empty value appearing in NullFields will be sent to the 725 // server as null. It is an error if a field in this list has a 726 // non-empty value. This may be used to include null fields in Patch 727 // requests. 728 NullFields []string `json:"-"` 729} 730 731func (s *DataPoint) MarshalJSON() ([]byte, error) { 732 type NoMethod DataPoint 733 raw := NoMethod(*s) 734 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 735} 736 737// DataSource: Definition of a unique source of sensor data. Data 738// sources can expose raw data coming from hardware sensors on local or 739// companion devices. They can also expose derived data, created by 740// transforming or merging other data sources. Multiple data sources can 741// exist for the same data type. Every data point inserted into or read 742// from this service has an associated data source. 743// 744// The data source contains enough information to uniquely identify its 745// data, including the hardware device and the application that 746// collected and/or transformed the data. It also holds useful metadata, 747// such as the hardware and application versions, and the device 748// type. 749// 750// Each data source produces a unique stream of data, with a unique 751// identifier. Not all changes to data source affect the stream 752// identifier, so that data collected by updated versions of the same 753// application/device can still be considered to belong to the same data 754// stream. 755type DataSource struct { 756 // Application: Information about an application which feeds sensor data 757 // into the platform. 758 Application *Application `json:"application,omitempty"` 759 760 // DataQualityStandard: DO NOT POPULATE THIS FIELD. It is never 761 // populated in responses from the platform, and is ignored in queries. 762 // It will be removed in a future version entirely. 763 // 764 // Possible values: 765 // "dataQualityBloodGlucoseIso151972003" 766 // "dataQualityBloodGlucoseIso151972013" 767 // "dataQualityBloodPressureAami" 768 // "dataQualityBloodPressureBhsAA" 769 // "dataQualityBloodPressureBhsAB" 770 // "dataQualityBloodPressureBhsBA" 771 // "dataQualityBloodPressureBhsBB" 772 // "dataQualityBloodPressureEsh2002" 773 // "dataQualityBloodPressureEsh2010" 774 // "dataQualityUnknown" 775 DataQualityStandard []string `json:"dataQualityStandard,omitempty"` 776 777 // DataStreamId: A unique identifier for the data stream produced by 778 // this data source. The identifier includes: 779 // 780 // 781 // - The physical device's manufacturer, model, and serial number (UID). 782 // 783 // - The application's package name or name. Package name is used when 784 // the data source was created by an Android application. The developer 785 // project number is used when the data source was created by a REST 786 // client. 787 // - The data source's type. 788 // - The data source's stream name. Note that not all attributes of the 789 // data source are used as part of the stream identifier. In particular, 790 // the version of the hardware/the application isn't used. This allows 791 // us to preserve the same stream through version updates. This also 792 // means that two DataSource objects may represent the same data stream 793 // even if they're not equal. 794 // 795 // The exact format of the data stream ID created by an Android 796 // application is: 797 // type:dataType.name:application.packageName:device.manufacturer:device. 798 // model:device.uid:dataStreamName 799 // 800 // The exact format of the data stream ID created by a REST client is: 801 // type:dataType.name:developer project 802 // number:device.manufacturer:device.model:device.uid:dataStreamName 803 // 804 // 805 // When any of the optional fields that make up the data stream ID are 806 // absent, they will be omitted from the data stream ID. The minimum 807 // viable data stream ID would be: type:dataType.name:developer project 808 // number 809 // 810 // Finally, the developer project number is obfuscated when read by any 811 // REST or Android client that did not create the data source. Only the 812 // data source creator will see the developer project number in clear 813 // and normal form. 814 DataStreamId string `json:"dataStreamId,omitempty"` 815 816 // DataStreamName: The stream name uniquely identifies this particular 817 // data source among other data sources of the same type from the same 818 // underlying producer. Setting the stream name is optional, but should 819 // be done whenever an application exposes two streams for the same data 820 // type, or when a device has two equivalent sensors. 821 DataStreamName string `json:"dataStreamName,omitempty"` 822 823 // DataType: The data type defines the schema for a stream of data being 824 // collected by, inserted into, or queried from the Fitness API. 825 DataType *DataType `json:"dataType,omitempty"` 826 827 // Device: Representation of an integrated device (such as a phone or a 828 // wearable) that can hold sensors. 829 Device *Device `json:"device,omitempty"` 830 831 // Name: An end-user visible name for this data source. 832 Name string `json:"name,omitempty"` 833 834 // Type: A constant describing the type of this data source. Indicates 835 // whether this data source produces raw or derived data. 836 // 837 // Possible values: 838 // "derived" 839 // "raw" 840 Type string `json:"type,omitempty"` 841 842 // ServerResponse contains the HTTP response code and headers from the 843 // server. 844 googleapi.ServerResponse `json:"-"` 845 846 // ForceSendFields is a list of field names (e.g. "Application") to 847 // unconditionally include in API requests. By default, fields with 848 // empty values are omitted from API requests. However, any non-pointer, 849 // non-interface field appearing in ForceSendFields will be sent to the 850 // server regardless of whether the field is empty or not. This may be 851 // used to include empty fields in Patch requests. 852 ForceSendFields []string `json:"-"` 853 854 // NullFields is a list of field names (e.g. "Application") to include 855 // in API requests with the JSON null value. By default, fields with 856 // empty values are omitted from API requests. However, any field with 857 // an empty value appearing in NullFields will be sent to the server as 858 // null. It is an error if a field in this list has a non-empty value. 859 // This may be used to include null fields in Patch requests. 860 NullFields []string `json:"-"` 861} 862 863func (s *DataSource) MarshalJSON() ([]byte, error) { 864 type NoMethod DataSource 865 raw := NoMethod(*s) 866 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 867} 868 869type DataType struct { 870 // Field: A field represents one dimension of a data type. 871 Field []*DataTypeField `json:"field,omitempty"` 872 873 // Name: Each data type has a unique, namespaced, name. All data types 874 // in the com.google namespace are shared as part of the platform. 875 Name string `json:"name,omitempty"` 876 877 // ForceSendFields is a list of field names (e.g. "Field") to 878 // unconditionally include in API requests. By default, fields with 879 // empty values are omitted from API requests. However, any non-pointer, 880 // non-interface field appearing in ForceSendFields will be sent to the 881 // server regardless of whether the field is empty or not. This may be 882 // used to include empty fields in Patch requests. 883 ForceSendFields []string `json:"-"` 884 885 // NullFields is a list of field names (e.g. "Field") to include in API 886 // requests with the JSON null value. By default, fields with empty 887 // values are omitted from API requests. However, any field with an 888 // empty value appearing in NullFields will be sent to the server as 889 // null. It is an error if a field in this list has a non-empty value. 890 // This may be used to include null fields in Patch requests. 891 NullFields []string `json:"-"` 892} 893 894func (s *DataType) MarshalJSON() ([]byte, error) { 895 type NoMethod DataType 896 raw := NoMethod(*s) 897 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 898} 899 900// DataTypeField: In case of multi-dimensional data (such as an 901// accelerometer with x, y, and z axes) each field represents one 902// dimension. Each data type field has a unique name which identifies 903// it. The field also defines the format of the data (int, float, 904// etc.). 905// 906// This message is only instantiated in code and not used for wire comms 907// or stored in any way. 908type DataTypeField struct { 909 // Format: The different supported formats for each field in a data 910 // type. 911 // 912 // Possible values: 913 // "blob" 914 // "floatList" 915 // "floatPoint" 916 // "integer" 917 // "integerList" 918 // "map" 919 // "string" 920 Format string `json:"format,omitempty"` 921 922 // Name: Defines the name and format of data. Unlike data type names, 923 // field names are not namespaced, and only need to be unique within the 924 // data type. 925 Name string `json:"name,omitempty"` 926 927 Optional bool `json:"optional,omitempty"` 928 929 // ForceSendFields is a list of field names (e.g. "Format") to 930 // unconditionally include in API requests. By default, fields with 931 // empty values are omitted from API requests. However, any non-pointer, 932 // non-interface field appearing in ForceSendFields will be sent to the 933 // server regardless of whether the field is empty or not. This may be 934 // used to include empty fields in Patch requests. 935 ForceSendFields []string `json:"-"` 936 937 // NullFields is a list of field names (e.g. "Format") to include in API 938 // requests with the JSON null value. By default, fields with empty 939 // values are omitted from API requests. However, any field with an 940 // empty value appearing in NullFields will be sent to the server as 941 // null. It is an error if a field in this list has a non-empty value. 942 // This may be used to include null fields in Patch requests. 943 NullFields []string `json:"-"` 944} 945 946func (s *DataTypeField) MarshalJSON() ([]byte, error) { 947 type NoMethod DataTypeField 948 raw := NoMethod(*s) 949 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 950} 951 952// Dataset: A dataset represents a projection container for data points. 953// They do not carry any info of their own. Datasets represent a set of 954// data points from a particular data source. A data point can be found 955// in more than one dataset. 956type Dataset struct { 957 // DataSourceId: The data stream ID of the data source that created the 958 // points in this dataset. 959 DataSourceId string `json:"dataSourceId,omitempty"` 960 961 // MaxEndTimeNs: The largest end time of all data points in this 962 // possibly partial representation of the dataset. Time is in 963 // nanoseconds from epoch. This should also match the second part of the 964 // dataset identifier. 965 MaxEndTimeNs int64 `json:"maxEndTimeNs,omitempty,string"` 966 967 // MinStartTimeNs: The smallest start time of all data points in this 968 // possibly partial representation of the dataset. Time is in 969 // nanoseconds from epoch. This should also match the first part of the 970 // dataset identifier. 971 MinStartTimeNs int64 `json:"minStartTimeNs,omitempty,string"` 972 973 // NextPageToken: This token will be set when a dataset is received in 974 // response to a GET request and the dataset is too large to be included 975 // in a single response. Provide this value in a subsequent GET request 976 // to return the next page of data points within this dataset. 977 NextPageToken string `json:"nextPageToken,omitempty"` 978 979 // Point: A partial list of data points contained in the dataset, 980 // ordered by largest endTimeNanos first. This list is considered 981 // complete when retrieving a small dataset and partial when patching a 982 // dataset or retrieving a dataset that is too large to include in a 983 // single response. 984 Point []*DataPoint `json:"point,omitempty"` 985 986 // ServerResponse contains the HTTP response code and headers from the 987 // server. 988 googleapi.ServerResponse `json:"-"` 989 990 // ForceSendFields is a list of field names (e.g. "DataSourceId") to 991 // unconditionally include in API requests. By default, fields with 992 // empty values are omitted from API requests. However, any non-pointer, 993 // non-interface field appearing in ForceSendFields will be sent to the 994 // server regardless of whether the field is empty or not. This may be 995 // used to include empty fields in Patch requests. 996 ForceSendFields []string `json:"-"` 997 998 // NullFields is a list of field names (e.g. "DataSourceId") to include 999 // in API requests with the JSON null value. By default, fields with 1000 // empty values are omitted from API requests. However, any field with 1001 // an empty value appearing in NullFields will be sent to the server as 1002 // null. It is an error if a field in this list has a non-empty value. 1003 // This may be used to include null fields in Patch requests. 1004 NullFields []string `json:"-"` 1005} 1006 1007func (s *Dataset) MarshalJSON() ([]byte, error) { 1008 type NoMethod Dataset 1009 raw := NoMethod(*s) 1010 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1011} 1012 1013// Device: Representation of an integrated device (such as a phone or a 1014// wearable) that can hold sensors. Each sensor is exposed as a data 1015// source. 1016// 1017// The main purpose of the device information contained in this class is 1018// to identify the hardware of a particular data source. This can be 1019// useful in different ways, including: 1020// - Distinguishing two similar sensors on different devices (the step 1021// counter on two nexus 5 phones, for instance) 1022// - Display the source of data to the user (by using the device make / 1023// model) 1024// - Treat data differently depending on sensor type (accelerometers on 1025// a watch may give different patterns than those on a phone) 1026// - Build different analysis models for each device/version. 1027type Device struct { 1028 // Manufacturer: Manufacturer of the product/hardware. 1029 Manufacturer string `json:"manufacturer,omitempty"` 1030 1031 // Model: End-user visible model name for the device. 1032 Model string `json:"model,omitempty"` 1033 1034 // Type: A constant representing the type of the device. 1035 // 1036 // Possible values: 1037 // "chestStrap" 1038 // "headMounted" 1039 // "phone" 1040 // "scale" 1041 // "tablet" 1042 // "unknown" 1043 // "watch" 1044 Type string `json:"type,omitempty"` 1045 1046 // Uid: The serial number or other unique ID for the hardware. This 1047 // field is obfuscated when read by any REST or Android client that did 1048 // not create the data source. Only the data source creator will see the 1049 // uid field in clear and normal form. 1050 Uid string `json:"uid,omitempty"` 1051 1052 // Version: Version string for the device hardware/software. 1053 Version string `json:"version,omitempty"` 1054 1055 // ForceSendFields is a list of field names (e.g. "Manufacturer") to 1056 // unconditionally include in API requests. By default, fields with 1057 // empty values are omitted from API requests. However, any non-pointer, 1058 // non-interface field appearing in ForceSendFields will be sent to the 1059 // server regardless of whether the field is empty or not. This may be 1060 // used to include empty fields in Patch requests. 1061 ForceSendFields []string `json:"-"` 1062 1063 // NullFields is a list of field names (e.g. "Manufacturer") to include 1064 // in API requests with the JSON null value. By default, fields with 1065 // empty values are omitted from API requests. However, any field with 1066 // an empty value appearing in NullFields will be sent to the server as 1067 // null. It is an error if a field in this list has a non-empty value. 1068 // This may be used to include null fields in Patch requests. 1069 NullFields []string `json:"-"` 1070} 1071 1072func (s *Device) MarshalJSON() ([]byte, error) { 1073 type NoMethod Device 1074 raw := NoMethod(*s) 1075 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1076} 1077 1078type ListDataPointChangesResponse struct { 1079 // DataSourceId: The data stream ID of the data source with data point 1080 // changes. 1081 DataSourceId string `json:"dataSourceId,omitempty"` 1082 1083 // DeletedDataPoint: Deleted data points for the user. Note, for 1084 // modifications this should be parsed before handling insertions. 1085 DeletedDataPoint []*DataPoint `json:"deletedDataPoint,omitempty"` 1086 1087 // InsertedDataPoint: Inserted data points for the user. 1088 InsertedDataPoint []*DataPoint `json:"insertedDataPoint,omitempty"` 1089 1090 // NextPageToken: The continuation token, which is used to page through 1091 // large result sets. Provide this value in a subsequent request to 1092 // return the next page of results. 1093 NextPageToken string `json:"nextPageToken,omitempty"` 1094 1095 // ServerResponse contains the HTTP response code and headers from the 1096 // server. 1097 googleapi.ServerResponse `json:"-"` 1098 1099 // ForceSendFields is a list of field names (e.g. "DataSourceId") to 1100 // unconditionally include in API requests. By default, fields with 1101 // empty values are omitted from API requests. However, any non-pointer, 1102 // non-interface field appearing in ForceSendFields will be sent to the 1103 // server regardless of whether the field is empty or not. This may be 1104 // used to include empty fields in Patch requests. 1105 ForceSendFields []string `json:"-"` 1106 1107 // NullFields is a list of field names (e.g. "DataSourceId") to include 1108 // in API requests with the JSON null value. By default, fields with 1109 // empty values are omitted from API requests. However, any field with 1110 // an empty value appearing in NullFields will be sent to the server as 1111 // null. It is an error if a field in this list has a non-empty value. 1112 // This may be used to include null fields in Patch requests. 1113 NullFields []string `json:"-"` 1114} 1115 1116func (s *ListDataPointChangesResponse) MarshalJSON() ([]byte, error) { 1117 type NoMethod ListDataPointChangesResponse 1118 raw := NoMethod(*s) 1119 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1120} 1121 1122type ListDataSourcesResponse struct { 1123 // DataSource: A previously created data source. 1124 DataSource []*DataSource `json:"dataSource,omitempty"` 1125 1126 // ServerResponse contains the HTTP response code and headers from the 1127 // server. 1128 googleapi.ServerResponse `json:"-"` 1129 1130 // ForceSendFields is a list of field names (e.g. "DataSource") to 1131 // unconditionally include in API requests. By default, fields with 1132 // empty values are omitted from API requests. However, any non-pointer, 1133 // non-interface field appearing in ForceSendFields will be sent to the 1134 // server regardless of whether the field is empty or not. This may be 1135 // used to include empty fields in Patch requests. 1136 ForceSendFields []string `json:"-"` 1137 1138 // NullFields is a list of field names (e.g. "DataSource") to include in 1139 // API requests with the JSON null value. By default, fields with empty 1140 // values are omitted from API requests. However, any field with an 1141 // empty value appearing in NullFields will be sent to the server as 1142 // null. It is an error if a field in this list has a non-empty value. 1143 // This may be used to include null fields in Patch requests. 1144 NullFields []string `json:"-"` 1145} 1146 1147func (s *ListDataSourcesResponse) MarshalJSON() ([]byte, error) { 1148 type NoMethod ListDataSourcesResponse 1149 raw := NoMethod(*s) 1150 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1151} 1152 1153type ListSessionsResponse struct { 1154 // DeletedSession: If includeDeleted is set to true in the request, this 1155 // list will contain sessions deleted with original end times that are 1156 // within the startTime and endTime frame. 1157 DeletedSession []*Session `json:"deletedSession,omitempty"` 1158 1159 // HasMoreData: Flag to indicate server has more data to transfer 1160 HasMoreData bool `json:"hasMoreData,omitempty"` 1161 1162 // NextPageToken: The continuation token, which is used to page through 1163 // large result sets. Provide this value in a subsequent request to 1164 // return the next page of results. 1165 NextPageToken string `json:"nextPageToken,omitempty"` 1166 1167 // Session: Sessions with an end time that is between startTime and 1168 // endTime of the request. 1169 Session []*Session `json:"session,omitempty"` 1170 1171 // ServerResponse contains the HTTP response code and headers from the 1172 // server. 1173 googleapi.ServerResponse `json:"-"` 1174 1175 // ForceSendFields is a list of field names (e.g. "DeletedSession") to 1176 // unconditionally include in API requests. By default, fields with 1177 // empty values are omitted from API requests. However, any non-pointer, 1178 // non-interface field appearing in ForceSendFields will be sent to the 1179 // server regardless of whether the field is empty or not. This may be 1180 // used to include empty fields in Patch requests. 1181 ForceSendFields []string `json:"-"` 1182 1183 // NullFields is a list of field names (e.g. "DeletedSession") to 1184 // include in API requests with the JSON null value. By default, fields 1185 // with empty values are omitted from API requests. However, any field 1186 // with an empty value appearing in NullFields will be sent to the 1187 // server as null. It is an error if a field in this list has a 1188 // non-empty value. This may be used to include null fields in Patch 1189 // requests. 1190 NullFields []string `json:"-"` 1191} 1192 1193func (s *ListSessionsResponse) MarshalJSON() ([]byte, error) { 1194 type NoMethod ListSessionsResponse 1195 raw := NoMethod(*s) 1196 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1197} 1198 1199// MapValue: Holder object for the value of an entry in a map field of a 1200// data point. 1201// 1202// A map value supports a subset of the formats that the regular Value 1203// supports. 1204type MapValue struct { 1205 // FpVal: Floating point value. 1206 FpVal float64 `json:"fpVal,omitempty"` 1207 1208 // ForceSendFields is a list of field names (e.g. "FpVal") to 1209 // unconditionally include in API requests. By default, fields with 1210 // empty values are omitted from API requests. However, any non-pointer, 1211 // non-interface field appearing in ForceSendFields will be sent to the 1212 // server regardless of whether the field is empty or not. This may be 1213 // used to include empty fields in Patch requests. 1214 ForceSendFields []string `json:"-"` 1215 1216 // NullFields is a list of field names (e.g. "FpVal") to include in API 1217 // requests with the JSON null value. By default, fields with empty 1218 // values are omitted from API requests. However, any field with an 1219 // empty value appearing in NullFields will be sent to the server as 1220 // null. It is an error if a field in this list has a non-empty value. 1221 // This may be used to include null fields in Patch requests. 1222 NullFields []string `json:"-"` 1223} 1224 1225func (s *MapValue) MarshalJSON() ([]byte, error) { 1226 type NoMethod MapValue 1227 raw := NoMethod(*s) 1228 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1229} 1230 1231func (s *MapValue) UnmarshalJSON(data []byte) error { 1232 type NoMethod MapValue 1233 var s1 struct { 1234 FpVal gensupport.JSONFloat64 `json:"fpVal"` 1235 *NoMethod 1236 } 1237 s1.NoMethod = (*NoMethod)(s) 1238 if err := json.Unmarshal(data, &s1); err != nil { 1239 return err 1240 } 1241 s.FpVal = float64(s1.FpVal) 1242 return nil 1243} 1244 1245// Session: Sessions contain metadata, such as a user-friendly name and 1246// time interval information. 1247type Session struct { 1248 // ActiveTimeMillis: Session active time. While start_time_millis and 1249 // end_time_millis define the full session time, the active time can be 1250 // shorter and specified by active_time_millis. If the inactive time 1251 // during the session is known, it should also be inserted via a 1252 // com.google.activity.segment data point with a STILL activity value 1253 ActiveTimeMillis int64 `json:"activeTimeMillis,omitempty,string"` 1254 1255 // ActivityType: The type of activity this session represents. 1256 ActivityType int64 `json:"activityType,omitempty"` 1257 1258 // Application: The application that created the session. 1259 Application *Application `json:"application,omitempty"` 1260 1261 // Description: A description for this session. 1262 Description string `json:"description,omitempty"` 1263 1264 // EndTimeMillis: An end time, in milliseconds since epoch, inclusive. 1265 EndTimeMillis int64 `json:"endTimeMillis,omitempty,string"` 1266 1267 // Id: A client-generated identifier that is unique across all sessions 1268 // owned by this particular user. 1269 Id string `json:"id,omitempty"` 1270 1271 // ModifiedTimeMillis: A timestamp that indicates when the session was 1272 // last modified. 1273 ModifiedTimeMillis int64 `json:"modifiedTimeMillis,omitempty,string"` 1274 1275 // Name: A human readable name of the session. 1276 Name string `json:"name,omitempty"` 1277 1278 // StartTimeMillis: A start time, in milliseconds since epoch, 1279 // inclusive. 1280 StartTimeMillis int64 `json:"startTimeMillis,omitempty,string"` 1281 1282 // ServerResponse contains the HTTP response code and headers from the 1283 // server. 1284 googleapi.ServerResponse `json:"-"` 1285 1286 // ForceSendFields is a list of field names (e.g. "ActiveTimeMillis") to 1287 // unconditionally include in API requests. By default, fields with 1288 // empty values are omitted from API requests. However, any non-pointer, 1289 // non-interface field appearing in ForceSendFields will be sent to the 1290 // server regardless of whether the field is empty or not. This may be 1291 // used to include empty fields in Patch requests. 1292 ForceSendFields []string `json:"-"` 1293 1294 // NullFields is a list of field names (e.g. "ActiveTimeMillis") to 1295 // include in API requests with the JSON null value. By default, fields 1296 // with empty values are omitted from API requests. However, any field 1297 // with an empty value appearing in NullFields will be sent to the 1298 // server as null. It is an error if a field in this list has a 1299 // non-empty value. This may be used to include null fields in Patch 1300 // requests. 1301 NullFields []string `json:"-"` 1302} 1303 1304func (s *Session) MarshalJSON() ([]byte, error) { 1305 type NoMethod Session 1306 raw := NoMethod(*s) 1307 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1308} 1309 1310// Value: Holder object for the value of a single field in a data 1311// point. 1312// 1313// A field value has a particular format and is only ever set to one of 1314// an integer or a floating point value. LINT.IfChange 1315type Value struct { 1316 // FpVal: Floating point value. When this is set, other values must not 1317 // be set. 1318 FpVal float64 `json:"fpVal,omitempty"` 1319 1320 // IntVal: Integer value. When this is set, other values must not be 1321 // set. 1322 IntVal int64 `json:"intVal,omitempty"` 1323 1324 // MapVal: Map value. The valid key space and units for the 1325 // corresponding value of each entry should be documented as part of the 1326 // data type definition. Keys should be kept small whenever possible. 1327 // Data streams with large keys and high data frequency may be down 1328 // sampled. 1329 MapVal []*ValueMapValEntry `json:"mapVal,omitempty"` 1330 1331 // StringVal: String value. When this is set, other values must not be 1332 // set. Strings should be kept small whenever possible. Data streams 1333 // with large string values and high data frequency may be down sampled. 1334 StringVal string `json:"stringVal,omitempty"` 1335 1336 // ForceSendFields is a list of field names (e.g. "FpVal") to 1337 // unconditionally include in API requests. By default, fields with 1338 // empty values are omitted from API requests. However, any non-pointer, 1339 // non-interface field appearing in ForceSendFields will be sent to the 1340 // server regardless of whether the field is empty or not. This may be 1341 // used to include empty fields in Patch requests. 1342 ForceSendFields []string `json:"-"` 1343 1344 // NullFields is a list of field names (e.g. "FpVal") to include in API 1345 // requests with the JSON null value. By default, fields with empty 1346 // values are omitted from API requests. However, any field with an 1347 // empty value appearing in NullFields will be sent to the server as 1348 // null. It is an error if a field in this list has a non-empty value. 1349 // This may be used to include null fields in Patch requests. 1350 NullFields []string `json:"-"` 1351} 1352 1353func (s *Value) MarshalJSON() ([]byte, error) { 1354 type NoMethod Value 1355 raw := NoMethod(*s) 1356 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1357} 1358 1359func (s *Value) UnmarshalJSON(data []byte) error { 1360 type NoMethod Value 1361 var s1 struct { 1362 FpVal gensupport.JSONFloat64 `json:"fpVal"` 1363 *NoMethod 1364 } 1365 s1.NoMethod = (*NoMethod)(s) 1366 if err := json.Unmarshal(data, &s1); err != nil { 1367 return err 1368 } 1369 s.FpVal = float64(s1.FpVal) 1370 return nil 1371} 1372 1373type ValueMapValEntry struct { 1374 Key string `json:"key,omitempty"` 1375 1376 Value *MapValue `json:"value,omitempty"` 1377 1378 // ForceSendFields is a list of field names (e.g. "Key") to 1379 // unconditionally include in API requests. By default, fields with 1380 // empty values are omitted from API requests. However, any non-pointer, 1381 // non-interface field appearing in ForceSendFields will be sent to the 1382 // server regardless of whether the field is empty or not. This may be 1383 // used to include empty fields in Patch requests. 1384 ForceSendFields []string `json:"-"` 1385 1386 // NullFields is a list of field names (e.g. "Key") to include in API 1387 // requests with the JSON null value. By default, fields with empty 1388 // values are omitted from API requests. However, any field with an 1389 // empty value appearing in NullFields will be sent to the server as 1390 // null. It is an error if a field in this list has a non-empty value. 1391 // This may be used to include null fields in Patch requests. 1392 NullFields []string `json:"-"` 1393} 1394 1395func (s *ValueMapValEntry) MarshalJSON() ([]byte, error) { 1396 type NoMethod ValueMapValEntry 1397 raw := NoMethod(*s) 1398 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1399} 1400 1401// method id "fitness.users.dataSources.create": 1402 1403type UsersDataSourcesCreateCall struct { 1404 s *Service 1405 userId string 1406 datasource *DataSource 1407 urlParams_ gensupport.URLParams 1408 ctx_ context.Context 1409 header_ http.Header 1410} 1411 1412// Create: Creates a new data source that is unique across all data 1413// sources belonging to this user. The data stream ID field can be 1414// omitted and will be generated by the server with the correct format. 1415// The data stream ID is an ordered combination of some fields from the 1416// data source. In addition to the data source fields reflected into the 1417// data source ID, the developer project number that is authenticated 1418// when creating the data source is included. This developer project 1419// number is obfuscated when read by any other developer reading public 1420// data types. 1421func (r *UsersDataSourcesService) Create(userId string, datasource *DataSource) *UsersDataSourcesCreateCall { 1422 c := &UsersDataSourcesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1423 c.userId = userId 1424 c.datasource = datasource 1425 return c 1426} 1427 1428// Fields allows partial responses to be retrieved. See 1429// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1430// for more information. 1431func (c *UsersDataSourcesCreateCall) Fields(s ...googleapi.Field) *UsersDataSourcesCreateCall { 1432 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1433 return c 1434} 1435 1436// Context sets the context to be used in this call's Do method. Any 1437// pending HTTP request will be aborted if the provided context is 1438// canceled. 1439func (c *UsersDataSourcesCreateCall) Context(ctx context.Context) *UsersDataSourcesCreateCall { 1440 c.ctx_ = ctx 1441 return c 1442} 1443 1444// Header returns an http.Header that can be modified by the caller to 1445// add HTTP headers to the request. 1446func (c *UsersDataSourcesCreateCall) Header() http.Header { 1447 if c.header_ == nil { 1448 c.header_ = make(http.Header) 1449 } 1450 return c.header_ 1451} 1452 1453func (c *UsersDataSourcesCreateCall) doRequest(alt string) (*http.Response, error) { 1454 reqHeaders := make(http.Header) 1455 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 1456 for k, v := range c.header_ { 1457 reqHeaders[k] = v 1458 } 1459 reqHeaders.Set("User-Agent", c.s.userAgent()) 1460 var body io.Reader = nil 1461 body, err := googleapi.WithoutDataWrapper.JSONReader(c.datasource) 1462 if err != nil { 1463 return nil, err 1464 } 1465 reqHeaders.Set("Content-Type", "application/json") 1466 c.urlParams_.Set("alt", alt) 1467 c.urlParams_.Set("prettyPrint", "false") 1468 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources") 1469 urls += "?" + c.urlParams_.Encode() 1470 req, err := http.NewRequest("POST", urls, body) 1471 if err != nil { 1472 return nil, err 1473 } 1474 req.Header = reqHeaders 1475 googleapi.Expand(req.URL, map[string]string{ 1476 "userId": c.userId, 1477 }) 1478 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1479} 1480 1481// Do executes the "fitness.users.dataSources.create" call. 1482// Exactly one of *DataSource or error will be non-nil. Any non-2xx 1483// status code is an error. Response headers are in either 1484// *DataSource.ServerResponse.Header or (if a response was returned at 1485// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1486// to check whether the returned error was because 1487// http.StatusNotModified was returned. 1488func (c *UsersDataSourcesCreateCall) Do(opts ...googleapi.CallOption) (*DataSource, error) { 1489 gensupport.SetOptions(c.urlParams_, opts...) 1490 res, err := c.doRequest("json") 1491 if res != nil && res.StatusCode == http.StatusNotModified { 1492 if res.Body != nil { 1493 res.Body.Close() 1494 } 1495 return nil, &googleapi.Error{ 1496 Code: res.StatusCode, 1497 Header: res.Header, 1498 } 1499 } 1500 if err != nil { 1501 return nil, err 1502 } 1503 defer googleapi.CloseBody(res) 1504 if err := googleapi.CheckResponse(res); err != nil { 1505 return nil, err 1506 } 1507 ret := &DataSource{ 1508 ServerResponse: googleapi.ServerResponse{ 1509 Header: res.Header, 1510 HTTPStatusCode: res.StatusCode, 1511 }, 1512 } 1513 target := &ret 1514 if err := gensupport.DecodeResponse(target, res); err != nil { 1515 return nil, err 1516 } 1517 return ret, nil 1518 // { 1519 // "description": "Creates a new data source that is unique across all data sources belonging to this user. The data stream ID field can be omitted and will be generated by the server with the correct format. The data stream ID is an ordered combination of some fields from the data source. In addition to the data source fields reflected into the data source ID, the developer project number that is authenticated when creating the data source is included. This developer project number is obfuscated when read by any other developer reading public data types.", 1520 // "httpMethod": "POST", 1521 // "id": "fitness.users.dataSources.create", 1522 // "parameterOrder": [ 1523 // "userId" 1524 // ], 1525 // "parameters": { 1526 // "userId": { 1527 // "description": "Create the data source for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.", 1528 // "location": "path", 1529 // "required": true, 1530 // "type": "string" 1531 // } 1532 // }, 1533 // "path": "{userId}/dataSources", 1534 // "request": { 1535 // "$ref": "DataSource" 1536 // }, 1537 // "response": { 1538 // "$ref": "DataSource" 1539 // }, 1540 // "scopes": [ 1541 // "https://www.googleapis.com/auth/fitness.activity.write", 1542 // "https://www.googleapis.com/auth/fitness.blood_glucose.write", 1543 // "https://www.googleapis.com/auth/fitness.blood_pressure.write", 1544 // "https://www.googleapis.com/auth/fitness.body.write", 1545 // "https://www.googleapis.com/auth/fitness.body_temperature.write", 1546 // "https://www.googleapis.com/auth/fitness.location.write", 1547 // "https://www.googleapis.com/auth/fitness.nutrition.write", 1548 // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", 1549 // "https://www.googleapis.com/auth/fitness.reproductive_health.write" 1550 // ] 1551 // } 1552 1553} 1554 1555// method id "fitness.users.dataSources.delete": 1556 1557type UsersDataSourcesDeleteCall struct { 1558 s *Service 1559 userId string 1560 dataSourceId string 1561 urlParams_ gensupport.URLParams 1562 ctx_ context.Context 1563 header_ http.Header 1564} 1565 1566// Delete: Deletes the specified data source. The request will fail if 1567// the data source contains any data points. 1568func (r *UsersDataSourcesService) Delete(userId string, dataSourceId string) *UsersDataSourcesDeleteCall { 1569 c := &UsersDataSourcesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1570 c.userId = userId 1571 c.dataSourceId = dataSourceId 1572 return c 1573} 1574 1575// Fields allows partial responses to be retrieved. See 1576// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1577// for more information. 1578func (c *UsersDataSourcesDeleteCall) Fields(s ...googleapi.Field) *UsersDataSourcesDeleteCall { 1579 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1580 return c 1581} 1582 1583// Context sets the context to be used in this call's Do method. Any 1584// pending HTTP request will be aborted if the provided context is 1585// canceled. 1586func (c *UsersDataSourcesDeleteCall) Context(ctx context.Context) *UsersDataSourcesDeleteCall { 1587 c.ctx_ = ctx 1588 return c 1589} 1590 1591// Header returns an http.Header that can be modified by the caller to 1592// add HTTP headers to the request. 1593func (c *UsersDataSourcesDeleteCall) Header() http.Header { 1594 if c.header_ == nil { 1595 c.header_ = make(http.Header) 1596 } 1597 return c.header_ 1598} 1599 1600func (c *UsersDataSourcesDeleteCall) doRequest(alt string) (*http.Response, error) { 1601 reqHeaders := make(http.Header) 1602 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 1603 for k, v := range c.header_ { 1604 reqHeaders[k] = v 1605 } 1606 reqHeaders.Set("User-Agent", c.s.userAgent()) 1607 var body io.Reader = nil 1608 c.urlParams_.Set("alt", alt) 1609 c.urlParams_.Set("prettyPrint", "false") 1610 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}") 1611 urls += "?" + c.urlParams_.Encode() 1612 req, err := http.NewRequest("DELETE", urls, body) 1613 if err != nil { 1614 return nil, err 1615 } 1616 req.Header = reqHeaders 1617 googleapi.Expand(req.URL, map[string]string{ 1618 "userId": c.userId, 1619 "dataSourceId": c.dataSourceId, 1620 }) 1621 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1622} 1623 1624// Do executes the "fitness.users.dataSources.delete" call. 1625// Exactly one of *DataSource or error will be non-nil. Any non-2xx 1626// status code is an error. Response headers are in either 1627// *DataSource.ServerResponse.Header or (if a response was returned at 1628// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1629// to check whether the returned error was because 1630// http.StatusNotModified was returned. 1631func (c *UsersDataSourcesDeleteCall) Do(opts ...googleapi.CallOption) (*DataSource, error) { 1632 gensupport.SetOptions(c.urlParams_, opts...) 1633 res, err := c.doRequest("json") 1634 if res != nil && res.StatusCode == http.StatusNotModified { 1635 if res.Body != nil { 1636 res.Body.Close() 1637 } 1638 return nil, &googleapi.Error{ 1639 Code: res.StatusCode, 1640 Header: res.Header, 1641 } 1642 } 1643 if err != nil { 1644 return nil, err 1645 } 1646 defer googleapi.CloseBody(res) 1647 if err := googleapi.CheckResponse(res); err != nil { 1648 return nil, err 1649 } 1650 ret := &DataSource{ 1651 ServerResponse: googleapi.ServerResponse{ 1652 Header: res.Header, 1653 HTTPStatusCode: res.StatusCode, 1654 }, 1655 } 1656 target := &ret 1657 if err := gensupport.DecodeResponse(target, res); err != nil { 1658 return nil, err 1659 } 1660 return ret, nil 1661 // { 1662 // "description": "Deletes the specified data source. The request will fail if the data source contains any data points.", 1663 // "httpMethod": "DELETE", 1664 // "id": "fitness.users.dataSources.delete", 1665 // "parameterOrder": [ 1666 // "userId", 1667 // "dataSourceId" 1668 // ], 1669 // "parameters": { 1670 // "dataSourceId": { 1671 // "description": "The data stream ID of the data source to delete.", 1672 // "location": "path", 1673 // "required": true, 1674 // "type": "string" 1675 // }, 1676 // "userId": { 1677 // "description": "Retrieve a data source for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.", 1678 // "location": "path", 1679 // "required": true, 1680 // "type": "string" 1681 // } 1682 // }, 1683 // "path": "{userId}/dataSources/{dataSourceId}", 1684 // "response": { 1685 // "$ref": "DataSource" 1686 // }, 1687 // "scopes": [ 1688 // "https://www.googleapis.com/auth/fitness.activity.write", 1689 // "https://www.googleapis.com/auth/fitness.blood_glucose.write", 1690 // "https://www.googleapis.com/auth/fitness.blood_pressure.write", 1691 // "https://www.googleapis.com/auth/fitness.body.write", 1692 // "https://www.googleapis.com/auth/fitness.body_temperature.write", 1693 // "https://www.googleapis.com/auth/fitness.location.write", 1694 // "https://www.googleapis.com/auth/fitness.nutrition.write", 1695 // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", 1696 // "https://www.googleapis.com/auth/fitness.reproductive_health.write" 1697 // ] 1698 // } 1699 1700} 1701 1702// method id "fitness.users.dataSources.get": 1703 1704type UsersDataSourcesGetCall struct { 1705 s *Service 1706 userId string 1707 dataSourceId string 1708 urlParams_ gensupport.URLParams 1709 ifNoneMatch_ string 1710 ctx_ context.Context 1711 header_ http.Header 1712} 1713 1714// Get: Returns the specified data source. 1715func (r *UsersDataSourcesService) Get(userId string, dataSourceId string) *UsersDataSourcesGetCall { 1716 c := &UsersDataSourcesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1717 c.userId = userId 1718 c.dataSourceId = dataSourceId 1719 return c 1720} 1721 1722// Fields allows partial responses to be retrieved. See 1723// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1724// for more information. 1725func (c *UsersDataSourcesGetCall) Fields(s ...googleapi.Field) *UsersDataSourcesGetCall { 1726 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1727 return c 1728} 1729 1730// IfNoneMatch sets the optional parameter which makes the operation 1731// fail if the object's ETag matches the given value. This is useful for 1732// getting updates only after the object has changed since the last 1733// request. Use googleapi.IsNotModified to check whether the response 1734// error from Do is the result of In-None-Match. 1735func (c *UsersDataSourcesGetCall) IfNoneMatch(entityTag string) *UsersDataSourcesGetCall { 1736 c.ifNoneMatch_ = entityTag 1737 return c 1738} 1739 1740// Context sets the context to be used in this call's Do method. Any 1741// pending HTTP request will be aborted if the provided context is 1742// canceled. 1743func (c *UsersDataSourcesGetCall) Context(ctx context.Context) *UsersDataSourcesGetCall { 1744 c.ctx_ = ctx 1745 return c 1746} 1747 1748// Header returns an http.Header that can be modified by the caller to 1749// add HTTP headers to the request. 1750func (c *UsersDataSourcesGetCall) Header() http.Header { 1751 if c.header_ == nil { 1752 c.header_ = make(http.Header) 1753 } 1754 return c.header_ 1755} 1756 1757func (c *UsersDataSourcesGetCall) doRequest(alt string) (*http.Response, error) { 1758 reqHeaders := make(http.Header) 1759 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 1760 for k, v := range c.header_ { 1761 reqHeaders[k] = v 1762 } 1763 reqHeaders.Set("User-Agent", c.s.userAgent()) 1764 if c.ifNoneMatch_ != "" { 1765 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1766 } 1767 var body io.Reader = nil 1768 c.urlParams_.Set("alt", alt) 1769 c.urlParams_.Set("prettyPrint", "false") 1770 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}") 1771 urls += "?" + c.urlParams_.Encode() 1772 req, err := http.NewRequest("GET", urls, body) 1773 if err != nil { 1774 return nil, err 1775 } 1776 req.Header = reqHeaders 1777 googleapi.Expand(req.URL, map[string]string{ 1778 "userId": c.userId, 1779 "dataSourceId": c.dataSourceId, 1780 }) 1781 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1782} 1783 1784// Do executes the "fitness.users.dataSources.get" call. 1785// Exactly one of *DataSource or error will be non-nil. Any non-2xx 1786// status code is an error. Response headers are in either 1787// *DataSource.ServerResponse.Header or (if a response was returned at 1788// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1789// to check whether the returned error was because 1790// http.StatusNotModified was returned. 1791func (c *UsersDataSourcesGetCall) Do(opts ...googleapi.CallOption) (*DataSource, error) { 1792 gensupport.SetOptions(c.urlParams_, opts...) 1793 res, err := c.doRequest("json") 1794 if res != nil && res.StatusCode == http.StatusNotModified { 1795 if res.Body != nil { 1796 res.Body.Close() 1797 } 1798 return nil, &googleapi.Error{ 1799 Code: res.StatusCode, 1800 Header: res.Header, 1801 } 1802 } 1803 if err != nil { 1804 return nil, err 1805 } 1806 defer googleapi.CloseBody(res) 1807 if err := googleapi.CheckResponse(res); err != nil { 1808 return nil, err 1809 } 1810 ret := &DataSource{ 1811 ServerResponse: googleapi.ServerResponse{ 1812 Header: res.Header, 1813 HTTPStatusCode: res.StatusCode, 1814 }, 1815 } 1816 target := &ret 1817 if err := gensupport.DecodeResponse(target, res); err != nil { 1818 return nil, err 1819 } 1820 return ret, nil 1821 // { 1822 // "description": "Returns the specified data source.", 1823 // "httpMethod": "GET", 1824 // "id": "fitness.users.dataSources.get", 1825 // "parameterOrder": [ 1826 // "userId", 1827 // "dataSourceId" 1828 // ], 1829 // "parameters": { 1830 // "dataSourceId": { 1831 // "description": "The data stream ID of the data source to retrieve.", 1832 // "location": "path", 1833 // "required": true, 1834 // "type": "string" 1835 // }, 1836 // "userId": { 1837 // "description": "Retrieve a data source for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.", 1838 // "location": "path", 1839 // "required": true, 1840 // "type": "string" 1841 // } 1842 // }, 1843 // "path": "{userId}/dataSources/{dataSourceId}", 1844 // "response": { 1845 // "$ref": "DataSource" 1846 // }, 1847 // "scopes": [ 1848 // "https://www.googleapis.com/auth/fitness.activity.read", 1849 // "https://www.googleapis.com/auth/fitness.activity.write", 1850 // "https://www.googleapis.com/auth/fitness.blood_glucose.read", 1851 // "https://www.googleapis.com/auth/fitness.blood_glucose.write", 1852 // "https://www.googleapis.com/auth/fitness.blood_pressure.read", 1853 // "https://www.googleapis.com/auth/fitness.blood_pressure.write", 1854 // "https://www.googleapis.com/auth/fitness.body.read", 1855 // "https://www.googleapis.com/auth/fitness.body.write", 1856 // "https://www.googleapis.com/auth/fitness.body_temperature.read", 1857 // "https://www.googleapis.com/auth/fitness.body_temperature.write", 1858 // "https://www.googleapis.com/auth/fitness.location.read", 1859 // "https://www.googleapis.com/auth/fitness.location.write", 1860 // "https://www.googleapis.com/auth/fitness.nutrition.read", 1861 // "https://www.googleapis.com/auth/fitness.nutrition.write", 1862 // "https://www.googleapis.com/auth/fitness.oxygen_saturation.read", 1863 // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", 1864 // "https://www.googleapis.com/auth/fitness.reproductive_health.read", 1865 // "https://www.googleapis.com/auth/fitness.reproductive_health.write" 1866 // ] 1867 // } 1868 1869} 1870 1871// method id "fitness.users.dataSources.list": 1872 1873type UsersDataSourcesListCall struct { 1874 s *Service 1875 userId string 1876 urlParams_ gensupport.URLParams 1877 ifNoneMatch_ string 1878 ctx_ context.Context 1879 header_ http.Header 1880} 1881 1882// List: Lists all data sources that are visible to the developer, using 1883// the OAuth scopes provided. The list is not exhaustive; the user may 1884// have private data sources that are only visible to other developers, 1885// or calls using other scopes. 1886func (r *UsersDataSourcesService) List(userId string) *UsersDataSourcesListCall { 1887 c := &UsersDataSourcesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1888 c.userId = userId 1889 return c 1890} 1891 1892// DataTypeName sets the optional parameter "dataTypeName": The names of 1893// data types to include in the list. If not specified, all data sources 1894// will be returned. 1895func (c *UsersDataSourcesListCall) DataTypeName(dataTypeName ...string) *UsersDataSourcesListCall { 1896 c.urlParams_.SetMulti("dataTypeName", append([]string{}, dataTypeName...)) 1897 return c 1898} 1899 1900// Fields allows partial responses to be retrieved. See 1901// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1902// for more information. 1903func (c *UsersDataSourcesListCall) Fields(s ...googleapi.Field) *UsersDataSourcesListCall { 1904 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1905 return c 1906} 1907 1908// IfNoneMatch sets the optional parameter which makes the operation 1909// fail if the object's ETag matches the given value. This is useful for 1910// getting updates only after the object has changed since the last 1911// request. Use googleapi.IsNotModified to check whether the response 1912// error from Do is the result of In-None-Match. 1913func (c *UsersDataSourcesListCall) IfNoneMatch(entityTag string) *UsersDataSourcesListCall { 1914 c.ifNoneMatch_ = entityTag 1915 return c 1916} 1917 1918// Context sets the context to be used in this call's Do method. Any 1919// pending HTTP request will be aborted if the provided context is 1920// canceled. 1921func (c *UsersDataSourcesListCall) Context(ctx context.Context) *UsersDataSourcesListCall { 1922 c.ctx_ = ctx 1923 return c 1924} 1925 1926// Header returns an http.Header that can be modified by the caller to 1927// add HTTP headers to the request. 1928func (c *UsersDataSourcesListCall) Header() http.Header { 1929 if c.header_ == nil { 1930 c.header_ = make(http.Header) 1931 } 1932 return c.header_ 1933} 1934 1935func (c *UsersDataSourcesListCall) doRequest(alt string) (*http.Response, error) { 1936 reqHeaders := make(http.Header) 1937 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 1938 for k, v := range c.header_ { 1939 reqHeaders[k] = v 1940 } 1941 reqHeaders.Set("User-Agent", c.s.userAgent()) 1942 if c.ifNoneMatch_ != "" { 1943 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 1944 } 1945 var body io.Reader = nil 1946 c.urlParams_.Set("alt", alt) 1947 c.urlParams_.Set("prettyPrint", "false") 1948 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources") 1949 urls += "?" + c.urlParams_.Encode() 1950 req, err := http.NewRequest("GET", urls, body) 1951 if err != nil { 1952 return nil, err 1953 } 1954 req.Header = reqHeaders 1955 googleapi.Expand(req.URL, map[string]string{ 1956 "userId": c.userId, 1957 }) 1958 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1959} 1960 1961// Do executes the "fitness.users.dataSources.list" call. 1962// Exactly one of *ListDataSourcesResponse or error will be non-nil. Any 1963// non-2xx status code is an error. Response headers are in either 1964// *ListDataSourcesResponse.ServerResponse.Header or (if a response was 1965// returned at all) in error.(*googleapi.Error).Header. Use 1966// googleapi.IsNotModified to check whether the returned error was 1967// because http.StatusNotModified was returned. 1968func (c *UsersDataSourcesListCall) Do(opts ...googleapi.CallOption) (*ListDataSourcesResponse, error) { 1969 gensupport.SetOptions(c.urlParams_, opts...) 1970 res, err := c.doRequest("json") 1971 if res != nil && res.StatusCode == http.StatusNotModified { 1972 if res.Body != nil { 1973 res.Body.Close() 1974 } 1975 return nil, &googleapi.Error{ 1976 Code: res.StatusCode, 1977 Header: res.Header, 1978 } 1979 } 1980 if err != nil { 1981 return nil, err 1982 } 1983 defer googleapi.CloseBody(res) 1984 if err := googleapi.CheckResponse(res); err != nil { 1985 return nil, err 1986 } 1987 ret := &ListDataSourcesResponse{ 1988 ServerResponse: googleapi.ServerResponse{ 1989 Header: res.Header, 1990 HTTPStatusCode: res.StatusCode, 1991 }, 1992 } 1993 target := &ret 1994 if err := gensupport.DecodeResponse(target, res); err != nil { 1995 return nil, err 1996 } 1997 return ret, nil 1998 // { 1999 // "description": "Lists all data sources that are visible to the developer, using the OAuth scopes provided. The list is not exhaustive; the user may have private data sources that are only visible to other developers, or calls using other scopes.", 2000 // "httpMethod": "GET", 2001 // "id": "fitness.users.dataSources.list", 2002 // "parameterOrder": [ 2003 // "userId" 2004 // ], 2005 // "parameters": { 2006 // "dataTypeName": { 2007 // "description": "The names of data types to include in the list. If not specified, all data sources will be returned.", 2008 // "location": "query", 2009 // "repeated": true, 2010 // "type": "string" 2011 // }, 2012 // "userId": { 2013 // "description": "List data sources for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.", 2014 // "location": "path", 2015 // "required": true, 2016 // "type": "string" 2017 // } 2018 // }, 2019 // "path": "{userId}/dataSources", 2020 // "response": { 2021 // "$ref": "ListDataSourcesResponse" 2022 // }, 2023 // "scopes": [ 2024 // "https://www.googleapis.com/auth/fitness.activity.read", 2025 // "https://www.googleapis.com/auth/fitness.activity.write", 2026 // "https://www.googleapis.com/auth/fitness.blood_glucose.read", 2027 // "https://www.googleapis.com/auth/fitness.blood_glucose.write", 2028 // "https://www.googleapis.com/auth/fitness.blood_pressure.read", 2029 // "https://www.googleapis.com/auth/fitness.blood_pressure.write", 2030 // "https://www.googleapis.com/auth/fitness.body.read", 2031 // "https://www.googleapis.com/auth/fitness.body.write", 2032 // "https://www.googleapis.com/auth/fitness.body_temperature.read", 2033 // "https://www.googleapis.com/auth/fitness.body_temperature.write", 2034 // "https://www.googleapis.com/auth/fitness.location.read", 2035 // "https://www.googleapis.com/auth/fitness.location.write", 2036 // "https://www.googleapis.com/auth/fitness.nutrition.read", 2037 // "https://www.googleapis.com/auth/fitness.nutrition.write", 2038 // "https://www.googleapis.com/auth/fitness.oxygen_saturation.read", 2039 // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", 2040 // "https://www.googleapis.com/auth/fitness.reproductive_health.read", 2041 // "https://www.googleapis.com/auth/fitness.reproductive_health.write" 2042 // ] 2043 // } 2044 2045} 2046 2047// method id "fitness.users.dataSources.update": 2048 2049type UsersDataSourcesUpdateCall struct { 2050 s *Service 2051 userId string 2052 dataSourceId string 2053 datasource *DataSource 2054 urlParams_ gensupport.URLParams 2055 ctx_ context.Context 2056 header_ http.Header 2057} 2058 2059// Update: Updates the specified data source. The dataStreamId, 2060// dataType, type, dataStreamName, and device properties with the 2061// exception of version, cannot be modified. 2062// 2063// Data sources are identified by their dataStreamId. 2064func (r *UsersDataSourcesService) Update(userId string, dataSourceId string, datasource *DataSource) *UsersDataSourcesUpdateCall { 2065 c := &UsersDataSourcesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2066 c.userId = userId 2067 c.dataSourceId = dataSourceId 2068 c.datasource = datasource 2069 return c 2070} 2071 2072// Fields allows partial responses to be retrieved. See 2073// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2074// for more information. 2075func (c *UsersDataSourcesUpdateCall) Fields(s ...googleapi.Field) *UsersDataSourcesUpdateCall { 2076 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2077 return c 2078} 2079 2080// Context sets the context to be used in this call's Do method. Any 2081// pending HTTP request will be aborted if the provided context is 2082// canceled. 2083func (c *UsersDataSourcesUpdateCall) Context(ctx context.Context) *UsersDataSourcesUpdateCall { 2084 c.ctx_ = ctx 2085 return c 2086} 2087 2088// Header returns an http.Header that can be modified by the caller to 2089// add HTTP headers to the request. 2090func (c *UsersDataSourcesUpdateCall) Header() http.Header { 2091 if c.header_ == nil { 2092 c.header_ = make(http.Header) 2093 } 2094 return c.header_ 2095} 2096 2097func (c *UsersDataSourcesUpdateCall) doRequest(alt string) (*http.Response, error) { 2098 reqHeaders := make(http.Header) 2099 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 2100 for k, v := range c.header_ { 2101 reqHeaders[k] = v 2102 } 2103 reqHeaders.Set("User-Agent", c.s.userAgent()) 2104 var body io.Reader = nil 2105 body, err := googleapi.WithoutDataWrapper.JSONReader(c.datasource) 2106 if err != nil { 2107 return nil, err 2108 } 2109 reqHeaders.Set("Content-Type", "application/json") 2110 c.urlParams_.Set("alt", alt) 2111 c.urlParams_.Set("prettyPrint", "false") 2112 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}") 2113 urls += "?" + c.urlParams_.Encode() 2114 req, err := http.NewRequest("PUT", urls, body) 2115 if err != nil { 2116 return nil, err 2117 } 2118 req.Header = reqHeaders 2119 googleapi.Expand(req.URL, map[string]string{ 2120 "userId": c.userId, 2121 "dataSourceId": c.dataSourceId, 2122 }) 2123 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2124} 2125 2126// Do executes the "fitness.users.dataSources.update" call. 2127// Exactly one of *DataSource or error will be non-nil. Any non-2xx 2128// status code is an error. Response headers are in either 2129// *DataSource.ServerResponse.Header or (if a response was returned at 2130// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2131// to check whether the returned error was because 2132// http.StatusNotModified was returned. 2133func (c *UsersDataSourcesUpdateCall) Do(opts ...googleapi.CallOption) (*DataSource, error) { 2134 gensupport.SetOptions(c.urlParams_, opts...) 2135 res, err := c.doRequest("json") 2136 if res != nil && res.StatusCode == http.StatusNotModified { 2137 if res.Body != nil { 2138 res.Body.Close() 2139 } 2140 return nil, &googleapi.Error{ 2141 Code: res.StatusCode, 2142 Header: res.Header, 2143 } 2144 } 2145 if err != nil { 2146 return nil, err 2147 } 2148 defer googleapi.CloseBody(res) 2149 if err := googleapi.CheckResponse(res); err != nil { 2150 return nil, err 2151 } 2152 ret := &DataSource{ 2153 ServerResponse: googleapi.ServerResponse{ 2154 Header: res.Header, 2155 HTTPStatusCode: res.StatusCode, 2156 }, 2157 } 2158 target := &ret 2159 if err := gensupport.DecodeResponse(target, res); err != nil { 2160 return nil, err 2161 } 2162 return ret, nil 2163 // { 2164 // "description": "Updates the specified data source. The dataStreamId, dataType, type, dataStreamName, and device properties with the exception of version, cannot be modified.\n\nData sources are identified by their dataStreamId.", 2165 // "httpMethod": "PUT", 2166 // "id": "fitness.users.dataSources.update", 2167 // "parameterOrder": [ 2168 // "userId", 2169 // "dataSourceId" 2170 // ], 2171 // "parameters": { 2172 // "dataSourceId": { 2173 // "description": "The data stream ID of the data source to update.", 2174 // "location": "path", 2175 // "required": true, 2176 // "type": "string" 2177 // }, 2178 // "userId": { 2179 // "description": "Update the data source for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.", 2180 // "location": "path", 2181 // "required": true, 2182 // "type": "string" 2183 // } 2184 // }, 2185 // "path": "{userId}/dataSources/{dataSourceId}", 2186 // "request": { 2187 // "$ref": "DataSource" 2188 // }, 2189 // "response": { 2190 // "$ref": "DataSource" 2191 // }, 2192 // "scopes": [ 2193 // "https://www.googleapis.com/auth/fitness.activity.write", 2194 // "https://www.googleapis.com/auth/fitness.blood_glucose.write", 2195 // "https://www.googleapis.com/auth/fitness.blood_pressure.write", 2196 // "https://www.googleapis.com/auth/fitness.body.write", 2197 // "https://www.googleapis.com/auth/fitness.body_temperature.write", 2198 // "https://www.googleapis.com/auth/fitness.location.write", 2199 // "https://www.googleapis.com/auth/fitness.nutrition.write", 2200 // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", 2201 // "https://www.googleapis.com/auth/fitness.reproductive_health.write" 2202 // ] 2203 // } 2204 2205} 2206 2207// method id "fitness.users.dataSources.dataPointChanges.list": 2208 2209type UsersDataSourcesDataPointChangesListCall struct { 2210 s *Service 2211 userId string 2212 dataSourceId string 2213 urlParams_ gensupport.URLParams 2214 ifNoneMatch_ string 2215 ctx_ context.Context 2216 header_ http.Header 2217} 2218 2219// List: Queries for user's data point changes for a particular data 2220// source. 2221func (r *UsersDataSourcesDataPointChangesService) List(userId string, dataSourceId string) *UsersDataSourcesDataPointChangesListCall { 2222 c := &UsersDataSourcesDataPointChangesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2223 c.userId = userId 2224 c.dataSourceId = dataSourceId 2225 return c 2226} 2227 2228// Limit sets the optional parameter "limit": If specified, no more than 2229// this many data point changes will be included in the response. 2230func (c *UsersDataSourcesDataPointChangesListCall) Limit(limit int64) *UsersDataSourcesDataPointChangesListCall { 2231 c.urlParams_.Set("limit", fmt.Sprint(limit)) 2232 return c 2233} 2234 2235// PageToken sets the optional parameter "pageToken": The continuation 2236// token, which is used to page through large result sets. To get the 2237// next page of results, set this parameter to the value of 2238// nextPageToken from the previous response. 2239func (c *UsersDataSourcesDataPointChangesListCall) PageToken(pageToken string) *UsersDataSourcesDataPointChangesListCall { 2240 c.urlParams_.Set("pageToken", pageToken) 2241 return c 2242} 2243 2244// Fields allows partial responses to be retrieved. See 2245// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2246// for more information. 2247func (c *UsersDataSourcesDataPointChangesListCall) Fields(s ...googleapi.Field) *UsersDataSourcesDataPointChangesListCall { 2248 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2249 return c 2250} 2251 2252// IfNoneMatch sets the optional parameter which makes the operation 2253// fail if the object's ETag matches the given value. This is useful for 2254// getting updates only after the object has changed since the last 2255// request. Use googleapi.IsNotModified to check whether the response 2256// error from Do is the result of In-None-Match. 2257func (c *UsersDataSourcesDataPointChangesListCall) IfNoneMatch(entityTag string) *UsersDataSourcesDataPointChangesListCall { 2258 c.ifNoneMatch_ = entityTag 2259 return c 2260} 2261 2262// Context sets the context to be used in this call's Do method. Any 2263// pending HTTP request will be aborted if the provided context is 2264// canceled. 2265func (c *UsersDataSourcesDataPointChangesListCall) Context(ctx context.Context) *UsersDataSourcesDataPointChangesListCall { 2266 c.ctx_ = ctx 2267 return c 2268} 2269 2270// Header returns an http.Header that can be modified by the caller to 2271// add HTTP headers to the request. 2272func (c *UsersDataSourcesDataPointChangesListCall) Header() http.Header { 2273 if c.header_ == nil { 2274 c.header_ = make(http.Header) 2275 } 2276 return c.header_ 2277} 2278 2279func (c *UsersDataSourcesDataPointChangesListCall) doRequest(alt string) (*http.Response, error) { 2280 reqHeaders := make(http.Header) 2281 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 2282 for k, v := range c.header_ { 2283 reqHeaders[k] = v 2284 } 2285 reqHeaders.Set("User-Agent", c.s.userAgent()) 2286 if c.ifNoneMatch_ != "" { 2287 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2288 } 2289 var body io.Reader = nil 2290 c.urlParams_.Set("alt", alt) 2291 c.urlParams_.Set("prettyPrint", "false") 2292 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/dataPointChanges") 2293 urls += "?" + c.urlParams_.Encode() 2294 req, err := http.NewRequest("GET", urls, body) 2295 if err != nil { 2296 return nil, err 2297 } 2298 req.Header = reqHeaders 2299 googleapi.Expand(req.URL, map[string]string{ 2300 "userId": c.userId, 2301 "dataSourceId": c.dataSourceId, 2302 }) 2303 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2304} 2305 2306// Do executes the "fitness.users.dataSources.dataPointChanges.list" call. 2307// Exactly one of *ListDataPointChangesResponse or error will be 2308// non-nil. Any non-2xx status code is an error. Response headers are in 2309// either *ListDataPointChangesResponse.ServerResponse.Header or (if a 2310// response was returned at all) in error.(*googleapi.Error).Header. Use 2311// googleapi.IsNotModified to check whether the returned error was 2312// because http.StatusNotModified was returned. 2313func (c *UsersDataSourcesDataPointChangesListCall) Do(opts ...googleapi.CallOption) (*ListDataPointChangesResponse, error) { 2314 gensupport.SetOptions(c.urlParams_, opts...) 2315 res, err := c.doRequest("json") 2316 if res != nil && res.StatusCode == http.StatusNotModified { 2317 if res.Body != nil { 2318 res.Body.Close() 2319 } 2320 return nil, &googleapi.Error{ 2321 Code: res.StatusCode, 2322 Header: res.Header, 2323 } 2324 } 2325 if err != nil { 2326 return nil, err 2327 } 2328 defer googleapi.CloseBody(res) 2329 if err := googleapi.CheckResponse(res); err != nil { 2330 return nil, err 2331 } 2332 ret := &ListDataPointChangesResponse{ 2333 ServerResponse: googleapi.ServerResponse{ 2334 Header: res.Header, 2335 HTTPStatusCode: res.StatusCode, 2336 }, 2337 } 2338 target := &ret 2339 if err := gensupport.DecodeResponse(target, res); err != nil { 2340 return nil, err 2341 } 2342 return ret, nil 2343 // { 2344 // "description": "Queries for user's data point changes for a particular data source.", 2345 // "httpMethod": "GET", 2346 // "id": "fitness.users.dataSources.dataPointChanges.list", 2347 // "parameterOrder": [ 2348 // "userId", 2349 // "dataSourceId" 2350 // ], 2351 // "parameters": { 2352 // "dataSourceId": { 2353 // "description": "The data stream ID of the data source that created the dataset.", 2354 // "location": "path", 2355 // "required": true, 2356 // "type": "string" 2357 // }, 2358 // "limit": { 2359 // "description": "If specified, no more than this many data point changes will be included in the response.", 2360 // "format": "int32", 2361 // "location": "query", 2362 // "type": "integer" 2363 // }, 2364 // "pageToken": { 2365 // "description": "The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of nextPageToken from the previous response.", 2366 // "location": "query", 2367 // "type": "string" 2368 // }, 2369 // "userId": { 2370 // "description": "List data points for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.", 2371 // "location": "path", 2372 // "required": true, 2373 // "type": "string" 2374 // } 2375 // }, 2376 // "path": "{userId}/dataSources/{dataSourceId}/dataPointChanges", 2377 // "response": { 2378 // "$ref": "ListDataPointChangesResponse" 2379 // }, 2380 // "scopes": [ 2381 // "https://www.googleapis.com/auth/fitness.activity.read", 2382 // "https://www.googleapis.com/auth/fitness.activity.write", 2383 // "https://www.googleapis.com/auth/fitness.blood_glucose.read", 2384 // "https://www.googleapis.com/auth/fitness.blood_glucose.write", 2385 // "https://www.googleapis.com/auth/fitness.blood_pressure.read", 2386 // "https://www.googleapis.com/auth/fitness.blood_pressure.write", 2387 // "https://www.googleapis.com/auth/fitness.body.read", 2388 // "https://www.googleapis.com/auth/fitness.body.write", 2389 // "https://www.googleapis.com/auth/fitness.body_temperature.read", 2390 // "https://www.googleapis.com/auth/fitness.body_temperature.write", 2391 // "https://www.googleapis.com/auth/fitness.location.read", 2392 // "https://www.googleapis.com/auth/fitness.location.write", 2393 // "https://www.googleapis.com/auth/fitness.nutrition.read", 2394 // "https://www.googleapis.com/auth/fitness.nutrition.write", 2395 // "https://www.googleapis.com/auth/fitness.oxygen_saturation.read", 2396 // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", 2397 // "https://www.googleapis.com/auth/fitness.reproductive_health.read", 2398 // "https://www.googleapis.com/auth/fitness.reproductive_health.write" 2399 // ] 2400 // } 2401 2402} 2403 2404// Pages invokes f for each page of results. 2405// A non-nil error returned from f will halt the iteration. 2406// The provided context supersedes any context provided to the Context method. 2407func (c *UsersDataSourcesDataPointChangesListCall) Pages(ctx context.Context, f func(*ListDataPointChangesResponse) error) error { 2408 c.ctx_ = ctx 2409 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2410 for { 2411 x, err := c.Do() 2412 if err != nil { 2413 return err 2414 } 2415 if err := f(x); err != nil { 2416 return err 2417 } 2418 if x.NextPageToken == "" { 2419 return nil 2420 } 2421 c.PageToken(x.NextPageToken) 2422 } 2423} 2424 2425// method id "fitness.users.dataSources.datasets.delete": 2426 2427type UsersDataSourcesDatasetsDeleteCall struct { 2428 s *Service 2429 userId string 2430 dataSourceId string 2431 datasetId string 2432 urlParams_ gensupport.URLParams 2433 ctx_ context.Context 2434 header_ http.Header 2435} 2436 2437// Delete: Performs an inclusive delete of all data points whose start 2438// and end times have any overlap with the time range specified by the 2439// dataset ID. For most data types, the entire data point will be 2440// deleted. For data types where the time span represents a consistent 2441// value (such as com.google.activity.segment), and a data point 2442// straddles either end point of the dataset, only the overlapping 2443// portion of the data point will be deleted. 2444func (r *UsersDataSourcesDatasetsService) Delete(userId string, dataSourceId string, datasetId string) *UsersDataSourcesDatasetsDeleteCall { 2445 c := &UsersDataSourcesDatasetsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2446 c.userId = userId 2447 c.dataSourceId = dataSourceId 2448 c.datasetId = datasetId 2449 return c 2450} 2451 2452// CurrentTimeMillis sets the optional parameter "currentTimeMillis": 2453// The client's current time in milliseconds since epoch. 2454func (c *UsersDataSourcesDatasetsDeleteCall) CurrentTimeMillis(currentTimeMillis int64) *UsersDataSourcesDatasetsDeleteCall { 2455 c.urlParams_.Set("currentTimeMillis", fmt.Sprint(currentTimeMillis)) 2456 return c 2457} 2458 2459// ModifiedTimeMillis sets the optional parameter "modifiedTimeMillis": 2460// When the operation was performed on the client. 2461func (c *UsersDataSourcesDatasetsDeleteCall) ModifiedTimeMillis(modifiedTimeMillis int64) *UsersDataSourcesDatasetsDeleteCall { 2462 c.urlParams_.Set("modifiedTimeMillis", fmt.Sprint(modifiedTimeMillis)) 2463 return c 2464} 2465 2466// Fields allows partial responses to be retrieved. See 2467// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2468// for more information. 2469func (c *UsersDataSourcesDatasetsDeleteCall) Fields(s ...googleapi.Field) *UsersDataSourcesDatasetsDeleteCall { 2470 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2471 return c 2472} 2473 2474// Context sets the context to be used in this call's Do method. Any 2475// pending HTTP request will be aborted if the provided context is 2476// canceled. 2477func (c *UsersDataSourcesDatasetsDeleteCall) Context(ctx context.Context) *UsersDataSourcesDatasetsDeleteCall { 2478 c.ctx_ = ctx 2479 return c 2480} 2481 2482// Header returns an http.Header that can be modified by the caller to 2483// add HTTP headers to the request. 2484func (c *UsersDataSourcesDatasetsDeleteCall) Header() http.Header { 2485 if c.header_ == nil { 2486 c.header_ = make(http.Header) 2487 } 2488 return c.header_ 2489} 2490 2491func (c *UsersDataSourcesDatasetsDeleteCall) doRequest(alt string) (*http.Response, error) { 2492 reqHeaders := make(http.Header) 2493 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 2494 for k, v := range c.header_ { 2495 reqHeaders[k] = v 2496 } 2497 reqHeaders.Set("User-Agent", c.s.userAgent()) 2498 var body io.Reader = nil 2499 c.urlParams_.Set("alt", alt) 2500 c.urlParams_.Set("prettyPrint", "false") 2501 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}") 2502 urls += "?" + c.urlParams_.Encode() 2503 req, err := http.NewRequest("DELETE", urls, body) 2504 if err != nil { 2505 return nil, err 2506 } 2507 req.Header = reqHeaders 2508 googleapi.Expand(req.URL, map[string]string{ 2509 "userId": c.userId, 2510 "dataSourceId": c.dataSourceId, 2511 "datasetId": c.datasetId, 2512 }) 2513 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2514} 2515 2516// Do executes the "fitness.users.dataSources.datasets.delete" call. 2517func (c *UsersDataSourcesDatasetsDeleteCall) Do(opts ...googleapi.CallOption) error { 2518 gensupport.SetOptions(c.urlParams_, opts...) 2519 res, err := c.doRequest("json") 2520 if err != nil { 2521 return err 2522 } 2523 defer googleapi.CloseBody(res) 2524 if err := googleapi.CheckResponse(res); err != nil { 2525 return err 2526 } 2527 return nil 2528 // { 2529 // "description": "Performs an inclusive delete of all data points whose start and end times have any overlap with the time range specified by the dataset ID. For most data types, the entire data point will be deleted. For data types where the time span represents a consistent value (such as com.google.activity.segment), and a data point straddles either end point of the dataset, only the overlapping portion of the data point will be deleted.", 2530 // "httpMethod": "DELETE", 2531 // "id": "fitness.users.dataSources.datasets.delete", 2532 // "parameterOrder": [ 2533 // "userId", 2534 // "dataSourceId", 2535 // "datasetId" 2536 // ], 2537 // "parameters": { 2538 // "currentTimeMillis": { 2539 // "description": "The client's current time in milliseconds since epoch.", 2540 // "format": "int64", 2541 // "location": "query", 2542 // "type": "string" 2543 // }, 2544 // "dataSourceId": { 2545 // "description": "The data stream ID of the data source that created the dataset.", 2546 // "location": "path", 2547 // "required": true, 2548 // "type": "string" 2549 // }, 2550 // "datasetId": { 2551 // "description": "Dataset identifier that is a composite of the minimum data point start time and maximum data point end time represented as nanoseconds from the epoch. The ID is formatted like: \"startTime-endTime\" where startTime and endTime are 64 bit integers.", 2552 // "location": "path", 2553 // "required": true, 2554 // "type": "string" 2555 // }, 2556 // "modifiedTimeMillis": { 2557 // "description": "When the operation was performed on the client.", 2558 // "format": "int64", 2559 // "location": "query", 2560 // "type": "string" 2561 // }, 2562 // "userId": { 2563 // "description": "Delete a dataset for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.", 2564 // "location": "path", 2565 // "required": true, 2566 // "type": "string" 2567 // } 2568 // }, 2569 // "path": "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}", 2570 // "scopes": [ 2571 // "https://www.googleapis.com/auth/fitness.activity.write", 2572 // "https://www.googleapis.com/auth/fitness.blood_glucose.write", 2573 // "https://www.googleapis.com/auth/fitness.blood_pressure.write", 2574 // "https://www.googleapis.com/auth/fitness.body.write", 2575 // "https://www.googleapis.com/auth/fitness.body_temperature.write", 2576 // "https://www.googleapis.com/auth/fitness.location.write", 2577 // "https://www.googleapis.com/auth/fitness.nutrition.write", 2578 // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", 2579 // "https://www.googleapis.com/auth/fitness.reproductive_health.write" 2580 // ] 2581 // } 2582 2583} 2584 2585// method id "fitness.users.dataSources.datasets.get": 2586 2587type UsersDataSourcesDatasetsGetCall struct { 2588 s *Service 2589 userId string 2590 dataSourceId string 2591 datasetId string 2592 urlParams_ gensupport.URLParams 2593 ifNoneMatch_ string 2594 ctx_ context.Context 2595 header_ http.Header 2596} 2597 2598// Get: Returns a dataset containing all data points whose start and end 2599// times overlap with the specified range of the dataset minimum start 2600// time and maximum end time. Specifically, any data point whose start 2601// time is less than or equal to the dataset end time and whose end time 2602// is greater than or equal to the dataset start time. 2603func (r *UsersDataSourcesDatasetsService) Get(userId string, dataSourceId string, datasetId string) *UsersDataSourcesDatasetsGetCall { 2604 c := &UsersDataSourcesDatasetsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2605 c.userId = userId 2606 c.dataSourceId = dataSourceId 2607 c.datasetId = datasetId 2608 return c 2609} 2610 2611// Limit sets the optional parameter "limit": If specified, no more than 2612// this many data points will be included in the dataset. If there are 2613// more data points in the dataset, nextPageToken will be set in the 2614// dataset response. 2615func (c *UsersDataSourcesDatasetsGetCall) Limit(limit int64) *UsersDataSourcesDatasetsGetCall { 2616 c.urlParams_.Set("limit", fmt.Sprint(limit)) 2617 return c 2618} 2619 2620// PageToken sets the optional parameter "pageToken": The continuation 2621// token, which is used to page through large datasets. To get the next 2622// page of a dataset, set this parameter to the value of nextPageToken 2623// from the previous response. Each subsequent call will yield a partial 2624// dataset with data point end timestamps that are strictly smaller than 2625// those in the previous partial response. 2626func (c *UsersDataSourcesDatasetsGetCall) PageToken(pageToken string) *UsersDataSourcesDatasetsGetCall { 2627 c.urlParams_.Set("pageToken", pageToken) 2628 return c 2629} 2630 2631// Fields allows partial responses to be retrieved. See 2632// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2633// for more information. 2634func (c *UsersDataSourcesDatasetsGetCall) Fields(s ...googleapi.Field) *UsersDataSourcesDatasetsGetCall { 2635 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2636 return c 2637} 2638 2639// IfNoneMatch sets the optional parameter which makes the operation 2640// fail if the object's ETag matches the given value. This is useful for 2641// getting updates only after the object has changed since the last 2642// request. Use googleapi.IsNotModified to check whether the response 2643// error from Do is the result of In-None-Match. 2644func (c *UsersDataSourcesDatasetsGetCall) IfNoneMatch(entityTag string) *UsersDataSourcesDatasetsGetCall { 2645 c.ifNoneMatch_ = entityTag 2646 return c 2647} 2648 2649// Context sets the context to be used in this call's Do method. Any 2650// pending HTTP request will be aborted if the provided context is 2651// canceled. 2652func (c *UsersDataSourcesDatasetsGetCall) Context(ctx context.Context) *UsersDataSourcesDatasetsGetCall { 2653 c.ctx_ = ctx 2654 return c 2655} 2656 2657// Header returns an http.Header that can be modified by the caller to 2658// add HTTP headers to the request. 2659func (c *UsersDataSourcesDatasetsGetCall) Header() http.Header { 2660 if c.header_ == nil { 2661 c.header_ = make(http.Header) 2662 } 2663 return c.header_ 2664} 2665 2666func (c *UsersDataSourcesDatasetsGetCall) doRequest(alt string) (*http.Response, error) { 2667 reqHeaders := make(http.Header) 2668 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 2669 for k, v := range c.header_ { 2670 reqHeaders[k] = v 2671 } 2672 reqHeaders.Set("User-Agent", c.s.userAgent()) 2673 if c.ifNoneMatch_ != "" { 2674 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2675 } 2676 var body io.Reader = nil 2677 c.urlParams_.Set("alt", alt) 2678 c.urlParams_.Set("prettyPrint", "false") 2679 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}") 2680 urls += "?" + c.urlParams_.Encode() 2681 req, err := http.NewRequest("GET", urls, body) 2682 if err != nil { 2683 return nil, err 2684 } 2685 req.Header = reqHeaders 2686 googleapi.Expand(req.URL, map[string]string{ 2687 "userId": c.userId, 2688 "dataSourceId": c.dataSourceId, 2689 "datasetId": c.datasetId, 2690 }) 2691 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2692} 2693 2694// Do executes the "fitness.users.dataSources.datasets.get" call. 2695// Exactly one of *Dataset or error will be non-nil. Any non-2xx status 2696// code is an error. Response headers are in either 2697// *Dataset.ServerResponse.Header or (if a response was returned at all) 2698// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2699// check whether the returned error was because http.StatusNotModified 2700// was returned. 2701func (c *UsersDataSourcesDatasetsGetCall) Do(opts ...googleapi.CallOption) (*Dataset, error) { 2702 gensupport.SetOptions(c.urlParams_, opts...) 2703 res, err := c.doRequest("json") 2704 if res != nil && res.StatusCode == http.StatusNotModified { 2705 if res.Body != nil { 2706 res.Body.Close() 2707 } 2708 return nil, &googleapi.Error{ 2709 Code: res.StatusCode, 2710 Header: res.Header, 2711 } 2712 } 2713 if err != nil { 2714 return nil, err 2715 } 2716 defer googleapi.CloseBody(res) 2717 if err := googleapi.CheckResponse(res); err != nil { 2718 return nil, err 2719 } 2720 ret := &Dataset{ 2721 ServerResponse: googleapi.ServerResponse{ 2722 Header: res.Header, 2723 HTTPStatusCode: res.StatusCode, 2724 }, 2725 } 2726 target := &ret 2727 if err := gensupport.DecodeResponse(target, res); err != nil { 2728 return nil, err 2729 } 2730 return ret, nil 2731 // { 2732 // "description": "Returns a dataset containing all data points whose start and end times overlap with the specified range of the dataset minimum start time and maximum end time. Specifically, any data point whose start time is less than or equal to the dataset end time and whose end time is greater than or equal to the dataset start time.", 2733 // "httpMethod": "GET", 2734 // "id": "fitness.users.dataSources.datasets.get", 2735 // "parameterOrder": [ 2736 // "userId", 2737 // "dataSourceId", 2738 // "datasetId" 2739 // ], 2740 // "parameters": { 2741 // "dataSourceId": { 2742 // "description": "The data stream ID of the data source that created the dataset.", 2743 // "location": "path", 2744 // "required": true, 2745 // "type": "string" 2746 // }, 2747 // "datasetId": { 2748 // "description": "Dataset identifier that is a composite of the minimum data point start time and maximum data point end time represented as nanoseconds from the epoch. The ID is formatted like: \"startTime-endTime\" where startTime and endTime are 64 bit integers.", 2749 // "location": "path", 2750 // "required": true, 2751 // "type": "string" 2752 // }, 2753 // "limit": { 2754 // "description": "If specified, no more than this many data points will be included in the dataset. If there are more data points in the dataset, nextPageToken will be set in the dataset response.", 2755 // "format": "int32", 2756 // "location": "query", 2757 // "type": "integer" 2758 // }, 2759 // "pageToken": { 2760 // "description": "The continuation token, which is used to page through large datasets. To get the next page of a dataset, set this parameter to the value of nextPageToken from the previous response. Each subsequent call will yield a partial dataset with data point end timestamps that are strictly smaller than those in the previous partial response.", 2761 // "location": "query", 2762 // "type": "string" 2763 // }, 2764 // "userId": { 2765 // "description": "Retrieve a dataset for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.", 2766 // "location": "path", 2767 // "required": true, 2768 // "type": "string" 2769 // } 2770 // }, 2771 // "path": "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}", 2772 // "response": { 2773 // "$ref": "Dataset" 2774 // }, 2775 // "scopes": [ 2776 // "https://www.googleapis.com/auth/fitness.activity.read", 2777 // "https://www.googleapis.com/auth/fitness.activity.write", 2778 // "https://www.googleapis.com/auth/fitness.blood_glucose.read", 2779 // "https://www.googleapis.com/auth/fitness.blood_glucose.write", 2780 // "https://www.googleapis.com/auth/fitness.blood_pressure.read", 2781 // "https://www.googleapis.com/auth/fitness.blood_pressure.write", 2782 // "https://www.googleapis.com/auth/fitness.body.read", 2783 // "https://www.googleapis.com/auth/fitness.body.write", 2784 // "https://www.googleapis.com/auth/fitness.body_temperature.read", 2785 // "https://www.googleapis.com/auth/fitness.body_temperature.write", 2786 // "https://www.googleapis.com/auth/fitness.location.read", 2787 // "https://www.googleapis.com/auth/fitness.location.write", 2788 // "https://www.googleapis.com/auth/fitness.nutrition.read", 2789 // "https://www.googleapis.com/auth/fitness.nutrition.write", 2790 // "https://www.googleapis.com/auth/fitness.oxygen_saturation.read", 2791 // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", 2792 // "https://www.googleapis.com/auth/fitness.reproductive_health.read", 2793 // "https://www.googleapis.com/auth/fitness.reproductive_health.write" 2794 // ] 2795 // } 2796 2797} 2798 2799// Pages invokes f for each page of results. 2800// A non-nil error returned from f will halt the iteration. 2801// The provided context supersedes any context provided to the Context method. 2802func (c *UsersDataSourcesDatasetsGetCall) Pages(ctx context.Context, f func(*Dataset) error) error { 2803 c.ctx_ = ctx 2804 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2805 for { 2806 x, err := c.Do() 2807 if err != nil { 2808 return err 2809 } 2810 if err := f(x); err != nil { 2811 return err 2812 } 2813 if x.NextPageToken == "" { 2814 return nil 2815 } 2816 c.PageToken(x.NextPageToken) 2817 } 2818} 2819 2820// method id "fitness.users.dataSources.datasets.patch": 2821 2822type UsersDataSourcesDatasetsPatchCall struct { 2823 s *Service 2824 userId string 2825 dataSourceId string 2826 datasetId string 2827 dataset *Dataset 2828 urlParams_ gensupport.URLParams 2829 ctx_ context.Context 2830 header_ http.Header 2831} 2832 2833// Patch: Adds data points to a dataset. The dataset need not be 2834// previously created. All points within the given dataset will be 2835// returned with subsquent calls to retrieve this dataset. Data points 2836// can belong to more than one dataset. This method does not use patch 2837// semantics. 2838func (r *UsersDataSourcesDatasetsService) Patch(userId string, dataSourceId string, datasetId string, dataset *Dataset) *UsersDataSourcesDatasetsPatchCall { 2839 c := &UsersDataSourcesDatasetsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2840 c.userId = userId 2841 c.dataSourceId = dataSourceId 2842 c.datasetId = datasetId 2843 c.dataset = dataset 2844 return c 2845} 2846 2847// CurrentTimeMillis sets the optional parameter "currentTimeMillis": 2848// The client's current time in milliseconds since epoch. Note that the 2849// minStartTimeNs and maxEndTimeNs properties in the request body are in 2850// nanoseconds instead of milliseconds. 2851func (c *UsersDataSourcesDatasetsPatchCall) CurrentTimeMillis(currentTimeMillis int64) *UsersDataSourcesDatasetsPatchCall { 2852 c.urlParams_.Set("currentTimeMillis", fmt.Sprint(currentTimeMillis)) 2853 return c 2854} 2855 2856// Fields allows partial responses to be retrieved. See 2857// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2858// for more information. 2859func (c *UsersDataSourcesDatasetsPatchCall) Fields(s ...googleapi.Field) *UsersDataSourcesDatasetsPatchCall { 2860 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2861 return c 2862} 2863 2864// Context sets the context to be used in this call's Do method. Any 2865// pending HTTP request will be aborted if the provided context is 2866// canceled. 2867func (c *UsersDataSourcesDatasetsPatchCall) Context(ctx context.Context) *UsersDataSourcesDatasetsPatchCall { 2868 c.ctx_ = ctx 2869 return c 2870} 2871 2872// Header returns an http.Header that can be modified by the caller to 2873// add HTTP headers to the request. 2874func (c *UsersDataSourcesDatasetsPatchCall) Header() http.Header { 2875 if c.header_ == nil { 2876 c.header_ = make(http.Header) 2877 } 2878 return c.header_ 2879} 2880 2881func (c *UsersDataSourcesDatasetsPatchCall) doRequest(alt string) (*http.Response, error) { 2882 reqHeaders := make(http.Header) 2883 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 2884 for k, v := range c.header_ { 2885 reqHeaders[k] = v 2886 } 2887 reqHeaders.Set("User-Agent", c.s.userAgent()) 2888 var body io.Reader = nil 2889 body, err := googleapi.WithoutDataWrapper.JSONReader(c.dataset) 2890 if err != nil { 2891 return nil, err 2892 } 2893 reqHeaders.Set("Content-Type", "application/json") 2894 c.urlParams_.Set("alt", alt) 2895 c.urlParams_.Set("prettyPrint", "false") 2896 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}") 2897 urls += "?" + c.urlParams_.Encode() 2898 req, err := http.NewRequest("PATCH", urls, body) 2899 if err != nil { 2900 return nil, err 2901 } 2902 req.Header = reqHeaders 2903 googleapi.Expand(req.URL, map[string]string{ 2904 "userId": c.userId, 2905 "dataSourceId": c.dataSourceId, 2906 "datasetId": c.datasetId, 2907 }) 2908 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2909} 2910 2911// Do executes the "fitness.users.dataSources.datasets.patch" call. 2912// Exactly one of *Dataset or error will be non-nil. Any non-2xx status 2913// code is an error. Response headers are in either 2914// *Dataset.ServerResponse.Header or (if a response was returned at all) 2915// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2916// check whether the returned error was because http.StatusNotModified 2917// was returned. 2918func (c *UsersDataSourcesDatasetsPatchCall) Do(opts ...googleapi.CallOption) (*Dataset, error) { 2919 gensupport.SetOptions(c.urlParams_, opts...) 2920 res, err := c.doRequest("json") 2921 if res != nil && res.StatusCode == http.StatusNotModified { 2922 if res.Body != nil { 2923 res.Body.Close() 2924 } 2925 return nil, &googleapi.Error{ 2926 Code: res.StatusCode, 2927 Header: res.Header, 2928 } 2929 } 2930 if err != nil { 2931 return nil, err 2932 } 2933 defer googleapi.CloseBody(res) 2934 if err := googleapi.CheckResponse(res); err != nil { 2935 return nil, err 2936 } 2937 ret := &Dataset{ 2938 ServerResponse: googleapi.ServerResponse{ 2939 Header: res.Header, 2940 HTTPStatusCode: res.StatusCode, 2941 }, 2942 } 2943 target := &ret 2944 if err := gensupport.DecodeResponse(target, res); err != nil { 2945 return nil, err 2946 } 2947 return ret, nil 2948 // { 2949 // "description": "Adds data points to a dataset. The dataset need not be previously created. All points within the given dataset will be returned with subsquent calls to retrieve this dataset. Data points can belong to more than one dataset. This method does not use patch semantics.", 2950 // "httpMethod": "PATCH", 2951 // "id": "fitness.users.dataSources.datasets.patch", 2952 // "parameterOrder": [ 2953 // "userId", 2954 // "dataSourceId", 2955 // "datasetId" 2956 // ], 2957 // "parameters": { 2958 // "currentTimeMillis": { 2959 // "description": "The client's current time in milliseconds since epoch. Note that the minStartTimeNs and maxEndTimeNs properties in the request body are in nanoseconds instead of milliseconds.", 2960 // "format": "int64", 2961 // "location": "query", 2962 // "type": "string" 2963 // }, 2964 // "dataSourceId": { 2965 // "description": "The data stream ID of the data source that created the dataset.", 2966 // "location": "path", 2967 // "required": true, 2968 // "type": "string" 2969 // }, 2970 // "datasetId": { 2971 // "description": "Dataset identifier that is a composite of the minimum data point start time and maximum data point end time represented as nanoseconds from the epoch. The ID is formatted like: \"startTime-endTime\" where startTime and endTime are 64 bit integers.", 2972 // "location": "path", 2973 // "required": true, 2974 // "type": "string" 2975 // }, 2976 // "userId": { 2977 // "description": "Patch a dataset for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.", 2978 // "location": "path", 2979 // "required": true, 2980 // "type": "string" 2981 // } 2982 // }, 2983 // "path": "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}", 2984 // "request": { 2985 // "$ref": "Dataset" 2986 // }, 2987 // "response": { 2988 // "$ref": "Dataset" 2989 // }, 2990 // "scopes": [ 2991 // "https://www.googleapis.com/auth/fitness.activity.write", 2992 // "https://www.googleapis.com/auth/fitness.blood_glucose.write", 2993 // "https://www.googleapis.com/auth/fitness.blood_pressure.write", 2994 // "https://www.googleapis.com/auth/fitness.body.write", 2995 // "https://www.googleapis.com/auth/fitness.body_temperature.write", 2996 // "https://www.googleapis.com/auth/fitness.location.write", 2997 // "https://www.googleapis.com/auth/fitness.nutrition.write", 2998 // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", 2999 // "https://www.googleapis.com/auth/fitness.reproductive_health.write" 3000 // ] 3001 // } 3002 3003} 3004 3005// Pages invokes f for each page of results. 3006// A non-nil error returned from f will halt the iteration. 3007// The provided context supersedes any context provided to the Context method. 3008func (c *UsersDataSourcesDatasetsPatchCall) Pages(ctx context.Context, f func(*Dataset) error) error { 3009 c.ctx_ = ctx 3010 defer func(pt string) { c.dataset.NextPageToken = pt }(c.dataset.NextPageToken) // reset paging to original point 3011 for { 3012 x, err := c.Do() 3013 if err != nil { 3014 return err 3015 } 3016 if err := f(x); err != nil { 3017 return err 3018 } 3019 if x.NextPageToken == "" { 3020 return nil 3021 } 3022 c.dataset.NextPageToken = x.NextPageToken 3023 } 3024} 3025 3026// method id "fitness.users.dataset.aggregate": 3027 3028type UsersDatasetAggregateCall struct { 3029 s *Service 3030 userId string 3031 aggregaterequest *AggregateRequest 3032 urlParams_ gensupport.URLParams 3033 ctx_ context.Context 3034 header_ http.Header 3035} 3036 3037// Aggregate: Aggregates data of a certain type or stream into buckets 3038// divided by a given type of boundary. Multiple data sets of multiple 3039// types and from multiple sources can be aggregated into exactly one 3040// bucket type per request. 3041func (r *UsersDatasetService) Aggregate(userId string, aggregaterequest *AggregateRequest) *UsersDatasetAggregateCall { 3042 c := &UsersDatasetAggregateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3043 c.userId = userId 3044 c.aggregaterequest = aggregaterequest 3045 return c 3046} 3047 3048// Fields allows partial responses to be retrieved. See 3049// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3050// for more information. 3051func (c *UsersDatasetAggregateCall) Fields(s ...googleapi.Field) *UsersDatasetAggregateCall { 3052 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3053 return c 3054} 3055 3056// Context sets the context to be used in this call's Do method. Any 3057// pending HTTP request will be aborted if the provided context is 3058// canceled. 3059func (c *UsersDatasetAggregateCall) Context(ctx context.Context) *UsersDatasetAggregateCall { 3060 c.ctx_ = ctx 3061 return c 3062} 3063 3064// Header returns an http.Header that can be modified by the caller to 3065// add HTTP headers to the request. 3066func (c *UsersDatasetAggregateCall) Header() http.Header { 3067 if c.header_ == nil { 3068 c.header_ = make(http.Header) 3069 } 3070 return c.header_ 3071} 3072 3073func (c *UsersDatasetAggregateCall) doRequest(alt string) (*http.Response, error) { 3074 reqHeaders := make(http.Header) 3075 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 3076 for k, v := range c.header_ { 3077 reqHeaders[k] = v 3078 } 3079 reqHeaders.Set("User-Agent", c.s.userAgent()) 3080 var body io.Reader = nil 3081 body, err := googleapi.WithoutDataWrapper.JSONReader(c.aggregaterequest) 3082 if err != nil { 3083 return nil, err 3084 } 3085 reqHeaders.Set("Content-Type", "application/json") 3086 c.urlParams_.Set("alt", alt) 3087 c.urlParams_.Set("prettyPrint", "false") 3088 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataset:aggregate") 3089 urls += "?" + c.urlParams_.Encode() 3090 req, err := http.NewRequest("POST", urls, body) 3091 if err != nil { 3092 return nil, err 3093 } 3094 req.Header = reqHeaders 3095 googleapi.Expand(req.URL, map[string]string{ 3096 "userId": c.userId, 3097 }) 3098 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3099} 3100 3101// Do executes the "fitness.users.dataset.aggregate" call. 3102// Exactly one of *AggregateResponse or error will be non-nil. Any 3103// non-2xx status code is an error. Response headers are in either 3104// *AggregateResponse.ServerResponse.Header or (if a response was 3105// returned at all) in error.(*googleapi.Error).Header. Use 3106// googleapi.IsNotModified to check whether the returned error was 3107// because http.StatusNotModified was returned. 3108func (c *UsersDatasetAggregateCall) Do(opts ...googleapi.CallOption) (*AggregateResponse, error) { 3109 gensupport.SetOptions(c.urlParams_, opts...) 3110 res, err := c.doRequest("json") 3111 if res != nil && res.StatusCode == http.StatusNotModified { 3112 if res.Body != nil { 3113 res.Body.Close() 3114 } 3115 return nil, &googleapi.Error{ 3116 Code: res.StatusCode, 3117 Header: res.Header, 3118 } 3119 } 3120 if err != nil { 3121 return nil, err 3122 } 3123 defer googleapi.CloseBody(res) 3124 if err := googleapi.CheckResponse(res); err != nil { 3125 return nil, err 3126 } 3127 ret := &AggregateResponse{ 3128 ServerResponse: googleapi.ServerResponse{ 3129 Header: res.Header, 3130 HTTPStatusCode: res.StatusCode, 3131 }, 3132 } 3133 target := &ret 3134 if err := gensupport.DecodeResponse(target, res); err != nil { 3135 return nil, err 3136 } 3137 return ret, nil 3138 // { 3139 // "description": "Aggregates data of a certain type or stream into buckets divided by a given type of boundary. Multiple data sets of multiple types and from multiple sources can be aggregated into exactly one bucket type per request.", 3140 // "httpMethod": "POST", 3141 // "id": "fitness.users.dataset.aggregate", 3142 // "parameterOrder": [ 3143 // "userId" 3144 // ], 3145 // "parameters": { 3146 // "userId": { 3147 // "description": "Aggregate data for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.", 3148 // "location": "path", 3149 // "required": true, 3150 // "type": "string" 3151 // } 3152 // }, 3153 // "path": "{userId}/dataset:aggregate", 3154 // "request": { 3155 // "$ref": "AggregateRequest" 3156 // }, 3157 // "response": { 3158 // "$ref": "AggregateResponse" 3159 // }, 3160 // "scopes": [ 3161 // "https://www.googleapis.com/auth/fitness.activity.read", 3162 // "https://www.googleapis.com/auth/fitness.activity.write", 3163 // "https://www.googleapis.com/auth/fitness.blood_glucose.read", 3164 // "https://www.googleapis.com/auth/fitness.blood_glucose.write", 3165 // "https://www.googleapis.com/auth/fitness.blood_pressure.read", 3166 // "https://www.googleapis.com/auth/fitness.blood_pressure.write", 3167 // "https://www.googleapis.com/auth/fitness.body.read", 3168 // "https://www.googleapis.com/auth/fitness.body.write", 3169 // "https://www.googleapis.com/auth/fitness.body_temperature.read", 3170 // "https://www.googleapis.com/auth/fitness.body_temperature.write", 3171 // "https://www.googleapis.com/auth/fitness.location.read", 3172 // "https://www.googleapis.com/auth/fitness.location.write", 3173 // "https://www.googleapis.com/auth/fitness.nutrition.read", 3174 // "https://www.googleapis.com/auth/fitness.nutrition.write", 3175 // "https://www.googleapis.com/auth/fitness.oxygen_saturation.read", 3176 // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", 3177 // "https://www.googleapis.com/auth/fitness.reproductive_health.read", 3178 // "https://www.googleapis.com/auth/fitness.reproductive_health.write" 3179 // ] 3180 // } 3181 3182} 3183 3184// method id "fitness.users.sessions.delete": 3185 3186type UsersSessionsDeleteCall struct { 3187 s *Service 3188 userId string 3189 sessionId string 3190 urlParams_ gensupport.URLParams 3191 ctx_ context.Context 3192 header_ http.Header 3193} 3194 3195// Delete: Deletes a session specified by the given session ID. 3196func (r *UsersSessionsService) Delete(userId string, sessionId string) *UsersSessionsDeleteCall { 3197 c := &UsersSessionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3198 c.userId = userId 3199 c.sessionId = sessionId 3200 return c 3201} 3202 3203// CurrentTimeMillis sets the optional parameter "currentTimeMillis": 3204// The client's current time in milliseconds since epoch. 3205func (c *UsersSessionsDeleteCall) CurrentTimeMillis(currentTimeMillis int64) *UsersSessionsDeleteCall { 3206 c.urlParams_.Set("currentTimeMillis", fmt.Sprint(currentTimeMillis)) 3207 return c 3208} 3209 3210// Fields allows partial responses to be retrieved. See 3211// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3212// for more information. 3213func (c *UsersSessionsDeleteCall) Fields(s ...googleapi.Field) *UsersSessionsDeleteCall { 3214 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3215 return c 3216} 3217 3218// Context sets the context to be used in this call's Do method. Any 3219// pending HTTP request will be aborted if the provided context is 3220// canceled. 3221func (c *UsersSessionsDeleteCall) Context(ctx context.Context) *UsersSessionsDeleteCall { 3222 c.ctx_ = ctx 3223 return c 3224} 3225 3226// Header returns an http.Header that can be modified by the caller to 3227// add HTTP headers to the request. 3228func (c *UsersSessionsDeleteCall) Header() http.Header { 3229 if c.header_ == nil { 3230 c.header_ = make(http.Header) 3231 } 3232 return c.header_ 3233} 3234 3235func (c *UsersSessionsDeleteCall) doRequest(alt string) (*http.Response, error) { 3236 reqHeaders := make(http.Header) 3237 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 3238 for k, v := range c.header_ { 3239 reqHeaders[k] = v 3240 } 3241 reqHeaders.Set("User-Agent", c.s.userAgent()) 3242 var body io.Reader = nil 3243 c.urlParams_.Set("alt", alt) 3244 c.urlParams_.Set("prettyPrint", "false") 3245 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/sessions/{sessionId}") 3246 urls += "?" + c.urlParams_.Encode() 3247 req, err := http.NewRequest("DELETE", urls, body) 3248 if err != nil { 3249 return nil, err 3250 } 3251 req.Header = reqHeaders 3252 googleapi.Expand(req.URL, map[string]string{ 3253 "userId": c.userId, 3254 "sessionId": c.sessionId, 3255 }) 3256 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3257} 3258 3259// Do executes the "fitness.users.sessions.delete" call. 3260func (c *UsersSessionsDeleteCall) Do(opts ...googleapi.CallOption) error { 3261 gensupport.SetOptions(c.urlParams_, opts...) 3262 res, err := c.doRequest("json") 3263 if err != nil { 3264 return err 3265 } 3266 defer googleapi.CloseBody(res) 3267 if err := googleapi.CheckResponse(res); err != nil { 3268 return err 3269 } 3270 return nil 3271 // { 3272 // "description": "Deletes a session specified by the given session ID.", 3273 // "httpMethod": "DELETE", 3274 // "id": "fitness.users.sessions.delete", 3275 // "parameterOrder": [ 3276 // "userId", 3277 // "sessionId" 3278 // ], 3279 // "parameters": { 3280 // "currentTimeMillis": { 3281 // "description": "The client's current time in milliseconds since epoch.", 3282 // "format": "int64", 3283 // "location": "query", 3284 // "type": "string" 3285 // }, 3286 // "sessionId": { 3287 // "description": "The ID of the session to be deleted.", 3288 // "location": "path", 3289 // "required": true, 3290 // "type": "string" 3291 // }, 3292 // "userId": { 3293 // "description": "Delete a session for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.", 3294 // "location": "path", 3295 // "required": true, 3296 // "type": "string" 3297 // } 3298 // }, 3299 // "path": "{userId}/sessions/{sessionId}", 3300 // "scopes": [ 3301 // "https://www.googleapis.com/auth/fitness.activity.write" 3302 // ] 3303 // } 3304 3305} 3306 3307// method id "fitness.users.sessions.list": 3308 3309type UsersSessionsListCall struct { 3310 s *Service 3311 userId string 3312 urlParams_ gensupport.URLParams 3313 ifNoneMatch_ string 3314 ctx_ context.Context 3315 header_ http.Header 3316} 3317 3318// List: Lists sessions previously created. 3319func (r *UsersSessionsService) List(userId string) *UsersSessionsListCall { 3320 c := &UsersSessionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3321 c.userId = userId 3322 return c 3323} 3324 3325// EndTime sets the optional parameter "endTime": An RFC3339 timestamp. 3326// Only sessions ending between the start and end times will be included 3327// in the response. 3328func (c *UsersSessionsListCall) EndTime(endTime string) *UsersSessionsListCall { 3329 c.urlParams_.Set("endTime", endTime) 3330 return c 3331} 3332 3333// IncludeDeleted sets the optional parameter "includeDeleted": If true, 3334// deleted sessions will be returned. When set to true, sessions 3335// returned in this response will only have an ID and will not have any 3336// other fields. 3337func (c *UsersSessionsListCall) IncludeDeleted(includeDeleted bool) *UsersSessionsListCall { 3338 c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted)) 3339 return c 3340} 3341 3342// PageToken sets the optional parameter "pageToken": The continuation 3343// token, which is used for incremental syncing. To get the next batch 3344// of changes, set this parameter to the value of nextPageToken from the 3345// previous response. This token is treated as a timestamp (in millis 3346// since epoch). If specified, the API returns sessions modified since 3347// this time. The page token is ignored if either start or end time is 3348// specified. If none of start time, end time, and the page token is 3349// specified, sessions modified in the last 30 days are returned. 3350func (c *UsersSessionsListCall) PageToken(pageToken string) *UsersSessionsListCall { 3351 c.urlParams_.Set("pageToken", pageToken) 3352 return c 3353} 3354 3355// StartTime sets the optional parameter "startTime": An RFC3339 3356// timestamp. Only sessions ending between the start and end times will 3357// be included in the response. 3358func (c *UsersSessionsListCall) StartTime(startTime string) *UsersSessionsListCall { 3359 c.urlParams_.Set("startTime", startTime) 3360 return c 3361} 3362 3363// Fields allows partial responses to be retrieved. See 3364// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3365// for more information. 3366func (c *UsersSessionsListCall) Fields(s ...googleapi.Field) *UsersSessionsListCall { 3367 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3368 return c 3369} 3370 3371// IfNoneMatch sets the optional parameter which makes the operation 3372// fail if the object's ETag matches the given value. This is useful for 3373// getting updates only after the object has changed since the last 3374// request. Use googleapi.IsNotModified to check whether the response 3375// error from Do is the result of In-None-Match. 3376func (c *UsersSessionsListCall) IfNoneMatch(entityTag string) *UsersSessionsListCall { 3377 c.ifNoneMatch_ = entityTag 3378 return c 3379} 3380 3381// Context sets the context to be used in this call's Do method. Any 3382// pending HTTP request will be aborted if the provided context is 3383// canceled. 3384func (c *UsersSessionsListCall) Context(ctx context.Context) *UsersSessionsListCall { 3385 c.ctx_ = ctx 3386 return c 3387} 3388 3389// Header returns an http.Header that can be modified by the caller to 3390// add HTTP headers to the request. 3391func (c *UsersSessionsListCall) Header() http.Header { 3392 if c.header_ == nil { 3393 c.header_ = make(http.Header) 3394 } 3395 return c.header_ 3396} 3397 3398func (c *UsersSessionsListCall) doRequest(alt string) (*http.Response, error) { 3399 reqHeaders := make(http.Header) 3400 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 3401 for k, v := range c.header_ { 3402 reqHeaders[k] = v 3403 } 3404 reqHeaders.Set("User-Agent", c.s.userAgent()) 3405 if c.ifNoneMatch_ != "" { 3406 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3407 } 3408 var body io.Reader = nil 3409 c.urlParams_.Set("alt", alt) 3410 c.urlParams_.Set("prettyPrint", "false") 3411 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/sessions") 3412 urls += "?" + c.urlParams_.Encode() 3413 req, err := http.NewRequest("GET", urls, body) 3414 if err != nil { 3415 return nil, err 3416 } 3417 req.Header = reqHeaders 3418 googleapi.Expand(req.URL, map[string]string{ 3419 "userId": c.userId, 3420 }) 3421 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3422} 3423 3424// Do executes the "fitness.users.sessions.list" call. 3425// Exactly one of *ListSessionsResponse or error will be non-nil. Any 3426// non-2xx status code is an error. Response headers are in either 3427// *ListSessionsResponse.ServerResponse.Header or (if a response was 3428// returned at all) in error.(*googleapi.Error).Header. Use 3429// googleapi.IsNotModified to check whether the returned error was 3430// because http.StatusNotModified was returned. 3431func (c *UsersSessionsListCall) Do(opts ...googleapi.CallOption) (*ListSessionsResponse, error) { 3432 gensupport.SetOptions(c.urlParams_, opts...) 3433 res, err := c.doRequest("json") 3434 if res != nil && res.StatusCode == http.StatusNotModified { 3435 if res.Body != nil { 3436 res.Body.Close() 3437 } 3438 return nil, &googleapi.Error{ 3439 Code: res.StatusCode, 3440 Header: res.Header, 3441 } 3442 } 3443 if err != nil { 3444 return nil, err 3445 } 3446 defer googleapi.CloseBody(res) 3447 if err := googleapi.CheckResponse(res); err != nil { 3448 return nil, err 3449 } 3450 ret := &ListSessionsResponse{ 3451 ServerResponse: googleapi.ServerResponse{ 3452 Header: res.Header, 3453 HTTPStatusCode: res.StatusCode, 3454 }, 3455 } 3456 target := &ret 3457 if err := gensupport.DecodeResponse(target, res); err != nil { 3458 return nil, err 3459 } 3460 return ret, nil 3461 // { 3462 // "description": "Lists sessions previously created.", 3463 // "httpMethod": "GET", 3464 // "id": "fitness.users.sessions.list", 3465 // "parameterOrder": [ 3466 // "userId" 3467 // ], 3468 // "parameters": { 3469 // "endTime": { 3470 // "description": "An RFC3339 timestamp. Only sessions ending between the start and end times will be included in the response.", 3471 // "location": "query", 3472 // "type": "string" 3473 // }, 3474 // "includeDeleted": { 3475 // "description": "If true, deleted sessions will be returned. When set to true, sessions returned in this response will only have an ID and will not have any other fields.", 3476 // "location": "query", 3477 // "type": "boolean" 3478 // }, 3479 // "pageToken": { 3480 // "description": "The continuation token, which is used for incremental syncing. To get the next batch of changes, set this parameter to the value of nextPageToken from the previous response. This token is treated as a timestamp (in millis since epoch). If specified, the API returns sessions modified since this time. The page token is ignored if either start or end time is specified. If none of start time, end time, and the page token is specified, sessions modified in the last 30 days are returned.", 3481 // "location": "query", 3482 // "type": "string" 3483 // }, 3484 // "startTime": { 3485 // "description": "An RFC3339 timestamp. Only sessions ending between the start and end times will be included in the response.", 3486 // "location": "query", 3487 // "type": "string" 3488 // }, 3489 // "userId": { 3490 // "description": "List sessions for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.", 3491 // "location": "path", 3492 // "required": true, 3493 // "type": "string" 3494 // } 3495 // }, 3496 // "path": "{userId}/sessions", 3497 // "response": { 3498 // "$ref": "ListSessionsResponse" 3499 // }, 3500 // "scopes": [ 3501 // "https://www.googleapis.com/auth/fitness.activity.read", 3502 // "https://www.googleapis.com/auth/fitness.activity.write", 3503 // "https://www.googleapis.com/auth/fitness.blood_glucose.read", 3504 // "https://www.googleapis.com/auth/fitness.blood_glucose.write", 3505 // "https://www.googleapis.com/auth/fitness.blood_pressure.read", 3506 // "https://www.googleapis.com/auth/fitness.blood_pressure.write", 3507 // "https://www.googleapis.com/auth/fitness.body.read", 3508 // "https://www.googleapis.com/auth/fitness.body.write", 3509 // "https://www.googleapis.com/auth/fitness.body_temperature.read", 3510 // "https://www.googleapis.com/auth/fitness.body_temperature.write", 3511 // "https://www.googleapis.com/auth/fitness.location.read", 3512 // "https://www.googleapis.com/auth/fitness.location.write", 3513 // "https://www.googleapis.com/auth/fitness.nutrition.read", 3514 // "https://www.googleapis.com/auth/fitness.nutrition.write", 3515 // "https://www.googleapis.com/auth/fitness.oxygen_saturation.read", 3516 // "https://www.googleapis.com/auth/fitness.oxygen_saturation.write", 3517 // "https://www.googleapis.com/auth/fitness.reproductive_health.read", 3518 // "https://www.googleapis.com/auth/fitness.reproductive_health.write" 3519 // ] 3520 // } 3521 3522} 3523 3524// Pages invokes f for each page of results. 3525// A non-nil error returned from f will halt the iteration. 3526// The provided context supersedes any context provided to the Context method. 3527func (c *UsersSessionsListCall) Pages(ctx context.Context, f func(*ListSessionsResponse) error) error { 3528 c.ctx_ = ctx 3529 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3530 for { 3531 x, err := c.Do() 3532 if err != nil { 3533 return err 3534 } 3535 if err := f(x); err != nil { 3536 return err 3537 } 3538 if x.NextPageToken == "" { 3539 return nil 3540 } 3541 c.PageToken(x.NextPageToken) 3542 } 3543} 3544 3545// method id "fitness.users.sessions.update": 3546 3547type UsersSessionsUpdateCall struct { 3548 s *Service 3549 userId string 3550 sessionId string 3551 session *Session 3552 urlParams_ gensupport.URLParams 3553 ctx_ context.Context 3554 header_ http.Header 3555} 3556 3557// Update: Updates or insert a given session. 3558func (r *UsersSessionsService) Update(userId string, sessionId string, session *Session) *UsersSessionsUpdateCall { 3559 c := &UsersSessionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3560 c.userId = userId 3561 c.sessionId = sessionId 3562 c.session = session 3563 return c 3564} 3565 3566// CurrentTimeMillis sets the optional parameter "currentTimeMillis": 3567// The client's current time in milliseconds since epoch. 3568func (c *UsersSessionsUpdateCall) CurrentTimeMillis(currentTimeMillis int64) *UsersSessionsUpdateCall { 3569 c.urlParams_.Set("currentTimeMillis", fmt.Sprint(currentTimeMillis)) 3570 return c 3571} 3572 3573// Fields allows partial responses to be retrieved. See 3574// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3575// for more information. 3576func (c *UsersSessionsUpdateCall) Fields(s ...googleapi.Field) *UsersSessionsUpdateCall { 3577 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3578 return c 3579} 3580 3581// Context sets the context to be used in this call's Do method. Any 3582// pending HTTP request will be aborted if the provided context is 3583// canceled. 3584func (c *UsersSessionsUpdateCall) Context(ctx context.Context) *UsersSessionsUpdateCall { 3585 c.ctx_ = ctx 3586 return c 3587} 3588 3589// Header returns an http.Header that can be modified by the caller to 3590// add HTTP headers to the request. 3591func (c *UsersSessionsUpdateCall) Header() http.Header { 3592 if c.header_ == nil { 3593 c.header_ = make(http.Header) 3594 } 3595 return c.header_ 3596} 3597 3598func (c *UsersSessionsUpdateCall) doRequest(alt string) (*http.Response, error) { 3599 reqHeaders := make(http.Header) 3600 reqHeaders.Set("x-goog-api-client", "gl-go/1.13.4 gdcl/20191114") 3601 for k, v := range c.header_ { 3602 reqHeaders[k] = v 3603 } 3604 reqHeaders.Set("User-Agent", c.s.userAgent()) 3605 var body io.Reader = nil 3606 body, err := googleapi.WithoutDataWrapper.JSONReader(c.session) 3607 if err != nil { 3608 return nil, err 3609 } 3610 reqHeaders.Set("Content-Type", "application/json") 3611 c.urlParams_.Set("alt", alt) 3612 c.urlParams_.Set("prettyPrint", "false") 3613 urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/sessions/{sessionId}") 3614 urls += "?" + c.urlParams_.Encode() 3615 req, err := http.NewRequest("PUT", urls, body) 3616 if err != nil { 3617 return nil, err 3618 } 3619 req.Header = reqHeaders 3620 googleapi.Expand(req.URL, map[string]string{ 3621 "userId": c.userId, 3622 "sessionId": c.sessionId, 3623 }) 3624 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3625} 3626 3627// Do executes the "fitness.users.sessions.update" call. 3628// Exactly one of *Session or error will be non-nil. Any non-2xx status 3629// code is an error. Response headers are in either 3630// *Session.ServerResponse.Header or (if a response was returned at all) 3631// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3632// check whether the returned error was because http.StatusNotModified 3633// was returned. 3634func (c *UsersSessionsUpdateCall) Do(opts ...googleapi.CallOption) (*Session, error) { 3635 gensupport.SetOptions(c.urlParams_, opts...) 3636 res, err := c.doRequest("json") 3637 if res != nil && res.StatusCode == http.StatusNotModified { 3638 if res.Body != nil { 3639 res.Body.Close() 3640 } 3641 return nil, &googleapi.Error{ 3642 Code: res.StatusCode, 3643 Header: res.Header, 3644 } 3645 } 3646 if err != nil { 3647 return nil, err 3648 } 3649 defer googleapi.CloseBody(res) 3650 if err := googleapi.CheckResponse(res); err != nil { 3651 return nil, err 3652 } 3653 ret := &Session{ 3654 ServerResponse: googleapi.ServerResponse{ 3655 Header: res.Header, 3656 HTTPStatusCode: res.StatusCode, 3657 }, 3658 } 3659 target := &ret 3660 if err := gensupport.DecodeResponse(target, res); err != nil { 3661 return nil, err 3662 } 3663 return ret, nil 3664 // { 3665 // "description": "Updates or insert a given session.", 3666 // "httpMethod": "PUT", 3667 // "id": "fitness.users.sessions.update", 3668 // "parameterOrder": [ 3669 // "userId", 3670 // "sessionId" 3671 // ], 3672 // "parameters": { 3673 // "currentTimeMillis": { 3674 // "description": "The client's current time in milliseconds since epoch.", 3675 // "format": "int64", 3676 // "location": "query", 3677 // "type": "string" 3678 // }, 3679 // "sessionId": { 3680 // "description": "The ID of the session to be created.", 3681 // "location": "path", 3682 // "required": true, 3683 // "type": "string" 3684 // }, 3685 // "userId": { 3686 // "description": "Create sessions for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.", 3687 // "location": "path", 3688 // "required": true, 3689 // "type": "string" 3690 // } 3691 // }, 3692 // "path": "{userId}/sessions/{sessionId}", 3693 // "request": { 3694 // "$ref": "Session" 3695 // }, 3696 // "response": { 3697 // "$ref": "Session" 3698 // }, 3699 // "scopes": [ 3700 // "https://www.googleapis.com/auth/fitness.activity.write" 3701 // ] 3702 // } 3703 3704} 3705