Fitness.php 15 KB

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