| 1 |
// Copyright 2026 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 |
"log/slog" |
| 66 |
"net/http" |
| 67 |
"net/url" |
| 68 |
"strconv" |
| 69 |
"strings" |
| 70 |
|
| 71 |
"github.com/googleapis/gax-go/v2/internallog" |
| 72 |
googleapi "google.golang.org/api/googleapi" |
| 73 |
internal "google.golang.org/api/internal" |
| 74 |
gensupport "google.golang.org/api/internal/gensupport" |
| 75 |
option "google.golang.org/api/option" |
| 76 |
internaloption "google.golang.org/api/option/internaloption" |
| 77 |
htransport "google.golang.org/api/transport/http" |
| 78 |
) |
| 79 |
|
| 80 |
// Always reference these packages, just in case the auto-generated code |
| 81 |
// below doesn't. |
| 82 |
var _ = bytes.NewBuffer |
| 83 |
var _ = strconv.Itoa |
| 84 |
var _ = fmt.Sprintf |
| 85 |
var _ = json.NewDecoder |
| 86 |
var _ = io.Copy |
| 87 |
var _ = url.Parse |
| 88 |
var _ = gensupport.MarshalJSON |
| 89 |
var _ = googleapi.Version |
| 90 |
var _ = errors.New |
| 91 |
var _ = strings.Replace |
| 92 |
var _ = context.Canceled |
| 93 |
var _ = internaloption.WithDefaultEndpoint |
| 94 |
var _ = internal.Version |
| 95 |
var _ = internallog.New |
| 96 |
|
| 97 |
const apiId = "fitness:v1" |
| 98 |
const apiName = "fitness" |
| 99 |
const apiVersion = "v1" |
| 100 |
const basePath = "https://fitness.googleapis.com/fitness/v1/users/" |
| 101 |
const basePathTemplate = "https://fitness.UNIVERSE_DOMAIN/fitness/v1/users/" |
| 102 |
const mtlsBasePath = "https://fitness.mtls.googleapis.com/fitness/v1/users/" |
| 103 |
|
| 104 |
// OAuth2 scopes used by this API. |
| 105 |
const ( |
| 106 |
// Use Google Fit to see and store your physical activity data |
| 107 |
FitnessActivityReadScope = "https://www.googleapis.com/auth/fitness.activity.read" |
| 108 |
|
| 109 |
// Add to your Google Fit physical activity data |
| 110 |
FitnessActivityWriteScope = "https://www.googleapis.com/auth/fitness.activity.write" |
| 111 |
|
| 112 |
// See info about your blood glucose in Google Fit. I consent to Google sharing |
| 113 |
// my blood glucose information with this app. |
| 114 |
FitnessBloodGlucoseReadScope = "https://www.googleapis.com/auth/fitness.blood_glucose.read" |
| 115 |
|
| 116 |
// Add info about your blood glucose to Google Fit. I consent to Google using |
| 117 |
// my blood glucose information with this app. |
| 118 |
FitnessBloodGlucoseWriteScope = "https://www.googleapis.com/auth/fitness.blood_glucose.write" |
| 119 |
|
| 120 |
// See info about your blood pressure in Google Fit. I consent to Google |
| 121 |
// sharing my blood pressure information with this app. |
| 122 |
FitnessBloodPressureReadScope = "https://www.googleapis.com/auth/fitness.blood_pressure.read" |
| 123 |
|
| 124 |
// Add info about your blood pressure in Google Fit. I consent to Google using |
| 125 |
// my blood pressure information with this app. |
| 126 |
FitnessBloodPressureWriteScope = "https://www.googleapis.com/auth/fitness.blood_pressure.write" |
| 127 |
|
| 128 |
// See info about your body measurements in Google Fit |
| 129 |
FitnessBodyReadScope = "https://www.googleapis.com/auth/fitness.body.read" |
| 130 |
|
| 131 |
// Add info about your body measurements to Google Fit |
| 132 |
FitnessBodyWriteScope = "https://www.googleapis.com/auth/fitness.body.write" |
| 133 |
|
| 134 |
// See info about your body temperature in Google Fit. I consent to Google |
| 135 |
// sharing my body temperature information with this app. |
| 136 |
FitnessBodyTemperatureReadScope = "https://www.googleapis.com/auth/fitness.body_temperature.read" |
| 137 |
|
| 138 |
// Add to info about your body temperature in Google Fit. I consent to Google |
| 139 |
// using my body temperature information with this app. |
| 140 |
FitnessBodyTemperatureWriteScope = "https://www.googleapis.com/auth/fitness.body_temperature.write" |
| 141 |
|
| 142 |
// See your heart rate data in Google Fit. I consent to Google sharing my heart |
| 143 |
// rate information with this app. |
| 144 |
FitnessHeartRateReadScope = "https://www.googleapis.com/auth/fitness.heart_rate.read" |
| 145 |
|
| 146 |
// Add to your heart rate data in Google Fit. I consent to Google using my |
| 147 |
// heart rate information with this app. |
| 148 |
FitnessHeartRateWriteScope = "https://www.googleapis.com/auth/fitness.heart_rate.write" |
| 149 |
|
| 150 |
// See your Google Fit speed and distance data |
| 151 |
FitnessLocationReadScope = "https://www.googleapis.com/auth/fitness.location.read" |
| 152 |
|
| 153 |
// Add to your Google Fit location data |
| 154 |
FitnessLocationWriteScope = "https://www.googleapis.com/auth/fitness.location.write" |
| 155 |
|
| 156 |
// See info about your nutrition in Google Fit |
| 157 |
FitnessNutritionReadScope = "https://www.googleapis.com/auth/fitness.nutrition.read" |
| 158 |
|
| 159 |
// Add to info about your nutrition in Google Fit |
| 160 |
FitnessNutritionWriteScope = "https://www.googleapis.com/auth/fitness.nutrition.write" |
| 161 |
|
| 162 |
// See info about your oxygen saturation in Google Fit. I consent to Google |
| 163 |
// sharing my oxygen saturation information with this app. |
| 164 |
FitnessOxygenSaturationReadScope = "https://www.googleapis.com/auth/fitness.oxygen_saturation.read" |
| 165 |
|
| 166 |
// Add info about your oxygen saturation in Google Fit. I consent to Google |
| 167 |
// using my oxygen saturation information with this app. |
| 168 |
FitnessOxygenSaturationWriteScope = "https://www.googleapis.com/auth/fitness.oxygen_saturation.write" |
| 169 |
|
| 170 |
// See info about your reproductive health in Google Fit. I consent to Google |
| 171 |
// sharing my reproductive health information with this app. |
| 172 |
FitnessReproductiveHealthReadScope = "https://www.googleapis.com/auth/fitness.reproductive_health.read" |
| 173 |
|
| 174 |
// Add info about your reproductive health in Google Fit. I consent to Google |
| 175 |
// using my reproductive health information with this app. |
| 176 |
FitnessReproductiveHealthWriteScope = "https://www.googleapis.com/auth/fitness.reproductive_health.write" |
| 177 |
|
| 178 |
// See your sleep data in Google Fit. I consent to Google sharing my sleep |
| 179 |
// information with this app. |
| 180 |
FitnessSleepReadScope = "https://www.googleapis.com/auth/fitness.sleep.read" |
| 181 |
|
| 182 |
// Add to your sleep data in Google Fit. I consent to Google using my sleep |
| 183 |
// information with this app. |
| 184 |
FitnessSleepWriteScope = "https://www.googleapis.com/auth/fitness.sleep.write" |
| 185 |
) |
| 186 |
|
| 187 |
// NewService creates a new Service. |
| 188 |
func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { |
| 189 |
scopesOption := internaloption.WithDefaultScopes( |
| 190 |
"https://www.googleapis.com/auth/fitness.activity.read", |
| 191 |
"https://www.googleapis.com/auth/fitness.activity.write", |
| 192 |
"https://www.googleapis.com/auth/fitness.blood_glucose.read", |
| 193 |
"https://www.googleapis.com/auth/fitness.blood_glucose.write", |
| 194 |
"https://www.googleapis.com/auth/fitness.blood_pressure.read", |
| 195 |
"https://www.googleapis.com/auth/fitness.blood_pressure.write", |
| 196 |
"https://www.googleapis.com/auth/fitness.body.read", |
| 197 |
"https://www.googleapis.com/auth/fitness.body.write", |
| 198 |
"https://www.googleapis.com/auth/fitness.body_temperature.read", |
| 199 |
"https://www.googleapis.com/auth/fitness.body_temperature.write", |
| 200 |
"https://www.googleapis.com/auth/fitness.heart_rate.read", |
| 201 |
"https://www.googleapis.com/auth/fitness.heart_rate.write", |
| 202 |
"https://www.googleapis.com/auth/fitness.location.read", |
| 203 |
"https://www.googleapis.com/auth/fitness.location.write", |
| 204 |
"https://www.googleapis.com/auth/fitness.nutrition.read", |
| 205 |
"https://www.googleapis.com/auth/fitness.nutrition.write", |
| 206 |
"https://www.googleapis.com/auth/fitness.oxygen_saturation.read", |
| 207 |
"https://www.googleapis.com/auth/fitness.oxygen_saturation.write", |
| 208 |
"https://www.googleapis.com/auth/fitness.reproductive_health.read", |
| 209 |
"https://www.googleapis.com/auth/fitness.reproductive_health.write", |
| 210 |
"https://www.googleapis.com/auth/fitness.sleep.read", |
| 211 |
"https://www.googleapis.com/auth/fitness.sleep.write", |
| 212 |
) |
| 213 |
// NOTE: prepend, so we don't override user-specified scopes. |
| 214 |
opts = append([]option.ClientOption{scopesOption}, opts...) |
| 215 |
opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) |
| 216 |
opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate)) |
| 217 |
opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) |
| 218 |
opts = append(opts, internaloption.EnableNewAuthLibrary()) |
| 219 |
client, endpoint, err := htransport.NewClient(ctx, opts...) |
| 220 |
if err != nil { |
| 221 |
return nil, err |
| 222 |
} |
| 223 |
s := &Service{client: client, BasePath: basePath, logger: internaloption.GetLogger(opts)} |
| 224 |
s.Users = NewUsersService(s) |
| 225 |
if endpoint != "" { |
| 226 |
s.BasePath = endpoint |
| 227 |
} |
| 228 |
return s, nil |
| 229 |
} |
| 230 |
|
| 231 |
// New creates a new Service. It uses the provided http.Client for requests. |
| 232 |
// |
| 233 |
// Deprecated: please use NewService instead. |
| 234 |
// To provide a custom HTTP client, use option.WithHTTPClient. |
| 235 |
// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. |
| 236 |
func New(client *http.Client) (*Service, error) { |
| 237 |
if client == nil { |
| 238 |
return nil, errors.New("client is nil") |
| 239 |
} |
| 240 |
return NewService(context.TODO(), option.WithHTTPClient(client)) |
| 241 |
} |
| 242 |
|
| 243 |
type Service struct { |
| 244 |
client *http.Client |
| 245 |
logger *slog.Logger |
| 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 starting before endTime of the request and ending after |
| 1028 |
// startTime of the request up to (endTime of the request + 1 day). |
| 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 |
body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.datasource) |
| 1277 |
if err != nil { |
| 1278 |
return nil, err |
| 1279 |
} |
| 1280 |
c.urlParams_.Set("alt", alt) |
| 1281 |
c.urlParams_.Set("prettyPrint", "false") |
| 1282 |
urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources") |
| 1283 |
urls += "?" + c.urlParams_.Encode() |
| 1284 |
req, err := http.NewRequest("POST", urls, body) |
| 1285 |
if err != nil { |
| 1286 |
return nil, err |
| 1287 |
} |
| 1288 |
req.Header = reqHeaders |
| 1289 |
googleapi.Expand(req.URL, map[string]string{ |
| 1290 |
"userId": c.userId, |
| 1291 |
}) |
| 1292 |
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "fitness.users.dataSources.create", "request", internallog.HTTPRequest(req, body.Bytes())) |
| 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 |
b, err := gensupport.DecodeResponseBytes(target, res) |
| 1328 |
if err != nil { |
| 1329 |
return nil, err |
| 1330 |
} |
| 1331 |
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "fitness.users.dataSources.create", "response", internallog.HTTPResponse(res, b)) |
| 1332 |
return ret, nil |
| 1333 |
} |
| 1334 |
|
| 1335 |
type UsersDataSourcesDeleteCall struct { |
| 1336 |
s *Service |
| 1337 |
userId string |
| 1338 |
dataSourceId string |
| 1339 |
urlParams_ gensupport.URLParams |
| 1340 |
ctx_ context.Context |
| 1341 |
header_ http.Header |
| 1342 |
} |
| 1343 |
|
| 1344 |
// Delete: Deletes the specified data source. The request will fail if the data |
| 1345 |
// source contains any data points. |
| 1346 |
// |
| 1347 |
// - dataSourceId: The data stream ID of the data source to delete. |
| 1348 |
// - userId: Retrieve a data source for the person identified. Use me to |
| 1349 |
// indicate the authenticated user. Only me is supported at this time. |
| 1350 |
func (r *UsersDataSourcesService) Delete(userId string, dataSourceId string) *UsersDataSourcesDeleteCall { |
| 1351 |
c := &UsersDataSourcesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| 1352 |
c.userId = userId |
| 1353 |
c.dataSourceId = dataSourceId |
| 1354 |
return c |
| 1355 |
} |
| 1356 |
|
| 1357 |
// Fields allows partial responses to be retrieved. See |
| 1358 |
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| 1359 |
// details. |
| 1360 |
func (c *UsersDataSourcesDeleteCall) Fields(s ...googleapi.Field) *UsersDataSourcesDeleteCall { |
| 1361 |
c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| 1362 |
return c |
| 1363 |
} |
| 1364 |
|
| 1365 |
// Context sets the context to be used in this call's Do method. |
| 1366 |
func (c *UsersDataSourcesDeleteCall) Context(ctx context.Context) *UsersDataSourcesDeleteCall { |
| 1367 |
c.ctx_ = ctx |
| 1368 |
return c |
| 1369 |
} |
| 1370 |
|
| 1371 |
// Header returns a http.Header that can be modified by the caller to add |
| 1372 |
// headers to the request. |
| 1373 |
func (c *UsersDataSourcesDeleteCall) Header() http.Header { |
| 1374 |
if c.header_ == nil { |
| 1375 |
c.header_ = make(http.Header) |
| 1376 |
} |
| 1377 |
return c.header_ |
| 1378 |
} |
| 1379 |
|
| 1380 |
func (c *UsersDataSourcesDeleteCall) doRequest(alt string) (*http.Response, error) { |
| 1381 |
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| 1382 |
c.urlParams_.Set("alt", alt) |
| 1383 |
c.urlParams_.Set("prettyPrint", "false") |
| 1384 |
urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}") |
| 1385 |
urls += "?" + c.urlParams_.Encode() |
| 1386 |
req, err := http.NewRequest("DELETE", urls, nil) |
| 1387 |
if err != nil { |
| 1388 |
return nil, err |
| 1389 |
} |
| 1390 |
req.Header = reqHeaders |
| 1391 |
googleapi.Expand(req.URL, map[string]string{ |
| 1392 |
"userId": c.userId, |
| 1393 |
"dataSourceId": c.dataSourceId, |
| 1394 |
}) |
| 1395 |
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "fitness.users.dataSources.delete", "request", internallog.HTTPRequest(req, nil)) |
| 1396 |
return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| 1397 |
} |
| 1398 |
|
| 1399 |
// Do executes the "fitness.users.dataSources.delete" call. |
| 1400 |
// Any non-2xx status code is an error. Response headers are in either |
| 1401 |
// *DataSource.ServerResponse.Header or (if a response was returned at all) in |
| 1402 |
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check |
| 1403 |
// whether the returned error was because http.StatusNotModified was returned. |
| 1404 |
func (c *UsersDataSourcesDeleteCall) Do(opts ...googleapi.CallOption) (*DataSource, error) { |
| 1405 |
gensupport.SetOptions(c.urlParams_, opts...) |
| 1406 |
res, err := c.doRequest("json") |
| 1407 |
if res != nil && res.StatusCode == http.StatusNotModified { |
| 1408 |
if res.Body != nil { |
| 1409 |
res.Body.Close() |
| 1410 |
} |
| 1411 |
return nil, gensupport.WrapError(&googleapi.Error{ |
| 1412 |
Code: res.StatusCode, |
| 1413 |
Header: res.Header, |
| 1414 |
}) |
| 1415 |
} |
| 1416 |
if err != nil { |
| 1417 |
return nil, err |
| 1418 |
} |
| 1419 |
defer googleapi.CloseBody(res) |
| 1420 |
if err := googleapi.CheckResponse(res); err != nil { |
| 1421 |
return nil, gensupport.WrapError(err) |
| 1422 |
} |
| 1423 |
ret := &DataSource{ |
| 1424 |
ServerResponse: googleapi.ServerResponse{ |
| 1425 |
Header: res.Header, |
| 1426 |
HTTPStatusCode: res.StatusCode, |
| 1427 |
}, |
| 1428 |
} |
| 1429 |
target := &ret |
| 1430 |
b, err := gensupport.DecodeResponseBytes(target, res) |
| 1431 |
if err != nil { |
| 1432 |
return nil, err |
| 1433 |
} |
| 1434 |
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "fitness.users.dataSources.delete", "response", internallog.HTTPResponse(res, b)) |
| 1435 |
return ret, nil |
| 1436 |
} |
| 1437 |
|
| 1438 |
type UsersDataSourcesGetCall struct { |
| 1439 |
s *Service |
| 1440 |
userId string |
| 1441 |
dataSourceId string |
| 1442 |
urlParams_ gensupport.URLParams |
| 1443 |
ifNoneMatch_ string |
| 1444 |
ctx_ context.Context |
| 1445 |
header_ http.Header |
| 1446 |
} |
| 1447 |
|
| 1448 |
// Get: Returns the specified data source. |
| 1449 |
// |
| 1450 |
// - dataSourceId: The data stream ID of the data source to retrieve. |
| 1451 |
// - userId: Retrieve a data source for the person identified. Use me to |
| 1452 |
// indicate the authenticated user. Only me is supported at this time. |
| 1453 |
func (r *UsersDataSourcesService) Get(userId string, dataSourceId string) *UsersDataSourcesGetCall { |
| 1454 |
c := &UsersDataSourcesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| 1455 |
c.userId = userId |
| 1456 |
c.dataSourceId = dataSourceId |
| 1457 |
return c |
| 1458 |
} |
| 1459 |
|
| 1460 |
// Fields allows partial responses to be retrieved. See |
| 1461 |
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| 1462 |
// details. |
| 1463 |
func (c *UsersDataSourcesGetCall) Fields(s ...googleapi.Field) *UsersDataSourcesGetCall { |
| 1464 |
c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| 1465 |
return c |
| 1466 |
} |
| 1467 |
|
| 1468 |
// IfNoneMatch sets an optional parameter which makes the operation fail if the |
| 1469 |
// object's ETag matches the given value. This is useful for getting updates |
| 1470 |
// only after the object has changed since the last request. |
| 1471 |
func (c *UsersDataSourcesGetCall) IfNoneMatch(entityTag string) *UsersDataSourcesGetCall { |
| 1472 |
c.ifNoneMatch_ = entityTag |
| 1473 |
return c |
| 1474 |
} |
| 1475 |
|
| 1476 |
// Context sets the context to be used in this call's Do method. |
| 1477 |
func (c *UsersDataSourcesGetCall) Context(ctx context.Context) *UsersDataSourcesGetCall { |
| 1478 |
c.ctx_ = ctx |
| 1479 |
return c |
| 1480 |
} |
| 1481 |
|
| 1482 |
// Header returns a http.Header that can be modified by the caller to add |
| 1483 |
// headers to the request. |
| 1484 |
func (c *UsersDataSourcesGetCall) Header() http.Header { |
| 1485 |
if c.header_ == nil { |
| 1486 |
c.header_ = make(http.Header) |
| 1487 |
} |
| 1488 |
return c.header_ |
| 1489 |
} |
| 1490 |
|
| 1491 |
func (c *UsersDataSourcesGetCall) doRequest(alt string) (*http.Response, error) { |
| 1492 |
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| 1493 |
if c.ifNoneMatch_ != "" { |
| 1494 |
reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| 1495 |
} |
| 1496 |
c.urlParams_.Set("alt", alt) |
| 1497 |
c.urlParams_.Set("prettyPrint", "false") |
| 1498 |
urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}") |
| 1499 |
urls += "?" + c.urlParams_.Encode() |
| 1500 |
req, err := http.NewRequest("GET", urls, nil) |
| 1501 |
if err != nil { |
| 1502 |
return nil, err |
| 1503 |
} |
| 1504 |
req.Header = reqHeaders |
| 1505 |
googleapi.Expand(req.URL, map[string]string{ |
| 1506 |
"userId": c.userId, |
| 1507 |
"dataSourceId": c.dataSourceId, |
| 1508 |
}) |
| 1509 |
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "fitness.users.dataSources.get", "request", internallog.HTTPRequest(req, nil)) |
| 1510 |
return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| 1511 |
} |
| 1512 |
|
| 1513 |
// Do executes the "fitness.users.dataSources.get" call. |
| 1514 |
// Any non-2xx status code is an error. Response headers are in either |
| 1515 |
// *DataSource.ServerResponse.Header or (if a response was returned at all) in |
| 1516 |
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check |
| 1517 |
// whether the returned error was because http.StatusNotModified was returned. |
| 1518 |
func (c *UsersDataSourcesGetCall) Do(opts ...googleapi.CallOption) (*DataSource, error) { |
| 1519 |
gensupport.SetOptions(c.urlParams_, opts...) |
| 1520 |
res, err := c.doRequest("json") |
| 1521 |
if res != nil && res.StatusCode == http.StatusNotModified { |
| 1522 |
if res.Body != nil { |
| 1523 |
res.Body.Close() |
| 1524 |
} |
| 1525 |
return nil, gensupport.WrapError(&googleapi.Error{ |
| 1526 |
Code: res.StatusCode, |
| 1527 |
Header: res.Header, |
| 1528 |
}) |
| 1529 |
} |
| 1530 |
if err != nil { |
| 1531 |
return nil, err |
| 1532 |
} |
| 1533 |
defer googleapi.CloseBody(res) |
| 1534 |
if err := googleapi.CheckResponse(res); err != nil { |
| 1535 |
return nil, gensupport.WrapError(err) |
| 1536 |
} |
| 1537 |
ret := &DataSource{ |
| 1538 |
ServerResponse: googleapi.ServerResponse{ |
| 1539 |
Header: res.Header, |
| 1540 |
HTTPStatusCode: res.StatusCode, |
| 1541 |
}, |
| 1542 |
} |
| 1543 |
target := &ret |
| 1544 |
b, err := gensupport.DecodeResponseBytes(target, res) |
| 1545 |
if err != nil { |
| 1546 |
return nil, err |
| 1547 |
} |
| 1548 |
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "fitness.users.dataSources.get", "response", internallog.HTTPResponse(res, b)) |
| 1549 |
return ret, nil |
| 1550 |
} |
| 1551 |
|
| 1552 |
type UsersDataSourcesListCall struct { |
| 1553 |
s *Service |
| 1554 |
userId string |
| 1555 |
urlParams_ gensupport.URLParams |
| 1556 |
ifNoneMatch_ string |
| 1557 |
ctx_ context.Context |
| 1558 |
header_ http.Header |
| 1559 |
} |
| 1560 |
|
| 1561 |
// List: Lists all data sources that are visible to the developer, using the |
| 1562 |
// OAuth scopes provided. The list is not exhaustive; the user may have private |
| 1563 |
// data sources that are only visible to other developers, or calls using other |
| 1564 |
// scopes. |
| 1565 |
// |
| 1566 |
// - userId: List data sources for the person identified. Use me to indicate |
| 1567 |
// the authenticated user. Only me is supported at this time. |
| 1568 |
func (r *UsersDataSourcesService) List(userId string) *UsersDataSourcesListCall { |
| 1569 |
c := &UsersDataSourcesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| 1570 |
c.userId = userId |
| 1571 |
return c |
| 1572 |
} |
| 1573 |
|
| 1574 |
// DataTypeName sets the optional parameter "dataTypeName": The names of data |
| 1575 |
// types to include in the list. If not specified, all data sources will be |
| 1576 |
// returned. |
| 1577 |
func (c *UsersDataSourcesListCall) DataTypeName(dataTypeName ...string) *UsersDataSourcesListCall { |
| 1578 |
c.urlParams_.SetMulti("dataTypeName", append([]string{}, dataTypeName...)) |
| 1579 |
return c |
| 1580 |
} |
| 1581 |
|
| 1582 |
// Fields allows partial responses to be retrieved. See |
| 1583 |
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| 1584 |
// details. |
| 1585 |
func (c *UsersDataSourcesListCall) Fields(s ...googleapi.Field) *UsersDataSourcesListCall { |
| 1586 |
c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| 1587 |
return c |
| 1588 |
} |
| 1589 |
|
| 1590 |
// IfNoneMatch sets an optional parameter which makes the operation fail if the |
| 1591 |
// object's ETag matches the given value. This is useful for getting updates |
| 1592 |
// only after the object has changed since the last request. |
| 1593 |
func (c *UsersDataSourcesListCall) IfNoneMatch(entityTag string) *UsersDataSourcesListCall { |
| 1594 |
c.ifNoneMatch_ = entityTag |
| 1595 |
return c |
| 1596 |
} |
| 1597 |
|
| 1598 |
// Context sets the context to be used in this call's Do method. |
| 1599 |
func (c *UsersDataSourcesListCall) Context(ctx context.Context) *UsersDataSourcesListCall { |
| 1600 |
c.ctx_ = ctx |
| 1601 |
return c |
| 1602 |
} |
| 1603 |
|
| 1604 |
// Header returns a http.Header that can be modified by the caller to add |
| 1605 |
// headers to the request. |
| 1606 |
func (c *UsersDataSourcesListCall) Header() http.Header { |
| 1607 |
if c.header_ == nil { |
| 1608 |
c.header_ = make(http.Header) |
| 1609 |
} |
| 1610 |
return c.header_ |
| 1611 |
} |
| 1612 |
|
| 1613 |
func (c *UsersDataSourcesListCall) doRequest(alt string) (*http.Response, error) { |
| 1614 |
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| 1615 |
if c.ifNoneMatch_ != "" { |
| 1616 |
reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| 1617 |
} |
| 1618 |
c.urlParams_.Set("alt", alt) |
| 1619 |
c.urlParams_.Set("prettyPrint", "false") |
| 1620 |
urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources") |
| 1621 |
urls += "?" + c.urlParams_.Encode() |
| 1622 |
req, err := http.NewRequest("GET", urls, nil) |
| 1623 |
if err != nil { |
| 1624 |
return nil, err |
| 1625 |
} |
| 1626 |
req.Header = reqHeaders |
| 1627 |
googleapi.Expand(req.URL, map[string]string{ |
| 1628 |
"userId": c.userId, |
| 1629 |
}) |
| 1630 |
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "fitness.users.dataSources.list", "request", internallog.HTTPRequest(req, nil)) |
| 1631 |
return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| 1632 |
} |
| 1633 |
|
| 1634 |
// Do executes the "fitness.users.dataSources.list" call. |
| 1635 |
// Any non-2xx status code is an error. Response headers are in either |
| 1636 |
// *ListDataSourcesResponse.ServerResponse.Header or (if a response was |
| 1637 |
// returned at all) in error.(*googleapi.Error).Header. Use |
| 1638 |
// googleapi.IsNotModified to check whether the returned error was because |
| 1639 |
// http.StatusNotModified was returned. |
| 1640 |
func (c *UsersDataSourcesListCall) Do(opts ...googleapi.CallOption) (*ListDataSourcesResponse, error) { |
| 1641 |
gensupport.SetOptions(c.urlParams_, opts...) |
| 1642 |
res, err := c.doRequest("json") |
| 1643 |
if res != nil && res.StatusCode == http.StatusNotModified { |
| 1644 |
if res.Body != nil { |
| 1645 |
res.Body.Close() |
| 1646 |
} |
| 1647 |
return nil, gensupport.WrapError(&googleapi.Error{ |
| 1648 |
Code: res.StatusCode, |
| 1649 |
Header: res.Header, |
| 1650 |
}) |
| 1651 |
} |
| 1652 |
if err != nil { |
| 1653 |
return nil, err |
| 1654 |
} |
| 1655 |
defer googleapi.CloseBody(res) |
| 1656 |
if err := googleapi.CheckResponse(res); err != nil { |
| 1657 |
return nil, gensupport.WrapError(err) |
| 1658 |
} |
| 1659 |
ret := &ListDataSourcesResponse{ |
| 1660 |
ServerResponse: googleapi.ServerResponse{ |
| 1661 |
Header: res.Header, |
| 1662 |
HTTPStatusCode: res.StatusCode, |
| 1663 |
}, |
| 1664 |
} |
| 1665 |
target := &ret |
| 1666 |
b, err := gensupport.DecodeResponseBytes(target, res) |
| 1667 |
if err != nil { |
| 1668 |
return nil, err |
| 1669 |
} |
| 1670 |
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "fitness.users.dataSources.list", "response", internallog.HTTPResponse(res, b)) |
| 1671 |
return ret, nil |
| 1672 |
} |
| 1673 |
|
| 1674 |
type UsersDataSourcesUpdateCall struct { |
| 1675 |
s *Service |
| 1676 |
userId string |
| 1677 |
dataSourceId string |
| 1678 |
datasource *DataSource |
| 1679 |
urlParams_ gensupport.URLParams |
| 1680 |
ctx_ context.Context |
| 1681 |
header_ http.Header |
| 1682 |
} |
| 1683 |
|
| 1684 |
// Update: Updates the specified data source. The dataStreamId, dataType, type, |
| 1685 |
// dataStreamName, and device properties with the exception of version, cannot |
| 1686 |
// be modified. Data sources are identified by their dataStreamId. |
| 1687 |
// |
| 1688 |
// - dataSourceId: The data stream ID of the data source to update. |
| 1689 |
// - userId: Update the data source for the person identified. Use me to |
| 1690 |
// indicate the authenticated user. Only me is supported at this time. |
| 1691 |
func (r *UsersDataSourcesService) Update(userId string, dataSourceId string, datasource *DataSource) *UsersDataSourcesUpdateCall { |
| 1692 |
c := &UsersDataSourcesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| 1693 |
c.userId = userId |
| 1694 |
c.dataSourceId = dataSourceId |
| 1695 |
c.datasource = datasource |
| 1696 |
return c |
| 1697 |
} |
| 1698 |
|
| 1699 |
// Fields allows partial responses to be retrieved. See |
| 1700 |
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| 1701 |
// details. |
| 1702 |
func (c *UsersDataSourcesUpdateCall) Fields(s ...googleapi.Field) *UsersDataSourcesUpdateCall { |
| 1703 |
c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| 1704 |
return c |
| 1705 |
} |
| 1706 |
|
| 1707 |
// Context sets the context to be used in this call's Do method. |
| 1708 |
func (c *UsersDataSourcesUpdateCall) Context(ctx context.Context) *UsersDataSourcesUpdateCall { |
| 1709 |
c.ctx_ = ctx |
| 1710 |
return c |
| 1711 |
} |
| 1712 |
|
| 1713 |
// Header returns a http.Header that can be modified by the caller to add |
| 1714 |
// headers to the request. |
| 1715 |
func (c *UsersDataSourcesUpdateCall) Header() http.Header { |
| 1716 |
if c.header_ == nil { |
| 1717 |
c.header_ = make(http.Header) |
| 1718 |
} |
| 1719 |
return c.header_ |
| 1720 |
} |
| 1721 |
|
| 1722 |
func (c *UsersDataSourcesUpdateCall) doRequest(alt string) (*http.Response, error) { |
| 1723 |
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) |
| 1724 |
body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.datasource) |
| 1725 |
if err != nil { |
| 1726 |
return nil, err |
| 1727 |
} |
| 1728 |
c.urlParams_.Set("alt", alt) |
| 1729 |
c.urlParams_.Set("prettyPrint", "false") |
| 1730 |
urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}") |
| 1731 |
urls += "?" + c.urlParams_.Encode() |
| 1732 |
req, err := http.NewRequest("PUT", urls, body) |
| 1733 |
if err != nil { |
| 1734 |
return nil, err |
| 1735 |
} |
| 1736 |
req.Header = reqHeaders |
| 1737 |
googleapi.Expand(req.URL, map[string]string{ |
| 1738 |
"userId": c.userId, |
| 1739 |
"dataSourceId": c.dataSourceId, |
| 1740 |
}) |
| 1741 |
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "fitness.users.dataSources.update", "request", internallog.HTTPRequest(req, body.Bytes())) |
| 1742 |
return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| 1743 |
} |
| 1744 |
|
| 1745 |
// Do executes the "fitness.users.dataSources.update" call. |
| 1746 |
// Any non-2xx status code is an error. Response headers are in either |
| 1747 |
// *DataSource.ServerResponse.Header or (if a response was returned at all) in |
| 1748 |
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check |
| 1749 |
// whether the returned error was because http.StatusNotModified was returned. |
| 1750 |
func (c *UsersDataSourcesUpdateCall) Do(opts ...googleapi.CallOption) (*DataSource, error) { |
| 1751 |
gensupport.SetOptions(c.urlParams_, opts...) |
| 1752 |
res, err := c.doRequest("json") |
| 1753 |
if res != nil && res.StatusCode == http.StatusNotModified { |
| 1754 |
if res.Body != nil { |
| 1755 |
res.Body.Close() |
| 1756 |
} |
| 1757 |
return nil, gensupport.WrapError(&googleapi.Error{ |
| 1758 |
Code: res.StatusCode, |
| 1759 |
Header: res.Header, |
| 1760 |
}) |
| 1761 |
} |
| 1762 |
if err != nil { |
| 1763 |
return nil, err |
| 1764 |
} |
| 1765 |
defer googleapi.CloseBody(res) |
| 1766 |
if err := googleapi.CheckResponse(res); err != nil { |
| 1767 |
return nil, gensupport.WrapError(err) |
| 1768 |
} |
| 1769 |
ret := &DataSource{ |
| 1770 |
ServerResponse: googleapi.ServerResponse{ |
| 1771 |
Header: res.Header, |
| 1772 |
HTTPStatusCode: res.StatusCode, |
| 1773 |
}, |
| 1774 |
} |
| 1775 |
target := &ret |
| 1776 |
b, err := gensupport.DecodeResponseBytes(target, res) |
| 1777 |
if err != nil { |
| 1778 |
return nil, err |
| 1779 |
} |
| 1780 |
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "fitness.users.dataSources.update", "response", internallog.HTTPResponse(res, b)) |
| 1781 |
return ret, nil |
| 1782 |
} |
| 1783 |
|
| 1784 |
type UsersDataSourcesDataPointChangesListCall struct { |
| 1785 |
s *Service |
| 1786 |
userId string |
| 1787 |
dataSourceId string |
| 1788 |
urlParams_ gensupport.URLParams |
| 1789 |
ifNoneMatch_ string |
| 1790 |
ctx_ context.Context |
| 1791 |
header_ http.Header |
| 1792 |
} |
| 1793 |
|
| 1794 |
// List: Queries for user's data point changes for a particular data source. |
| 1795 |
// |
| 1796 |
// - dataSourceId: The data stream ID of the data source that created the |
| 1797 |
// dataset. |
| 1798 |
// - userId: List data points for the person identified. Use me to indicate the |
| 1799 |
// authenticated user. Only me is supported at this time. |
| 1800 |
func (r *UsersDataSourcesDataPointChangesService) List(userId string, dataSourceId string) *UsersDataSourcesDataPointChangesListCall { |
| 1801 |
c := &UsersDataSourcesDataPointChangesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| 1802 |
c.userId = userId |
| 1803 |
c.dataSourceId = dataSourceId |
| 1804 |
return c |
| 1805 |
} |
| 1806 |
|
| 1807 |
// Limit sets the optional parameter "limit": If specified, no more than this |
| 1808 |
// many data point changes will be included in the response. |
| 1809 |
func (c *UsersDataSourcesDataPointChangesListCall) Limit(limit int64) *UsersDataSourcesDataPointChangesListCall { |
| 1810 |
c.urlParams_.Set("limit", fmt.Sprint(limit)) |
| 1811 |
return c |
| 1812 |
} |
| 1813 |
|
| 1814 |
// PageToken sets the optional parameter "pageToken": The continuation token, |
| 1815 |
// which is used to page through large result sets. To get the next page of |
| 1816 |
// results, set this parameter to the value of nextPageToken from the previous |
| 1817 |
// response. |
| 1818 |
func (c *UsersDataSourcesDataPointChangesListCall) PageToken(pageToken string) *UsersDataSourcesDataPointChangesListCall { |
| 1819 |
c.urlParams_.Set("pageToken", pageToken) |
| 1820 |
return c |
| 1821 |
} |
| 1822 |
|
| 1823 |
// Fields allows partial responses to be retrieved. See |
| 1824 |
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| 1825 |
// details. |
| 1826 |
func (c *UsersDataSourcesDataPointChangesListCall) Fields(s ...googleapi.Field) *UsersDataSourcesDataPointChangesListCall { |
| 1827 |
c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| 1828 |
return c |
| 1829 |
} |
| 1830 |
|
| 1831 |
// IfNoneMatch sets an optional parameter which makes the operation fail if the |
| 1832 |
// object's ETag matches the given value. This is useful for getting updates |
| 1833 |
// only after the object has changed since the last request. |
| 1834 |
func (c *UsersDataSourcesDataPointChangesListCall) IfNoneMatch(entityTag string) *UsersDataSourcesDataPointChangesListCall { |
| 1835 |
c.ifNoneMatch_ = entityTag |
| 1836 |
return c |
| 1837 |
} |
| 1838 |
|
| 1839 |
// Context sets the context to be used in this call's Do method. |
| 1840 |
func (c *UsersDataSourcesDataPointChangesListCall) Context(ctx context.Context) *UsersDataSourcesDataPointChangesListCall { |
| 1841 |
c.ctx_ = ctx |
| 1842 |
return c |
| 1843 |
} |
| 1844 |
|
| 1845 |
// Header returns a http.Header that can be modified by the caller to add |
| 1846 |
// headers to the request. |
| 1847 |
func (c *UsersDataSourcesDataPointChangesListCall) Header() http.Header { |
| 1848 |
if c.header_ == nil { |
| 1849 |
c.header_ = make(http.Header) |
| 1850 |
} |
| 1851 |
return c.header_ |
| 1852 |
} |
| 1853 |
|
| 1854 |
func (c *UsersDataSourcesDataPointChangesListCall) doRequest(alt string) (*http.Response, error) { |
| 1855 |
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| 1856 |
if c.ifNoneMatch_ != "" { |
| 1857 |
reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| 1858 |
} |
| 1859 |
c.urlParams_.Set("alt", alt) |
| 1860 |
c.urlParams_.Set("prettyPrint", "false") |
| 1861 |
urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/dataPointChanges") |
| 1862 |
urls += "?" + c.urlParams_.Encode() |
| 1863 |
req, err := http.NewRequest("GET", urls, nil) |
| 1864 |
if err != nil { |
| 1865 |
return nil, err |
| 1866 |
} |
| 1867 |
req.Header = reqHeaders |
| 1868 |
googleapi.Expand(req.URL, map[string]string{ |
| 1869 |
"userId": c.userId, |
| 1870 |
"dataSourceId": c.dataSourceId, |
| 1871 |
}) |
| 1872 |
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "fitness.users.dataSources.dataPointChanges.list", "request", internallog.HTTPRequest(req, nil)) |
| 1873 |
return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| 1874 |
} |
| 1875 |
|
| 1876 |
// Do executes the "fitness.users.dataSources.dataPointChanges.list" call. |
| 1877 |
// Any non-2xx status code is an error. Response headers are in either |
| 1878 |
// *ListDataPointChangesResponse.ServerResponse.Header or (if a response was |
| 1879 |
// returned at all) in error.(*googleapi.Error).Header. Use |
| 1880 |
// googleapi.IsNotModified to check whether the returned error was because |
| 1881 |
// http.StatusNotModified was returned. |
| 1882 |
func (c *UsersDataSourcesDataPointChangesListCall) Do(opts ...googleapi.CallOption) (*ListDataPointChangesResponse, error) { |
| 1883 |
gensupport.SetOptions(c.urlParams_, opts...) |
| 1884 |
res, err := c.doRequest("json") |
| 1885 |
if res != nil && res.StatusCode == http.StatusNotModified { |
| 1886 |
if res.Body != nil { |
| 1887 |
res.Body.Close() |
| 1888 |
} |
| 1889 |
return nil, gensupport.WrapError(&googleapi.Error{ |
| 1890 |
Code: res.StatusCode, |
| 1891 |
Header: res.Header, |
| 1892 |
}) |
| 1893 |
} |
| 1894 |
if err != nil { |
| 1895 |
return nil, err |
| 1896 |
} |
| 1897 |
defer googleapi.CloseBody(res) |
| 1898 |
if err := googleapi.CheckResponse(res); err != nil { |
| 1899 |
return nil, gensupport.WrapError(err) |
| 1900 |
} |
| 1901 |
ret := &ListDataPointChangesResponse{ |
| 1902 |
ServerResponse: googleapi.ServerResponse{ |
| 1903 |
Header: res.Header, |
| 1904 |
HTTPStatusCode: res.StatusCode, |
| 1905 |
}, |
| 1906 |
} |
| 1907 |
target := &ret |
| 1908 |
b, err := gensupport.DecodeResponseBytes(target, res) |
| 1909 |
if err != nil { |
| 1910 |
return nil, err |
| 1911 |
} |
| 1912 |
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "fitness.users.dataSources.dataPointChanges.list", "response", internallog.HTTPResponse(res, b)) |
| 1913 |
return ret, nil |
| 1914 |
} |
| 1915 |
|
| 1916 |
// Pages invokes f for each page of results. |
| 1917 |
// A non-nil error returned from f will halt the iteration. |
| 1918 |
// The provided context supersedes any context provided to the Context method. |
| 1919 |
func (c *UsersDataSourcesDataPointChangesListCall) Pages(ctx context.Context, f func(*ListDataPointChangesResponse) error) error { |
| 1920 |
c.ctx_ = ctx |
| 1921 |
defer c.PageToken(c.urlParams_.Get("pageToken")) |
| 1922 |
for { |
| 1923 |
x, err := c.Do() |
| 1924 |
if err != nil { |
| 1925 |
return err |
| 1926 |
} |
| 1927 |
if err := f(x); err != nil { |
| 1928 |
return err |
| 1929 |
} |
| 1930 |
if x.NextPageToken == "" { |
| 1931 |
return nil |
| 1932 |
} |
| 1933 |
c.PageToken(x.NextPageToken) |
| 1934 |
} |
| 1935 |
} |
| 1936 |
|
| 1937 |
type UsersDataSourcesDatasetsDeleteCall struct { |
| 1938 |
s *Service |
| 1939 |
userId string |
| 1940 |
dataSourceId string |
| 1941 |
datasetId string |
| 1942 |
urlParams_ gensupport.URLParams |
| 1943 |
ctx_ context.Context |
| 1944 |
header_ http.Header |
| 1945 |
} |
| 1946 |
|
| 1947 |
// Delete: Performs an inclusive delete of all data points whose start and end |
| 1948 |
// times have any overlap with the time range specified by the dataset ID. For |
| 1949 |
// most data types, the entire data point will be deleted. For data types where |
| 1950 |
// the time span represents a consistent value (such as |
| 1951 |
// com.google.activity.segment), and a data point straddles either end point of |
| 1952 |
// the dataset, only the overlapping portion of the data point will be deleted. |
| 1953 |
// |
| 1954 |
// - dataSourceId: The data stream ID of the data source that created the |
| 1955 |
// dataset. |
| 1956 |
// - datasetId: Dataset identifier that is a composite of the minimum data |
| 1957 |
// point start time and maximum data point end time represented as |
| 1958 |
// nanoseconds from the epoch. The ID is formatted like: "startTime-endTime" |
| 1959 |
// where startTime and endTime are 64 bit integers. |
| 1960 |
// - userId: Delete a dataset for the person identified. Use me to indicate the |
| 1961 |
// authenticated user. Only me is supported at this time. |
| 1962 |
func (r *UsersDataSourcesDatasetsService) Delete(userId string, dataSourceId string, datasetId string) *UsersDataSourcesDatasetsDeleteCall { |
| 1963 |
c := &UsersDataSourcesDatasetsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| 1964 |
c.userId = userId |
| 1965 |
c.dataSourceId = dataSourceId |
| 1966 |
c.datasetId = datasetId |
| 1967 |
return c |
| 1968 |
} |
| 1969 |
|
| 1970 |
// Fields allows partial responses to be retrieved. See |
| 1971 |
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| 1972 |
// details. |
| 1973 |
func (c *UsersDataSourcesDatasetsDeleteCall) Fields(s ...googleapi.Field) *UsersDataSourcesDatasetsDeleteCall { |
| 1974 |
c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| 1975 |
return c |
| 1976 |
} |
| 1977 |
|
| 1978 |
// Context sets the context to be used in this call's Do method. |
| 1979 |
func (c *UsersDataSourcesDatasetsDeleteCall) Context(ctx context.Context) *UsersDataSourcesDatasetsDeleteCall { |
| 1980 |
c.ctx_ = ctx |
| 1981 |
return c |
| 1982 |
} |
| 1983 |
|
| 1984 |
// Header returns a http.Header that can be modified by the caller to add |
| 1985 |
// headers to the request. |
| 1986 |
func (c *UsersDataSourcesDatasetsDeleteCall) Header() http.Header { |
| 1987 |
if c.header_ == nil { |
| 1988 |
c.header_ = make(http.Header) |
| 1989 |
} |
| 1990 |
return c.header_ |
| 1991 |
} |
| 1992 |
|
| 1993 |
func (c *UsersDataSourcesDatasetsDeleteCall) doRequest(alt string) (*http.Response, error) { |
| 1994 |
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| 1995 |
c.urlParams_.Set("alt", alt) |
| 1996 |
c.urlParams_.Set("prettyPrint", "false") |
| 1997 |
urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}") |
| 1998 |
urls += "?" + c.urlParams_.Encode() |
| 1999 |
req, err := http.NewRequest("DELETE", urls, nil) |
| 2000 |
if err != nil { |
| 2001 |
return nil, err |
| 2002 |
} |
| 2003 |
req.Header = reqHeaders |
| 2004 |
googleapi.Expand(req.URL, map[string]string{ |
| 2005 |
"userId": c.userId, |
| 2006 |
"dataSourceId": c.dataSourceId, |
| 2007 |
"datasetId": c.datasetId, |
| 2008 |
}) |
| 2009 |
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "fitness.users.dataSources.datasets.delete", "request", internallog.HTTPRequest(req, nil)) |
| 2010 |
return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| 2011 |
} |
| 2012 |
|
| 2013 |
// Do executes the "fitness.users.dataSources.datasets.delete" call. |
| 2014 |
func (c *UsersDataSourcesDatasetsDeleteCall) Do(opts ...googleapi.CallOption) error { |
| 2015 |
gensupport.SetOptions(c.urlParams_, opts...) |
| 2016 |
res, err := c.doRequest("json") |
| 2017 |
if err != nil { |
| 2018 |
return err |
| 2019 |
} |
| 2020 |
defer googleapi.CloseBody(res) |
| 2021 |
if err := googleapi.CheckResponse(res); err != nil { |
| 2022 |
return gensupport.WrapError(err) |
| 2023 |
} |
| 2024 |
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "fitness.users.dataSources.datasets.delete", "response", internallog.HTTPResponse(res, nil)) |
| 2025 |
return nil |
| 2026 |
} |
| 2027 |
|
| 2028 |
type UsersDataSourcesDatasetsGetCall struct { |
| 2029 |
s *Service |
| 2030 |
userId string |
| 2031 |
dataSourceId string |
| 2032 |
datasetId string |
| 2033 |
urlParams_ gensupport.URLParams |
| 2034 |
ifNoneMatch_ string |
| 2035 |
ctx_ context.Context |
| 2036 |
header_ http.Header |
| 2037 |
} |
| 2038 |
|
| 2039 |
// Get: Returns a dataset containing all data points whose start and end times |
| 2040 |
// overlap with the specified range of the dataset minimum start time and |
| 2041 |
// maximum end time. Specifically, any data point whose start time is less than |
| 2042 |
// or equal to the dataset end time and whose end time is greater than or equal |
| 2043 |
// to the dataset start time. |
| 2044 |
// |
| 2045 |
// - dataSourceId: The data stream ID of the data source that created the |
| 2046 |
// dataset. |
| 2047 |
// - datasetId: Dataset identifier that is a composite of the minimum data |
| 2048 |
// point start time and maximum data point end time represented as |
| 2049 |
// nanoseconds from the epoch. The ID is formatted like: "startTime-endTime" |
| 2050 |
// where startTime and endTime are 64 bit integers. |
| 2051 |
// - userId: Retrieve a dataset for the person identified. Use me to indicate |
| 2052 |
// the authenticated user. Only me is supported at this time. |
| 2053 |
func (r *UsersDataSourcesDatasetsService) Get(userId string, dataSourceId string, datasetId string) *UsersDataSourcesDatasetsGetCall { |
| 2054 |
c := &UsersDataSourcesDatasetsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| 2055 |
c.userId = userId |
| 2056 |
c.dataSourceId = dataSourceId |
| 2057 |
c.datasetId = datasetId |
| 2058 |
return c |
| 2059 |
} |
| 2060 |
|
| 2061 |
// Limit sets the optional parameter "limit": If specified, no more than this |
| 2062 |
// many data points will be included in the dataset. If there are more data |
| 2063 |
// points in the dataset, nextPageToken will be set in the dataset response. |
| 2064 |
// The limit is applied from the end of the time range. That is, if pageToken |
| 2065 |
// is absent, the limit most recent data points will be returned. |
| 2066 |
func (c *UsersDataSourcesDatasetsGetCall) Limit(limit int64) *UsersDataSourcesDatasetsGetCall { |
| 2067 |
c.urlParams_.Set("limit", fmt.Sprint(limit)) |
| 2068 |
return c |
| 2069 |
} |
| 2070 |
|
| 2071 |
// PageToken sets the optional parameter "pageToken": The continuation token, |
| 2072 |
// which is used to page through large datasets. To get the next page of a |
| 2073 |
// dataset, set this parameter to the value of nextPageToken from the previous |
| 2074 |
// response. Each subsequent call will yield a partial dataset with data point |
| 2075 |
// end timestamps that are strictly smaller than those in the previous partial |
| 2076 |
// response. |
| 2077 |
func (c *UsersDataSourcesDatasetsGetCall) PageToken(pageToken string) *UsersDataSourcesDatasetsGetCall { |
| 2078 |
c.urlParams_.Set("pageToken", pageToken) |
| 2079 |
return c |
| 2080 |
} |
| 2081 |
|
| 2082 |
// Fields allows partial responses to be retrieved. See |
| 2083 |
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| 2084 |
// details. |
| 2085 |
func (c *UsersDataSourcesDatasetsGetCall) Fields(s ...googleapi.Field) *UsersDataSourcesDatasetsGetCall { |
| 2086 |
c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| 2087 |
return c |
| 2088 |
} |
| 2089 |
|
| 2090 |
// IfNoneMatch sets an optional parameter which makes the operation fail if the |
| 2091 |
// object's ETag matches the given value. This is useful for getting updates |
| 2092 |
// only after the object has changed since the last request. |
| 2093 |
func (c *UsersDataSourcesDatasetsGetCall) IfNoneMatch(entityTag string) *UsersDataSourcesDatasetsGetCall { |
| 2094 |
c.ifNoneMatch_ = entityTag |
| 2095 |
return c |
| 2096 |
} |
| 2097 |
|
| 2098 |
// Context sets the context to be used in this call's Do method. |
| 2099 |
func (c *UsersDataSourcesDatasetsGetCall) Context(ctx context.Context) *UsersDataSourcesDatasetsGetCall { |
| 2100 |
c.ctx_ = ctx |
| 2101 |
return c |
| 2102 |
} |
| 2103 |
|
| 2104 |
// Header returns a http.Header that can be modified by the caller to add |
| 2105 |
// headers to the request. |
| 2106 |
func (c *UsersDataSourcesDatasetsGetCall) Header() http.Header { |
| 2107 |
if c.header_ == nil { |
| 2108 |
c.header_ = make(http.Header) |
| 2109 |
} |
| 2110 |
return c.header_ |
| 2111 |
} |
| 2112 |
|
| 2113 |
func (c *UsersDataSourcesDatasetsGetCall) doRequest(alt string) (*http.Response, error) { |
| 2114 |
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| 2115 |
if c.ifNoneMatch_ != "" { |
| 2116 |
reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| 2117 |
} |
| 2118 |
c.urlParams_.Set("alt", alt) |
| 2119 |
c.urlParams_.Set("prettyPrint", "false") |
| 2120 |
urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}") |
| 2121 |
urls += "?" + c.urlParams_.Encode() |
| 2122 |
req, err := http.NewRequest("GET", urls, nil) |
| 2123 |
if err != nil { |
| 2124 |
return nil, err |
| 2125 |
} |
| 2126 |
req.Header = reqHeaders |
| 2127 |
googleapi.Expand(req.URL, map[string]string{ |
| 2128 |
"userId": c.userId, |
| 2129 |
"dataSourceId": c.dataSourceId, |
| 2130 |
"datasetId": c.datasetId, |
| 2131 |
}) |
| 2132 |
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "fitness.users.dataSources.datasets.get", "request", internallog.HTTPRequest(req, nil)) |
| 2133 |
return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| 2134 |
} |
| 2135 |
|
| 2136 |
// Do executes the "fitness.users.dataSources.datasets.get" call. |
| 2137 |
// Any non-2xx status code is an error. Response headers are in either |
| 2138 |
// *Dataset.ServerResponse.Header or (if a response was returned at all) in |
| 2139 |
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check |
| 2140 |
// whether the returned error was because http.StatusNotModified was returned. |
| 2141 |
func (c *UsersDataSourcesDatasetsGetCall) Do(opts ...googleapi.CallOption) (*Dataset, error) { |
| 2142 |
gensupport.SetOptions(c.urlParams_, opts...) |
| 2143 |
res, err := c.doRequest("json") |
| 2144 |
if res != nil && res.StatusCode == http.StatusNotModified { |
| 2145 |
if res.Body != nil { |
| 2146 |
res.Body.Close() |
| 2147 |
} |
| 2148 |
return nil, gensupport.WrapError(&googleapi.Error{ |
| 2149 |
Code: res.StatusCode, |
| 2150 |
Header: res.Header, |
| 2151 |
}) |
| 2152 |
} |
| 2153 |
if err != nil { |
| 2154 |
return nil, err |
| 2155 |
} |
| 2156 |
defer googleapi.CloseBody(res) |
| 2157 |
if err := googleapi.CheckResponse(res); err != nil { |
| 2158 |
return nil, gensupport.WrapError(err) |
| 2159 |
} |
| 2160 |
ret := &Dataset{ |
| 2161 |
ServerResponse: googleapi.ServerResponse{ |
| 2162 |
Header: res.Header, |
| 2163 |
HTTPStatusCode: res.StatusCode, |
| 2164 |
}, |
| 2165 |
} |
| 2166 |
target := &ret |
| 2167 |
b, err := gensupport.DecodeResponseBytes(target, res) |
| 2168 |
if err != nil { |
| 2169 |
return nil, err |
| 2170 |
} |
| 2171 |
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "fitness.users.dataSources.datasets.get", "response", internallog.HTTPResponse(res, b)) |
| 2172 |
return ret, nil |
| 2173 |
} |
| 2174 |
|
| 2175 |
// Pages invokes f for each page of results. |
| 2176 |
// A non-nil error returned from f will halt the iteration. |
| 2177 |
// The provided context supersedes any context provided to the Context method. |
| 2178 |
func (c *UsersDataSourcesDatasetsGetCall) Pages(ctx context.Context, f func(*Dataset) error) error { |
| 2179 |
c.ctx_ = ctx |
| 2180 |
defer c.PageToken(c.urlParams_.Get("pageToken")) |
| 2181 |
for { |
| 2182 |
x, err := c.Do() |
| 2183 |
if err != nil { |
| 2184 |
return err |
| 2185 |
} |
| 2186 |
if err := f(x); err != nil { |
| 2187 |
return err |
| 2188 |
} |
| 2189 |
if x.NextPageToken == "" { |
| 2190 |
return nil |
| 2191 |
} |
| 2192 |
c.PageToken(x.NextPageToken) |
| 2193 |
} |
| 2194 |
} |
| 2195 |
|
| 2196 |
type UsersDataSourcesDatasetsPatchCall struct { |
| 2197 |
s *Service |
| 2198 |
userId string |
| 2199 |
dataSourceId string |
| 2200 |
datasetId string |
| 2201 |
dataset *Dataset |
| 2202 |
urlParams_ gensupport.URLParams |
| 2203 |
ctx_ context.Context |
| 2204 |
header_ http.Header |
| 2205 |
} |
| 2206 |
|
| 2207 |
// Patch: Adds data points to a dataset. The dataset need not be previously |
| 2208 |
// created. All points within the given dataset will be returned with subsquent |
| 2209 |
// calls to retrieve this dataset. Data points can belong to more than one |
| 2210 |
// dataset. This method does not use patch semantics: the data points provided |
| 2211 |
// are merely inserted, with no existing data replaced. |
| 2212 |
// |
| 2213 |
// - dataSourceId: The data stream ID of the data source that created the |
| 2214 |
// dataset. |
| 2215 |
// - datasetId: This field is not used, and can be safely omitted. |
| 2216 |
// - userId: Patch a dataset for the person identified. Use me to indicate the |
| 2217 |
// authenticated user. Only me is supported at this time. |
| 2218 |
func (r *UsersDataSourcesDatasetsService) Patch(userId string, dataSourceId string, datasetId string, dataset *Dataset) *UsersDataSourcesDatasetsPatchCall { |
| 2219 |
c := &UsersDataSourcesDatasetsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| 2220 |
c.userId = userId |
| 2221 |
c.dataSourceId = dataSourceId |
| 2222 |
c.datasetId = datasetId |
| 2223 |
c.dataset = dataset |
| 2224 |
return c |
| 2225 |
} |
| 2226 |
|
| 2227 |
// Fields allows partial responses to be retrieved. See |
| 2228 |
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| 2229 |
// details. |
| 2230 |
func (c *UsersDataSourcesDatasetsPatchCall) Fields(s ...googleapi.Field) *UsersDataSourcesDatasetsPatchCall { |
| 2231 |
c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| 2232 |
return c |
| 2233 |
} |
| 2234 |
|
| 2235 |
// Context sets the context to be used in this call's Do method. |
| 2236 |
func (c *UsersDataSourcesDatasetsPatchCall) Context(ctx context.Context) *UsersDataSourcesDatasetsPatchCall { |
| 2237 |
c.ctx_ = ctx |
| 2238 |
return c |
| 2239 |
} |
| 2240 |
|
| 2241 |
// Header returns a http.Header that can be modified by the caller to add |
| 2242 |
// headers to the request. |
| 2243 |
func (c *UsersDataSourcesDatasetsPatchCall) Header() http.Header { |
| 2244 |
if c.header_ == nil { |
| 2245 |
c.header_ = make(http.Header) |
| 2246 |
} |
| 2247 |
return c.header_ |
| 2248 |
} |
| 2249 |
|
| 2250 |
func (c *UsersDataSourcesDatasetsPatchCall) doRequest(alt string) (*http.Response, error) { |
| 2251 |
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) |
| 2252 |
body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.dataset) |
| 2253 |
if err != nil { |
| 2254 |
return nil, err |
| 2255 |
} |
| 2256 |
c.urlParams_.Set("alt", alt) |
| 2257 |
c.urlParams_.Set("prettyPrint", "false") |
| 2258 |
urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataSources/{dataSourceId}/datasets/{datasetId}") |
| 2259 |
urls += "?" + c.urlParams_.Encode() |
| 2260 |
req, err := http.NewRequest("PATCH", urls, body) |
| 2261 |
if err != nil { |
| 2262 |
return nil, err |
| 2263 |
} |
| 2264 |
req.Header = reqHeaders |
| 2265 |
googleapi.Expand(req.URL, map[string]string{ |
| 2266 |
"userId": c.userId, |
| 2267 |
"dataSourceId": c.dataSourceId, |
| 2268 |
"datasetId": c.datasetId, |
| 2269 |
}) |
| 2270 |
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "fitness.users.dataSources.datasets.patch", "request", internallog.HTTPRequest(req, body.Bytes())) |
| 2271 |
return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| 2272 |
} |
| 2273 |
|
| 2274 |
// Do executes the "fitness.users.dataSources.datasets.patch" call. |
| 2275 |
// Any non-2xx status code is an error. Response headers are in either |
| 2276 |
// *Dataset.ServerResponse.Header or (if a response was returned at all) in |
| 2277 |
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check |
| 2278 |
// whether the returned error was because http.StatusNotModified was returned. |
| 2279 |
func (c *UsersDataSourcesDatasetsPatchCall) Do(opts ...googleapi.CallOption) (*Dataset, error) { |
| 2280 |
gensupport.SetOptions(c.urlParams_, opts...) |
| 2281 |
res, err := c.doRequest("json") |
| 2282 |
if res != nil && res.StatusCode == http.StatusNotModified { |
| 2283 |
if res.Body != nil { |
| 2284 |
res.Body.Close() |
| 2285 |
} |
| 2286 |
return nil, gensupport.WrapError(&googleapi.Error{ |
| 2287 |
Code: res.StatusCode, |
| 2288 |
Header: res.Header, |
| 2289 |
}) |
| 2290 |
} |
| 2291 |
if err != nil { |
| 2292 |
return nil, err |
| 2293 |
} |
| 2294 |
defer googleapi.CloseBody(res) |
| 2295 |
if err := googleapi.CheckResponse(res); err != nil { |
| 2296 |
return nil, gensupport.WrapError(err) |
| 2297 |
} |
| 2298 |
ret := &Dataset{ |
| 2299 |
ServerResponse: googleapi.ServerResponse{ |
| 2300 |
Header: res.Header, |
| 2301 |
HTTPStatusCode: res.StatusCode, |
| 2302 |
}, |
| 2303 |
} |
| 2304 |
target := &ret |
| 2305 |
b, err := gensupport.DecodeResponseBytes(target, res) |
| 2306 |
if err != nil { |
| 2307 |
return nil, err |
| 2308 |
} |
| 2309 |
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "fitness.users.dataSources.datasets.patch", "response", internallog.HTTPResponse(res, b)) |
| 2310 |
return ret, nil |
| 2311 |
} |
| 2312 |
|
| 2313 |
// Pages invokes f for each page of results. |
| 2314 |
// A non-nil error returned from f will halt the iteration. |
| 2315 |
// The provided context supersedes any context provided to the Context method. |
| 2316 |
func (c *UsersDataSourcesDatasetsPatchCall) Pages(ctx context.Context, f func(*Dataset) error) error { |
| 2317 |
c.ctx_ = ctx |
| 2318 |
defer func(pt string) { c.dataset.NextPageToken = pt }(c.dataset.NextPageToken) |
| 2319 |
for { |
| 2320 |
x, err := c.Do() |
| 2321 |
if err != nil { |
| 2322 |
return err |
| 2323 |
} |
| 2324 |
if err := f(x); err != nil { |
| 2325 |
return err |
| 2326 |
} |
| 2327 |
if x.NextPageToken == "" { |
| 2328 |
return nil |
| 2329 |
} |
| 2330 |
c.dataset.NextPageToken = x.NextPageToken |
| 2331 |
} |
| 2332 |
} |
| 2333 |
|
| 2334 |
type UsersDatasetAggregateCall struct { |
| 2335 |
s *Service |
| 2336 |
userId string |
| 2337 |
aggregaterequest *AggregateRequest |
| 2338 |
urlParams_ gensupport.URLParams |
| 2339 |
ctx_ context.Context |
| 2340 |
header_ http.Header |
| 2341 |
} |
| 2342 |
|
| 2343 |
// Aggregate: Aggregates data of a certain type or stream into buckets divided |
| 2344 |
// by a given type of boundary. Multiple data sets of multiple types and from |
| 2345 |
// multiple sources can be aggregated into exactly one bucket type per request. |
| 2346 |
// |
| 2347 |
// - userId: Aggregate data for the person identified. Use me to indicate the |
| 2348 |
// authenticated user. Only me is supported at this time. |
| 2349 |
func (r *UsersDatasetService) Aggregate(userId string, aggregaterequest *AggregateRequest) *UsersDatasetAggregateCall { |
| 2350 |
c := &UsersDatasetAggregateCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| 2351 |
c.userId = userId |
| 2352 |
c.aggregaterequest = aggregaterequest |
| 2353 |
return c |
| 2354 |
} |
| 2355 |
|
| 2356 |
// Fields allows partial responses to be retrieved. See |
| 2357 |
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| 2358 |
// details. |
| 2359 |
func (c *UsersDatasetAggregateCall) Fields(s ...googleapi.Field) *UsersDatasetAggregateCall { |
| 2360 |
c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| 2361 |
return c |
| 2362 |
} |
| 2363 |
|
| 2364 |
// Context sets the context to be used in this call's Do method. |
| 2365 |
func (c *UsersDatasetAggregateCall) Context(ctx context.Context) *UsersDatasetAggregateCall { |
| 2366 |
c.ctx_ = ctx |
| 2367 |
return c |
| 2368 |
} |
| 2369 |
|
| 2370 |
// Header returns a http.Header that can be modified by the caller to add |
| 2371 |
// headers to the request. |
| 2372 |
func (c *UsersDatasetAggregateCall) Header() http.Header { |
| 2373 |
if c.header_ == nil { |
| 2374 |
c.header_ = make(http.Header) |
| 2375 |
} |
| 2376 |
return c.header_ |
| 2377 |
} |
| 2378 |
|
| 2379 |
func (c *UsersDatasetAggregateCall) doRequest(alt string) (*http.Response, error) { |
| 2380 |
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) |
| 2381 |
body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.aggregaterequest) |
| 2382 |
if err != nil { |
| 2383 |
return nil, err |
| 2384 |
} |
| 2385 |
c.urlParams_.Set("alt", alt) |
| 2386 |
c.urlParams_.Set("prettyPrint", "false") |
| 2387 |
urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/dataset:aggregate") |
| 2388 |
urls += "?" + c.urlParams_.Encode() |
| 2389 |
req, err := http.NewRequest("POST", urls, body) |
| 2390 |
if err != nil { |
| 2391 |
return nil, err |
| 2392 |
} |
| 2393 |
req.Header = reqHeaders |
| 2394 |
googleapi.Expand(req.URL, map[string]string{ |
| 2395 |
"userId": c.userId, |
| 2396 |
}) |
| 2397 |
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "fitness.users.dataset.aggregate", "request", internallog.HTTPRequest(req, body.Bytes())) |
| 2398 |
return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| 2399 |
} |
| 2400 |
|
| 2401 |
// Do executes the "fitness.users.dataset.aggregate" call. |
| 2402 |
// Any non-2xx status code is an error. Response headers are in either |
| 2403 |
// *AggregateResponse.ServerResponse.Header or (if a response was returned at |
| 2404 |
// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to |
| 2405 |
// check whether the returned error was because http.StatusNotModified was |
| 2406 |
// returned. |
| 2407 |
func (c *UsersDatasetAggregateCall) Do(opts ...googleapi.CallOption) (*AggregateResponse, error) { |
| 2408 |
gensupport.SetOptions(c.urlParams_, opts...) |
| 2409 |
res, err := c.doRequest("json") |
| 2410 |
if res != nil && res.StatusCode == http.StatusNotModified { |
| 2411 |
if res.Body != nil { |
| 2412 |
res.Body.Close() |
| 2413 |
} |
| 2414 |
return nil, gensupport.WrapError(&googleapi.Error{ |
| 2415 |
Code: res.StatusCode, |
| 2416 |
Header: res.Header, |
| 2417 |
}) |
| 2418 |
} |
| 2419 |
if err != nil { |
| 2420 |
return nil, err |
| 2421 |
} |
| 2422 |
defer googleapi.CloseBody(res) |
| 2423 |
if err := googleapi.CheckResponse(res); err != nil { |
| 2424 |
return nil, gensupport.WrapError(err) |
| 2425 |
} |
| 2426 |
ret := &AggregateResponse{ |
| 2427 |
ServerResponse: googleapi.ServerResponse{ |
| 2428 |
Header: res.Header, |
| 2429 |
HTTPStatusCode: res.StatusCode, |
| 2430 |
}, |
| 2431 |
} |
| 2432 |
target := &ret |
| 2433 |
b, err := gensupport.DecodeResponseBytes(target, res) |
| 2434 |
if err != nil { |
| 2435 |
return nil, err |
| 2436 |
} |
| 2437 |
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "fitness.users.dataset.aggregate", "response", internallog.HTTPResponse(res, b)) |
| 2438 |
return ret, nil |
| 2439 |
} |
| 2440 |
|
| 2441 |
type UsersSessionsDeleteCall struct { |
| 2442 |
s *Service |
| 2443 |
userId string |
| 2444 |
sessionId string |
| 2445 |
urlParams_ gensupport.URLParams |
| 2446 |
ctx_ context.Context |
| 2447 |
header_ http.Header |
| 2448 |
} |
| 2449 |
|
| 2450 |
// Delete: Deletes a session specified by the given session ID. |
| 2451 |
// |
| 2452 |
// - sessionId: The ID of the session to be deleted. |
| 2453 |
// - userId: Delete a session for the person identified. Use me to indicate the |
| 2454 |
// authenticated user. Only me is supported at this time. |
| 2455 |
func (r *UsersSessionsService) Delete(userId string, sessionId string) *UsersSessionsDeleteCall { |
| 2456 |
c := &UsersSessionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| 2457 |
c.userId = userId |
| 2458 |
c.sessionId = sessionId |
| 2459 |
return c |
| 2460 |
} |
| 2461 |
|
| 2462 |
// Fields allows partial responses to be retrieved. See |
| 2463 |
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| 2464 |
// details. |
| 2465 |
func (c *UsersSessionsDeleteCall) Fields(s ...googleapi.Field) *UsersSessionsDeleteCall { |
| 2466 |
c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| 2467 |
return c |
| 2468 |
} |
| 2469 |
|
| 2470 |
// Context sets the context to be used in this call's Do method. |
| 2471 |
func (c *UsersSessionsDeleteCall) Context(ctx context.Context) *UsersSessionsDeleteCall { |
| 2472 |
c.ctx_ = ctx |
| 2473 |
return c |
| 2474 |
} |
| 2475 |
|
| 2476 |
// Header returns a http.Header that can be modified by the caller to add |
| 2477 |
// headers to the request. |
| 2478 |
func (c *UsersSessionsDeleteCall) Header() http.Header { |
| 2479 |
if c.header_ == nil { |
| 2480 |
c.header_ = make(http.Header) |
| 2481 |
} |
| 2482 |
return c.header_ |
| 2483 |
} |
| 2484 |
|
| 2485 |
func (c *UsersSessionsDeleteCall) doRequest(alt string) (*http.Response, error) { |
| 2486 |
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| 2487 |
c.urlParams_.Set("alt", alt) |
| 2488 |
c.urlParams_.Set("prettyPrint", "false") |
| 2489 |
urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/sessions/{sessionId}") |
| 2490 |
urls += "?" + c.urlParams_.Encode() |
| 2491 |
req, err := http.NewRequest("DELETE", urls, nil) |
| 2492 |
if err != nil { |
| 2493 |
return nil, err |
| 2494 |
} |
| 2495 |
req.Header = reqHeaders |
| 2496 |
googleapi.Expand(req.URL, map[string]string{ |
| 2497 |
"userId": c.userId, |
| 2498 |
"sessionId": c.sessionId, |
| 2499 |
}) |
| 2500 |
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "fitness.users.sessions.delete", "request", internallog.HTTPRequest(req, nil)) |
| 2501 |
return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| 2502 |
} |
| 2503 |
|
| 2504 |
// Do executes the "fitness.users.sessions.delete" call. |
| 2505 |
func (c *UsersSessionsDeleteCall) Do(opts ...googleapi.CallOption) error { |
| 2506 |
gensupport.SetOptions(c.urlParams_, opts...) |
| 2507 |
res, err := c.doRequest("json") |
| 2508 |
if err != nil { |
| 2509 |
return err |
| 2510 |
} |
| 2511 |
defer googleapi.CloseBody(res) |
| 2512 |
if err := googleapi.CheckResponse(res); err != nil { |
| 2513 |
return gensupport.WrapError(err) |
| 2514 |
} |
| 2515 |
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "fitness.users.sessions.delete", "response", internallog.HTTPResponse(res, nil)) |
| 2516 |
return nil |
| 2517 |
} |
| 2518 |
|
| 2519 |
type UsersSessionsListCall struct { |
| 2520 |
s *Service |
| 2521 |
userId string |
| 2522 |
urlParams_ gensupport.URLParams |
| 2523 |
ifNoneMatch_ string |
| 2524 |
ctx_ context.Context |
| 2525 |
header_ http.Header |
| 2526 |
} |
| 2527 |
|
| 2528 |
// List: Lists sessions previously created. |
| 2529 |
// |
| 2530 |
// - userId: List sessions for the person identified. Use me to indicate the |
| 2531 |
// authenticated user. Only me is supported at this time. |
| 2532 |
func (r *UsersSessionsService) List(userId string) *UsersSessionsListCall { |
| 2533 |
c := &UsersSessionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| 2534 |
c.userId = userId |
| 2535 |
return c |
| 2536 |
} |
| 2537 |
|
| 2538 |
// ActivityType sets the optional parameter "activityType": If non-empty, only |
| 2539 |
// sessions with these activity types should be returned. |
| 2540 |
func (c *UsersSessionsListCall) ActivityType(activityType ...int64) *UsersSessionsListCall { |
| 2541 |
var activityType_ []string |
| 2542 |
for _, v := range activityType { |
| 2543 |
activityType_ = append(activityType_, fmt.Sprint(v)) |
| 2544 |
} |
| 2545 |
c.urlParams_.SetMulti("activityType", activityType_) |
| 2546 |
return c |
| 2547 |
} |
| 2548 |
|
| 2549 |
// EndTime sets the optional parameter "endTime": An RFC3339 timestamp. Only |
| 2550 |
// sessions starting before endTime and ending after startTime up to (endTime + |
| 2551 |
// 1 day) will be included in the response. If this time is omitted but |
| 2552 |
// startTime is specified, all sessions ending after startTime to the end of |
| 2553 |
// time will be returned. |
| 2554 |
func (c *UsersSessionsListCall) EndTime(endTime string) *UsersSessionsListCall { |
| 2555 |
c.urlParams_.Set("endTime", endTime) |
| 2556 |
return c |
| 2557 |
} |
| 2558 |
|
| 2559 |
// IncludeDeleted sets the optional parameter "includeDeleted": If true, and if |
| 2560 |
// both startTime and endTime are omitted, session deletions will be returned. |
| 2561 |
func (c *UsersSessionsListCall) IncludeDeleted(includeDeleted bool) *UsersSessionsListCall { |
| 2562 |
c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted)) |
| 2563 |
return c |
| 2564 |
} |
| 2565 |
|
| 2566 |
// PageToken sets the optional parameter "pageToken": The continuation token, |
| 2567 |
// which is used for incremental syncing. To get the next batch of changes, set |
| 2568 |
// this parameter to the value of nextPageToken from the previous response. The |
| 2569 |
// page token is ignored if either start or end time is specified. If none of |
| 2570 |
// start time, end time, and the page token is specified, sessions modified in |
| 2571 |
// the last 30 days are returned. |
| 2572 |
func (c *UsersSessionsListCall) PageToken(pageToken string) *UsersSessionsListCall { |
| 2573 |
c.urlParams_.Set("pageToken", pageToken) |
| 2574 |
return c |
| 2575 |
} |
| 2576 |
|
| 2577 |
// StartTime sets the optional parameter "startTime": An RFC3339 timestamp. |
| 2578 |
// Only sessions starting before endTime and ending after startTime up to |
| 2579 |
// (endTime + 1 day) will be included in the response. If this time is omitted |
| 2580 |
// but endTime is specified, all sessions starting before endTime and ending |
| 2581 |
// after the start of time up to (endTime + 1 day) will be returned. |
| 2582 |
func (c *UsersSessionsListCall) StartTime(startTime string) *UsersSessionsListCall { |
| 2583 |
c.urlParams_.Set("startTime", startTime) |
| 2584 |
return c |
| 2585 |
} |
| 2586 |
|
| 2587 |
// Fields allows partial responses to be retrieved. See |
| 2588 |
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| 2589 |
// details. |
| 2590 |
func (c *UsersSessionsListCall) Fields(s ...googleapi.Field) *UsersSessionsListCall { |
| 2591 |
c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| 2592 |
return c |
| 2593 |
} |
| 2594 |
|
| 2595 |
// IfNoneMatch sets an optional parameter which makes the operation fail if the |
| 2596 |
// object's ETag matches the given value. This is useful for getting updates |
| 2597 |
// only after the object has changed since the last request. |
| 2598 |
func (c *UsersSessionsListCall) IfNoneMatch(entityTag string) *UsersSessionsListCall { |
| 2599 |
c.ifNoneMatch_ = entityTag |
| 2600 |
return c |
| 2601 |
} |
| 2602 |
|
| 2603 |
// Context sets the context to be used in this call's Do method. |
| 2604 |
func (c *UsersSessionsListCall) Context(ctx context.Context) *UsersSessionsListCall { |
| 2605 |
c.ctx_ = ctx |
| 2606 |
return c |
| 2607 |
} |
| 2608 |
|
| 2609 |
// Header returns a http.Header that can be modified by the caller to add |
| 2610 |
// headers to the request. |
| 2611 |
func (c *UsersSessionsListCall) Header() http.Header { |
| 2612 |
if c.header_ == nil { |
| 2613 |
c.header_ = make(http.Header) |
| 2614 |
} |
| 2615 |
return c.header_ |
| 2616 |
} |
| 2617 |
|
| 2618 |
func (c *UsersSessionsListCall) doRequest(alt string) (*http.Response, error) { |
| 2619 |
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_) |
| 2620 |
if c.ifNoneMatch_ != "" { |
| 2621 |
reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| 2622 |
} |
| 2623 |
c.urlParams_.Set("alt", alt) |
| 2624 |
c.urlParams_.Set("prettyPrint", "false") |
| 2625 |
urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/sessions") |
| 2626 |
urls += "?" + c.urlParams_.Encode() |
| 2627 |
req, err := http.NewRequest("GET", urls, nil) |
| 2628 |
if err != nil { |
| 2629 |
return nil, err |
| 2630 |
} |
| 2631 |
req.Header = reqHeaders |
| 2632 |
googleapi.Expand(req.URL, map[string]string{ |
| 2633 |
"userId": c.userId, |
| 2634 |
}) |
| 2635 |
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "fitness.users.sessions.list", "request", internallog.HTTPRequest(req, nil)) |
| 2636 |
return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| 2637 |
} |
| 2638 |
|
| 2639 |
// Do executes the "fitness.users.sessions.list" call. |
| 2640 |
// Any non-2xx status code is an error. Response headers are in either |
| 2641 |
// *ListSessionsResponse.ServerResponse.Header or (if a response was returned |
| 2642 |
// at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to |
| 2643 |
// check whether the returned error was because http.StatusNotModified was |
| 2644 |
// returned. |
| 2645 |
func (c *UsersSessionsListCall) Do(opts ...googleapi.CallOption) (*ListSessionsResponse, error) { |
| 2646 |
gensupport.SetOptions(c.urlParams_, opts...) |
| 2647 |
res, err := c.doRequest("json") |
| 2648 |
if res != nil && res.StatusCode == http.StatusNotModified { |
| 2649 |
if res.Body != nil { |
| 2650 |
res.Body.Close() |
| 2651 |
} |
| 2652 |
return nil, gensupport.WrapError(&googleapi.Error{ |
| 2653 |
Code: res.StatusCode, |
| 2654 |
Header: res.Header, |
| 2655 |
}) |
| 2656 |
} |
| 2657 |
if err != nil { |
| 2658 |
return nil, err |
| 2659 |
} |
| 2660 |
defer googleapi.CloseBody(res) |
| 2661 |
if err := googleapi.CheckResponse(res); err != nil { |
| 2662 |
return nil, gensupport.WrapError(err) |
| 2663 |
} |
| 2664 |
ret := &ListSessionsResponse{ |
| 2665 |
ServerResponse: googleapi.ServerResponse{ |
| 2666 |
Header: res.Header, |
| 2667 |
HTTPStatusCode: res.StatusCode, |
| 2668 |
}, |
| 2669 |
} |
| 2670 |
target := &ret |
| 2671 |
b, err := gensupport.DecodeResponseBytes(target, res) |
| 2672 |
if err != nil { |
| 2673 |
return nil, err |
| 2674 |
} |
| 2675 |
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "fitness.users.sessions.list", "response", internallog.HTTPResponse(res, b)) |
| 2676 |
return ret, nil |
| 2677 |
} |
| 2678 |
|
| 2679 |
// Pages invokes f for each page of results. |
| 2680 |
// A non-nil error returned from f will halt the iteration. |
| 2681 |
// The provided context supersedes any context provided to the Context method. |
| 2682 |
func (c *UsersSessionsListCall) Pages(ctx context.Context, f func(*ListSessionsResponse) error) error { |
| 2683 |
c.ctx_ = ctx |
| 2684 |
defer c.PageToken(c.urlParams_.Get("pageToken")) |
| 2685 |
for { |
| 2686 |
x, err := c.Do() |
| 2687 |
if err != nil { |
| 2688 |
return err |
| 2689 |
} |
| 2690 |
if err := f(x); err != nil { |
| 2691 |
return err |
| 2692 |
} |
| 2693 |
if x.NextPageToken == "" { |
| 2694 |
return nil |
| 2695 |
} |
| 2696 |
c.PageToken(x.NextPageToken) |
| 2697 |
} |
| 2698 |
} |
| 2699 |
|
| 2700 |
type UsersSessionsUpdateCall struct { |
| 2701 |
s *Service |
| 2702 |
userId string |
| 2703 |
sessionId string |
| 2704 |
session *Session |
| 2705 |
urlParams_ gensupport.URLParams |
| 2706 |
ctx_ context.Context |
| 2707 |
header_ http.Header |
| 2708 |
} |
| 2709 |
|
| 2710 |
// Update: Updates or insert a given session. |
| 2711 |
// |
| 2712 |
// - sessionId: The ID of the session to be created. |
| 2713 |
// - userId: Create sessions for the person identified. Use me to indicate the |
| 2714 |
// authenticated user. Only me is supported at this time. |
| 2715 |
func (r *UsersSessionsService) Update(userId string, sessionId string, session *Session) *UsersSessionsUpdateCall { |
| 2716 |
c := &UsersSessionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| 2717 |
c.userId = userId |
| 2718 |
c.sessionId = sessionId |
| 2719 |
c.session = session |
| 2720 |
return c |
| 2721 |
} |
| 2722 |
|
| 2723 |
// Fields allows partial responses to be retrieved. See |
| 2724 |
// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more |
| 2725 |
// details. |
| 2726 |
func (c *UsersSessionsUpdateCall) Fields(s ...googleapi.Field) *UsersSessionsUpdateCall { |
| 2727 |
c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| 2728 |
return c |
| 2729 |
} |
| 2730 |
|
| 2731 |
// Context sets the context to be used in this call's Do method. |
| 2732 |
func (c *UsersSessionsUpdateCall) Context(ctx context.Context) *UsersSessionsUpdateCall { |
| 2733 |
c.ctx_ = ctx |
| 2734 |
return c |
| 2735 |
} |
| 2736 |
|
| 2737 |
// Header returns a http.Header that can be modified by the caller to add |
| 2738 |
// headers to the request. |
| 2739 |
func (c *UsersSessionsUpdateCall) Header() http.Header { |
| 2740 |
if c.header_ == nil { |
| 2741 |
c.header_ = make(http.Header) |
| 2742 |
} |
| 2743 |
return c.header_ |
| 2744 |
} |
| 2745 |
|
| 2746 |
func (c *UsersSessionsUpdateCall) doRequest(alt string) (*http.Response, error) { |
| 2747 |
reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) |
| 2748 |
body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.session) |
| 2749 |
if err != nil { |
| 2750 |
return nil, err |
| 2751 |
} |
| 2752 |
c.urlParams_.Set("alt", alt) |
| 2753 |
c.urlParams_.Set("prettyPrint", "false") |
| 2754 |
urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/sessions/{sessionId}") |
| 2755 |
urls += "?" + c.urlParams_.Encode() |
| 2756 |
req, err := http.NewRequest("PUT", urls, body) |
| 2757 |
if err != nil { |
| 2758 |
return nil, err |
| 2759 |
} |
| 2760 |
req.Header = reqHeaders |
| 2761 |
googleapi.Expand(req.URL, map[string]string{ |
| 2762 |
"userId": c.userId, |
| 2763 |
"sessionId": c.sessionId, |
| 2764 |
}) |
| 2765 |
c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "fitness.users.sessions.update", "request", internallog.HTTPRequest(req, body.Bytes())) |
| 2766 |
return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| 2767 |
} |
| 2768 |
|
| 2769 |
// Do executes the "fitness.users.sessions.update" call. |
| 2770 |
// Any non-2xx status code is an error. Response headers are in either |
| 2771 |
// *Session.ServerResponse.Header or (if a response was returned at all) in |
| 2772 |
// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check |
| 2773 |
// whether the returned error was because http.StatusNotModified was returned. |
| 2774 |
func (c *UsersSessionsUpdateCall) Do(opts ...googleapi.CallOption) (*Session, error) { |
| 2775 |
gensupport.SetOptions(c.urlParams_, opts...) |
| 2776 |
res, err := c.doRequest("json") |
| 2777 |
if res != nil && res.StatusCode == http.StatusNotModified { |
| 2778 |
if res.Body != nil { |
| 2779 |
res.Body.Close() |
| 2780 |
} |
| 2781 |
return nil, gensupport.WrapError(&googleapi.Error{ |
| 2782 |
Code: res.StatusCode, |
| 2783 |
Header: res.Header, |
| 2784 |
}) |
| 2785 |
} |
| 2786 |
if err != nil { |
| 2787 |
return nil, err |
| 2788 |
} |
| 2789 |
defer googleapi.CloseBody(res) |
| 2790 |
if err := googleapi.CheckResponse(res); err != nil { |
| 2791 |
return nil, gensupport.WrapError(err) |
| 2792 |
} |
| 2793 |
ret := &Session{ |
| 2794 |
ServerResponse: googleapi.ServerResponse{ |
| 2795 |
Header: res.Header, |
| 2796 |
HTTPStatusCode: res.StatusCode, |
| 2797 |
}, |
| 2798 |
} |
| 2799 |
target := &ret |
| 2800 |
b, err := gensupport.DecodeResponseBytes(target, res) |
| 2801 |
if err != nil { |
| 2802 |
return nil, err |
| 2803 |
} |
| 2804 |
c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "fitness.users.sessions.update", "response", internallog.HTTPResponse(res, b)) |
| 2805 |
return ret, nil |
| 2806 |
} |