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