...

Source file src/google.golang.org/api/fitness/v1/fitness-gen.go

Documentation: google.golang.org/api/fitness/v1

     1  // Copyright 2024 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  // # Library status
    12  //
    13  // These client libraries are officially supported by Google. However, this
    14  // library is considered complete and is in maintenance mode. This means
    15  // that we will address critical bugs and security issues but will not add
    16  // any new features.
    17  //
    18  // When possible, we recommend using our newer
    19  // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
    20  // that are still actively being worked and iterated on.
    21  //
    22  // # Creating a client
    23  //
    24  // Usage example:
    25  //
    26  //	import "google.golang.org/api/fitness/v1"
    27  //	...
    28  //	ctx := context.Background()
    29  //	fitnessService, err := fitness.NewService(ctx)
    30  //
    31  // In this example, Google Application Default Credentials are used for
    32  // authentication. For information on how to create and obtain Application
    33  // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    34  //
    35  // # Other authentication options
    36  //
    37  // By default, all available scopes (see "Constants") are used to authenticate.
    38  // To restrict scopes, use [google.golang.org/api/option.WithScopes]:
    39  //
    40  //	fitnessService, err := fitness.NewService(ctx, option.WithScopes(fitness.FitnessSleepWriteScope))
    41  //
    42  // To use an API key for authentication (note: some APIs do not support API
    43  // keys), use [google.golang.org/api/option.WithAPIKey]:
    44  //
    45  //	fitnessService, err := fitness.NewService(ctx, option.WithAPIKey("AIza..."))
    46  //
    47  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
    48  // flow, use [google.golang.org/api/option.WithTokenSource]:
    49  //
    50  //	config := &oauth2.Config{...}
    51  //	// ...
    52  //	token, err := config.Exchange(ctx, ...)
    53  //	fitnessService, err := fitness.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    54  //
    55  // See [google.golang.org/api/option.ClientOption] for details on options.
    56  package fitness // import "google.golang.org/api/fitness/v1"
    57  
    58  import (
    59  	"bytes"
    60  	"context"
    61  	"encoding/json"
    62  	"errors"
    63  	"fmt"
    64  	"io"
    65  	"net/http"
    66  	"net/url"
    67  	"strconv"
    68  	"strings"
    69  
    70  	googleapi "google.golang.org/api/googleapi"
    71  	internal "google.golang.org/api/internal"
    72  	gensupport "google.golang.org/api/internal/gensupport"
    73  	option "google.golang.org/api/option"
    74  	internaloption "google.golang.org/api/option/internaloption"
    75  	htransport "google.golang.org/api/transport/http"
    76  )
    77  
    78  // Always reference these packages, just in case the auto-generated code
    79  // below doesn't.
    80  var _ = bytes.NewBuffer
    81  var _ = strconv.Itoa
    82  var _ = fmt.Sprintf
    83  var _ = json.NewDecoder
    84  var _ = io.Copy
    85  var _ = url.Parse
    86  var _ = gensupport.MarshalJSON
    87  var _ = googleapi.Version
    88  var _ = errors.New
    89  var _ = strings.Replace
    90  var _ = context.Canceled
    91  var _ = internaloption.WithDefaultEndpoint
    92  var _ = internal.Version
    93  
    94  const apiId = "fitness:v1"
    95  const apiName = "fitness"
    96  const apiVersion = "v1"
    97  const basePath = "https://fitness.googleapis.com/fitness/v1/users/"
    98  const basePathTemplate = "https://fitness.UNIVERSE_DOMAIN/fitness/v1/users/"
    99  const mtlsBasePath = "https://fitness.mtls.googleapis.com/fitness/v1/users/"
   100  
   101  // OAuth2 scopes used by this API.
   102  const (
   103  	// Use Google Fit to see and store your physical activity data
   104  	FitnessActivityReadScope = "https://www.googleapis.com/auth/fitness.activity.read"
   105  
   106  	// Add to your Google Fit physical activity data
   107  	FitnessActivityWriteScope = "https://www.googleapis.com/auth/fitness.activity.write"
   108  
   109  	// See info about your blood glucose in Google Fit. I consent to Google sharing
   110  	// my blood glucose information with this app.
   111  	FitnessBloodGlucoseReadScope = "https://www.googleapis.com/auth/fitness.blood_glucose.read"
   112  
   113  	// Add info about your blood glucose to Google Fit. I consent to Google using
   114  	// my blood glucose information with this app.
   115  	FitnessBloodGlucoseWriteScope = "https://www.googleapis.com/auth/fitness.blood_glucose.write"
   116  
   117  	// See info about your blood pressure in Google Fit. I consent to Google
   118  	// sharing my blood pressure information with this app.
   119  	FitnessBloodPressureReadScope = "https://www.googleapis.com/auth/fitness.blood_pressure.read"
   120  
   121  	// Add info about your blood pressure in Google Fit. I consent to Google using
   122  	// my blood pressure information with this app.
   123  	FitnessBloodPressureWriteScope = "https://www.googleapis.com/auth/fitness.blood_pressure.write"
   124  
   125  	// See info about your body measurements in Google Fit
   126  	FitnessBodyReadScope = "https://www.googleapis.com/auth/fitness.body.read"
   127  
   128  	// Add info about your body measurements to Google Fit
   129  	FitnessBodyWriteScope = "https://www.googleapis.com/auth/fitness.body.write"
   130  
   131  	// See info about your body temperature in Google Fit. I consent to Google
   132  	// sharing my body temperature information with this app.
   133  	FitnessBodyTemperatureReadScope = "https://www.googleapis.com/auth/fitness.body_temperature.read"
   134  
   135  	// Add to info about your body temperature in Google Fit. I consent to Google
   136  	// using my body temperature information with this app.
   137  	FitnessBodyTemperatureWriteScope = "https://www.googleapis.com/auth/fitness.body_temperature.write"
   138  
   139  	// See your heart rate data in Google Fit. I consent to Google sharing my heart
   140  	// rate information with this app.
   141  	FitnessHeartRateReadScope = "https://www.googleapis.com/auth/fitness.heart_rate.read"
   142  
   143  	// Add to your heart rate data in Google Fit. I consent to Google using my
   144  	// heart rate information with this app.
   145  	FitnessHeartRateWriteScope = "https://www.googleapis.com/auth/fitness.heart_rate.write"
   146  
   147  	// See your Google Fit speed and distance data
   148  	FitnessLocationReadScope = "https://www.googleapis.com/auth/fitness.location.read"
   149  
   150  	// Add to your Google Fit location data
   151  	FitnessLocationWriteScope = "https://www.googleapis.com/auth/fitness.location.write"
   152  
   153  	// See info about your nutrition in Google Fit
   154  	FitnessNutritionReadScope = "https://www.googleapis.com/auth/fitness.nutrition.read"
   155  
   156  	// Add to info about your nutrition in Google Fit
   157  	FitnessNutritionWriteScope = "https://www.googleapis.com/auth/fitness.nutrition.write"
   158  
   159  	// See info about your oxygen saturation in Google Fit. I consent to Google
   160  	// sharing my oxygen saturation information with this app.
   161  	FitnessOxygenSaturationReadScope = "https://www.googleapis.com/auth/fitness.oxygen_saturation.read"
   162  
   163  	// Add info about your oxygen saturation in Google Fit. I consent to Google
   164  	// using my oxygen saturation information with this app.
   165  	FitnessOxygenSaturationWriteScope = "https://www.googleapis.com/auth/fitness.oxygen_saturation.write"
   166  
   167  	// See info about your reproductive health in Google Fit. I consent to Google
   168  	// sharing my reproductive health information with this app.
   169  	FitnessReproductiveHealthReadScope = "https://www.googleapis.com/auth/fitness.reproductive_health.read"
   170  
   171  	// Add info about your reproductive health in Google Fit. I consent to Google
   172  	// using my reproductive health information with this app.
   173  	FitnessReproductiveHealthWriteScope = "https://www.googleapis.com/auth/fitness.reproductive_health.write"
   174  
   175  	// See your sleep data in Google Fit. I consent to Google sharing my sleep
   176  	// information with this app.
   177  	FitnessSleepReadScope = "https://www.googleapis.com/auth/fitness.sleep.read"
   178  
   179  	// Add to your sleep data in Google Fit. I consent to Google using my sleep
   180  	// information with this app.
   181  	FitnessSleepWriteScope = "https://www.googleapis.com/auth/fitness.sleep.write"
   182  )
   183  
   184  // NewService creates a new Service.
   185  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   186  	scopesOption := internaloption.WithDefaultScopes(
   187  		"https://www.googleapis.com/auth/fitness.activity.read",
   188  		"https://www.googleapis.com/auth/fitness.activity.write",
   189  		"https://www.googleapis.com/auth/fitness.blood_glucose.read",
   190  		"https://www.googleapis.com/auth/fitness.blood_glucose.write",
   191  		"https://www.googleapis.com/auth/fitness.blood_pressure.read",
   192  		"https://www.googleapis.com/auth/fitness.blood_pressure.write",
   193  		"https://www.googleapis.com/auth/fitness.body.read",
   194  		"https://www.googleapis.com/auth/fitness.body.write",
   195  		"https://www.googleapis.com/auth/fitness.body_temperature.read",
   196  		"https://www.googleapis.com/auth/fitness.body_temperature.write",
   197  		"https://www.googleapis.com/auth/fitness.heart_rate.read",
   198  		"https://www.googleapis.com/auth/fitness.heart_rate.write",
   199  		"https://www.googleapis.com/auth/fitness.location.read",
   200  		"https://www.googleapis.com/auth/fitness.location.write",
   201  		"https://www.googleapis.com/auth/fitness.nutrition.read",
   202  		"https://www.googleapis.com/auth/fitness.nutrition.write",
   203  		"https://www.googleapis.com/auth/fitness.oxygen_saturation.read",
   204  		"https://www.googleapis.com/auth/fitness.oxygen_saturation.write",
   205  		"https://www.googleapis.com/auth/fitness.reproductive_health.read",
   206  		"https://www.googleapis.com/auth/fitness.reproductive_health.write",
   207  		"https://www.googleapis.com/auth/fitness.sleep.read",
   208  		"https://www.googleapis.com/auth/fitness.sleep.write",
   209  	)
   210  	// NOTE: prepend, so we don't override user-specified scopes.
   211  	opts = append([]option.ClientOption{scopesOption}, opts...)
   212  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   213  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   214  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   215  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   216  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   217  	if err != nil {
   218  		return nil, err
   219  	}
   220  	s, err := New(client)
   221  	if err != nil {
   222  		return nil, err
   223  	}
   224  	if endpoint != "" {
   225  		s.BasePath = endpoint
   226  	}
   227  	return s, nil
   228  }
   229  
   230  // New creates a new Service. It uses the provided http.Client for requests.
   231  //
   232  // Deprecated: please use NewService instead.
   233  // To provide a custom HTTP client, use option.WithHTTPClient.
   234  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   235  func New(client *http.Client) (*Service, error) {
   236  	if client == nil {
   237  		return nil, errors.New("client is nil")
   238  	}
   239  	s := &Service{client: client, BasePath: basePath}
   240  	s.Users = NewUsersService(s)
   241  	return s, nil
   242  }
   243  
   244  type Service struct {
   245  	client    *http.Client
   246  	BasePath  string // API endpoint base URL
   247  	UserAgent string // optional additional User-Agent fragment
   248  
   249  	Users *UsersService
   250  }
   251  
   252  func (s *Service) userAgent() string {
   253  	if s.UserAgent == "" {
   254  		return googleapi.UserAgent
   255  	}
   256  	return googleapi.UserAgent + " " + s.UserAgent
   257  }
   258  
   259  func NewUsersService(s *Service) *UsersService {
   260  	rs := &UsersService{s: s}
   261  	rs.DataSources = NewUsersDataSourcesService(s)
   262  	rs.Dataset = NewUsersDatasetService(s)
   263  	rs.Sessions = NewUsersSessionsService(s)
   264  	return rs
   265  }
   266  
   267  type UsersService struct {
   268  	s *Service
   269  
   270  	DataSources *UsersDataSourcesService
   271  
   272  	Dataset *UsersDatasetService
   273  
   274  	Sessions *UsersSessionsService
   275  }
   276  
   277  func NewUsersDataSourcesService(s *Service) *UsersDataSourcesService {
   278  	rs := &UsersDataSourcesService{s: s}
   279  	rs.DataPointChanges = NewUsersDataSourcesDataPointChangesService(s)
   280  	rs.Datasets = NewUsersDataSourcesDatasetsService(s)
   281  	return rs
   282  }
   283  
   284  type UsersDataSourcesService struct {
   285  	s *Service
   286  
   287  	DataPointChanges *UsersDataSourcesDataPointChangesService
   288  
   289  	Datasets *UsersDataSourcesDatasetsService
   290  }
   291  
   292  func NewUsersDataSourcesDataPointChangesService(s *Service) *UsersDataSourcesDataPointChangesService {
   293  	rs := &UsersDataSourcesDataPointChangesService{s: s}
   294  	return rs
   295  }
   296  
   297  type UsersDataSourcesDataPointChangesService struct {
   298  	s *Service
   299  }
   300  
   301  func NewUsersDataSourcesDatasetsService(s *Service) *UsersDataSourcesDatasetsService {
   302  	rs := &UsersDataSourcesDatasetsService{s: s}
   303  	return rs
   304  }
   305  
   306  type UsersDataSourcesDatasetsService struct {
   307  	s *Service
   308  }
   309  
   310  func NewUsersDatasetService(s *Service) *UsersDatasetService {
   311  	rs := &UsersDatasetService{s: s}
   312  	return rs
   313  }
   314  
   315  type UsersDatasetService struct {
   316  	s *Service
   317  }
   318  
   319  func NewUsersSessionsService(s *Service) *UsersSessionsService {
   320  	rs := &UsersSessionsService{s: s}
   321  	return rs
   322  }
   323  
   324  type UsersSessionsService struct {
   325  	s *Service
   326  }
   327  
   328  type AggregateBucket struct {
   329  	// Activity: Available for Bucket.Type.ACTIVITY_TYPE,
   330  	// Bucket.Type.ACTIVITY_SEGMENT
   331  	Activity int64 `json:"activity,omitempty"`
   332  	// Dataset: There will be one dataset per AggregateBy in the request.
   333  	Dataset []*Dataset `json:"dataset,omitempty"`
   334  	// EndTimeMillis: The end time for the aggregated data, in milliseconds since
   335  	// epoch, inclusive.
   336  	EndTimeMillis int64 `json:"endTimeMillis,omitempty,string"`
   337  	// Session: Available for Bucket.Type.SESSION
   338  	Session *Session `json:"session,omitempty"`
   339  	// StartTimeMillis: The start time for the aggregated data, in milliseconds
   340  	// since epoch, inclusive.
   341  	StartTimeMillis int64 `json:"startTimeMillis,omitempty,string"`
   342  	// Type: The type of a bucket signifies how the data aggregation is performed
   343  	// in the bucket.
   344  	//
   345  	// Possible values:
   346  	//   "unknown"
   347  	//   "time" - Denotes that bucketing by time is requested. When this is
   348  	// specified, the timeBucketDurationMillis field is used to determine how many
   349  	// buckets will be returned.
   350  	//   "session" - Denotes that bucketing by session is requested. When this is
   351  	// specified, only data that occurs within sessions that begin and end within
   352  	// the dataset time frame, is included in the results.
   353  	//   "activityType" - Denotes that bucketing by activity type is requested.
   354  	// When this is specified, there will be one bucket for each unique activity
   355  	// type that a user participated in, during the dataset time frame of interest.
   356  	//   "activitySegment" - Denotes that bucketing by individual activity segment
   357  	// is requested. This will aggregate data by the time boundaries specified by
   358  	// each activity segment occurring within the dataset time frame of interest.
   359  	Type string `json:"type,omitempty"`
   360  	// ForceSendFields is a list of field names (e.g. "Activity") to
   361  	// unconditionally include in API requests. By default, fields with empty or
   362  	// default values are omitted from API requests. See
   363  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   364  	// details.
   365  	ForceSendFields []string `json:"-"`
   366  	// NullFields is a list of field names (e.g. "Activity") to include in API
   367  	// requests with the JSON null value. By default, fields with empty values are
   368  	// omitted from API requests. See
   369  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   370  	NullFields []string `json:"-"`
   371  }
   372  
   373  func (s *AggregateBucket) MarshalJSON() ([]byte, error) {
   374  	type NoMethod AggregateBucket
   375  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   376  }
   377  
   378  // AggregateBy: The specification of which data to aggregate.
   379  type AggregateBy struct {
   380  	// DataSourceId: A data source ID to aggregate. Only data from the specified
   381  	// data source ID will be included in the aggregation. If specified, this data
   382  	// source must exist; the OAuth scopes in the supplied credentials must grant
   383  	// read access to this data type. The dataset in the response will have the
   384  	// same data source ID. Note: Data can be aggregated by either the dataTypeName
   385  	// or the dataSourceId, not both.
   386  	DataSourceId string `json:"dataSourceId,omitempty"`
   387  	// DataTypeName: The data type to aggregate. All data sources providing this
   388  	// data type will contribute data to the aggregation. The response will contain
   389  	// a single dataset for this data type name. The dataset will have a data
   390  	// source ID of derived::com.google.android.gms:aggregated. If the user has no
   391  	// data for this data type, an empty data set will be returned. Note: Data can
   392  	// be aggregated by either the dataTypeName or the dataSourceId, not both.
   393  	DataTypeName string `json:"dataTypeName,omitempty"`
   394  	// ForceSendFields is a list of field names (e.g. "DataSourceId") to
   395  	// unconditionally include in API requests. By default, fields with empty or
   396  	// default values are omitted from API requests. See
   397  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   398  	// details.
   399  	ForceSendFields []string `json:"-"`
   400  	// NullFields is a list of field names (e.g. "DataSourceId") to include in API
   401  	// requests with the JSON null value. By default, fields with empty values are
   402  	// omitted from API requests. See
   403  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   404  	NullFields []string `json:"-"`
   405  }
   406  
   407  func (s *AggregateBy) MarshalJSON() ([]byte, error) {
   408  	type NoMethod AggregateBy
   409  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   410  }
   411  
   412  // AggregateRequest: Next id: 10
   413  type AggregateRequest struct {
   414  	// AggregateBy: The specification of data to be aggregated. At least one
   415  	// aggregateBy spec must be provided. All data that is specified will be
   416  	// aggregated using the same bucketing criteria. There will be one dataset in
   417  	// the response for every aggregateBy spec.
   418  	AggregateBy []*AggregateBy `json:"aggregateBy,omitempty"`
   419  	// BucketByActivitySegment: Specifies that data be aggregated each activity
   420  	// segment recorded for a user. Similar to bucketByActivitySegment, but
   421  	// bucketing is done for each activity segment rather than all segments of the
   422  	// same type. Mutually exclusive of other bucketing specifications.
   423  	BucketByActivitySegment *BucketByActivity `json:"bucketByActivitySegment,omitempty"`
   424  	// BucketByActivityType: Specifies that data be aggregated by the type of
   425  	// activity being performed when the data was recorded. All data that was
   426  	// recorded during a certain activity type (.for the given time range) will be
   427  	// aggregated into the same bucket. Data that was recorded while the user was
   428  	// not active will not be included in the response. Mutually exclusive of other
   429  	// bucketing specifications.
   430  	BucketByActivityType *BucketByActivity `json:"bucketByActivityType,omitempty"`
   431  	// BucketBySession: Specifies that data be aggregated by user sessions. Data
   432  	// that does not fall within the time range of a session will not be included
   433  	// in the response. Mutually exclusive of other bucketing specifications.
   434  	BucketBySession *BucketBySession `json:"bucketBySession,omitempty"`
   435  	// BucketByTime: Specifies that data be aggregated by a single time interval.
   436  	// Mutually exclusive of other bucketing specifications.
   437  	BucketByTime *BucketByTime `json:"bucketByTime,omitempty"`
   438  	// EndTimeMillis: The end of a window of time. Data that intersects with this
   439  	// time window will be aggregated. The time is in milliseconds since epoch,
   440  	// inclusive. The maximum allowed difference between start_time_millis // and
   441  	// end_time_millis is 7776000000 (roughly 90 days).
   442  	EndTimeMillis int64 `json:"endTimeMillis,omitempty,string"`
   443  	// FilteredDataQualityStandard: DO NOT POPULATE THIS FIELD. It is ignored.
   444  	//
   445  	// Possible values:
   446  	//   "dataQualityUnknown"
   447  	//   "dataQualityBloodPressureEsh2002"
   448  	//   "dataQualityBloodPressureEsh2010"
   449  	//   "dataQualityBloodPressureAami"
   450  	//   "dataQualityBloodPressureBhsAA"
   451  	//   "dataQualityBloodPressureBhsAB"
   452  	//   "dataQualityBloodPressureBhsBA"
   453  	//   "dataQualityBloodPressureBhsBB"
   454  	//   "dataQualityBloodGlucoseIso151972003"
   455  	//   "dataQualityBloodGlucoseIso151972013"
   456  	FilteredDataQualityStandard []string `json:"filteredDataQualityStandard,omitempty"`
   457  	// StartTimeMillis: The start of a window of time. Data that intersects with
   458  	// this time window will be aggregated. The time is in milliseconds since
   459  	// epoch, inclusive.
   460  	StartTimeMillis int64 `json:"startTimeMillis,omitempty,string"`
   461  	// ForceSendFields is a list of field names (e.g. "AggregateBy") to
   462  	// unconditionally include in API requests. By default, fields with empty or
   463  	// default values are omitted from API requests. See
   464  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   465  	// details.
   466  	ForceSendFields []string `json:"-"`
   467  	// NullFields is a list of field names (e.g. "AggregateBy") to include in API
   468  	// requests with the JSON null value. By default, fields with empty values are
   469  	// omitted from API requests. See
   470  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   471  	NullFields []string `json:"-"`
   472  }
   473  
   474  func (s *AggregateRequest) MarshalJSON() ([]byte, error) {
   475  	type NoMethod AggregateRequest
   476  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   477  }
   478  
   479  type AggregateResponse struct {
   480  	// Bucket: A list of buckets containing the aggregated data.
   481  	Bucket []*AggregateBucket `json:"bucket,omitempty"`
   482  
   483  	// ServerResponse contains the HTTP response code and headers from the server.
   484  	googleapi.ServerResponse `json:"-"`
   485  	// ForceSendFields is a list of field names (e.g. "Bucket") to unconditionally
   486  	// include in API requests. By default, fields with empty or default values are
   487  	// omitted from API requests. See
   488  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   489  	// details.
   490  	ForceSendFields []string `json:"-"`
   491  	// NullFields is a list of field names (e.g. "Bucket") to include in API
   492  	// requests with the JSON null value. By default, fields with empty values are
   493  	// omitted from API requests. See
   494  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   495  	NullFields []string `json:"-"`
   496  }
   497  
   498  func (s *AggregateResponse) MarshalJSON() ([]byte, error) {
   499  	type NoMethod AggregateResponse
   500  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   501  }
   502  
   503  type Application struct {
   504  	// DetailsUrl: An optional URI that can be used to link back to the
   505  	// application.
   506  	DetailsUrl string `json:"detailsUrl,omitempty"`
   507  	// Name: The name of this application. This is required for REST clients, but
   508  	// we do not enforce uniqueness of this name. It is provided as a matter of
   509  	// convenience for other developers who would like to identify which REST
   510  	// created an Application or Data Source.
   511  	Name string `json:"name,omitempty"`
   512  	// PackageName: Package name for this application. This is used as a unique
   513  	// identifier when created by Android applications, but cannot be specified by
   514  	// REST clients. REST clients will have their developer project number
   515  	// reflected into the Data Source data stream IDs, instead of the packageName.
   516  	PackageName string `json:"packageName,omitempty"`
   517  	// Version: Version of the application. You should update this field whenever
   518  	// the application changes in a way that affects the computation of the data.
   519  	Version string `json:"version,omitempty"`
   520  	// ForceSendFields is a list of field names (e.g. "DetailsUrl") to
   521  	// unconditionally include in API requests. By default, fields with empty or
   522  	// default values are omitted from API requests. See
   523  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   524  	// details.
   525  	ForceSendFields []string `json:"-"`
   526  	// NullFields is a list of field names (e.g. "DetailsUrl") to include in API
   527  	// requests with the JSON null value. By default, fields with empty values are
   528  	// omitted from API requests. See
   529  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   530  	NullFields []string `json:"-"`
   531  }
   532  
   533  func (s *Application) MarshalJSON() ([]byte, error) {
   534  	type NoMethod Application
   535  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   536  }
   537  
   538  type BucketByActivity struct {
   539  	// ActivityDataSourceId: The default activity stream will be used if a specific
   540  	// activityDataSourceId is not specified.
   541  	ActivityDataSourceId string `json:"activityDataSourceId,omitempty"`
   542  	// MinDurationMillis: Specifies that only activity segments of duration longer
   543  	// than minDurationMillis are considered and used as a container for aggregated
   544  	// data.
   545  	MinDurationMillis int64 `json:"minDurationMillis,omitempty,string"`
   546  	// ForceSendFields is a list of field names (e.g. "ActivityDataSourceId") to
   547  	// unconditionally include in API requests. By default, fields with empty or
   548  	// default values are omitted from API requests. See
   549  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   550  	// details.
   551  	ForceSendFields []string `json:"-"`
   552  	// NullFields is a list of field names (e.g. "ActivityDataSourceId") to include
   553  	// in API requests with the JSON null value. By default, fields with empty
   554  	// values are omitted from API requests. See
   555  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   556  	NullFields []string `json:"-"`
   557  }
   558  
   559  func (s *BucketByActivity) MarshalJSON() ([]byte, error) {
   560  	type NoMethod BucketByActivity
   561  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   562  }
   563  
   564  type BucketBySession struct {
   565  	// MinDurationMillis: Specifies that only sessions of duration longer than
   566  	// minDurationMillis are considered and used as a container for aggregated
   567  	// data.
   568  	MinDurationMillis int64 `json:"minDurationMillis,omitempty,string"`
   569  	// ForceSendFields is a list of field names (e.g. "MinDurationMillis") to
   570  	// unconditionally include in API requests. By default, fields with empty or
   571  	// default values are omitted from API requests. See
   572  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   573  	// details.
   574  	ForceSendFields []string `json:"-"`
   575  	// NullFields is a list of field names (e.g. "MinDurationMillis") to include in
   576  	// API requests with the JSON null value. By default, fields with empty values
   577  	// are omitted from API requests. See
   578  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   579  	NullFields []string `json:"-"`
   580  }
   581  
   582  func (s *BucketBySession) MarshalJSON() ([]byte, error) {
   583  	type NoMethod BucketBySession
   584  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   585  }
   586  
   587  type BucketByTime struct {
   588  	// DurationMillis: Specifies that result buckets aggregate data by exactly
   589  	// durationMillis time frames. Time frames that contain no data will be
   590  	// included in the response with an empty dataset.
   591  	DurationMillis int64               `json:"durationMillis,omitempty,string"`
   592  	Period         *BucketByTimePeriod `json:"period,omitempty"`
   593  	// ForceSendFields is a list of field names (e.g. "DurationMillis") to
   594  	// unconditionally include in API requests. By default, fields with empty or
   595  	// default values are omitted from API requests. See
   596  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   597  	// details.
   598  	ForceSendFields []string `json:"-"`
   599  	// NullFields is a list of field names (e.g. "DurationMillis") to include in
   600  	// API requests with the JSON null value. By default, fields with empty values
   601  	// are omitted from API requests. See
   602  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   603  	NullFields []string `json:"-"`
   604  }
   605  
   606  func (s *BucketByTime) MarshalJSON() ([]byte, error) {
   607  	type NoMethod BucketByTime
   608  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   609  }
   610  
   611  type BucketByTimePeriod struct {
   612  	// TimeZoneId: org.joda.timezone.DateTimeZone
   613  	TimeZoneId string `json:"timeZoneId,omitempty"`
   614  	// Possible values:
   615  	//   "day"
   616  	//   "week"
   617  	//   "month"
   618  	Type  string `json:"type,omitempty"`
   619  	Value int64  `json:"value,omitempty"`
   620  	// ForceSendFields is a list of field names (e.g. "TimeZoneId") to
   621  	// unconditionally include in API requests. By default, fields with empty or
   622  	// default values are omitted from API requests. See
   623  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   624  	// details.
   625  	ForceSendFields []string `json:"-"`
   626  	// NullFields is a list of field names (e.g. "TimeZoneId") to include in API
   627  	// requests with the JSON null value. By default, fields with empty values are
   628  	// omitted from API requests. See
   629  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   630  	NullFields []string `json:"-"`
   631  }
   632  
   633  func (s *BucketByTimePeriod) MarshalJSON() ([]byte, error) {
   634  	type NoMethod BucketByTimePeriod
   635  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   636  }
   637  
   638  // DataPoint: Represents a single data point, generated by a particular data
   639  // source. A data point holds a value for each field, an end timestamp and an
   640  // optional start time. The exact semantics of each of these attributes are
   641  // specified in the documentation for the particular data type. A data point
   642  // can represent an instantaneous measurement, reading or input observation, as
   643  // well as averages or aggregates over a time interval. Check the data type
   644  // documentation to determine which is the case for a particular data type.
   645  // Data points always contain one value for each field of the data type.
   646  type DataPoint struct {
   647  	// ComputationTimeMillis: DO NOT USE THIS FIELD. It is ignored, and not stored.
   648  	ComputationTimeMillis int64 `json:"computationTimeMillis,omitempty,string"`
   649  	// DataTypeName: The data type defining the format of the values in this data
   650  	// point.
   651  	DataTypeName string `json:"dataTypeName,omitempty"`
   652  	// EndTimeNanos: The end time of the interval represented by this data point,
   653  	// in nanoseconds since epoch.
   654  	EndTimeNanos int64 `json:"endTimeNanos,omitempty,string"`
   655  	// ModifiedTimeMillis: Indicates the last time this data point was modified.
   656  	// Useful only in contexts where we are listing the data changes, rather than
   657  	// representing the current state of the data.
   658  	ModifiedTimeMillis int64 `json:"modifiedTimeMillis,omitempty,string"`
   659  	// OriginDataSourceId: If the data point is contained in a dataset for a
   660  	// derived data source, this field will be populated with the data source
   661  	// stream ID that created the data point originally. WARNING: do not rely on
   662  	// this field for anything other than debugging. The value of this field, if it
   663  	// is set at all, is an implementation detail and is not guaranteed to remain
   664  	// consistent.
   665  	OriginDataSourceId string `json:"originDataSourceId,omitempty"`
   666  	// RawTimestampNanos: The raw timestamp from the original SensorEvent.
   667  	RawTimestampNanos int64 `json:"rawTimestampNanos,omitempty,string"`
   668  	// StartTimeNanos: The start time of the interval represented by this data
   669  	// point, in nanoseconds since epoch.
   670  	StartTimeNanos int64 `json:"startTimeNanos,omitempty,string"`
   671  	// Value: Values of each data type field for the data point. It is expected
   672  	// that each value corresponding to a data type field will occur in the same
   673  	// order that the field is listed with in the data type specified in a data
   674  	// source. Only one of integer and floating point fields will be populated,
   675  	// depending on the format enum value within data source's type field.
   676  	Value []*Value `json:"value,omitempty"`
   677  	// ForceSendFields is a list of field names (e.g. "ComputationTimeMillis") to
   678  	// unconditionally include in API requests. By default, fields with empty or
   679  	// default values are omitted from API requests. See
   680  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   681  	// details.
   682  	ForceSendFields []string `json:"-"`
   683  	// NullFields is a list of field names (e.g. "ComputationTimeMillis") to
   684  	// include in API requests with the JSON null value. By default, fields with
   685  	// empty values are omitted from API requests. See
   686  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   687  	NullFields []string `json:"-"`
   688  }
   689  
   690  func (s *DataPoint) MarshalJSON() ([]byte, error) {
   691  	type NoMethod DataPoint
   692  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   693  }
   694  
   695  // DataSource: Definition of a unique source of sensor data. Data sources can
   696  // expose raw data coming from hardware sensors on local or companion devices.
   697  // They can also expose derived data, created by transforming or merging other
   698  // data sources. Multiple data sources can exist for the same data type. Every
   699  // data point inserted into or read from this service has an associated data
   700  // source. The data source contains enough information to uniquely identify its
   701  // data, including the hardware device and the application that collected
   702  // and/or transformed the data. It also holds useful metadata, such as the
   703  // hardware and application versions, and the device type. Each data source
   704  // produces a unique stream of data, with a unique identifier. Not all changes
   705  // to data source affect the stream identifier, so that data collected by
   706  // updated versions of the same application/device can still be considered to
   707  // belong to the same data stream.
   708  type DataSource struct {
   709  	// Application: Information about an application which feeds sensor data into
   710  	// the platform.
   711  	Application *Application `json:"application,omitempty"`
   712  	// DataQualityStandard: DO NOT POPULATE THIS FIELD. It is never populated in
   713  	// responses from the platform, and is ignored in queries. It will be removed
   714  	// in a future version entirely.
   715  	//
   716  	// Possible values:
   717  	//   "dataQualityUnknown"
   718  	//   "dataQualityBloodPressureEsh2002"
   719  	//   "dataQualityBloodPressureEsh2010"
   720  	//   "dataQualityBloodPressureAami"
   721  	//   "dataQualityBloodPressureBhsAA"
   722  	//   "dataQualityBloodPressureBhsAB"
   723  	//   "dataQualityBloodPressureBhsBA"
   724  	//   "dataQualityBloodPressureBhsBB"
   725  	//   "dataQualityBloodGlucoseIso151972003"
   726  	//   "dataQualityBloodGlucoseIso151972013"
   727  	DataQualityStandard []string `json:"dataQualityStandard,omitempty"`
   728  	// DataStreamId: A unique identifier for the data stream produced by this data
   729  	// source. The identifier includes: - The physical device's manufacturer,
   730  	// model, and serial number (UID). - The application's package name or name.
   731  	// Package name is used when the data source was created by an Android
   732  	// application. The developer project number is used when the data source was
   733  	// created by a REST client. - The data source's type. - The data source's
   734  	// stream name. Note that not all attributes of the data source are used as
   735  	// part of the stream identifier. In particular, the version of the
   736  	// hardware/the application isn't used. This allows us to preserve the same
   737  	// stream through version updates. This also means that two DataSource objects
   738  	// may represent the same data stream even if they're not equal. The exact
   739  	// format of the data stream ID created by an Android application is:
   740  	// type:dataType.name:application.packageName:device.manufacturer:device.model:d
   741  	// evice.uid:dataStreamName The exact format of the data stream ID created by a
   742  	// REST client is: type:dataType.name:developer project
   743  	// number:device.manufacturer:device.model:device.uid:dataStreamName When any
   744  	// of the optional fields that make up the data stream ID are absent, they will
   745  	// be omitted from the data stream ID. The minimum viable data stream ID would
   746  	// be: type:dataType.name:developer project number Finally, the developer
   747  	// project number and device UID are obfuscated when read by any REST or
   748  	// Android client that did not create the data source. Only the data source
   749  	// creator will see the developer project number in clear and normal form. This
   750  	// means a client will see a different set of data_stream_ids than another
   751  	// client with different credentials.
   752  	DataStreamId string `json:"dataStreamId,omitempty"`
   753  	// DataStreamName: The stream name uniquely identifies this particular data
   754  	// source among other data sources of the same type from the same underlying
   755  	// producer. Setting the stream name is optional, but should be done whenever
   756  	// an application exposes two streams for the same data type, or when a device
   757  	// has two equivalent sensors.
   758  	DataStreamName string `json:"dataStreamName,omitempty"`
   759  	// DataType: The data type defines the schema for a stream of data being
   760  	// collected by, inserted into, or queried from the Fitness API.
   761  	DataType *DataType `json:"dataType,omitempty"`
   762  	// Device: Representation of an integrated device (such as a phone or a
   763  	// wearable) that can hold sensors.
   764  	Device *Device `json:"device,omitempty"`
   765  	// Name: An end-user visible name for this data source.
   766  	Name string `json:"name,omitempty"`
   767  	// Type: A constant describing the type of this data source. Indicates whether
   768  	// this data source produces raw or derived data.
   769  	//
   770  	// Possible values:
   771  	//   "raw"
   772  	//   "derived"
   773  	Type string `json:"type,omitempty"`
   774  
   775  	// ServerResponse contains the HTTP response code and headers from the server.
   776  	googleapi.ServerResponse `json:"-"`
   777  	// ForceSendFields is a list of field names (e.g. "Application") to
   778  	// unconditionally include in API requests. By default, fields with empty or
   779  	// default values are omitted from API requests. See
   780  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   781  	// details.
   782  	ForceSendFields []string `json:"-"`
   783  	// NullFields is a list of field names (e.g. "Application") to include in API
   784  	// requests with the JSON null value. By default, fields with empty values are
   785  	// omitted from API requests. See
   786  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   787  	NullFields []string `json:"-"`
   788  }
   789  
   790  func (s *DataSource) MarshalJSON() ([]byte, error) {
   791  	type NoMethod DataSource
   792  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   793  }
   794  
   795  type DataType struct {
   796  	// Field: A field represents one dimension of a data type.
   797  	Field []*DataTypeField `json:"field,omitempty"`
   798  	// Name: Each data type has a unique, namespaced, name. All data types in the
   799  	// com.google namespace are shared as part of the platform.
   800  	Name string `json:"name,omitempty"`
   801  	// ForceSendFields is a list of field names (e.g. "Field") to unconditionally
   802  	// include in API requests. By default, fields with empty or default values are
   803  	// omitted from API requests. See
   804  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   805  	// details.
   806  	ForceSendFields []string `json:"-"`
   807  	// NullFields is a list of field names (e.g. "Field") to include in API
   808  	// requests with the JSON null value. By default, fields with empty values are
   809  	// omitted from API requests. See
   810  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   811  	NullFields []string `json:"-"`
   812  }
   813  
   814  func (s *DataType) MarshalJSON() ([]byte, error) {
   815  	type NoMethod DataType
   816  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   817  }
   818  
   819  // DataTypeField: In case of multi-dimensional data (such as an accelerometer
   820  // with x, y, and z axes) each field represents one dimension. Each data type
   821  // field has a unique name which identifies it. The field also defines the
   822  // format of the data (int, float, etc.). This message is only instantiated in
   823  // code and not used for wire comms or stored in any way.
   824  type DataTypeField struct {
   825  	// Format: The different supported formats for each field in a data type.
   826  	//
   827  	// Possible values:
   828  	//   "integer"
   829  	//   "floatPoint"
   830  	//   "string"
   831  	//   "map"
   832  	//   "integerList"
   833  	//   "floatList"
   834  	//   "blob"
   835  	Format string `json:"format,omitempty"`
   836  	// Name: Defines the name and format of data. Unlike data type names, field
   837  	// names are not namespaced, and only need to be unique within the data type.
   838  	Name     string `json:"name,omitempty"`
   839  	Optional bool   `json:"optional,omitempty"`
   840  	// ForceSendFields is a list of field names (e.g. "Format") to unconditionally
   841  	// include in API requests. By default, fields with empty or default values are
   842  	// omitted from API requests. See
   843  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   844  	// details.
   845  	ForceSendFields []string `json:"-"`
   846  	// NullFields is a list of field names (e.g. "Format") to include in API
   847  	// requests with the JSON null value. By default, fields with empty values are
   848  	// omitted from API requests. See
   849  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   850  	NullFields []string `json:"-"`
   851  }
   852  
   853  func (s *DataTypeField) MarshalJSON() ([]byte, error) {
   854  	type NoMethod DataTypeField
   855  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   856  }
   857  
   858  // Dataset: A dataset represents a projection container for data points. They
   859  // do not carry any info of their own. Datasets represent a set of data points
   860  // from a particular data source. A data point can be found in more than one
   861  // dataset.
   862  type Dataset struct {
   863  	// DataSourceId: The data stream ID of the data source that created the points
   864  	// in this dataset.
   865  	DataSourceId string `json:"dataSourceId,omitempty"`
   866  	// MaxEndTimeNs: The largest end time of all data points in this possibly
   867  	// partial representation of the dataset. Time is in nanoseconds from epoch.
   868  	// This should also match the second part of the dataset identifier.
   869  	MaxEndTimeNs int64 `json:"maxEndTimeNs,omitempty,string"`
   870  	// MinStartTimeNs: The smallest start time of all data points in this possibly
   871  	// partial representation of the dataset. Time is in nanoseconds from epoch.
   872  	// This should also match the first part of the dataset identifier.
   873  	MinStartTimeNs int64 `json:"minStartTimeNs,omitempty,string"`
   874  	// NextPageToken: This token will be set when a dataset is received in response
   875  	// to a GET request and the dataset is too large to be included in a single
   876  	// response. Provide this value in a subsequent GET request to return the next
   877  	// page of data points within this dataset.
   878  	NextPageToken string `json:"nextPageToken,omitempty"`
   879  	// Point: A partial list of data points contained in the dataset, ordered by
   880  	// endTimeNanos. This list is considered complete when retrieving a small
   881  	// dataset and partial when patching a dataset or retrieving a dataset that is
   882  	// too large to include in a single response.
   883  	Point []*DataPoint `json:"point,omitempty"`
   884  
   885  	// ServerResponse contains the HTTP response code and headers from the server.
   886  	googleapi.ServerResponse `json:"-"`
   887  	// ForceSendFields is a list of field names (e.g. "DataSourceId") to
   888  	// unconditionally include in API requests. By default, fields with empty or
   889  	// default values are omitted from API requests. See
   890  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   891  	// details.
   892  	ForceSendFields []string `json:"-"`
   893  	// NullFields is a list of field names (e.g. "DataSourceId") to include in API
   894  	// requests with the JSON null value. By default, fields with empty values are
   895  	// omitted from API requests. See
   896  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   897  	NullFields []string `json:"-"`
   898  }
   899  
   900  func (s *Dataset) MarshalJSON() ([]byte, error) {
   901  	type NoMethod Dataset
   902  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   903  }
   904  
   905  // Device: Representation of an integrated device (such as a phone or a
   906  // wearable) that can hold sensors. Each sensor is exposed as a data source.
   907  // The main purpose of the device information contained in this class is to
   908  // identify the hardware of a particular data source. This can be useful in
   909  // different ways, including: - Distinguishing two similar sensors on different
   910  // devices (the step counter on two nexus 5 phones, for instance) - Display the
   911  // source of data to the user (by using the device make / model) - Treat data
   912  // differently depending on sensor type (accelerometers on a watch may give
   913  // different patterns than those on a phone) - Build different analysis models
   914  // for each device/version.
   915  type Device struct {
   916  	// Manufacturer: Manufacturer of the product/hardware.
   917  	Manufacturer string `json:"manufacturer,omitempty"`
   918  	// Model: End-user visible model name for the device.
   919  	Model string `json:"model,omitempty"`
   920  	// Type: A constant representing the type of the device.
   921  	//
   922  	// Possible values:
   923  	//   "unknown" - Device type is not known.
   924  	//   "phone" - An Android phone.
   925  	//   "tablet" - An Android tablet.
   926  	//   "watch" - A watch or other wrist-mounted band.
   927  	//   "chestStrap" - A chest strap.
   928  	//   "scale" - A scale.
   929  	//   "headMounted" - Glass or other head-mounted device.
   930  	//   "smartDisplay" - A smart display e.g. Nest device.
   931  	Type string `json:"type,omitempty"`
   932  	// Uid: The serial number or other unique ID for the hardware. This field is
   933  	// obfuscated when read by any REST or Android client that did not create the
   934  	// data source. Only the data source creator will see the uid field in clear
   935  	// and normal form. The obfuscation preserves equality; that is, given two IDs,
   936  	// if id1 == id2, obfuscated(id1) == obfuscated(id2).
   937  	Uid string `json:"uid,omitempty"`
   938  	// Version: Version string for the device hardware/software.
   939  	Version string `json:"version,omitempty"`
   940  	// ForceSendFields is a list of field names (e.g. "Manufacturer") to
   941  	// unconditionally include in API requests. By default, fields with empty or
   942  	// default values are omitted from API requests. See
   943  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   944  	// details.
   945  	ForceSendFields []string `json:"-"`
   946  	// NullFields is a list of field names (e.g. "Manufacturer") to include in API
   947  	// requests with the JSON null value. By default, fields with empty values are
   948  	// omitted from API requests. See
   949  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   950  	NullFields []string `json:"-"`
   951  }
   952  
   953  func (s *Device) MarshalJSON() ([]byte, error) {
   954  	type NoMethod Device
   955  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   956  }
   957  
   958  type ListDataPointChangesResponse struct {
   959  	// DataSourceId: The data stream ID of the data source with data point changes.
   960  	DataSourceId string `json:"dataSourceId,omitempty"`
   961  	// DeletedDataPoint: Deleted data points for the user. Note, for modifications
   962  	// this should be parsed before handling insertions.
   963  	DeletedDataPoint []*DataPoint `json:"deletedDataPoint,omitempty"`
   964  	// InsertedDataPoint: Inserted data points for the user.
   965  	InsertedDataPoint []*DataPoint `json:"insertedDataPoint,omitempty"`
   966  	// NextPageToken: The continuation token, which is used to page through large
   967  	// result sets. Provide this value in a subsequent request to return the next
   968  	// page of results.
   969  	NextPageToken string `json:"nextPageToken,omitempty"`
   970  
   971  	// ServerResponse contains the HTTP response code and headers from the server.
   972  	googleapi.ServerResponse `json:"-"`
   973  	// ForceSendFields is a list of field names (e.g. "DataSourceId") to
   974  	// unconditionally include in API requests. By default, fields with empty or
   975  	// default values are omitted from API requests. See
   976  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   977  	// details.
   978  	ForceSendFields []string `json:"-"`
   979  	// NullFields is a list of field names (e.g. "DataSourceId") to include in API
   980  	// requests with the JSON null value. By default, fields with empty values are
   981  	// omitted from API requests. See
   982  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   983  	NullFields []string `json:"-"`
   984  }
   985  
   986  func (s *ListDataPointChangesResponse) MarshalJSON() ([]byte, error) {
   987  	type NoMethod ListDataPointChangesResponse
   988  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   989  }
   990  
   991  type ListDataSourcesResponse struct {
   992  	// DataSource: A previously created data source.
   993  	DataSource []*DataSource `json:"dataSource,omitempty"`
   994  
   995  	// ServerResponse contains the HTTP response code and headers from the server.
   996  	googleapi.ServerResponse `json:"-"`
   997  	// ForceSendFields is a list of field names (e.g. "DataSource") to
   998  	// unconditionally include in API requests. By default, fields with empty or
   999  	// default values are omitted from API requests. See
  1000  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1001  	// details.
  1002  	ForceSendFields []string `json:"-"`
  1003  	// NullFields is a list of field names (e.g. "DataSource") to include in API
  1004  	// requests with the JSON null value. By default, fields with empty values are
  1005  	// omitted from API requests. See
  1006  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1007  	NullFields []string `json:"-"`
  1008  }
  1009  
  1010  func (s *ListDataSourcesResponse) MarshalJSON() ([]byte, error) {
  1011  	type NoMethod ListDataSourcesResponse
  1012  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1013  }
  1014  
  1015  type ListSessionsResponse struct {
  1016  	// DeletedSession: If includeDeleted is set to true in the request, and
  1017  	// startTime and endTime are omitted, this will include sessions which were
  1018  	// deleted since the last sync.
  1019  	DeletedSession []*Session `json:"deletedSession,omitempty"`
  1020  	// HasMoreData: Flag to indicate server has more data to transfer. DO NOT USE
  1021  	// THIS FIELD. It is never populated in responses from the server.
  1022  	HasMoreData bool `json:"hasMoreData,omitempty"`
  1023  	// NextPageToken: The sync token which is used to sync further changes. This
  1024  	// will only be provided if both startTime and endTime are omitted from the
  1025  	// request.
  1026  	NextPageToken string `json:"nextPageToken,omitempty"`
  1027  	// Session: Sessions with an end time that is between startTime and endTime of
  1028  	// the request.
  1029  	Session []*Session `json:"session,omitempty"`
  1030  
  1031  	// ServerResponse contains the HTTP response code and headers from the server.
  1032  	googleapi.ServerResponse `json:"-"`
  1033  	// ForceSendFields is a list of field names (e.g. "DeletedSession") to
  1034  	// unconditionally include in API requests. By default, fields with empty or
  1035  	// default values are omitted from API requests. See
  1036  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1037  	// details.
  1038  	ForceSendFields []string `json:"-"`
  1039  	// NullFields is a list of field names (e.g. "DeletedSession") to include in
  1040  	// API requests with the JSON null value. By default, fields with empty values
  1041  	// are omitted from API requests. See
  1042  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1043  	NullFields []string `json:"-"`
  1044  }
  1045  
  1046  func (s *ListSessionsResponse) MarshalJSON() ([]byte, error) {
  1047  	type NoMethod ListSessionsResponse
  1048  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1049  }
  1050  
  1051  // MapValue: Holder object for the value of an entry in a map field of a data
  1052  // point. A map value supports a subset of the formats that the regular Value
  1053  // supports.
  1054  type MapValue struct {
  1055  	// FpVal: Floating point value.
  1056  	FpVal float64 `json:"fpVal,omitempty"`
  1057  	// ForceSendFields is a list of field names (e.g. "FpVal") to unconditionally
  1058  	// include in API requests. By default, fields with empty or default values are
  1059  	// omitted from API requests. See
  1060  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1061  	// details.
  1062  	ForceSendFields []string `json:"-"`
  1063  	// NullFields is a list of field names (e.g. "FpVal") to include in API
  1064  	// requests with the JSON null value. By default, fields with empty values are
  1065  	// omitted from API requests. See
  1066  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1067  	NullFields []string `json:"-"`
  1068  }
  1069  
  1070  func (s *MapValue) MarshalJSON() ([]byte, error) {
  1071  	type NoMethod MapValue
  1072  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1073  }
  1074  
  1075  func (s *MapValue) UnmarshalJSON(data []byte) error {
  1076  	type NoMethod MapValue
  1077  	var s1 struct {
  1078  		FpVal gensupport.JSONFloat64 `json:"fpVal"`
  1079  		*NoMethod
  1080  	}
  1081  	s1.NoMethod = (*NoMethod)(s)
  1082  	if err := json.Unmarshal(data, &s1); err != nil {
  1083  		return err
  1084  	}
  1085  	s.FpVal = float64(s1.FpVal)
  1086  	return nil
  1087  }
  1088  
  1089  // Session: Sessions contain metadata, such as a user-friendly name and time
  1090  // interval information.
  1091  type Session struct {
  1092  	// ActiveTimeMillis: Session active time. While start_time_millis and
  1093  	// end_time_millis define the full session time, the active time can be shorter
  1094  	// and specified by active_time_millis. If the inactive time during the session
  1095  	// is known, it should also be inserted via a com.google.activity.segment data
  1096  	// point with a STILL activity value
  1097  	ActiveTimeMillis int64 `json:"activeTimeMillis,omitempty,string"`
  1098  	// ActivityType: The type of activity this session represents.
  1099  	ActivityType int64 `json:"activityType,omitempty"`
  1100  	// Application: The application that created the session.
  1101  	Application *Application `json:"application,omitempty"`
  1102  	// Description: A description for this session.
  1103  	Description string `json:"description,omitempty"`
  1104  	// EndTimeMillis: An end time, in milliseconds since epoch, inclusive.
  1105  	EndTimeMillis int64 `json:"endTimeMillis,omitempty,string"`
  1106  	// Id: A client-generated identifier that is unique across all sessions owned
  1107  	// by this particular user.
  1108  	Id string `json:"id,omitempty"`
  1109  	// ModifiedTimeMillis: A timestamp that indicates when the session was last
  1110  	// modified.
  1111  	ModifiedTimeMillis int64 `json:"modifiedTimeMillis,omitempty,string"`
  1112  	// Name: A human readable name of the session.
  1113  	Name string `json:"name,omitempty"`
  1114  	// StartTimeMillis: A start time, in milliseconds since epoch, inclusive.
  1115  	StartTimeMillis int64 `json:"startTimeMillis,omitempty,string"`
  1116  
  1117  	// ServerResponse contains the HTTP response code and headers from the server.
  1118  	googleapi.ServerResponse `json:"-"`
  1119  	// ForceSendFields is a list of field names (e.g. "ActiveTimeMillis") to
  1120  	// unconditionally include in API requests. By default, fields with empty or
  1121  	// default values are omitted from API requests. See
  1122  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1123  	// details.
  1124  	ForceSendFields []string `json:"-"`
  1125  	// NullFields is a list of field names (e.g. "ActiveTimeMillis") to include in
  1126  	// API requests with the JSON null value. By default, fields with empty values
  1127  	// are omitted from API requests. See
  1128  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1129  	NullFields []string `json:"-"`
  1130  }
  1131  
  1132  func (s *Session) MarshalJSON() ([]byte, error) {
  1133  	type NoMethod Session
  1134  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1135  }
  1136  
  1137  // Value: Holder object for the value of a single field in a data point. A
  1138  // field value has a particular format and is only ever set to one of an
  1139  // integer or a floating point value.
  1140  type Value struct {
  1141  	// FpVal: Floating point value. When this is set, other values must not be set.
  1142  	FpVal float64 `json:"fpVal,omitempty"`
  1143  	// IntVal: Integer value. When this is set, other values must not be set.
  1144  	IntVal int64 `json:"intVal,omitempty"`
  1145  	// MapVal: Map value. The valid key space and units for the corresponding value
  1146  	// of each entry should be documented as part of the data type definition. Keys
  1147  	// should be kept small whenever possible. Data streams with large keys and
  1148  	// high data frequency may be down sampled.
  1149  	MapVal []*ValueMapValEntry `json:"mapVal,omitempty"`
  1150  	// StringVal: String value. When this is set, other values must not be set.
  1151  	// Strings should be kept small whenever possible. Data streams with large
  1152  	// string values and high data frequency may be down sampled.
  1153  	StringVal string `json:"stringVal,omitempty"`
  1154  	// ForceSendFields is a list of field names (e.g. "FpVal") to unconditionally
  1155  	// include in API requests. By default, fields with empty or default values are
  1156  	// omitted from API requests. See
  1157  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1158  	// details.
  1159  	ForceSendFields []string `json:"-"`
  1160  	// NullFields is a list of field names (e.g. "FpVal") to include in API
  1161  	// requests with the JSON null value. By default, fields with empty values are
  1162  	// omitted from API requests. See
  1163  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1164  	NullFields []string `json:"-"`
  1165  }
  1166  
  1167  func (s *Value) MarshalJSON() ([]byte, error) {
  1168  	type NoMethod Value
  1169  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1170  }
  1171  
  1172  func (s *Value) UnmarshalJSON(data []byte) error {
  1173  	type NoMethod Value
  1174  	var s1 struct {
  1175  		FpVal gensupport.JSONFloat64 `json:"fpVal"`
  1176  		*NoMethod
  1177  	}
  1178  	s1.NoMethod = (*NoMethod)(s)
  1179  	if err := json.Unmarshal(data, &s1); err != nil {
  1180  		return err
  1181  	}
  1182  	s.FpVal = float64(s1.FpVal)
  1183  	return nil
  1184  }
  1185  
  1186  type ValueMapValEntry struct {
  1187  	Key   string    `json:"key,omitempty"`
  1188  	Value *MapValue `json:"value,omitempty"`
  1189  	// ForceSendFields is a list of field names (e.g. "Key") to unconditionally
  1190  	// include in API requests. By default, fields with empty or default values are
  1191  	// omitted from API requests. See
  1192  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1193  	// details.
  1194  	ForceSendFields []string `json:"-"`
  1195  	// NullFields is a list of field names (e.g. "Key") to include in API requests
  1196  	// with the JSON null value. By default, fields with empty values are omitted
  1197  	// from API requests. See
  1198  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1199  	NullFields []string `json:"-"`
  1200  }
  1201  
  1202  func (s *ValueMapValEntry) MarshalJSON() ([]byte, error) {
  1203  	type NoMethod ValueMapValEntry
  1204  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1205  }
  1206  
  1207  type UsersDataSourcesCreateCall struct {
  1208  	s          *Service
  1209  	userId     string
  1210  	datasource *DataSource
  1211  	urlParams_ gensupport.URLParams
  1212  	ctx_       context.Context
  1213  	header_    http.Header
  1214  }
  1215  
  1216  // Create: Creates a new data source that is unique across all data sources
  1217  // belonging to this user. A data source is a unique source of sensor data.
  1218  // Data sources can expose raw data coming from hardware sensors on local or
  1219  // companion devices. They can also expose derived data, created by
  1220  // transforming or merging other data sources. Multiple data sources can exist
  1221  // for the same data type. Every data point in every dataset inserted into or
  1222  // read from the Fitness API has an associated data source. Each data source
  1223  // produces a unique stream of dataset updates, with a unique data source
  1224  // identifier. Not all changes to data source affect the data stream ID, so
  1225  // that data collected by updated versions of the same application/device can
  1226  // still be considered to belong to the same data source. Data sources are
  1227  // identified using a string generated by the server, based on the contents of
  1228  // the source being created. The dataStreamId field should not be set when
  1229  // invoking this method. It will be automatically generated by the server with
  1230  // the correct format. If a dataStreamId is set, it must match the format that
  1231  // the server would generate. This format is a combination of some fields from
  1232  // the data source, and has a specific order. If it doesn't match, the request
  1233  // will fail with an error. Specifying a DataType which is not a known type
  1234  // (beginning with "com.google.") will create a DataSource with a *custom data
  1235  // type*. Custom data types are only readable by the application that created
  1236  // them. Custom data types are *deprecated*; use standard data types instead.
  1237  // In addition to the data source fields included in the data source ID, the
  1238  // developer project number that is authenticated when creating the data source
  1239  // is included. This developer project number is obfuscated when read by any
  1240  // other developer reading public data types.
  1241  //
  1242  //   - userId: Create the data source for the person identified. Use me to
  1243  //     indicate the authenticated user. Only me is supported at this time.
  1244  func (r *UsersDataSourcesService) Create(userId string, datasource *DataSource) *UsersDataSourcesCreateCall {
  1245  	c := &UsersDataSourcesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1246  	c.userId = userId
  1247  	c.datasource = datasource
  1248  	return c
  1249  }
  1250  
  1251  // Fields allows partial responses to be retrieved. See
  1252  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1253  // details.
  1254  func (c *UsersDataSourcesCreateCall) Fields(s ...googleapi.Field) *UsersDataSourcesCreateCall {
  1255  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1256  	return c
  1257  }
  1258  
  1259  // Context sets the context to be used in this call's Do method.
  1260  func (c *UsersDataSourcesCreateCall) Context(ctx context.Context) *UsersDataSourcesCreateCall {
  1261  	c.ctx_ = ctx
  1262  	return c
  1263  }
  1264  
  1265  // Header returns a http.Header that can be modified by the caller to add
  1266  // headers to the request.
  1267  func (c *UsersDataSourcesCreateCall) Header() http.Header {
  1268  	if c.header_ == nil {
  1269  		c.header_ = make(http.Header)
  1270  	}
  1271  	return c.header_
  1272  }
  1273  
  1274  func (c *UsersDataSourcesCreateCall) doRequest(alt string) (*http.Response, error) {
  1275  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1276  	var body io.Reader = nil
  1277  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.datasource)
  1278  	if err != nil {
  1279  		return nil, err
  1280  	}
  1281  	c.urlParams_.Set("alt", alt)
  1282  	c.urlParams_.Set("prettyPrint", "false")
  1283  	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources")
  1284  	urls += "?" + c.urlParams_.Encode()
  1285  	req, err := http.NewRequest("POST", urls, body)
  1286  	if err != nil {
  1287  		return nil, err
  1288  	}
  1289  	req.Header = reqHeaders
  1290  	googleapi.Expand(req.URL, map[string]string{
  1291  		"userId": c.userId,
  1292  	})
  1293  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1294  }
  1295  
  1296  // Do executes the "fitness.users.dataSources.create" call.
  1297  // Any non-2xx status code is an error. Response headers are in either
  1298  // *DataSource.ServerResponse.Header or (if a response was returned at all) in
  1299  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1300  // whether the returned error was because http.StatusNotModified was returned.
  1301  func (c *UsersDataSourcesCreateCall) Do(opts ...googleapi.CallOption) (*DataSource, error) {
  1302  	gensupport.SetOptions(c.urlParams_, opts...)
  1303  	res, err := c.doRequest("json")
  1304  	if res != nil && res.StatusCode == http.StatusNotModified {
  1305  		if res.Body != nil {
  1306  			res.Body.Close()
  1307  		}
  1308  		return nil, gensupport.WrapError(&googleapi.Error{
  1309  			Code:   res.StatusCode,
  1310  			Header: res.Header,
  1311  		})
  1312  	}
  1313  	if err != nil {
  1314  		return nil, err
  1315  	}
  1316  	defer googleapi.CloseBody(res)
  1317  	if err := googleapi.CheckResponse(res); err != nil {
  1318  		return nil, gensupport.WrapError(err)
  1319  	}
  1320  	ret := &DataSource{
  1321  		ServerResponse: googleapi.ServerResponse{
  1322  			Header:         res.Header,
  1323  			HTTPStatusCode: res.StatusCode,
  1324  		},
  1325  	}
  1326  	target := &ret
  1327  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1328  		return nil, err
  1329  	}
  1330  	return ret, nil
  1331  }
  1332  
  1333  type UsersDataSourcesDeleteCall struct {
  1334  	s            *Service
  1335  	userId       string
  1336  	dataSourceId string
  1337  	urlParams_   gensupport.URLParams
  1338  	ctx_         context.Context
  1339  	header_      http.Header
  1340  }
  1341  
  1342  // Delete: Deletes the specified data source. The request will fail if the data
  1343  // source contains any data points.
  1344  //
  1345  //   - dataSourceId: The data stream ID of the data source to delete.
  1346  //   - userId: Retrieve a data source for the person identified. Use me to
  1347  //     indicate the authenticated user. Only me is supported at this time.
  1348  func (r *UsersDataSourcesService) Delete(userId string, dataSourceId string) *UsersDataSourcesDeleteCall {
  1349  	c := &UsersDataSourcesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1350  	c.userId = userId
  1351  	c.dataSourceId = dataSourceId
  1352  	return c
  1353  }
  1354  
  1355  // Fields allows partial responses to be retrieved. See
  1356  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1357  // details.
  1358  func (c *UsersDataSourcesDeleteCall) Fields(s ...googleapi.Field) *UsersDataSourcesDeleteCall {
  1359  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1360  	return c
  1361  }
  1362  
  1363  // Context sets the context to be used in this call's Do method.
  1364  func (c *UsersDataSourcesDeleteCall) Context(ctx context.Context) *UsersDataSourcesDeleteCall {
  1365  	c.ctx_ = ctx
  1366  	return c
  1367  }
  1368  
  1369  // Header returns a http.Header that can be modified by the caller to add
  1370  // headers to the request.
  1371  func (c *UsersDataSourcesDeleteCall) Header() http.Header {
  1372  	if c.header_ == nil {
  1373  		c.header_ = make(http.Header)
  1374  	}
  1375  	return c.header_
  1376  }
  1377  
  1378  func (c *UsersDataSourcesDeleteCall) doRequest(alt string) (*http.Response, error) {
  1379  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1380  	var body io.Reader = nil
  1381  	c.urlParams_.Set("alt", alt)
  1382  	c.urlParams_.Set("prettyPrint", "false")
  1383  	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}")
  1384  	urls += "?" + c.urlParams_.Encode()
  1385  	req, err := http.NewRequest("DELETE", urls, body)
  1386  	if err != nil {
  1387  		return nil, err
  1388  	}
  1389  	req.Header = reqHeaders
  1390  	googleapi.Expand(req.URL, map[string]string{
  1391  		"userId":       c.userId,
  1392  		"dataSourceId": c.dataSourceId,
  1393  	})
  1394  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1395  }
  1396  
  1397  // Do executes the "fitness.users.dataSources.delete" call.
  1398  // Any non-2xx status code is an error. Response headers are in either
  1399  // *DataSource.ServerResponse.Header or (if a response was returned at all) in
  1400  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1401  // whether the returned error was because http.StatusNotModified was returned.
  1402  func (c *UsersDataSourcesDeleteCall) Do(opts ...googleapi.CallOption) (*DataSource, error) {
  1403  	gensupport.SetOptions(c.urlParams_, opts...)
  1404  	res, err := c.doRequest("json")
  1405  	if res != nil && res.StatusCode == http.StatusNotModified {
  1406  		if res.Body != nil {
  1407  			res.Body.Close()
  1408  		}
  1409  		return nil, gensupport.WrapError(&googleapi.Error{
  1410  			Code:   res.StatusCode,
  1411  			Header: res.Header,
  1412  		})
  1413  	}
  1414  	if err != nil {
  1415  		return nil, err
  1416  	}
  1417  	defer googleapi.CloseBody(res)
  1418  	if err := googleapi.CheckResponse(res); err != nil {
  1419  		return nil, gensupport.WrapError(err)
  1420  	}
  1421  	ret := &DataSource{
  1422  		ServerResponse: googleapi.ServerResponse{
  1423  			Header:         res.Header,
  1424  			HTTPStatusCode: res.StatusCode,
  1425  		},
  1426  	}
  1427  	target := &ret
  1428  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1429  		return nil, err
  1430  	}
  1431  	return ret, nil
  1432  }
  1433  
  1434  type UsersDataSourcesGetCall struct {
  1435  	s            *Service
  1436  	userId       string
  1437  	dataSourceId string
  1438  	urlParams_   gensupport.URLParams
  1439  	ifNoneMatch_ string
  1440  	ctx_         context.Context
  1441  	header_      http.Header
  1442  }
  1443  
  1444  // Get: Returns the specified data source.
  1445  //
  1446  //   - dataSourceId: The data stream ID of the data source to retrieve.
  1447  //   - userId: Retrieve a data source for the person identified. Use me to
  1448  //     indicate the authenticated user. Only me is supported at this time.
  1449  func (r *UsersDataSourcesService) Get(userId string, dataSourceId string) *UsersDataSourcesGetCall {
  1450  	c := &UsersDataSourcesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1451  	c.userId = userId
  1452  	c.dataSourceId = dataSourceId
  1453  	return c
  1454  }
  1455  
  1456  // Fields allows partial responses to be retrieved. See
  1457  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1458  // details.
  1459  func (c *UsersDataSourcesGetCall) Fields(s ...googleapi.Field) *UsersDataSourcesGetCall {
  1460  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1461  	return c
  1462  }
  1463  
  1464  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1465  // object's ETag matches the given value. This is useful for getting updates
  1466  // only after the object has changed since the last request.
  1467  func (c *UsersDataSourcesGetCall) IfNoneMatch(entityTag string) *UsersDataSourcesGetCall {
  1468  	c.ifNoneMatch_ = entityTag
  1469  	return c
  1470  }
  1471  
  1472  // Context sets the context to be used in this call's Do method.
  1473  func (c *UsersDataSourcesGetCall) Context(ctx context.Context) *UsersDataSourcesGetCall {
  1474  	c.ctx_ = ctx
  1475  	return c
  1476  }
  1477  
  1478  // Header returns a http.Header that can be modified by the caller to add
  1479  // headers to the request.
  1480  func (c *UsersDataSourcesGetCall) Header() http.Header {
  1481  	if c.header_ == nil {
  1482  		c.header_ = make(http.Header)
  1483  	}
  1484  	return c.header_
  1485  }
  1486  
  1487  func (c *UsersDataSourcesGetCall) doRequest(alt string) (*http.Response, error) {
  1488  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1489  	if c.ifNoneMatch_ != "" {
  1490  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1491  	}
  1492  	var body io.Reader = nil
  1493  	c.urlParams_.Set("alt", alt)
  1494  	c.urlParams_.Set("prettyPrint", "false")
  1495  	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}")
  1496  	urls += "?" + c.urlParams_.Encode()
  1497  	req, err := http.NewRequest("GET", urls, body)
  1498  	if err != nil {
  1499  		return nil, err
  1500  	}
  1501  	req.Header = reqHeaders
  1502  	googleapi.Expand(req.URL, map[string]string{
  1503  		"userId":       c.userId,
  1504  		"dataSourceId": c.dataSourceId,
  1505  	})
  1506  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1507  }
  1508  
  1509  // Do executes the "fitness.users.dataSources.get" call.
  1510  // Any non-2xx status code is an error. Response headers are in either
  1511  // *DataSource.ServerResponse.Header or (if a response was returned at all) in
  1512  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1513  // whether the returned error was because http.StatusNotModified was returned.
  1514  func (c *UsersDataSourcesGetCall) Do(opts ...googleapi.CallOption) (*DataSource, error) {
  1515  	gensupport.SetOptions(c.urlParams_, opts...)
  1516  	res, err := c.doRequest("json")
  1517  	if res != nil && res.StatusCode == http.StatusNotModified {
  1518  		if res.Body != nil {
  1519  			res.Body.Close()
  1520  		}
  1521  		return nil, gensupport.WrapError(&googleapi.Error{
  1522  			Code:   res.StatusCode,
  1523  			Header: res.Header,
  1524  		})
  1525  	}
  1526  	if err != nil {
  1527  		return nil, err
  1528  	}
  1529  	defer googleapi.CloseBody(res)
  1530  	if err := googleapi.CheckResponse(res); err != nil {
  1531  		return nil, gensupport.WrapError(err)
  1532  	}
  1533  	ret := &DataSource{
  1534  		ServerResponse: googleapi.ServerResponse{
  1535  			Header:         res.Header,
  1536  			HTTPStatusCode: res.StatusCode,
  1537  		},
  1538  	}
  1539  	target := &ret
  1540  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1541  		return nil, err
  1542  	}
  1543  	return ret, nil
  1544  }
  1545  
  1546  type UsersDataSourcesListCall struct {
  1547  	s            *Service
  1548  	userId       string
  1549  	urlParams_   gensupport.URLParams
  1550  	ifNoneMatch_ string
  1551  	ctx_         context.Context
  1552  	header_      http.Header
  1553  }
  1554  
  1555  // List: Lists all data sources that are visible to the developer, using the
  1556  // OAuth scopes provided. The list is not exhaustive; the user may have private
  1557  // data sources that are only visible to other developers, or calls using other
  1558  // scopes.
  1559  //
  1560  //   - userId: List data sources for the person identified. Use me to indicate
  1561  //     the authenticated user. Only me is supported at this time.
  1562  func (r *UsersDataSourcesService) List(userId string) *UsersDataSourcesListCall {
  1563  	c := &UsersDataSourcesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1564  	c.userId = userId
  1565  	return c
  1566  }
  1567  
  1568  // DataTypeName sets the optional parameter "dataTypeName": The names of data
  1569  // types to include in the list. If not specified, all data sources will be
  1570  // returned.
  1571  func (c *UsersDataSourcesListCall) DataTypeName(dataTypeName ...string) *UsersDataSourcesListCall {
  1572  	c.urlParams_.SetMulti("dataTypeName", append([]string{}, dataTypeName...))
  1573  	return c
  1574  }
  1575  
  1576  // Fields allows partial responses to be retrieved. See
  1577  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1578  // details.
  1579  func (c *UsersDataSourcesListCall) Fields(s ...googleapi.Field) *UsersDataSourcesListCall {
  1580  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1581  	return c
  1582  }
  1583  
  1584  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1585  // object's ETag matches the given value. This is useful for getting updates
  1586  // only after the object has changed since the last request.
  1587  func (c *UsersDataSourcesListCall) IfNoneMatch(entityTag string) *UsersDataSourcesListCall {
  1588  	c.ifNoneMatch_ = entityTag
  1589  	return c
  1590  }
  1591  
  1592  // Context sets the context to be used in this call's Do method.
  1593  func (c *UsersDataSourcesListCall) Context(ctx context.Context) *UsersDataSourcesListCall {
  1594  	c.ctx_ = ctx
  1595  	return c
  1596  }
  1597  
  1598  // Header returns a http.Header that can be modified by the caller to add
  1599  // headers to the request.
  1600  func (c *UsersDataSourcesListCall) Header() http.Header {
  1601  	if c.header_ == nil {
  1602  		c.header_ = make(http.Header)
  1603  	}
  1604  	return c.header_
  1605  }
  1606  
  1607  func (c *UsersDataSourcesListCall) doRequest(alt string) (*http.Response, error) {
  1608  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1609  	if c.ifNoneMatch_ != "" {
  1610  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1611  	}
  1612  	var body io.Reader = nil
  1613  	c.urlParams_.Set("alt", alt)
  1614  	c.urlParams_.Set("prettyPrint", "false")
  1615  	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources")
  1616  	urls += "?" + c.urlParams_.Encode()
  1617  	req, err := http.NewRequest("GET", urls, body)
  1618  	if err != nil {
  1619  		return nil, err
  1620  	}
  1621  	req.Header = reqHeaders
  1622  	googleapi.Expand(req.URL, map[string]string{
  1623  		"userId": c.userId,
  1624  	})
  1625  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1626  }
  1627  
  1628  // Do executes the "fitness.users.dataSources.list" call.
  1629  // Any non-2xx status code is an error. Response headers are in either
  1630  // *ListDataSourcesResponse.ServerResponse.Header or (if a response was
  1631  // returned at all) in error.(*googleapi.Error).Header. Use
  1632  // googleapi.IsNotModified to check whether the returned error was because
  1633  // http.StatusNotModified was returned.
  1634  func (c *UsersDataSourcesListCall) Do(opts ...googleapi.CallOption) (*ListDataSourcesResponse, error) {
  1635  	gensupport.SetOptions(c.urlParams_, opts...)
  1636  	res, err := c.doRequest("json")
  1637  	if res != nil && res.StatusCode == http.StatusNotModified {
  1638  		if res.Body != nil {
  1639  			res.Body.Close()
  1640  		}
  1641  		return nil, gensupport.WrapError(&googleapi.Error{
  1642  			Code:   res.StatusCode,
  1643  			Header: res.Header,
  1644  		})
  1645  	}
  1646  	if err != nil {
  1647  		return nil, err
  1648  	}
  1649  	defer googleapi.CloseBody(res)
  1650  	if err := googleapi.CheckResponse(res); err != nil {
  1651  		return nil, gensupport.WrapError(err)
  1652  	}
  1653  	ret := &ListDataSourcesResponse{
  1654  		ServerResponse: googleapi.ServerResponse{
  1655  			Header:         res.Header,
  1656  			HTTPStatusCode: res.StatusCode,
  1657  		},
  1658  	}
  1659  	target := &ret
  1660  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1661  		return nil, err
  1662  	}
  1663  	return ret, nil
  1664  }
  1665  
  1666  type UsersDataSourcesUpdateCall struct {
  1667  	s            *Service
  1668  	userId       string
  1669  	dataSourceId string
  1670  	datasource   *DataSource
  1671  	urlParams_   gensupport.URLParams
  1672  	ctx_         context.Context
  1673  	header_      http.Header
  1674  }
  1675  
  1676  // Update: Updates the specified data source. The dataStreamId, dataType, type,
  1677  // dataStreamName, and device properties with the exception of version, cannot
  1678  // be modified. Data sources are identified by their dataStreamId.
  1679  //
  1680  //   - dataSourceId: The data stream ID of the data source to update.
  1681  //   - userId: Update the data source for the person identified. Use me to
  1682  //     indicate the authenticated user. Only me is supported at this time.
  1683  func (r *UsersDataSourcesService) Update(userId string, dataSourceId string, datasource *DataSource) *UsersDataSourcesUpdateCall {
  1684  	c := &UsersDataSourcesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1685  	c.userId = userId
  1686  	c.dataSourceId = dataSourceId
  1687  	c.datasource = datasource
  1688  	return c
  1689  }
  1690  
  1691  // Fields allows partial responses to be retrieved. See
  1692  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1693  // details.
  1694  func (c *UsersDataSourcesUpdateCall) Fields(s ...googleapi.Field) *UsersDataSourcesUpdateCall {
  1695  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1696  	return c
  1697  }
  1698  
  1699  // Context sets the context to be used in this call's Do method.
  1700  func (c *UsersDataSourcesUpdateCall) Context(ctx context.Context) *UsersDataSourcesUpdateCall {
  1701  	c.ctx_ = ctx
  1702  	return c
  1703  }
  1704  
  1705  // Header returns a http.Header that can be modified by the caller to add
  1706  // headers to the request.
  1707  func (c *UsersDataSourcesUpdateCall) Header() http.Header {
  1708  	if c.header_ == nil {
  1709  		c.header_ = make(http.Header)
  1710  	}
  1711  	return c.header_
  1712  }
  1713  
  1714  func (c *UsersDataSourcesUpdateCall) doRequest(alt string) (*http.Response, error) {
  1715  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  1716  	var body io.Reader = nil
  1717  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.datasource)
  1718  	if err != nil {
  1719  		return nil, err
  1720  	}
  1721  	c.urlParams_.Set("alt", alt)
  1722  	c.urlParams_.Set("prettyPrint", "false")
  1723  	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}")
  1724  	urls += "?" + c.urlParams_.Encode()
  1725  	req, err := http.NewRequest("PUT", urls, body)
  1726  	if err != nil {
  1727  		return nil, err
  1728  	}
  1729  	req.Header = reqHeaders
  1730  	googleapi.Expand(req.URL, map[string]string{
  1731  		"userId":       c.userId,
  1732  		"dataSourceId": c.dataSourceId,
  1733  	})
  1734  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1735  }
  1736  
  1737  // Do executes the "fitness.users.dataSources.update" call.
  1738  // Any non-2xx status code is an error. Response headers are in either
  1739  // *DataSource.ServerResponse.Header or (if a response was returned at all) in
  1740  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1741  // whether the returned error was because http.StatusNotModified was returned.
  1742  func (c *UsersDataSourcesUpdateCall) Do(opts ...googleapi.CallOption) (*DataSource, error) {
  1743  	gensupport.SetOptions(c.urlParams_, opts...)
  1744  	res, err := c.doRequest("json")
  1745  	if res != nil && res.StatusCode == http.StatusNotModified {
  1746  		if res.Body != nil {
  1747  			res.Body.Close()
  1748  		}
  1749  		return nil, gensupport.WrapError(&googleapi.Error{
  1750  			Code:   res.StatusCode,
  1751  			Header: res.Header,
  1752  		})
  1753  	}
  1754  	if err != nil {
  1755  		return nil, err
  1756  	}
  1757  	defer googleapi.CloseBody(res)
  1758  	if err := googleapi.CheckResponse(res); err != nil {
  1759  		return nil, gensupport.WrapError(err)
  1760  	}
  1761  	ret := &DataSource{
  1762  		ServerResponse: googleapi.ServerResponse{
  1763  			Header:         res.Header,
  1764  			HTTPStatusCode: res.StatusCode,
  1765  		},
  1766  	}
  1767  	target := &ret
  1768  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1769  		return nil, err
  1770  	}
  1771  	return ret, nil
  1772  }
  1773  
  1774  type UsersDataSourcesDataPointChangesListCall struct {
  1775  	s            *Service
  1776  	userId       string
  1777  	dataSourceId string
  1778  	urlParams_   gensupport.URLParams
  1779  	ifNoneMatch_ string
  1780  	ctx_         context.Context
  1781  	header_      http.Header
  1782  }
  1783  
  1784  // List: Queries for user's data point changes for a particular data source.
  1785  //
  1786  //   - dataSourceId: The data stream ID of the data source that created the
  1787  //     dataset.
  1788  //   - userId: List data points for the person identified. Use me to indicate the
  1789  //     authenticated user. Only me is supported at this time.
  1790  func (r *UsersDataSourcesDataPointChangesService) List(userId string, dataSourceId string) *UsersDataSourcesDataPointChangesListCall {
  1791  	c := &UsersDataSourcesDataPointChangesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1792  	c.userId = userId
  1793  	c.dataSourceId = dataSourceId
  1794  	return c
  1795  }
  1796  
  1797  // Limit sets the optional parameter "limit": If specified, no more than this
  1798  // many data point changes will be included in the response.
  1799  func (c *UsersDataSourcesDataPointChangesListCall) Limit(limit int64) *UsersDataSourcesDataPointChangesListCall {
  1800  	c.urlParams_.Set("limit", fmt.Sprint(limit))
  1801  	return c
  1802  }
  1803  
  1804  // PageToken sets the optional parameter "pageToken": The continuation token,
  1805  // which is used to page through large result sets. To get the next page of
  1806  // results, set this parameter to the value of nextPageToken from the previous
  1807  // response.
  1808  func (c *UsersDataSourcesDataPointChangesListCall) PageToken(pageToken string) *UsersDataSourcesDataPointChangesListCall {
  1809  	c.urlParams_.Set("pageToken", pageToken)
  1810  	return c
  1811  }
  1812  
  1813  // Fields allows partial responses to be retrieved. See
  1814  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1815  // details.
  1816  func (c *UsersDataSourcesDataPointChangesListCall) Fields(s ...googleapi.Field) *UsersDataSourcesDataPointChangesListCall {
  1817  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1818  	return c
  1819  }
  1820  
  1821  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  1822  // object's ETag matches the given value. This is useful for getting updates
  1823  // only after the object has changed since the last request.
  1824  func (c *UsersDataSourcesDataPointChangesListCall) IfNoneMatch(entityTag string) *UsersDataSourcesDataPointChangesListCall {
  1825  	c.ifNoneMatch_ = entityTag
  1826  	return c
  1827  }
  1828  
  1829  // Context sets the context to be used in this call's Do method.
  1830  func (c *UsersDataSourcesDataPointChangesListCall) Context(ctx context.Context) *UsersDataSourcesDataPointChangesListCall {
  1831  	c.ctx_ = ctx
  1832  	return c
  1833  }
  1834  
  1835  // Header returns a http.Header that can be modified by the caller to add
  1836  // headers to the request.
  1837  func (c *UsersDataSourcesDataPointChangesListCall) Header() http.Header {
  1838  	if c.header_ == nil {
  1839  		c.header_ = make(http.Header)
  1840  	}
  1841  	return c.header_
  1842  }
  1843  
  1844  func (c *UsersDataSourcesDataPointChangesListCall) doRequest(alt string) (*http.Response, error) {
  1845  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1846  	if c.ifNoneMatch_ != "" {
  1847  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1848  	}
  1849  	var body io.Reader = nil
  1850  	c.urlParams_.Set("alt", alt)
  1851  	c.urlParams_.Set("prettyPrint", "false")
  1852  	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/dataPointChanges")
  1853  	urls += "?" + c.urlParams_.Encode()
  1854  	req, err := http.NewRequest("GET", urls, body)
  1855  	if err != nil {
  1856  		return nil, err
  1857  	}
  1858  	req.Header = reqHeaders
  1859  	googleapi.Expand(req.URL, map[string]string{
  1860  		"userId":       c.userId,
  1861  		"dataSourceId": c.dataSourceId,
  1862  	})
  1863  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1864  }
  1865  
  1866  // Do executes the "fitness.users.dataSources.dataPointChanges.list" call.
  1867  // Any non-2xx status code is an error. Response headers are in either
  1868  // *ListDataPointChangesResponse.ServerResponse.Header or (if a response was
  1869  // returned at all) in error.(*googleapi.Error).Header. Use
  1870  // googleapi.IsNotModified to check whether the returned error was because
  1871  // http.StatusNotModified was returned.
  1872  func (c *UsersDataSourcesDataPointChangesListCall) Do(opts ...googleapi.CallOption) (*ListDataPointChangesResponse, error) {
  1873  	gensupport.SetOptions(c.urlParams_, opts...)
  1874  	res, err := c.doRequest("json")
  1875  	if res != nil && res.StatusCode == http.StatusNotModified {
  1876  		if res.Body != nil {
  1877  			res.Body.Close()
  1878  		}
  1879  		return nil, gensupport.WrapError(&googleapi.Error{
  1880  			Code:   res.StatusCode,
  1881  			Header: res.Header,
  1882  		})
  1883  	}
  1884  	if err != nil {
  1885  		return nil, err
  1886  	}
  1887  	defer googleapi.CloseBody(res)
  1888  	if err := googleapi.CheckResponse(res); err != nil {
  1889  		return nil, gensupport.WrapError(err)
  1890  	}
  1891  	ret := &ListDataPointChangesResponse{
  1892  		ServerResponse: googleapi.ServerResponse{
  1893  			Header:         res.Header,
  1894  			HTTPStatusCode: res.StatusCode,
  1895  		},
  1896  	}
  1897  	target := &ret
  1898  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1899  		return nil, err
  1900  	}
  1901  	return ret, nil
  1902  }
  1903  
  1904  // Pages invokes f for each page of results.
  1905  // A non-nil error returned from f will halt the iteration.
  1906  // The provided context supersedes any context provided to the Context method.
  1907  func (c *UsersDataSourcesDataPointChangesListCall) Pages(ctx context.Context, f func(*ListDataPointChangesResponse) error) error {
  1908  	c.ctx_ = ctx
  1909  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  1910  	for {
  1911  		x, err := c.Do()
  1912  		if err != nil {
  1913  			return err
  1914  		}
  1915  		if err := f(x); err != nil {
  1916  			return err
  1917  		}
  1918  		if x.NextPageToken == "" {
  1919  			return nil
  1920  		}
  1921  		c.PageToken(x.NextPageToken)
  1922  	}
  1923  }
  1924  
  1925  type UsersDataSourcesDatasetsDeleteCall struct {
  1926  	s            *Service
  1927  	userId       string
  1928  	dataSourceId string
  1929  	datasetId    string
  1930  	urlParams_   gensupport.URLParams
  1931  	ctx_         context.Context
  1932  	header_      http.Header
  1933  }
  1934  
  1935  // Delete: Performs an inclusive delete of all data points whose start and end
  1936  // times have any overlap with the time range specified by the dataset ID. For
  1937  // most data types, the entire data point will be deleted. For data types where
  1938  // the time span represents a consistent value (such as
  1939  // com.google.activity.segment), and a data point straddles either end point of
  1940  // the dataset, only the overlapping portion of the data point will be deleted.
  1941  //
  1942  //   - dataSourceId: The data stream ID of the data source that created the
  1943  //     dataset.
  1944  //   - datasetId: Dataset identifier that is a composite of the minimum data
  1945  //     point start time and maximum data point end time represented as
  1946  //     nanoseconds from the epoch. The ID is formatted like: "startTime-endTime"
  1947  //     where startTime and endTime are 64 bit integers.
  1948  //   - userId: Delete a dataset for the person identified. Use me to indicate the
  1949  //     authenticated user. Only me is supported at this time.
  1950  func (r *UsersDataSourcesDatasetsService) Delete(userId string, dataSourceId string, datasetId string) *UsersDataSourcesDatasetsDeleteCall {
  1951  	c := &UsersDataSourcesDatasetsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1952  	c.userId = userId
  1953  	c.dataSourceId = dataSourceId
  1954  	c.datasetId = datasetId
  1955  	return c
  1956  }
  1957  
  1958  // Fields allows partial responses to be retrieved. See
  1959  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  1960  // details.
  1961  func (c *UsersDataSourcesDatasetsDeleteCall) Fields(s ...googleapi.Field) *UsersDataSourcesDatasetsDeleteCall {
  1962  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1963  	return c
  1964  }
  1965  
  1966  // Context sets the context to be used in this call's Do method.
  1967  func (c *UsersDataSourcesDatasetsDeleteCall) Context(ctx context.Context) *UsersDataSourcesDatasetsDeleteCall {
  1968  	c.ctx_ = ctx
  1969  	return c
  1970  }
  1971  
  1972  // Header returns a http.Header that can be modified by the caller to add
  1973  // headers to the request.
  1974  func (c *UsersDataSourcesDatasetsDeleteCall) Header() http.Header {
  1975  	if c.header_ == nil {
  1976  		c.header_ = make(http.Header)
  1977  	}
  1978  	return c.header_
  1979  }
  1980  
  1981  func (c *UsersDataSourcesDatasetsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1982  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  1983  	var body io.Reader = nil
  1984  	c.urlParams_.Set("alt", alt)
  1985  	c.urlParams_.Set("prettyPrint", "false")
  1986  	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}")
  1987  	urls += "?" + c.urlParams_.Encode()
  1988  	req, err := http.NewRequest("DELETE", urls, body)
  1989  	if err != nil {
  1990  		return nil, err
  1991  	}
  1992  	req.Header = reqHeaders
  1993  	googleapi.Expand(req.URL, map[string]string{
  1994  		"userId":       c.userId,
  1995  		"dataSourceId": c.dataSourceId,
  1996  		"datasetId":    c.datasetId,
  1997  	})
  1998  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1999  }
  2000  
  2001  // Do executes the "fitness.users.dataSources.datasets.delete" call.
  2002  func (c *UsersDataSourcesDatasetsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2003  	gensupport.SetOptions(c.urlParams_, opts...)
  2004  	res, err := c.doRequest("json")
  2005  	if err != nil {
  2006  		return err
  2007  	}
  2008  	defer googleapi.CloseBody(res)
  2009  	if err := googleapi.CheckResponse(res); err != nil {
  2010  		return gensupport.WrapError(err)
  2011  	}
  2012  	return nil
  2013  }
  2014  
  2015  type UsersDataSourcesDatasetsGetCall struct {
  2016  	s            *Service
  2017  	userId       string
  2018  	dataSourceId string
  2019  	datasetId    string
  2020  	urlParams_   gensupport.URLParams
  2021  	ifNoneMatch_ string
  2022  	ctx_         context.Context
  2023  	header_      http.Header
  2024  }
  2025  
  2026  // Get: Returns a dataset containing all data points whose start and end times
  2027  // overlap with the specified range of the dataset minimum start time and
  2028  // maximum end time. Specifically, any data point whose start time is less than
  2029  // or equal to the dataset end time and whose end time is greater than or equal
  2030  // to the dataset start time.
  2031  //
  2032  //   - dataSourceId: The data stream ID of the data source that created the
  2033  //     dataset.
  2034  //   - datasetId: Dataset identifier that is a composite of the minimum data
  2035  //     point start time and maximum data point end time represented as
  2036  //     nanoseconds from the epoch. The ID is formatted like: "startTime-endTime"
  2037  //     where startTime and endTime are 64 bit integers.
  2038  //   - userId: Retrieve a dataset for the person identified. Use me to indicate
  2039  //     the authenticated user. Only me is supported at this time.
  2040  func (r *UsersDataSourcesDatasetsService) Get(userId string, dataSourceId string, datasetId string) *UsersDataSourcesDatasetsGetCall {
  2041  	c := &UsersDataSourcesDatasetsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2042  	c.userId = userId
  2043  	c.dataSourceId = dataSourceId
  2044  	c.datasetId = datasetId
  2045  	return c
  2046  }
  2047  
  2048  // Limit sets the optional parameter "limit": If specified, no more than this
  2049  // many data points will be included in the dataset. If there are more data
  2050  // points in the dataset, nextPageToken will be set in the dataset response.
  2051  // The limit is applied from the end of the time range. That is, if pageToken
  2052  // is absent, the limit most recent data points will be returned.
  2053  func (c *UsersDataSourcesDatasetsGetCall) Limit(limit int64) *UsersDataSourcesDatasetsGetCall {
  2054  	c.urlParams_.Set("limit", fmt.Sprint(limit))
  2055  	return c
  2056  }
  2057  
  2058  // PageToken sets the optional parameter "pageToken": The continuation token,
  2059  // which is used to page through large datasets. To get the next page of a
  2060  // dataset, set this parameter to the value of nextPageToken from the previous
  2061  // response. Each subsequent call will yield a partial dataset with data point
  2062  // end timestamps that are strictly smaller than those in the previous partial
  2063  // response.
  2064  func (c *UsersDataSourcesDatasetsGetCall) PageToken(pageToken string) *UsersDataSourcesDatasetsGetCall {
  2065  	c.urlParams_.Set("pageToken", pageToken)
  2066  	return c
  2067  }
  2068  
  2069  // Fields allows partial responses to be retrieved. See
  2070  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2071  // details.
  2072  func (c *UsersDataSourcesDatasetsGetCall) Fields(s ...googleapi.Field) *UsersDataSourcesDatasetsGetCall {
  2073  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2074  	return c
  2075  }
  2076  
  2077  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2078  // object's ETag matches the given value. This is useful for getting updates
  2079  // only after the object has changed since the last request.
  2080  func (c *UsersDataSourcesDatasetsGetCall) IfNoneMatch(entityTag string) *UsersDataSourcesDatasetsGetCall {
  2081  	c.ifNoneMatch_ = entityTag
  2082  	return c
  2083  }
  2084  
  2085  // Context sets the context to be used in this call's Do method.
  2086  func (c *UsersDataSourcesDatasetsGetCall) Context(ctx context.Context) *UsersDataSourcesDatasetsGetCall {
  2087  	c.ctx_ = ctx
  2088  	return c
  2089  }
  2090  
  2091  // Header returns a http.Header that can be modified by the caller to add
  2092  // headers to the request.
  2093  func (c *UsersDataSourcesDatasetsGetCall) Header() http.Header {
  2094  	if c.header_ == nil {
  2095  		c.header_ = make(http.Header)
  2096  	}
  2097  	return c.header_
  2098  }
  2099  
  2100  func (c *UsersDataSourcesDatasetsGetCall) doRequest(alt string) (*http.Response, error) {
  2101  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2102  	if c.ifNoneMatch_ != "" {
  2103  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2104  	}
  2105  	var body io.Reader = nil
  2106  	c.urlParams_.Set("alt", alt)
  2107  	c.urlParams_.Set("prettyPrint", "false")
  2108  	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}")
  2109  	urls += "?" + c.urlParams_.Encode()
  2110  	req, err := http.NewRequest("GET", urls, body)
  2111  	if err != nil {
  2112  		return nil, err
  2113  	}
  2114  	req.Header = reqHeaders
  2115  	googleapi.Expand(req.URL, map[string]string{
  2116  		"userId":       c.userId,
  2117  		"dataSourceId": c.dataSourceId,
  2118  		"datasetId":    c.datasetId,
  2119  	})
  2120  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2121  }
  2122  
  2123  // Do executes the "fitness.users.dataSources.datasets.get" call.
  2124  // Any non-2xx status code is an error. Response headers are in either
  2125  // *Dataset.ServerResponse.Header or (if a response was returned at all) in
  2126  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2127  // whether the returned error was because http.StatusNotModified was returned.
  2128  func (c *UsersDataSourcesDatasetsGetCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
  2129  	gensupport.SetOptions(c.urlParams_, opts...)
  2130  	res, err := c.doRequest("json")
  2131  	if res != nil && res.StatusCode == http.StatusNotModified {
  2132  		if res.Body != nil {
  2133  			res.Body.Close()
  2134  		}
  2135  		return nil, gensupport.WrapError(&googleapi.Error{
  2136  			Code:   res.StatusCode,
  2137  			Header: res.Header,
  2138  		})
  2139  	}
  2140  	if err != nil {
  2141  		return nil, err
  2142  	}
  2143  	defer googleapi.CloseBody(res)
  2144  	if err := googleapi.CheckResponse(res); err != nil {
  2145  		return nil, gensupport.WrapError(err)
  2146  	}
  2147  	ret := &Dataset{
  2148  		ServerResponse: googleapi.ServerResponse{
  2149  			Header:         res.Header,
  2150  			HTTPStatusCode: res.StatusCode,
  2151  		},
  2152  	}
  2153  	target := &ret
  2154  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2155  		return nil, err
  2156  	}
  2157  	return ret, nil
  2158  }
  2159  
  2160  // Pages invokes f for each page of results.
  2161  // A non-nil error returned from f will halt the iteration.
  2162  // The provided context supersedes any context provided to the Context method.
  2163  func (c *UsersDataSourcesDatasetsGetCall) Pages(ctx context.Context, f func(*Dataset) error) error {
  2164  	c.ctx_ = ctx
  2165  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  2166  	for {
  2167  		x, err := c.Do()
  2168  		if err != nil {
  2169  			return err
  2170  		}
  2171  		if err := f(x); err != nil {
  2172  			return err
  2173  		}
  2174  		if x.NextPageToken == "" {
  2175  			return nil
  2176  		}
  2177  		c.PageToken(x.NextPageToken)
  2178  	}
  2179  }
  2180  
  2181  type UsersDataSourcesDatasetsPatchCall struct {
  2182  	s            *Service
  2183  	userId       string
  2184  	dataSourceId string
  2185  	datasetId    string
  2186  	dataset      *Dataset
  2187  	urlParams_   gensupport.URLParams
  2188  	ctx_         context.Context
  2189  	header_      http.Header
  2190  }
  2191  
  2192  // Patch: Adds data points to a dataset. The dataset need not be previously
  2193  // created. All points within the given dataset will be returned with subsquent
  2194  // calls to retrieve this dataset. Data points can belong to more than one
  2195  // dataset. This method does not use patch semantics: the data points provided
  2196  // are merely inserted, with no existing data replaced.
  2197  //
  2198  //   - dataSourceId: The data stream ID of the data source that created the
  2199  //     dataset.
  2200  //   - datasetId: This field is not used, and can be safely omitted.
  2201  //   - userId: Patch a dataset for the person identified. Use me to indicate the
  2202  //     authenticated user. Only me is supported at this time.
  2203  func (r *UsersDataSourcesDatasetsService) Patch(userId string, dataSourceId string, datasetId string, dataset *Dataset) *UsersDataSourcesDatasetsPatchCall {
  2204  	c := &UsersDataSourcesDatasetsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2205  	c.userId = userId
  2206  	c.dataSourceId = dataSourceId
  2207  	c.datasetId = datasetId
  2208  	c.dataset = dataset
  2209  	return c
  2210  }
  2211  
  2212  // Fields allows partial responses to be retrieved. See
  2213  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2214  // details.
  2215  func (c *UsersDataSourcesDatasetsPatchCall) Fields(s ...googleapi.Field) *UsersDataSourcesDatasetsPatchCall {
  2216  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2217  	return c
  2218  }
  2219  
  2220  // Context sets the context to be used in this call's Do method.
  2221  func (c *UsersDataSourcesDatasetsPatchCall) Context(ctx context.Context) *UsersDataSourcesDatasetsPatchCall {
  2222  	c.ctx_ = ctx
  2223  	return c
  2224  }
  2225  
  2226  // Header returns a http.Header that can be modified by the caller to add
  2227  // headers to the request.
  2228  func (c *UsersDataSourcesDatasetsPatchCall) Header() http.Header {
  2229  	if c.header_ == nil {
  2230  		c.header_ = make(http.Header)
  2231  	}
  2232  	return c.header_
  2233  }
  2234  
  2235  func (c *UsersDataSourcesDatasetsPatchCall) doRequest(alt string) (*http.Response, error) {
  2236  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2237  	var body io.Reader = nil
  2238  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.dataset)
  2239  	if err != nil {
  2240  		return nil, err
  2241  	}
  2242  	c.urlParams_.Set("alt", alt)
  2243  	c.urlParams_.Set("prettyPrint", "false")
  2244  	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}")
  2245  	urls += "?" + c.urlParams_.Encode()
  2246  	req, err := http.NewRequest("PATCH", urls, body)
  2247  	if err != nil {
  2248  		return nil, err
  2249  	}
  2250  	req.Header = reqHeaders
  2251  	googleapi.Expand(req.URL, map[string]string{
  2252  		"userId":       c.userId,
  2253  		"dataSourceId": c.dataSourceId,
  2254  		"datasetId":    c.datasetId,
  2255  	})
  2256  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2257  }
  2258  
  2259  // Do executes the "fitness.users.dataSources.datasets.patch" call.
  2260  // Any non-2xx status code is an error. Response headers are in either
  2261  // *Dataset.ServerResponse.Header or (if a response was returned at all) in
  2262  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2263  // whether the returned error was because http.StatusNotModified was returned.
  2264  func (c *UsersDataSourcesDatasetsPatchCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
  2265  	gensupport.SetOptions(c.urlParams_, opts...)
  2266  	res, err := c.doRequest("json")
  2267  	if res != nil && res.StatusCode == http.StatusNotModified {
  2268  		if res.Body != nil {
  2269  			res.Body.Close()
  2270  		}
  2271  		return nil, gensupport.WrapError(&googleapi.Error{
  2272  			Code:   res.StatusCode,
  2273  			Header: res.Header,
  2274  		})
  2275  	}
  2276  	if err != nil {
  2277  		return nil, err
  2278  	}
  2279  	defer googleapi.CloseBody(res)
  2280  	if err := googleapi.CheckResponse(res); err != nil {
  2281  		return nil, gensupport.WrapError(err)
  2282  	}
  2283  	ret := &Dataset{
  2284  		ServerResponse: googleapi.ServerResponse{
  2285  			Header:         res.Header,
  2286  			HTTPStatusCode: res.StatusCode,
  2287  		},
  2288  	}
  2289  	target := &ret
  2290  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2291  		return nil, err
  2292  	}
  2293  	return ret, nil
  2294  }
  2295  
  2296  // Pages invokes f for each page of results.
  2297  // A non-nil error returned from f will halt the iteration.
  2298  // The provided context supersedes any context provided to the Context method.
  2299  func (c *UsersDataSourcesDatasetsPatchCall) Pages(ctx context.Context, f func(*Dataset) error) error {
  2300  	c.ctx_ = ctx
  2301  	defer func(pt string) { c.dataset.NextPageToken = pt }(c.dataset.NextPageToken)
  2302  	for {
  2303  		x, err := c.Do()
  2304  		if err != nil {
  2305  			return err
  2306  		}
  2307  		if err := f(x); err != nil {
  2308  			return err
  2309  		}
  2310  		if x.NextPageToken == "" {
  2311  			return nil
  2312  		}
  2313  		c.dataset.NextPageToken = x.NextPageToken
  2314  	}
  2315  }
  2316  
  2317  type UsersDatasetAggregateCall struct {
  2318  	s                *Service
  2319  	userId           string
  2320  	aggregaterequest *AggregateRequest
  2321  	urlParams_       gensupport.URLParams
  2322  	ctx_             context.Context
  2323  	header_          http.Header
  2324  }
  2325  
  2326  // Aggregate: Aggregates data of a certain type or stream into buckets divided
  2327  // by a given type of boundary. Multiple data sets of multiple types and from
  2328  // multiple sources can be aggregated into exactly one bucket type per request.
  2329  //
  2330  //   - userId: Aggregate data for the person identified. Use me to indicate the
  2331  //     authenticated user. Only me is supported at this time.
  2332  func (r *UsersDatasetService) Aggregate(userId string, aggregaterequest *AggregateRequest) *UsersDatasetAggregateCall {
  2333  	c := &UsersDatasetAggregateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2334  	c.userId = userId
  2335  	c.aggregaterequest = aggregaterequest
  2336  	return c
  2337  }
  2338  
  2339  // Fields allows partial responses to be retrieved. See
  2340  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2341  // details.
  2342  func (c *UsersDatasetAggregateCall) Fields(s ...googleapi.Field) *UsersDatasetAggregateCall {
  2343  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2344  	return c
  2345  }
  2346  
  2347  // Context sets the context to be used in this call's Do method.
  2348  func (c *UsersDatasetAggregateCall) Context(ctx context.Context) *UsersDatasetAggregateCall {
  2349  	c.ctx_ = ctx
  2350  	return c
  2351  }
  2352  
  2353  // Header returns a http.Header that can be modified by the caller to add
  2354  // headers to the request.
  2355  func (c *UsersDatasetAggregateCall) Header() http.Header {
  2356  	if c.header_ == nil {
  2357  		c.header_ = make(http.Header)
  2358  	}
  2359  	return c.header_
  2360  }
  2361  
  2362  func (c *UsersDatasetAggregateCall) doRequest(alt string) (*http.Response, error) {
  2363  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2364  	var body io.Reader = nil
  2365  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.aggregaterequest)
  2366  	if err != nil {
  2367  		return nil, err
  2368  	}
  2369  	c.urlParams_.Set("alt", alt)
  2370  	c.urlParams_.Set("prettyPrint", "false")
  2371  	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataset:aggregate")
  2372  	urls += "?" + c.urlParams_.Encode()
  2373  	req, err := http.NewRequest("POST", urls, body)
  2374  	if err != nil {
  2375  		return nil, err
  2376  	}
  2377  	req.Header = reqHeaders
  2378  	googleapi.Expand(req.URL, map[string]string{
  2379  		"userId": c.userId,
  2380  	})
  2381  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2382  }
  2383  
  2384  // Do executes the "fitness.users.dataset.aggregate" call.
  2385  // Any non-2xx status code is an error. Response headers are in either
  2386  // *AggregateResponse.ServerResponse.Header or (if a response was returned at
  2387  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2388  // check whether the returned error was because http.StatusNotModified was
  2389  // returned.
  2390  func (c *UsersDatasetAggregateCall) Do(opts ...googleapi.CallOption) (*AggregateResponse, error) {
  2391  	gensupport.SetOptions(c.urlParams_, opts...)
  2392  	res, err := c.doRequest("json")
  2393  	if res != nil && res.StatusCode == http.StatusNotModified {
  2394  		if res.Body != nil {
  2395  			res.Body.Close()
  2396  		}
  2397  		return nil, gensupport.WrapError(&googleapi.Error{
  2398  			Code:   res.StatusCode,
  2399  			Header: res.Header,
  2400  		})
  2401  	}
  2402  	if err != nil {
  2403  		return nil, err
  2404  	}
  2405  	defer googleapi.CloseBody(res)
  2406  	if err := googleapi.CheckResponse(res); err != nil {
  2407  		return nil, gensupport.WrapError(err)
  2408  	}
  2409  	ret := &AggregateResponse{
  2410  		ServerResponse: googleapi.ServerResponse{
  2411  			Header:         res.Header,
  2412  			HTTPStatusCode: res.StatusCode,
  2413  		},
  2414  	}
  2415  	target := &ret
  2416  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2417  		return nil, err
  2418  	}
  2419  	return ret, nil
  2420  }
  2421  
  2422  type UsersSessionsDeleteCall struct {
  2423  	s          *Service
  2424  	userId     string
  2425  	sessionId  string
  2426  	urlParams_ gensupport.URLParams
  2427  	ctx_       context.Context
  2428  	header_    http.Header
  2429  }
  2430  
  2431  // Delete: Deletes a session specified by the given session ID.
  2432  //
  2433  //   - sessionId: The ID of the session to be deleted.
  2434  //   - userId: Delete a session for the person identified. Use me to indicate the
  2435  //     authenticated user. Only me is supported at this time.
  2436  func (r *UsersSessionsService) Delete(userId string, sessionId string) *UsersSessionsDeleteCall {
  2437  	c := &UsersSessionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2438  	c.userId = userId
  2439  	c.sessionId = sessionId
  2440  	return c
  2441  }
  2442  
  2443  // Fields allows partial responses to be retrieved. See
  2444  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2445  // details.
  2446  func (c *UsersSessionsDeleteCall) Fields(s ...googleapi.Field) *UsersSessionsDeleteCall {
  2447  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2448  	return c
  2449  }
  2450  
  2451  // Context sets the context to be used in this call's Do method.
  2452  func (c *UsersSessionsDeleteCall) Context(ctx context.Context) *UsersSessionsDeleteCall {
  2453  	c.ctx_ = ctx
  2454  	return c
  2455  }
  2456  
  2457  // Header returns a http.Header that can be modified by the caller to add
  2458  // headers to the request.
  2459  func (c *UsersSessionsDeleteCall) Header() http.Header {
  2460  	if c.header_ == nil {
  2461  		c.header_ = make(http.Header)
  2462  	}
  2463  	return c.header_
  2464  }
  2465  
  2466  func (c *UsersSessionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2467  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2468  	var body io.Reader = nil
  2469  	c.urlParams_.Set("alt", alt)
  2470  	c.urlParams_.Set("prettyPrint", "false")
  2471  	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/sessions/{sessionId}")
  2472  	urls += "?" + c.urlParams_.Encode()
  2473  	req, err := http.NewRequest("DELETE", urls, body)
  2474  	if err != nil {
  2475  		return nil, err
  2476  	}
  2477  	req.Header = reqHeaders
  2478  	googleapi.Expand(req.URL, map[string]string{
  2479  		"userId":    c.userId,
  2480  		"sessionId": c.sessionId,
  2481  	})
  2482  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2483  }
  2484  
  2485  // Do executes the "fitness.users.sessions.delete" call.
  2486  func (c *UsersSessionsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2487  	gensupport.SetOptions(c.urlParams_, opts...)
  2488  	res, err := c.doRequest("json")
  2489  	if err != nil {
  2490  		return err
  2491  	}
  2492  	defer googleapi.CloseBody(res)
  2493  	if err := googleapi.CheckResponse(res); err != nil {
  2494  		return gensupport.WrapError(err)
  2495  	}
  2496  	return nil
  2497  }
  2498  
  2499  type UsersSessionsListCall struct {
  2500  	s            *Service
  2501  	userId       string
  2502  	urlParams_   gensupport.URLParams
  2503  	ifNoneMatch_ string
  2504  	ctx_         context.Context
  2505  	header_      http.Header
  2506  }
  2507  
  2508  // List: Lists sessions previously created.
  2509  //
  2510  //   - userId: List sessions for the person identified. Use me to indicate the
  2511  //     authenticated user. Only me is supported at this time.
  2512  func (r *UsersSessionsService) List(userId string) *UsersSessionsListCall {
  2513  	c := &UsersSessionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2514  	c.userId = userId
  2515  	return c
  2516  }
  2517  
  2518  // ActivityType sets the optional parameter "activityType": If non-empty, only
  2519  // sessions with these activity types should be returned.
  2520  func (c *UsersSessionsListCall) ActivityType(activityType ...int64) *UsersSessionsListCall {
  2521  	var activityType_ []string
  2522  	for _, v := range activityType {
  2523  		activityType_ = append(activityType_, fmt.Sprint(v))
  2524  	}
  2525  	c.urlParams_.SetMulti("activityType", activityType_)
  2526  	return c
  2527  }
  2528  
  2529  // EndTime sets the optional parameter "endTime": An RFC3339 timestamp. Only
  2530  // sessions ending between the start and end times will be included in the
  2531  // response. If this time is omitted but startTime is specified, all sessions
  2532  // from startTime to the end of time will be returned.
  2533  func (c *UsersSessionsListCall) EndTime(endTime string) *UsersSessionsListCall {
  2534  	c.urlParams_.Set("endTime", endTime)
  2535  	return c
  2536  }
  2537  
  2538  // IncludeDeleted sets the optional parameter "includeDeleted": If true, and if
  2539  // both startTime and endTime are omitted, session deletions will be returned.
  2540  func (c *UsersSessionsListCall) IncludeDeleted(includeDeleted bool) *UsersSessionsListCall {
  2541  	c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  2542  	return c
  2543  }
  2544  
  2545  // PageToken sets the optional parameter "pageToken": The continuation token,
  2546  // which is used for incremental syncing. To get the next batch of changes, set
  2547  // this parameter to the value of nextPageToken from the previous response. The
  2548  // page token is ignored if either start or end time is specified. If none of
  2549  // start time, end time, and the page token is specified, sessions modified in
  2550  // the last 30 days are returned.
  2551  func (c *UsersSessionsListCall) PageToken(pageToken string) *UsersSessionsListCall {
  2552  	c.urlParams_.Set("pageToken", pageToken)
  2553  	return c
  2554  }
  2555  
  2556  // StartTime sets the optional parameter "startTime": An RFC3339 timestamp.
  2557  // Only sessions ending between the start and end times will be included in the
  2558  // response. If this time is omitted but endTime is specified, all sessions
  2559  // from the start of time up to endTime will be returned.
  2560  func (c *UsersSessionsListCall) StartTime(startTime string) *UsersSessionsListCall {
  2561  	c.urlParams_.Set("startTime", startTime)
  2562  	return c
  2563  }
  2564  
  2565  // Fields allows partial responses to be retrieved. See
  2566  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2567  // details.
  2568  func (c *UsersSessionsListCall) Fields(s ...googleapi.Field) *UsersSessionsListCall {
  2569  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2570  	return c
  2571  }
  2572  
  2573  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2574  // object's ETag matches the given value. This is useful for getting updates
  2575  // only after the object has changed since the last request.
  2576  func (c *UsersSessionsListCall) IfNoneMatch(entityTag string) *UsersSessionsListCall {
  2577  	c.ifNoneMatch_ = entityTag
  2578  	return c
  2579  }
  2580  
  2581  // Context sets the context to be used in this call's Do method.
  2582  func (c *UsersSessionsListCall) Context(ctx context.Context) *UsersSessionsListCall {
  2583  	c.ctx_ = ctx
  2584  	return c
  2585  }
  2586  
  2587  // Header returns a http.Header that can be modified by the caller to add
  2588  // headers to the request.
  2589  func (c *UsersSessionsListCall) Header() http.Header {
  2590  	if c.header_ == nil {
  2591  		c.header_ = make(http.Header)
  2592  	}
  2593  	return c.header_
  2594  }
  2595  
  2596  func (c *UsersSessionsListCall) doRequest(alt string) (*http.Response, error) {
  2597  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2598  	if c.ifNoneMatch_ != "" {
  2599  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2600  	}
  2601  	var body io.Reader = nil
  2602  	c.urlParams_.Set("alt", alt)
  2603  	c.urlParams_.Set("prettyPrint", "false")
  2604  	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/sessions")
  2605  	urls += "?" + c.urlParams_.Encode()
  2606  	req, err := http.NewRequest("GET", urls, body)
  2607  	if err != nil {
  2608  		return nil, err
  2609  	}
  2610  	req.Header = reqHeaders
  2611  	googleapi.Expand(req.URL, map[string]string{
  2612  		"userId": c.userId,
  2613  	})
  2614  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2615  }
  2616  
  2617  // Do executes the "fitness.users.sessions.list" call.
  2618  // Any non-2xx status code is an error. Response headers are in either
  2619  // *ListSessionsResponse.ServerResponse.Header or (if a response was returned
  2620  // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2621  // check whether the returned error was because http.StatusNotModified was
  2622  // returned.
  2623  func (c *UsersSessionsListCall) Do(opts ...googleapi.CallOption) (*ListSessionsResponse, error) {
  2624  	gensupport.SetOptions(c.urlParams_, opts...)
  2625  	res, err := c.doRequest("json")
  2626  	if res != nil && res.StatusCode == http.StatusNotModified {
  2627  		if res.Body != nil {
  2628  			res.Body.Close()
  2629  		}
  2630  		return nil, gensupport.WrapError(&googleapi.Error{
  2631  			Code:   res.StatusCode,
  2632  			Header: res.Header,
  2633  		})
  2634  	}
  2635  	if err != nil {
  2636  		return nil, err
  2637  	}
  2638  	defer googleapi.CloseBody(res)
  2639  	if err := googleapi.CheckResponse(res); err != nil {
  2640  		return nil, gensupport.WrapError(err)
  2641  	}
  2642  	ret := &ListSessionsResponse{
  2643  		ServerResponse: googleapi.ServerResponse{
  2644  			Header:         res.Header,
  2645  			HTTPStatusCode: res.StatusCode,
  2646  		},
  2647  	}
  2648  	target := &ret
  2649  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2650  		return nil, err
  2651  	}
  2652  	return ret, nil
  2653  }
  2654  
  2655  // Pages invokes f for each page of results.
  2656  // A non-nil error returned from f will halt the iteration.
  2657  // The provided context supersedes any context provided to the Context method.
  2658  func (c *UsersSessionsListCall) Pages(ctx context.Context, f func(*ListSessionsResponse) error) error {
  2659  	c.ctx_ = ctx
  2660  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  2661  	for {
  2662  		x, err := c.Do()
  2663  		if err != nil {
  2664  			return err
  2665  		}
  2666  		if err := f(x); err != nil {
  2667  			return err
  2668  		}
  2669  		if x.NextPageToken == "" {
  2670  			return nil
  2671  		}
  2672  		c.PageToken(x.NextPageToken)
  2673  	}
  2674  }
  2675  
  2676  type UsersSessionsUpdateCall struct {
  2677  	s          *Service
  2678  	userId     string
  2679  	sessionId  string
  2680  	session    *Session
  2681  	urlParams_ gensupport.URLParams
  2682  	ctx_       context.Context
  2683  	header_    http.Header
  2684  }
  2685  
  2686  // Update: Updates or insert a given session.
  2687  //
  2688  //   - sessionId: The ID of the session to be created.
  2689  //   - userId: Create sessions for the person identified. Use me to indicate the
  2690  //     authenticated user. Only me is supported at this time.
  2691  func (r *UsersSessionsService) Update(userId string, sessionId string, session *Session) *UsersSessionsUpdateCall {
  2692  	c := &UsersSessionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2693  	c.userId = userId
  2694  	c.sessionId = sessionId
  2695  	c.session = session
  2696  	return c
  2697  }
  2698  
  2699  // Fields allows partial responses to be retrieved. See
  2700  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2701  // details.
  2702  func (c *UsersSessionsUpdateCall) Fields(s ...googleapi.Field) *UsersSessionsUpdateCall {
  2703  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2704  	return c
  2705  }
  2706  
  2707  // Context sets the context to be used in this call's Do method.
  2708  func (c *UsersSessionsUpdateCall) Context(ctx context.Context) *UsersSessionsUpdateCall {
  2709  	c.ctx_ = ctx
  2710  	return c
  2711  }
  2712  
  2713  // Header returns a http.Header that can be modified by the caller to add
  2714  // headers to the request.
  2715  func (c *UsersSessionsUpdateCall) Header() http.Header {
  2716  	if c.header_ == nil {
  2717  		c.header_ = make(http.Header)
  2718  	}
  2719  	return c.header_
  2720  }
  2721  
  2722  func (c *UsersSessionsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2723  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2724  	var body io.Reader = nil
  2725  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.session)
  2726  	if err != nil {
  2727  		return nil, err
  2728  	}
  2729  	c.urlParams_.Set("alt", alt)
  2730  	c.urlParams_.Set("prettyPrint", "false")
  2731  	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/sessions/{sessionId}")
  2732  	urls += "?" + c.urlParams_.Encode()
  2733  	req, err := http.NewRequest("PUT", urls, body)
  2734  	if err != nil {
  2735  		return nil, err
  2736  	}
  2737  	req.Header = reqHeaders
  2738  	googleapi.Expand(req.URL, map[string]string{
  2739  		"userId":    c.userId,
  2740  		"sessionId": c.sessionId,
  2741  	})
  2742  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2743  }
  2744  
  2745  // Do executes the "fitness.users.sessions.update" call.
  2746  // Any non-2xx status code is an error. Response headers are in either
  2747  // *Session.ServerResponse.Header or (if a response was returned at all) in
  2748  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2749  // whether the returned error was because http.StatusNotModified was returned.
  2750  func (c *UsersSessionsUpdateCall) Do(opts ...googleapi.CallOption) (*Session, error) {
  2751  	gensupport.SetOptions(c.urlParams_, opts...)
  2752  	res, err := c.doRequest("json")
  2753  	if res != nil && res.StatusCode == http.StatusNotModified {
  2754  		if res.Body != nil {
  2755  			res.Body.Close()
  2756  		}
  2757  		return nil, gensupport.WrapError(&googleapi.Error{
  2758  			Code:   res.StatusCode,
  2759  			Header: res.Header,
  2760  		})
  2761  	}
  2762  	if err != nil {
  2763  		return nil, err
  2764  	}
  2765  	defer googleapi.CloseBody(res)
  2766  	if err := googleapi.CheckResponse(res); err != nil {
  2767  		return nil, gensupport.WrapError(err)
  2768  	}
  2769  	ret := &Session{
  2770  		ServerResponse: googleapi.ServerResponse{
  2771  			Header:         res.Header,
  2772  			HTTPStatusCode: res.StatusCode,
  2773  		},
  2774  	}
  2775  	target := &ret
  2776  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2777  		return nil, err
  2778  	}
  2779  	return ret, nil
  2780  }
  2781  

View as plain text