google-apis-fitness_v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,28 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Apis
17
+ module FitnessV1
18
+ # Version of the google-apis-fitness_v1 gem
19
+ GEM_VERSION = "0.1.0"
20
+
21
+ # Version of the code generator used to generate this client
22
+ GENERATOR_VERSION = "0.1.1"
23
+
24
+ # Revision of the discovery document this client was generated from
25
+ REVISION = "20201012"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,398 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'date'
16
+ require 'google/apis/core/base_service'
17
+ require 'google/apis/core/json_representation'
18
+ require 'google/apis/core/hashable'
19
+ require 'google/apis/errors'
20
+
21
+ module Google
22
+ module Apis
23
+ module FitnessV1
24
+
25
+ class AggregateBucket
26
+ class Representation < Google::Apis::Core::JsonRepresentation; end
27
+
28
+ include Google::Apis::Core::JsonObjectSupport
29
+ end
30
+
31
+ class AggregateBy
32
+ class Representation < Google::Apis::Core::JsonRepresentation; end
33
+
34
+ include Google::Apis::Core::JsonObjectSupport
35
+ end
36
+
37
+ class AggregateRequest
38
+ class Representation < Google::Apis::Core::JsonRepresentation; end
39
+
40
+ include Google::Apis::Core::JsonObjectSupport
41
+ end
42
+
43
+ class AggregateResponse
44
+ class Representation < Google::Apis::Core::JsonRepresentation; end
45
+
46
+ include Google::Apis::Core::JsonObjectSupport
47
+ end
48
+
49
+ class Application
50
+ class Representation < Google::Apis::Core::JsonRepresentation; end
51
+
52
+ include Google::Apis::Core::JsonObjectSupport
53
+ end
54
+
55
+ class BucketByActivity
56
+ class Representation < Google::Apis::Core::JsonRepresentation; end
57
+
58
+ include Google::Apis::Core::JsonObjectSupport
59
+ end
60
+
61
+ class BucketBySession
62
+ class Representation < Google::Apis::Core::JsonRepresentation; end
63
+
64
+ include Google::Apis::Core::JsonObjectSupport
65
+ end
66
+
67
+ class BucketByTime
68
+ class Representation < Google::Apis::Core::JsonRepresentation; end
69
+
70
+ include Google::Apis::Core::JsonObjectSupport
71
+ end
72
+
73
+ class BucketByTimePeriod
74
+ class Representation < Google::Apis::Core::JsonRepresentation; end
75
+
76
+ include Google::Apis::Core::JsonObjectSupport
77
+ end
78
+
79
+ class DataPoint
80
+ class Representation < Google::Apis::Core::JsonRepresentation; end
81
+
82
+ include Google::Apis::Core::JsonObjectSupport
83
+ end
84
+
85
+ class DataSource
86
+ class Representation < Google::Apis::Core::JsonRepresentation; end
87
+
88
+ include Google::Apis::Core::JsonObjectSupport
89
+ end
90
+
91
+ class DataType
92
+ class Representation < Google::Apis::Core::JsonRepresentation; end
93
+
94
+ include Google::Apis::Core::JsonObjectSupport
95
+ end
96
+
97
+ class DataTypeField
98
+ class Representation < Google::Apis::Core::JsonRepresentation; end
99
+
100
+ include Google::Apis::Core::JsonObjectSupport
101
+ end
102
+
103
+ class Dataset
104
+ class Representation < Google::Apis::Core::JsonRepresentation; end
105
+
106
+ include Google::Apis::Core::JsonObjectSupport
107
+ end
108
+
109
+ class Device
110
+ class Representation < Google::Apis::Core::JsonRepresentation; end
111
+
112
+ include Google::Apis::Core::JsonObjectSupport
113
+ end
114
+
115
+ class ListDataPointChangesResponse
116
+ class Representation < Google::Apis::Core::JsonRepresentation; end
117
+
118
+ include Google::Apis::Core::JsonObjectSupport
119
+ end
120
+
121
+ class ListDataSourcesResponse
122
+ class Representation < Google::Apis::Core::JsonRepresentation; end
123
+
124
+ include Google::Apis::Core::JsonObjectSupport
125
+ end
126
+
127
+ class ListSessionsResponse
128
+ class Representation < Google::Apis::Core::JsonRepresentation; end
129
+
130
+ include Google::Apis::Core::JsonObjectSupport
131
+ end
132
+
133
+ class MapValue
134
+ class Representation < Google::Apis::Core::JsonRepresentation; end
135
+
136
+ include Google::Apis::Core::JsonObjectSupport
137
+ end
138
+
139
+ class Session
140
+ class Representation < Google::Apis::Core::JsonRepresentation; end
141
+
142
+ include Google::Apis::Core::JsonObjectSupport
143
+ end
144
+
145
+ class Value
146
+ class Representation < Google::Apis::Core::JsonRepresentation; end
147
+
148
+ include Google::Apis::Core::JsonObjectSupport
149
+ end
150
+
151
+ class ValueMapValEntry
152
+ class Representation < Google::Apis::Core::JsonRepresentation; end
153
+
154
+ include Google::Apis::Core::JsonObjectSupport
155
+ end
156
+
157
+ class AggregateBucket
158
+ # @private
159
+ class Representation < Google::Apis::Core::JsonRepresentation
160
+ property :activity, as: 'activity'
161
+ collection :dataset, as: 'dataset', class: Google::Apis::FitnessV1::Dataset, decorator: Google::Apis::FitnessV1::Dataset::Representation
162
+
163
+ property :end_time_millis, :numeric_string => true, as: 'endTimeMillis'
164
+ property :session, as: 'session', class: Google::Apis::FitnessV1::Session, decorator: Google::Apis::FitnessV1::Session::Representation
165
+
166
+ property :start_time_millis, :numeric_string => true, as: 'startTimeMillis'
167
+ property :type, as: 'type'
168
+ end
169
+ end
170
+
171
+ class AggregateBy
172
+ # @private
173
+ class Representation < Google::Apis::Core::JsonRepresentation
174
+ property :data_source_id, as: 'dataSourceId'
175
+ property :data_type_name, as: 'dataTypeName'
176
+ end
177
+ end
178
+
179
+ class AggregateRequest
180
+ # @private
181
+ class Representation < Google::Apis::Core::JsonRepresentation
182
+ collection :aggregate_by, as: 'aggregateBy', class: Google::Apis::FitnessV1::AggregateBy, decorator: Google::Apis::FitnessV1::AggregateBy::Representation
183
+
184
+ property :bucket_by_activity_segment, as: 'bucketByActivitySegment', class: Google::Apis::FitnessV1::BucketByActivity, decorator: Google::Apis::FitnessV1::BucketByActivity::Representation
185
+
186
+ property :bucket_by_activity_type, as: 'bucketByActivityType', class: Google::Apis::FitnessV1::BucketByActivity, decorator: Google::Apis::FitnessV1::BucketByActivity::Representation
187
+
188
+ property :bucket_by_session, as: 'bucketBySession', class: Google::Apis::FitnessV1::BucketBySession, decorator: Google::Apis::FitnessV1::BucketBySession::Representation
189
+
190
+ property :bucket_by_time, as: 'bucketByTime', class: Google::Apis::FitnessV1::BucketByTime, decorator: Google::Apis::FitnessV1::BucketByTime::Representation
191
+
192
+ property :end_time_millis, :numeric_string => true, as: 'endTimeMillis'
193
+ collection :filtered_data_quality_standard, as: 'filteredDataQualityStandard'
194
+ property :start_time_millis, :numeric_string => true, as: 'startTimeMillis'
195
+ end
196
+ end
197
+
198
+ class AggregateResponse
199
+ # @private
200
+ class Representation < Google::Apis::Core::JsonRepresentation
201
+ collection :bucket, as: 'bucket', class: Google::Apis::FitnessV1::AggregateBucket, decorator: Google::Apis::FitnessV1::AggregateBucket::Representation
202
+
203
+ end
204
+ end
205
+
206
+ class Application
207
+ # @private
208
+ class Representation < Google::Apis::Core::JsonRepresentation
209
+ property :details_url, as: 'detailsUrl'
210
+ property :name, as: 'name'
211
+ property :package_name, as: 'packageName'
212
+ property :version, as: 'version'
213
+ end
214
+ end
215
+
216
+ class BucketByActivity
217
+ # @private
218
+ class Representation < Google::Apis::Core::JsonRepresentation
219
+ property :activity_data_source_id, as: 'activityDataSourceId'
220
+ property :min_duration_millis, :numeric_string => true, as: 'minDurationMillis'
221
+ end
222
+ end
223
+
224
+ class BucketBySession
225
+ # @private
226
+ class Representation < Google::Apis::Core::JsonRepresentation
227
+ property :min_duration_millis, :numeric_string => true, as: 'minDurationMillis'
228
+ end
229
+ end
230
+
231
+ class BucketByTime
232
+ # @private
233
+ class Representation < Google::Apis::Core::JsonRepresentation
234
+ property :duration_millis, :numeric_string => true, as: 'durationMillis'
235
+ property :period, as: 'period', class: Google::Apis::FitnessV1::BucketByTimePeriod, decorator: Google::Apis::FitnessV1::BucketByTimePeriod::Representation
236
+
237
+ end
238
+ end
239
+
240
+ class BucketByTimePeriod
241
+ # @private
242
+ class Representation < Google::Apis::Core::JsonRepresentation
243
+ property :time_zone_id, as: 'timeZoneId'
244
+ property :type, as: 'type'
245
+ property :value, as: 'value'
246
+ end
247
+ end
248
+
249
+ class DataPoint
250
+ # @private
251
+ class Representation < Google::Apis::Core::JsonRepresentation
252
+ property :computation_time_millis, :numeric_string => true, as: 'computationTimeMillis'
253
+ property :data_type_name, as: 'dataTypeName'
254
+ property :end_time_nanos, :numeric_string => true, as: 'endTimeNanos'
255
+ property :modified_time_millis, :numeric_string => true, as: 'modifiedTimeMillis'
256
+ property :origin_data_source_id, as: 'originDataSourceId'
257
+ property :raw_timestamp_nanos, :numeric_string => true, as: 'rawTimestampNanos'
258
+ property :start_time_nanos, :numeric_string => true, as: 'startTimeNanos'
259
+ collection :value, as: 'value', class: Google::Apis::FitnessV1::Value, decorator: Google::Apis::FitnessV1::Value::Representation
260
+
261
+ end
262
+ end
263
+
264
+ class DataSource
265
+ # @private
266
+ class Representation < Google::Apis::Core::JsonRepresentation
267
+ property :application, as: 'application', class: Google::Apis::FitnessV1::Application, decorator: Google::Apis::FitnessV1::Application::Representation
268
+
269
+ collection :data_quality_standard, as: 'dataQualityStandard'
270
+ property :data_stream_id, as: 'dataStreamId'
271
+ property :data_stream_name, as: 'dataStreamName'
272
+ property :data_type, as: 'dataType', class: Google::Apis::FitnessV1::DataType, decorator: Google::Apis::FitnessV1::DataType::Representation
273
+
274
+ property :device, as: 'device', class: Google::Apis::FitnessV1::Device, decorator: Google::Apis::FitnessV1::Device::Representation
275
+
276
+ property :name, as: 'name'
277
+ property :type, as: 'type'
278
+ end
279
+ end
280
+
281
+ class DataType
282
+ # @private
283
+ class Representation < Google::Apis::Core::JsonRepresentation
284
+ collection :field, as: 'field', class: Google::Apis::FitnessV1::DataTypeField, decorator: Google::Apis::FitnessV1::DataTypeField::Representation
285
+
286
+ property :name, as: 'name'
287
+ end
288
+ end
289
+
290
+ class DataTypeField
291
+ # @private
292
+ class Representation < Google::Apis::Core::JsonRepresentation
293
+ property :format, as: 'format'
294
+ property :name, as: 'name'
295
+ property :optional, as: 'optional'
296
+ end
297
+ end
298
+
299
+ class Dataset
300
+ # @private
301
+ class Representation < Google::Apis::Core::JsonRepresentation
302
+ property :data_source_id, as: 'dataSourceId'
303
+ property :max_end_time_ns, :numeric_string => true, as: 'maxEndTimeNs'
304
+ property :min_start_time_ns, :numeric_string => true, as: 'minStartTimeNs'
305
+ property :next_page_token, as: 'nextPageToken'
306
+ collection :point, as: 'point', class: Google::Apis::FitnessV1::DataPoint, decorator: Google::Apis::FitnessV1::DataPoint::Representation
307
+
308
+ end
309
+ end
310
+
311
+ class Device
312
+ # @private
313
+ class Representation < Google::Apis::Core::JsonRepresentation
314
+ property :manufacturer, as: 'manufacturer'
315
+ property :model, as: 'model'
316
+ property :type, as: 'type'
317
+ property :uid, as: 'uid'
318
+ property :version, as: 'version'
319
+ end
320
+ end
321
+
322
+ class ListDataPointChangesResponse
323
+ # @private
324
+ class Representation < Google::Apis::Core::JsonRepresentation
325
+ property :data_source_id, as: 'dataSourceId'
326
+ collection :deleted_data_point, as: 'deletedDataPoint', class: Google::Apis::FitnessV1::DataPoint, decorator: Google::Apis::FitnessV1::DataPoint::Representation
327
+
328
+ collection :inserted_data_point, as: 'insertedDataPoint', class: Google::Apis::FitnessV1::DataPoint, decorator: Google::Apis::FitnessV1::DataPoint::Representation
329
+
330
+ property :next_page_token, as: 'nextPageToken'
331
+ end
332
+ end
333
+
334
+ class ListDataSourcesResponse
335
+ # @private
336
+ class Representation < Google::Apis::Core::JsonRepresentation
337
+ collection :data_source, as: 'dataSource', class: Google::Apis::FitnessV1::DataSource, decorator: Google::Apis::FitnessV1::DataSource::Representation
338
+
339
+ end
340
+ end
341
+
342
+ class ListSessionsResponse
343
+ # @private
344
+ class Representation < Google::Apis::Core::JsonRepresentation
345
+ collection :deleted_session, as: 'deletedSession', class: Google::Apis::FitnessV1::Session, decorator: Google::Apis::FitnessV1::Session::Representation
346
+
347
+ property :has_more_data, as: 'hasMoreData'
348
+ property :next_page_token, as: 'nextPageToken'
349
+ collection :session, as: 'session', class: Google::Apis::FitnessV1::Session, decorator: Google::Apis::FitnessV1::Session::Representation
350
+
351
+ end
352
+ end
353
+
354
+ class MapValue
355
+ # @private
356
+ class Representation < Google::Apis::Core::JsonRepresentation
357
+ property :fp_val, as: 'fpVal'
358
+ end
359
+ end
360
+
361
+ class Session
362
+ # @private
363
+ class Representation < Google::Apis::Core::JsonRepresentation
364
+ property :active_time_millis, :numeric_string => true, as: 'activeTimeMillis'
365
+ property :activity_type, as: 'activityType'
366
+ property :application, as: 'application', class: Google::Apis::FitnessV1::Application, decorator: Google::Apis::FitnessV1::Application::Representation
367
+
368
+ property :description, as: 'description'
369
+ property :end_time_millis, :numeric_string => true, as: 'endTimeMillis'
370
+ property :id, as: 'id'
371
+ property :modified_time_millis, :numeric_string => true, as: 'modifiedTimeMillis'
372
+ property :name, as: 'name'
373
+ property :start_time_millis, :numeric_string => true, as: 'startTimeMillis'
374
+ end
375
+ end
376
+
377
+ class Value
378
+ # @private
379
+ class Representation < Google::Apis::Core::JsonRepresentation
380
+ property :fp_val, as: 'fpVal'
381
+ property :int_val, as: 'intVal'
382
+ collection :map_val, as: 'mapVal', class: Google::Apis::FitnessV1::ValueMapValEntry, decorator: Google::Apis::FitnessV1::ValueMapValEntry::Representation
383
+
384
+ property :string_val, as: 'stringVal'
385
+ end
386
+ end
387
+
388
+ class ValueMapValEntry
389
+ # @private
390
+ class Representation < Google::Apis::Core::JsonRepresentation
391
+ property :key, as: 'key'
392
+ property :value, as: 'value', class: Google::Apis::FitnessV1::MapValue, decorator: Google::Apis::FitnessV1::MapValue::Representation
393
+
394
+ end
395
+ end
396
+ end
397
+ end
398
+ end
@@ -0,0 +1,630 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module FitnessV1
23
+ # Fitness API
24
+ #
25
+ # The Fitness API for managing users' fitness tracking data.
26
+ #
27
+ # @example
28
+ # require 'google/apis/fitness_v1'
29
+ #
30
+ # Fitness = Google::Apis::FitnessV1 # Alias the module
31
+ # service = Fitness::FitnessService.new
32
+ #
33
+ # @see https://developers.google.com/fit/rest/v1/get-started
34
+ class FitnessService < Google::Apis::Core::BaseService
35
+ # @return [String]
36
+ # API key. Your API key identifies your project and provides you with API access,
37
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
38
+ attr_accessor :key
39
+
40
+ # @return [String]
41
+ # Available to use for quota purposes for server-side applications. Can be any
42
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
43
+ attr_accessor :quota_user
44
+
45
+ def initialize
46
+ super('https://fitness.googleapis.com/', 'fitness/v1/users/',
47
+ client_name: 'google-apis-fitness_v1',
48
+ client_version: Google::Apis::FitnessV1::GEM_VERSION)
49
+ @batch_path = 'batch'
50
+ end
51
+
52
+ # Creates a new data source that is unique across all data sources belonging to
53
+ # this user. A data source is a unique source of sensor data. Data sources can
54
+ # expose raw data coming from hardware sensors on local or companion devices.
55
+ # They can also expose derived data, created by transforming or merging other
56
+ # data sources. Multiple data sources can exist for the same data type. Every
57
+ # data point in every dataset inserted into or read from the Fitness API has an
58
+ # associated data source. Each data source produces a unique stream of dataset
59
+ # updates, with a unique data source identifier. Not all changes to data source
60
+ # affect the data stream ID, so that data collected by updated versions of the
61
+ # same application/device can still be considered to belong to the same data
62
+ # source. Data sources are identified using a string generated by the server,
63
+ # based on the contents of the source being created. The dataStreamId field
64
+ # should not be set when invoking this method. It will be automatically
65
+ # generated by the server with the correct format. If a dataStreamId is set, it
66
+ # must match the format that the server would generate. This format is a
67
+ # combination of some fields from the data source, and has a specific order. If
68
+ # it doesn't match, the request will fail with an error. Specifying a DataType
69
+ # which is not a known type (beginning with "com.google.") will create a
70
+ # DataSource with a *custom data type*. Custom data types are only readable by
71
+ # the application that created them. Custom data types are *deprecated*; use
72
+ # standard data types instead. In addition to the data source fields included in
73
+ # the data source ID, the developer project number that is authenticated when
74
+ # creating the data source is included. This developer project number is
75
+ # obfuscated when read by any other developer reading public data types.
76
+ # @param [String] user_id
77
+ # Create the data source for the person identified. Use me to indicate the
78
+ # authenticated user. Only me is supported at this time.
79
+ # @param [Google::Apis::FitnessV1::DataSource] data_source_object
80
+ # @param [String] fields
81
+ # Selector specifying which fields to include in a partial response.
82
+ # @param [String] quota_user
83
+ # Available to use for quota purposes for server-side applications. Can be any
84
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
85
+ # @param [Google::Apis::RequestOptions] options
86
+ # Request-specific options
87
+ #
88
+ # @yield [result, err] Result & error if block supplied
89
+ # @yieldparam result [Google::Apis::FitnessV1::DataSource] parsed result object
90
+ # @yieldparam err [StandardError] error object if request failed
91
+ #
92
+ # @return [Google::Apis::FitnessV1::DataSource]
93
+ #
94
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
95
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
96
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
97
+ def create_user_data_source(user_id, data_source_object = nil, fields: nil, quota_user: nil, options: nil, &block)
98
+ command = make_simple_command(:post, '{userId}/dataSources', options)
99
+ command.request_representation = Google::Apis::FitnessV1::DataSource::Representation
100
+ command.request_object = data_source_object
101
+ command.response_representation = Google::Apis::FitnessV1::DataSource::Representation
102
+ command.response_class = Google::Apis::FitnessV1::DataSource
103
+ command.params['userId'] = user_id unless user_id.nil?
104
+ command.query['fields'] = fields unless fields.nil?
105
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
106
+ execute_or_queue_command(command, &block)
107
+ end
108
+
109
+ # Deletes the specified data source. The request will fail if the data source
110
+ # contains any data points.
111
+ # @param [String] user_id
112
+ # Retrieve a data source for the person identified. Use me to indicate the
113
+ # authenticated user. Only me is supported at this time.
114
+ # @param [String] data_source_id
115
+ # The data stream ID of the data source to delete.
116
+ # @param [String] fields
117
+ # Selector specifying which fields to include in a partial response.
118
+ # @param [String] quota_user
119
+ # Available to use for quota purposes for server-side applications. Can be any
120
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
121
+ # @param [Google::Apis::RequestOptions] options
122
+ # Request-specific options
123
+ #
124
+ # @yield [result, err] Result & error if block supplied
125
+ # @yieldparam result [Google::Apis::FitnessV1::DataSource] parsed result object
126
+ # @yieldparam err [StandardError] error object if request failed
127
+ #
128
+ # @return [Google::Apis::FitnessV1::DataSource]
129
+ #
130
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
131
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
132
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
133
+ def delete_user_data_source(user_id, data_source_id, fields: nil, quota_user: nil, options: nil, &block)
134
+ command = make_simple_command(:delete, '{userId}/dataSources/{dataSourceId}', options)
135
+ command.response_representation = Google::Apis::FitnessV1::DataSource::Representation
136
+ command.response_class = Google::Apis::FitnessV1::DataSource
137
+ command.params['userId'] = user_id unless user_id.nil?
138
+ command.params['dataSourceId'] = data_source_id unless data_source_id.nil?
139
+ command.query['fields'] = fields unless fields.nil?
140
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
141
+ execute_or_queue_command(command, &block)
142
+ end
143
+
144
+ # Returns the specified data source.
145
+ # @param [String] user_id
146
+ # Retrieve a data source for the person identified. Use me to indicate the
147
+ # authenticated user. Only me is supported at this time.
148
+ # @param [String] data_source_id
149
+ # The data stream ID of the data source to retrieve.
150
+ # @param [String] fields
151
+ # Selector specifying which fields to include in a partial response.
152
+ # @param [String] quota_user
153
+ # Available to use for quota purposes for server-side applications. Can be any
154
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
155
+ # @param [Google::Apis::RequestOptions] options
156
+ # Request-specific options
157
+ #
158
+ # @yield [result, err] Result & error if block supplied
159
+ # @yieldparam result [Google::Apis::FitnessV1::DataSource] parsed result object
160
+ # @yieldparam err [StandardError] error object if request failed
161
+ #
162
+ # @return [Google::Apis::FitnessV1::DataSource]
163
+ #
164
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
165
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
166
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
167
+ def get_user_data_source(user_id, data_source_id, fields: nil, quota_user: nil, options: nil, &block)
168
+ command = make_simple_command(:get, '{userId}/dataSources/{dataSourceId}', options)
169
+ command.response_representation = Google::Apis::FitnessV1::DataSource::Representation
170
+ command.response_class = Google::Apis::FitnessV1::DataSource
171
+ command.params['userId'] = user_id unless user_id.nil?
172
+ command.params['dataSourceId'] = data_source_id unless data_source_id.nil?
173
+ command.query['fields'] = fields unless fields.nil?
174
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
175
+ execute_or_queue_command(command, &block)
176
+ end
177
+
178
+ # Lists all data sources that are visible to the developer, using the OAuth
179
+ # scopes provided. The list is not exhaustive; the user may have private data
180
+ # sources that are only visible to other developers, or calls using other scopes.
181
+ # @param [String] user_id
182
+ # List data sources for the person identified. Use me to indicate the
183
+ # authenticated user. Only me is supported at this time.
184
+ # @param [Array<String>, String] data_type_name
185
+ # The names of data types to include in the list. If not specified, all data
186
+ # sources will be returned.
187
+ # @param [String] fields
188
+ # Selector specifying which fields to include in a partial response.
189
+ # @param [String] quota_user
190
+ # Available to use for quota purposes for server-side applications. Can be any
191
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
192
+ # @param [Google::Apis::RequestOptions] options
193
+ # Request-specific options
194
+ #
195
+ # @yield [result, err] Result & error if block supplied
196
+ # @yieldparam result [Google::Apis::FitnessV1::ListDataSourcesResponse] parsed result object
197
+ # @yieldparam err [StandardError] error object if request failed
198
+ #
199
+ # @return [Google::Apis::FitnessV1::ListDataSourcesResponse]
200
+ #
201
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
202
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
203
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
204
+ def list_user_data_sources(user_id, data_type_name: nil, fields: nil, quota_user: nil, options: nil, &block)
205
+ command = make_simple_command(:get, '{userId}/dataSources', options)
206
+ command.response_representation = Google::Apis::FitnessV1::ListDataSourcesResponse::Representation
207
+ command.response_class = Google::Apis::FitnessV1::ListDataSourcesResponse
208
+ command.params['userId'] = user_id unless user_id.nil?
209
+ command.query['dataTypeName'] = data_type_name unless data_type_name.nil?
210
+ command.query['fields'] = fields unless fields.nil?
211
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
212
+ execute_or_queue_command(command, &block)
213
+ end
214
+
215
+ # Updates the specified data source. The dataStreamId, dataType, type,
216
+ # dataStreamName, and device properties with the exception of version, cannot be
217
+ # modified. Data sources are identified by their dataStreamId.
218
+ # @param [String] user_id
219
+ # Update the data source for the person identified. Use me to indicate the
220
+ # authenticated user. Only me is supported at this time.
221
+ # @param [String] data_source_id
222
+ # The data stream ID of the data source to update.
223
+ # @param [Google::Apis::FitnessV1::DataSource] data_source_object
224
+ # @param [String] fields
225
+ # Selector specifying which fields to include in a partial response.
226
+ # @param [String] quota_user
227
+ # Available to use for quota purposes for server-side applications. Can be any
228
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
229
+ # @param [Google::Apis::RequestOptions] options
230
+ # Request-specific options
231
+ #
232
+ # @yield [result, err] Result & error if block supplied
233
+ # @yieldparam result [Google::Apis::FitnessV1::DataSource] parsed result object
234
+ # @yieldparam err [StandardError] error object if request failed
235
+ #
236
+ # @return [Google::Apis::FitnessV1::DataSource]
237
+ #
238
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
239
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
240
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
241
+ def update_user_data_source(user_id, data_source_id, data_source_object = nil, fields: nil, quota_user: nil, options: nil, &block)
242
+ command = make_simple_command(:put, '{userId}/dataSources/{dataSourceId}', options)
243
+ command.request_representation = Google::Apis::FitnessV1::DataSource::Representation
244
+ command.request_object = data_source_object
245
+ command.response_representation = Google::Apis::FitnessV1::DataSource::Representation
246
+ command.response_class = Google::Apis::FitnessV1::DataSource
247
+ command.params['userId'] = user_id unless user_id.nil?
248
+ command.params['dataSourceId'] = data_source_id unless data_source_id.nil?
249
+ command.query['fields'] = fields unless fields.nil?
250
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
251
+ execute_or_queue_command(command, &block)
252
+ end
253
+
254
+ # Queries for user's data point changes for a particular data source.
255
+ # @param [String] user_id
256
+ # List data points for the person identified. Use me to indicate the
257
+ # authenticated user. Only me is supported at this time.
258
+ # @param [String] data_source_id
259
+ # The data stream ID of the data source that created the dataset.
260
+ # @param [Fixnum] limit
261
+ # If specified, no more than this many data point changes will be included in
262
+ # the response.
263
+ # @param [String] page_token
264
+ # The continuation token, which is used to page through large result sets. To
265
+ # get the next page of results, set this parameter to the value of nextPageToken
266
+ # from the previous response.
267
+ # @param [String] fields
268
+ # Selector specifying which fields to include in a partial response.
269
+ # @param [String] quota_user
270
+ # Available to use for quota purposes for server-side applications. Can be any
271
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
272
+ # @param [Google::Apis::RequestOptions] options
273
+ # Request-specific options
274
+ #
275
+ # @yield [result, err] Result & error if block supplied
276
+ # @yieldparam result [Google::Apis::FitnessV1::ListDataPointChangesResponse] parsed result object
277
+ # @yieldparam err [StandardError] error object if request failed
278
+ #
279
+ # @return [Google::Apis::FitnessV1::ListDataPointChangesResponse]
280
+ #
281
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
282
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
283
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
284
+ def list_user_data_source_data_point_changes(user_id, data_source_id, limit: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
285
+ command = make_simple_command(:get, '{userId}/dataSources/{dataSourceId}/dataPointChanges', options)
286
+ command.response_representation = Google::Apis::FitnessV1::ListDataPointChangesResponse::Representation
287
+ command.response_class = Google::Apis::FitnessV1::ListDataPointChangesResponse
288
+ command.params['userId'] = user_id unless user_id.nil?
289
+ command.params['dataSourceId'] = data_source_id unless data_source_id.nil?
290
+ command.query['limit'] = limit unless limit.nil?
291
+ command.query['pageToken'] = page_token unless page_token.nil?
292
+ command.query['fields'] = fields unless fields.nil?
293
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
294
+ execute_or_queue_command(command, &block)
295
+ end
296
+
297
+ # Performs an inclusive delete of all data points whose start and end times have
298
+ # any overlap with the time range specified by the dataset ID. For most data
299
+ # types, the entire data point will be deleted. For data types where the time
300
+ # span represents a consistent value (such as com.google.activity.segment), and
301
+ # a data point straddles either end point of the dataset, only the overlapping
302
+ # portion of the data point will be deleted.
303
+ # @param [String] user_id
304
+ # Delete a dataset for the person identified. Use me to indicate the
305
+ # authenticated user. Only me is supported at this time.
306
+ # @param [String] data_source_id
307
+ # The data stream ID of the data source that created the dataset.
308
+ # @param [String] dataset_id
309
+ # Dataset identifier that is a composite of the minimum data point start time
310
+ # and maximum data point end time represented as nanoseconds from the epoch. The
311
+ # ID is formatted like: "startTime-endTime" where startTime and endTime are 64
312
+ # bit integers.
313
+ # @param [Fixnum] current_time_millis
314
+ # The client's current time in milliseconds since epoch.
315
+ # @param [Fixnum] modified_time_millis
316
+ # When the operation was performed on the client.
317
+ # @param [String] fields
318
+ # Selector specifying which fields to include in a partial response.
319
+ # @param [String] quota_user
320
+ # Available to use for quota purposes for server-side applications. Can be any
321
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
322
+ # @param [Google::Apis::RequestOptions] options
323
+ # Request-specific options
324
+ #
325
+ # @yield [result, err] Result & error if block supplied
326
+ # @yieldparam result [NilClass] No result returned for this method
327
+ # @yieldparam err [StandardError] error object if request failed
328
+ #
329
+ # @return [void]
330
+ #
331
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
332
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
333
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
334
+ def delete_user_data_source_dataset(user_id, data_source_id, dataset_id, current_time_millis: nil, modified_time_millis: nil, fields: nil, quota_user: nil, options: nil, &block)
335
+ command = make_simple_command(:delete, '{userId}/dataSources/{dataSourceId}/datasets/{datasetId}', options)
336
+ command.params['userId'] = user_id unless user_id.nil?
337
+ command.params['dataSourceId'] = data_source_id unless data_source_id.nil?
338
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
339
+ command.query['currentTimeMillis'] = current_time_millis unless current_time_millis.nil?
340
+ command.query['modifiedTimeMillis'] = modified_time_millis unless modified_time_millis.nil?
341
+ command.query['fields'] = fields unless fields.nil?
342
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
343
+ execute_or_queue_command(command, &block)
344
+ end
345
+
346
+ # Returns a dataset containing all data points whose start and end times overlap
347
+ # with the specified range of the dataset minimum start time and maximum end
348
+ # time. Specifically, any data point whose start time is less than or equal to
349
+ # the dataset end time and whose end time is greater than or equal to the
350
+ # dataset start time.
351
+ # @param [String] user_id
352
+ # Retrieve a dataset for the person identified. Use me to indicate the
353
+ # authenticated user. Only me is supported at this time.
354
+ # @param [String] data_source_id
355
+ # The data stream ID of the data source that created the dataset.
356
+ # @param [String] dataset_id
357
+ # Dataset identifier that is a composite of the minimum data point start time
358
+ # and maximum data point end time represented as nanoseconds from the epoch. The
359
+ # ID is formatted like: "startTime-endTime" where startTime and endTime are 64
360
+ # bit integers.
361
+ # @param [Fixnum] limit
362
+ # If specified, no more than this many data points will be included in the
363
+ # dataset. If there are more data points in the dataset, nextPageToken will be
364
+ # set in the dataset response. The limit is applied from the end of the time
365
+ # range. That is, if pageToken is absent, the limit most recent data points will
366
+ # be returned.
367
+ # @param [String] page_token
368
+ # The continuation token, which is used to page through large datasets. To get
369
+ # the next page of a dataset, set this parameter to the value of nextPageToken
370
+ # from the previous response. Each subsequent call will yield a partial dataset
371
+ # with data point end timestamps that are strictly smaller than those in the
372
+ # previous partial response.
373
+ # @param [String] fields
374
+ # Selector specifying which fields to include in a partial response.
375
+ # @param [String] quota_user
376
+ # Available to use for quota purposes for server-side applications. Can be any
377
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
378
+ # @param [Google::Apis::RequestOptions] options
379
+ # Request-specific options
380
+ #
381
+ # @yield [result, err] Result & error if block supplied
382
+ # @yieldparam result [Google::Apis::FitnessV1::Dataset] parsed result object
383
+ # @yieldparam err [StandardError] error object if request failed
384
+ #
385
+ # @return [Google::Apis::FitnessV1::Dataset]
386
+ #
387
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
388
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
389
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
390
+ def get_user_data_source_dataset(user_id, data_source_id, dataset_id, limit: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
391
+ command = make_simple_command(:get, '{userId}/dataSources/{dataSourceId}/datasets/{datasetId}', options)
392
+ command.response_representation = Google::Apis::FitnessV1::Dataset::Representation
393
+ command.response_class = Google::Apis::FitnessV1::Dataset
394
+ command.params['userId'] = user_id unless user_id.nil?
395
+ command.params['dataSourceId'] = data_source_id unless data_source_id.nil?
396
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
397
+ command.query['limit'] = limit unless limit.nil?
398
+ command.query['pageToken'] = page_token unless page_token.nil?
399
+ command.query['fields'] = fields unless fields.nil?
400
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
401
+ execute_or_queue_command(command, &block)
402
+ end
403
+
404
+ # Adds data points to a dataset. The dataset need not be previously created. All
405
+ # points within the given dataset will be returned with subsquent calls to
406
+ # retrieve this dataset. Data points can belong to more than one dataset. This
407
+ # method does not use patch semantics.
408
+ # @param [String] user_id
409
+ # Patch a dataset for the person identified. Use me to indicate the
410
+ # authenticated user. Only me is supported at this time.
411
+ # @param [String] data_source_id
412
+ # The data stream ID of the data source that created the dataset.
413
+ # @param [String] dataset_id
414
+ # Dataset identifier that is a composite of the minimum data point start time
415
+ # and maximum data point end time represented as nanoseconds from the epoch. The
416
+ # ID is formatted like: "startTime-endTime" where startTime and endTime are 64
417
+ # bit integers.
418
+ # @param [Google::Apis::FitnessV1::Dataset] dataset_object
419
+ # @param [Fixnum] current_time_millis
420
+ # The client's current time in milliseconds since epoch. Note that the
421
+ # minStartTimeNs and maxEndTimeNs properties in the request body are in
422
+ # nanoseconds instead of milliseconds.
423
+ # @param [String] fields
424
+ # Selector specifying which fields to include in a partial response.
425
+ # @param [String] quota_user
426
+ # Available to use for quota purposes for server-side applications. Can be any
427
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
428
+ # @param [Google::Apis::RequestOptions] options
429
+ # Request-specific options
430
+ #
431
+ # @yield [result, err] Result & error if block supplied
432
+ # @yieldparam result [Google::Apis::FitnessV1::Dataset] parsed result object
433
+ # @yieldparam err [StandardError] error object if request failed
434
+ #
435
+ # @return [Google::Apis::FitnessV1::Dataset]
436
+ #
437
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
438
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
439
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
440
+ def patch_user_data_source_dataset(user_id, data_source_id, dataset_id, dataset_object = nil, current_time_millis: nil, fields: nil, quota_user: nil, options: nil, &block)
441
+ command = make_simple_command(:patch, '{userId}/dataSources/{dataSourceId}/datasets/{datasetId}', options)
442
+ command.request_representation = Google::Apis::FitnessV1::Dataset::Representation
443
+ command.request_object = dataset_object
444
+ command.response_representation = Google::Apis::FitnessV1::Dataset::Representation
445
+ command.response_class = Google::Apis::FitnessV1::Dataset
446
+ command.params['userId'] = user_id unless user_id.nil?
447
+ command.params['dataSourceId'] = data_source_id unless data_source_id.nil?
448
+ command.params['datasetId'] = dataset_id unless dataset_id.nil?
449
+ command.query['currentTimeMillis'] = current_time_millis unless current_time_millis.nil?
450
+ command.query['fields'] = fields unless fields.nil?
451
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
452
+ execute_or_queue_command(command, &block)
453
+ end
454
+
455
+ # Aggregates data of a certain type or stream into buckets divided by a given
456
+ # type of boundary. Multiple data sets of multiple types and from multiple
457
+ # sources can be aggregated into exactly one bucket type per request.
458
+ # @param [String] user_id
459
+ # Aggregate data for the person identified. Use me to indicate the authenticated
460
+ # user. Only me is supported at this time.
461
+ # @param [Google::Apis::FitnessV1::AggregateRequest] aggregate_request_object
462
+ # @param [String] fields
463
+ # Selector specifying which fields to include in a partial response.
464
+ # @param [String] quota_user
465
+ # Available to use for quota purposes for server-side applications. Can be any
466
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
467
+ # @param [Google::Apis::RequestOptions] options
468
+ # Request-specific options
469
+ #
470
+ # @yield [result, err] Result & error if block supplied
471
+ # @yieldparam result [Google::Apis::FitnessV1::AggregateResponse] parsed result object
472
+ # @yieldparam err [StandardError] error object if request failed
473
+ #
474
+ # @return [Google::Apis::FitnessV1::AggregateResponse]
475
+ #
476
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
477
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
478
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
479
+ def aggregate_dataset(user_id, aggregate_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
480
+ command = make_simple_command(:post, '{userId}/dataset:aggregate', options)
481
+ command.request_representation = Google::Apis::FitnessV1::AggregateRequest::Representation
482
+ command.request_object = aggregate_request_object
483
+ command.response_representation = Google::Apis::FitnessV1::AggregateResponse::Representation
484
+ command.response_class = Google::Apis::FitnessV1::AggregateResponse
485
+ command.params['userId'] = user_id unless user_id.nil?
486
+ command.query['fields'] = fields unless fields.nil?
487
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
488
+ execute_or_queue_command(command, &block)
489
+ end
490
+
491
+ # Deletes a session specified by the given session ID.
492
+ # @param [String] user_id
493
+ # Delete a session for the person identified. Use me to indicate the
494
+ # authenticated user. Only me is supported at this time.
495
+ # @param [String] session_id
496
+ # The ID of the session to be deleted.
497
+ # @param [Fixnum] current_time_millis
498
+ # The client's current time in milliseconds since epoch.
499
+ # @param [String] fields
500
+ # Selector specifying which fields to include in a partial response.
501
+ # @param [String] quota_user
502
+ # Available to use for quota purposes for server-side applications. Can be any
503
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
504
+ # @param [Google::Apis::RequestOptions] options
505
+ # Request-specific options
506
+ #
507
+ # @yield [result, err] Result & error if block supplied
508
+ # @yieldparam result [NilClass] No result returned for this method
509
+ # @yieldparam err [StandardError] error object if request failed
510
+ #
511
+ # @return [void]
512
+ #
513
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
514
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
515
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
516
+ def delete_user_session(user_id, session_id, current_time_millis: nil, fields: nil, quota_user: nil, options: nil, &block)
517
+ command = make_simple_command(:delete, '{userId}/sessions/{sessionId}', options)
518
+ command.params['userId'] = user_id unless user_id.nil?
519
+ command.params['sessionId'] = session_id unless session_id.nil?
520
+ command.query['currentTimeMillis'] = current_time_millis unless current_time_millis.nil?
521
+ command.query['fields'] = fields unless fields.nil?
522
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
523
+ execute_or_queue_command(command, &block)
524
+ end
525
+
526
+ # Lists sessions previously created.
527
+ # @param [String] user_id
528
+ # List sessions for the person identified. Use me to indicate the authenticated
529
+ # user. Only me is supported at this time.
530
+ # @param [Array<Fixnum>, Fixnum] activity_type
531
+ # If non-empty, only sessions with these activity types should be returned.
532
+ # @param [String] end_time
533
+ # An RFC3339 timestamp. Only sessions ending between the start and end times
534
+ # will be included in the response. If this time is omitted but startTime is
535
+ # specified, all sessions from startTime to the end of time will be returned.
536
+ # @param [Boolean] include_deleted
537
+ # If true, and if both startTime and endTime are omitted, session deletions will
538
+ # be returned.
539
+ # @param [String] page_token
540
+ # The continuation token, which is used for incremental syncing. To get the next
541
+ # batch of changes, set this parameter to the value of nextPageToken from the
542
+ # previous response. The page token is ignored if either start or end time is
543
+ # specified. If none of start time, end time, and the page token is specified,
544
+ # sessions modified in the last 30 days are returned.
545
+ # @param [String] start_time
546
+ # An RFC3339 timestamp. Only sessions ending between the start and end times
547
+ # will be included in the response. If this time is omitted but endTime is
548
+ # specified, all sessions from the start of time up to endTime will be returned.
549
+ # @param [String] fields
550
+ # Selector specifying which fields to include in a partial response.
551
+ # @param [String] quota_user
552
+ # Available to use for quota purposes for server-side applications. Can be any
553
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
554
+ # @param [Google::Apis::RequestOptions] options
555
+ # Request-specific options
556
+ #
557
+ # @yield [result, err] Result & error if block supplied
558
+ # @yieldparam result [Google::Apis::FitnessV1::ListSessionsResponse] parsed result object
559
+ # @yieldparam err [StandardError] error object if request failed
560
+ #
561
+ # @return [Google::Apis::FitnessV1::ListSessionsResponse]
562
+ #
563
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
564
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
565
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
566
+ def list_user_sessions(user_id, activity_type: nil, end_time: nil, include_deleted: nil, page_token: nil, start_time: nil, fields: nil, quota_user: nil, options: nil, &block)
567
+ command = make_simple_command(:get, '{userId}/sessions', options)
568
+ command.response_representation = Google::Apis::FitnessV1::ListSessionsResponse::Representation
569
+ command.response_class = Google::Apis::FitnessV1::ListSessionsResponse
570
+ command.params['userId'] = user_id unless user_id.nil?
571
+ command.query['activityType'] = activity_type unless activity_type.nil?
572
+ command.query['endTime'] = end_time unless end_time.nil?
573
+ command.query['includeDeleted'] = include_deleted unless include_deleted.nil?
574
+ command.query['pageToken'] = page_token unless page_token.nil?
575
+ command.query['startTime'] = start_time unless start_time.nil?
576
+ command.query['fields'] = fields unless fields.nil?
577
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
578
+ execute_or_queue_command(command, &block)
579
+ end
580
+
581
+ # Updates or insert a given session.
582
+ # @param [String] user_id
583
+ # Create sessions for the person identified. Use me to indicate the
584
+ # authenticated user. Only me is supported at this time.
585
+ # @param [String] session_id
586
+ # The ID of the session to be created.
587
+ # @param [Google::Apis::FitnessV1::Session] session_object
588
+ # @param [Fixnum] current_time_millis
589
+ # The client's current time in milliseconds since epoch.
590
+ # @param [String] fields
591
+ # Selector specifying which fields to include in a partial response.
592
+ # @param [String] quota_user
593
+ # Available to use for quota purposes for server-side applications. Can be any
594
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
595
+ # @param [Google::Apis::RequestOptions] options
596
+ # Request-specific options
597
+ #
598
+ # @yield [result, err] Result & error if block supplied
599
+ # @yieldparam result [Google::Apis::FitnessV1::Session] parsed result object
600
+ # @yieldparam err [StandardError] error object if request failed
601
+ #
602
+ # @return [Google::Apis::FitnessV1::Session]
603
+ #
604
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
605
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
606
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
607
+ def update_user_session(user_id, session_id, session_object = nil, current_time_millis: nil, fields: nil, quota_user: nil, options: nil, &block)
608
+ command = make_simple_command(:put, '{userId}/sessions/{sessionId}', options)
609
+ command.request_representation = Google::Apis::FitnessV1::Session::Representation
610
+ command.request_object = session_object
611
+ command.response_representation = Google::Apis::FitnessV1::Session::Representation
612
+ command.response_class = Google::Apis::FitnessV1::Session
613
+ command.params['userId'] = user_id unless user_id.nil?
614
+ command.params['sessionId'] = session_id unless session_id.nil?
615
+ command.query['currentTimeMillis'] = current_time_millis unless current_time_millis.nil?
616
+ command.query['fields'] = fields unless fields.nil?
617
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
618
+ execute_or_queue_command(command, &block)
619
+ end
620
+
621
+ protected
622
+
623
+ def apply_command_defaults(command)
624
+ command.query['key'] = key unless key.nil?
625
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
626
+ end
627
+ end
628
+ end
629
+ end
630
+ end