1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service;
19
20use Google\Client;
21
22/**
23 * Service definition for Fitness (v1).
24 *
25 * <p>
26 * The Fitness API for managing users' fitness tracking data.</p>
27 *
28 * <p>
29 * For more information about this service, see the API
30 * <a href="https://developers.google.com/fit/rest/v1/get-started" target="_blank">Documentation</a>
31 * </p>
32 *
33 * @author Google, Inc.
34 */
35class Fitness extends \Google\Service
36{
37  /** Use Google Fit to see and store your physical activity data. */
38  const FITNESS_ACTIVITY_READ =
39      "https://www.googleapis.com/auth/fitness.activity.read";
40  /** Add to your Google Fit physical activity data. */
41  const FITNESS_ACTIVITY_WRITE =
42      "https://www.googleapis.com/auth/fitness.activity.write";
43  /** See info about your blood glucose in Google Fit. I consent to Google sharing my blood glucose information with this app.. */
44  const FITNESS_BLOOD_GLUCOSE_READ =
45      "https://www.googleapis.com/auth/fitness.blood_glucose.read";
46  /** Add info about your blood glucose to Google Fit. I consent to Google using my blood glucose information with this app.. */
47  const FITNESS_BLOOD_GLUCOSE_WRITE =
48      "https://www.googleapis.com/auth/fitness.blood_glucose.write";
49  /** See info about your blood pressure in Google Fit. I consent to Google sharing my blood pressure information with this app.. */
50  const FITNESS_BLOOD_PRESSURE_READ =
51      "https://www.googleapis.com/auth/fitness.blood_pressure.read";
52  /** Add info about your blood pressure in Google Fit. I consent to Google using my blood pressure information with this app.. */
53  const FITNESS_BLOOD_PRESSURE_WRITE =
54      "https://www.googleapis.com/auth/fitness.blood_pressure.write";
55  /** See info about your body measurements in Google Fit. */
56  const FITNESS_BODY_READ =
57      "https://www.googleapis.com/auth/fitness.body.read";
58  /** Add info about your body measurements to Google Fit. */
59  const FITNESS_BODY_WRITE =
60      "https://www.googleapis.com/auth/fitness.body.write";
61  /** See info about your body temperature in Google Fit. I consent to Google sharing my body temperature information with this app.. */
62  const FITNESS_BODY_TEMPERATURE_READ =
63      "https://www.googleapis.com/auth/fitness.body_temperature.read";
64  /** Add to info about your body temperature in Google Fit. I consent to Google using my body temperature information with this app.. */
65  const FITNESS_BODY_TEMPERATURE_WRITE =
66      "https://www.googleapis.com/auth/fitness.body_temperature.write";
67  /** See your heart rate data in Google Fit. I consent to Google sharing my heart rate information with this app.. */
68  const FITNESS_HEART_RATE_READ =
69      "https://www.googleapis.com/auth/fitness.heart_rate.read";
70  /** Add to your heart rate data in Google Fit. I consent to Google using my heart rate information with this app.. */
71  const FITNESS_HEART_RATE_WRITE =
72      "https://www.googleapis.com/auth/fitness.heart_rate.write";
73  /** See your Google Fit speed and distance data. */
74  const FITNESS_LOCATION_READ =
75      "https://www.googleapis.com/auth/fitness.location.read";
76  /** Add to your Google Fit location data. */
77  const FITNESS_LOCATION_WRITE =
78      "https://www.googleapis.com/auth/fitness.location.write";
79  /** See info about your nutrition in Google Fit. */
80  const FITNESS_NUTRITION_READ =
81      "https://www.googleapis.com/auth/fitness.nutrition.read";
82  /** Add to info about your nutrition in Google Fit. */
83  const FITNESS_NUTRITION_WRITE =
84      "https://www.googleapis.com/auth/fitness.nutrition.write";
85  /** See info about your oxygen saturation in Google Fit. I consent to Google sharing my oxygen saturation information with this app.. */
86  const FITNESS_OXYGEN_SATURATION_READ =
87      "https://www.googleapis.com/auth/fitness.oxygen_saturation.read";
88  /** Add info about your oxygen saturation in Google Fit. I consent to Google using my oxygen saturation information with this app.. */
89  const FITNESS_OXYGEN_SATURATION_WRITE =
90      "https://www.googleapis.com/auth/fitness.oxygen_saturation.write";
91  /** See info about your reproductive health in Google Fit. I consent to Google sharing my reproductive health information with this app.. */
92  const FITNESS_REPRODUCTIVE_HEALTH_READ =
93      "https://www.googleapis.com/auth/fitness.reproductive_health.read";
94  /** Add info about your reproductive health in Google Fit. I consent to Google using my reproductive health information with this app.. */
95  const FITNESS_REPRODUCTIVE_HEALTH_WRITE =
96      "https://www.googleapis.com/auth/fitness.reproductive_health.write";
97  /** See your sleep data in Google Fit. I consent to Google sharing my sleep information with this app.. */
98  const FITNESS_SLEEP_READ =
99      "https://www.googleapis.com/auth/fitness.sleep.read";
100  /** Add to your sleep data in Google Fit. I consent to Google using my sleep information with this app.. */
101  const FITNESS_SLEEP_WRITE =
102      "https://www.googleapis.com/auth/fitness.sleep.write";
103
104  public $users_dataSources;
105  public $users_dataSources_dataPointChanges;
106  public $users_dataSources_datasets;
107  public $users_dataset;
108  public $users_sessions;
109
110  /**
111   * Constructs the internal representation of the Fitness service.
112   *
113   * @param Client|array $clientOrConfig The client used to deliver requests, or a
114   *                                     config array to pass to a new Client instance.
115   * @param string $rootUrl The root URL used for requests to the service.
116   */
117  public function __construct($clientOrConfig = [], $rootUrl = null)
118  {
119    parent::__construct($clientOrConfig);
120    $this->rootUrl = $rootUrl ?: 'https://fitness.googleapis.com/';
121    $this->servicePath = 'fitness/v1/users/';
122    $this->batchPath = 'batch';
123    $this->version = 'v1';
124    $this->serviceName = 'fitness';
125
126    $this->users_dataSources = new Fitness\Resource\UsersDataSources(
127        $this,
128        $this->serviceName,
129        'dataSources',
130        [
131          'methods' => [
132            'create' => [
133              'path' => '{userId}/dataSources',
134              'httpMethod' => 'POST',
135              'parameters' => [
136                'userId' => [
137                  'location' => 'path',
138                  'type' => 'string',
139                  'required' => true,
140                ],
141              ],
142            ],'delete' => [
143              'path' => '{userId}/dataSources/{dataSourceId}',
144              'httpMethod' => 'DELETE',
145              'parameters' => [
146                'userId' => [
147                  'location' => 'path',
148                  'type' => 'string',
149                  'required' => true,
150                ],
151                'dataSourceId' => [
152                  'location' => 'path',
153                  'type' => 'string',
154                  'required' => true,
155                ],
156              ],
157            ],'get' => [
158              'path' => '{userId}/dataSources/{dataSourceId}',
159              'httpMethod' => 'GET',
160              'parameters' => [
161                'userId' => [
162                  'location' => 'path',
163                  'type' => 'string',
164                  'required' => true,
165                ],
166                'dataSourceId' => [
167                  'location' => 'path',
168                  'type' => 'string',
169                  'required' => true,
170                ],
171              ],
172            ],'list' => [
173              'path' => '{userId}/dataSources',
174              'httpMethod' => 'GET',
175              'parameters' => [
176                'userId' => [
177                  'location' => 'path',
178                  'type' => 'string',
179                  'required' => true,
180                ],
181                'dataTypeName' => [
182                  'location' => 'query',
183                  'type' => 'string',
184                  'repeated' => true,
185                ],
186              ],
187            ],'update' => [
188              'path' => '{userId}/dataSources/{dataSourceId}',
189              'httpMethod' => 'PUT',
190              'parameters' => [
191                'userId' => [
192                  'location' => 'path',
193                  'type' => 'string',
194                  'required' => true,
195                ],
196                'dataSourceId' => [
197                  'location' => 'path',
198                  'type' => 'string',
199                  'required' => true,
200                ],
201              ],
202            ],
203          ]
204        ]
205    );
206    $this->users_dataSources_dataPointChanges = new Fitness\Resource\UsersDataSourcesDataPointChanges(
207        $this,
208        $this->serviceName,
209        'dataPointChanges',
210        [
211          'methods' => [
212            'list' => [
213              'path' => '{userId}/dataSources/{dataSourceId}/dataPointChanges',
214              'httpMethod' => 'GET',
215              'parameters' => [
216                'userId' => [
217                  'location' => 'path',
218                  'type' => 'string',
219                  'required' => true,
220                ],
221                'dataSourceId' => [
222                  'location' => 'path',
223                  'type' => 'string',
224                  'required' => true,
225                ],
226                'limit' => [
227                  'location' => 'query',
228                  'type' => 'integer',
229                ],
230                'pageToken' => [
231                  'location' => 'query',
232                  'type' => 'string',
233                ],
234              ],
235            ],
236          ]
237        ]
238    );
239    $this->users_dataSources_datasets = new Fitness\Resource\UsersDataSourcesDatasets(
240        $this,
241        $this->serviceName,
242        'datasets',
243        [
244          'methods' => [
245            'delete' => [
246              'path' => '{userId}/dataSources/{dataSourceId}/datasets/{datasetId}',
247              'httpMethod' => 'DELETE',
248              'parameters' => [
249                'userId' => [
250                  'location' => 'path',
251                  'type' => 'string',
252                  'required' => true,
253                ],
254                'dataSourceId' => [
255                  'location' => 'path',
256                  'type' => 'string',
257                  'required' => true,
258                ],
259                'datasetId' => [
260                  'location' => 'path',
261                  'type' => 'string',
262                  'required' => true,
263                ],
264              ],
265            ],'get' => [
266              'path' => '{userId}/dataSources/{dataSourceId}/datasets/{datasetId}',
267              'httpMethod' => 'GET',
268              'parameters' => [
269                'userId' => [
270                  'location' => 'path',
271                  'type' => 'string',
272                  'required' => true,
273                ],
274                'dataSourceId' => [
275                  'location' => 'path',
276                  'type' => 'string',
277                  'required' => true,
278                ],
279                'datasetId' => [
280                  'location' => 'path',
281                  'type' => 'string',
282                  'required' => true,
283                ],
284                'limit' => [
285                  'location' => 'query',
286                  'type' => 'integer',
287                ],
288                'pageToken' => [
289                  'location' => 'query',
290                  'type' => 'string',
291                ],
292              ],
293            ],'patch' => [
294              'path' => '{userId}/dataSources/{dataSourceId}/datasets/{datasetId}',
295              'httpMethod' => 'PATCH',
296              'parameters' => [
297                'userId' => [
298                  'location' => 'path',
299                  'type' => 'string',
300                  'required' => true,
301                ],
302                'dataSourceId' => [
303                  'location' => 'path',
304                  'type' => 'string',
305                  'required' => true,
306                ],
307                'datasetId' => [
308                  'location' => 'path',
309                  'type' => 'string',
310                  'required' => true,
311                ],
312              ],
313            ],
314          ]
315        ]
316    );
317    $this->users_dataset = new Fitness\Resource\UsersDataset(
318        $this,
319        $this->serviceName,
320        'dataset',
321        [
322          'methods' => [
323            'aggregate' => [
324              'path' => '{userId}/dataset:aggregate',
325              'httpMethod' => 'POST',
326              'parameters' => [
327                'userId' => [
328                  'location' => 'path',
329                  'type' => 'string',
330                  'required' => true,
331                ],
332              ],
333            ],
334          ]
335        ]
336    );
337    $this->users_sessions = new Fitness\Resource\UsersSessions(
338        $this,
339        $this->serviceName,
340        'sessions',
341        [
342          'methods' => [
343            'delete' => [
344              'path' => '{userId}/sessions/{sessionId}',
345              'httpMethod' => 'DELETE',
346              'parameters' => [
347                'userId' => [
348                  'location' => 'path',
349                  'type' => 'string',
350                  'required' => true,
351                ],
352                'sessionId' => [
353                  'location' => 'path',
354                  'type' => 'string',
355                  'required' => true,
356                ],
357              ],
358            ],'list' => [
359              'path' => '{userId}/sessions',
360              'httpMethod' => 'GET',
361              'parameters' => [
362                'userId' => [
363                  'location' => 'path',
364                  'type' => 'string',
365                  'required' => true,
366                ],
367                'activityType' => [
368                  'location' => 'query',
369                  'type' => 'integer',
370                  'repeated' => true,
371                ],
372                'endTime' => [
373                  'location' => 'query',
374                  'type' => 'string',
375                ],
376                'includeDeleted' => [
377                  'location' => 'query',
378                  'type' => 'boolean',
379                ],
380                'pageToken' => [
381                  'location' => 'query',
382                  'type' => 'string',
383                ],
384                'startTime' => [
385                  'location' => 'query',
386                  'type' => 'string',
387                ],
388              ],
389            ],'update' => [
390              'path' => '{userId}/sessions/{sessionId}',
391              'httpMethod' => 'PUT',
392              'parameters' => [
393                'userId' => [
394                  'location' => 'path',
395                  'type' => 'string',
396                  'required' => true,
397                ],
398                'sessionId' => [
399                  'location' => 'path',
400                  'type' => 'string',
401                  'required' => true,
402                ],
403              ],
404            ],
405          ]
406        ]
407    );
408  }
409}
410
411// Adding a class alias for backwards compatibility with the previous class name.
412class_alias(Fitness::class, 'Google_Service_Fitness');
413