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