[e3d4e0a] | 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 |
|
---|
| 18 | namespace Google\Service\Fitness\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Fitness\DataSource;
|
---|
| 21 | use Google\Service\Fitness\ListDataSourcesResponse;
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * The "dataSources" collection of methods.
|
---|
| 25 | * Typical usage is:
|
---|
| 26 | * <code>
|
---|
| 27 | * $fitnessService = new Google\Service\Fitness(...);
|
---|
| 28 | * $dataSources = $fitnessService->users_dataSources;
|
---|
| 29 | * </code>
|
---|
| 30 | */
|
---|
| 31 | class UsersDataSources extends \Google\Service\Resource
|
---|
| 32 | {
|
---|
| 33 | /**
|
---|
| 34 | * Creates a new data source that is unique across all data sources belonging to
|
---|
| 35 | * this user. A data source is a unique source of sensor data. Data sources can
|
---|
| 36 | * expose raw data coming from hardware sensors on local or companion devices.
|
---|
| 37 | * They can also expose derived data, created by transforming or merging other
|
---|
| 38 | * data sources. Multiple data sources can exist for the same data type. Every
|
---|
| 39 | * data point in every dataset inserted into or read from the Fitness API has an
|
---|
| 40 | * associated data source. Each data source produces a unique stream of dataset
|
---|
| 41 | * updates, with a unique data source identifier. Not all changes to data source
|
---|
| 42 | * affect the data stream ID, so that data collected by updated versions of the
|
---|
| 43 | * same application/device can still be considered to belong to the same data
|
---|
| 44 | * source. Data sources are identified using a string generated by the server,
|
---|
| 45 | * based on the contents of the source being created. The dataStreamId field
|
---|
| 46 | * should not be set when invoking this method. It will be automatically
|
---|
| 47 | * generated by the server with the correct format. If a dataStreamId is set, it
|
---|
| 48 | * must match the format that the server would generate. This format is a
|
---|
| 49 | * combination of some fields from the data source, and has a specific order. If
|
---|
| 50 | * it doesn't match, the request will fail with an error. Specifying a DataType
|
---|
| 51 | * which is not a known type (beginning with "com.google.") will create a
|
---|
| 52 | * DataSource with a *custom data type*. Custom data types are only readable by
|
---|
| 53 | * the application that created them. Custom data types are *deprecated*; use
|
---|
| 54 | * standard data types instead. In addition to the data source fields included
|
---|
| 55 | * in the data source ID, the developer project number that is authenticated
|
---|
| 56 | * when creating the data source is included. This developer project number is
|
---|
| 57 | * obfuscated when read by any other developer reading public data types.
|
---|
| 58 | * (dataSources.create)
|
---|
| 59 | *
|
---|
| 60 | * @param string $userId Create the data source for the person identified. Use
|
---|
| 61 | * me to indicate the authenticated user. Only me is supported at this time.
|
---|
| 62 | * @param DataSource $postBody
|
---|
| 63 | * @param array $optParams Optional parameters.
|
---|
| 64 | * @return DataSource
|
---|
| 65 | * @throws \Google\Service\Exception
|
---|
| 66 | */
|
---|
| 67 | public function create($userId, DataSource $postBody, $optParams = [])
|
---|
| 68 | {
|
---|
| 69 | $params = ['userId' => $userId, 'postBody' => $postBody];
|
---|
| 70 | $params = array_merge($params, $optParams);
|
---|
| 71 | return $this->call('create', [$params], DataSource::class);
|
---|
| 72 | }
|
---|
| 73 | /**
|
---|
| 74 | * Deletes the specified data source. The request will fail if the data source
|
---|
| 75 | * contains any data points. (dataSources.delete)
|
---|
| 76 | *
|
---|
| 77 | * @param string $userId Retrieve a data source for the person identified. Use
|
---|
| 78 | * me to indicate the authenticated user. Only me is supported at this time.
|
---|
| 79 | * @param string $dataSourceId The data stream ID of the data source to delete.
|
---|
| 80 | * @param array $optParams Optional parameters.
|
---|
| 81 | * @return DataSource
|
---|
| 82 | * @throws \Google\Service\Exception
|
---|
| 83 | */
|
---|
| 84 | public function delete($userId, $dataSourceId, $optParams = [])
|
---|
| 85 | {
|
---|
| 86 | $params = ['userId' => $userId, 'dataSourceId' => $dataSourceId];
|
---|
| 87 | $params = array_merge($params, $optParams);
|
---|
| 88 | return $this->call('delete', [$params], DataSource::class);
|
---|
| 89 | }
|
---|
| 90 | /**
|
---|
| 91 | * Returns the specified data source. (dataSources.get)
|
---|
| 92 | *
|
---|
| 93 | * @param string $userId Retrieve a data source for the person identified. Use
|
---|
| 94 | * me to indicate the authenticated user. Only me is supported at this time.
|
---|
| 95 | * @param string $dataSourceId The data stream ID of the data source to
|
---|
| 96 | * retrieve.
|
---|
| 97 | * @param array $optParams Optional parameters.
|
---|
| 98 | * @return DataSource
|
---|
| 99 | * @throws \Google\Service\Exception
|
---|
| 100 | */
|
---|
| 101 | public function get($userId, $dataSourceId, $optParams = [])
|
---|
| 102 | {
|
---|
| 103 | $params = ['userId' => $userId, 'dataSourceId' => $dataSourceId];
|
---|
| 104 | $params = array_merge($params, $optParams);
|
---|
| 105 | return $this->call('get', [$params], DataSource::class);
|
---|
| 106 | }
|
---|
| 107 | /**
|
---|
| 108 | * Lists all data sources that are visible to the developer, using the OAuth
|
---|
| 109 | * scopes provided. The list is not exhaustive; the user may have private data
|
---|
| 110 | * sources that are only visible to other developers, or calls using other
|
---|
| 111 | * scopes. (dataSources.listUsersDataSources)
|
---|
| 112 | *
|
---|
| 113 | * @param string $userId List data sources for the person identified. Use me to
|
---|
| 114 | * indicate the authenticated user. Only me is supported at this time.
|
---|
| 115 | * @param array $optParams Optional parameters.
|
---|
| 116 | *
|
---|
| 117 | * @opt_param string dataTypeName The names of data types to include in the
|
---|
| 118 | * list. If not specified, all data sources will be returned.
|
---|
| 119 | * @return ListDataSourcesResponse
|
---|
| 120 | * @throws \Google\Service\Exception
|
---|
| 121 | */
|
---|
| 122 | public function listUsersDataSources($userId, $optParams = [])
|
---|
| 123 | {
|
---|
| 124 | $params = ['userId' => $userId];
|
---|
| 125 | $params = array_merge($params, $optParams);
|
---|
| 126 | return $this->call('list', [$params], ListDataSourcesResponse::class);
|
---|
| 127 | }
|
---|
| 128 | /**
|
---|
| 129 | * Updates the specified data source. The dataStreamId, dataType, type,
|
---|
| 130 | * dataStreamName, and device properties with the exception of version, cannot
|
---|
| 131 | * be modified. Data sources are identified by their dataStreamId.
|
---|
| 132 | * (dataSources.update)
|
---|
| 133 | *
|
---|
| 134 | * @param string $userId Update the data source for the person identified. Use
|
---|
| 135 | * me to indicate the authenticated user. Only me is supported at this time.
|
---|
| 136 | * @param string $dataSourceId The data stream ID of the data source to update.
|
---|
| 137 | * @param DataSource $postBody
|
---|
| 138 | * @param array $optParams Optional parameters.
|
---|
| 139 | * @return DataSource
|
---|
| 140 | * @throws \Google\Service\Exception
|
---|
| 141 | */
|
---|
| 142 | public function update($userId, $dataSourceId, DataSource $postBody, $optParams = [])
|
---|
| 143 | {
|
---|
| 144 | $params = ['userId' => $userId, 'dataSourceId' => $dataSourceId, 'postBody' => $postBody];
|
---|
| 145 | $params = array_merge($params, $optParams);
|
---|
| 146 | return $this->call('update', [$params], DataSource::class);
|
---|
| 147 | }
|
---|
| 148 | }
|
---|
| 149 |
|
---|
| 150 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 151 | class_alias(UsersDataSources::class, 'Google_Service_Fitness_Resource_UsersDataSources');
|
---|