[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\Dataset;
|
---|
| 21 |
|
---|
| 22 | /**
|
---|
| 23 | * The "datasets" collection of methods.
|
---|
| 24 | * Typical usage is:
|
---|
| 25 | * <code>
|
---|
| 26 | * $fitnessService = new Google\Service\Fitness(...);
|
---|
| 27 | * $datasets = $fitnessService->users_dataSources_datasets;
|
---|
| 28 | * </code>
|
---|
| 29 | */
|
---|
| 30 | class UsersDataSourcesDatasets extends \Google\Service\Resource
|
---|
| 31 | {
|
---|
| 32 | /**
|
---|
| 33 | * Performs an inclusive delete of all data points whose start and end times
|
---|
| 34 | * have any overlap with the time range specified by the dataset ID. For most
|
---|
| 35 | * data types, the entire data point will be deleted. For data types where the
|
---|
| 36 | * time span represents a consistent value (such as
|
---|
| 37 | * com.google.activity.segment), and a data point straddles either end point of
|
---|
| 38 | * the dataset, only the overlapping portion of the data point will be deleted.
|
---|
| 39 | * (datasets.delete)
|
---|
| 40 | *
|
---|
| 41 | * @param string $userId Delete a dataset for the person identified. Use me to
|
---|
| 42 | * indicate the authenticated user. Only me is supported at this time.
|
---|
| 43 | * @param string $dataSourceId The data stream ID of the data source that
|
---|
| 44 | * created the dataset.
|
---|
| 45 | * @param string $datasetId Dataset identifier that is a composite of the
|
---|
| 46 | * minimum data point start time and maximum data point end time represented as
|
---|
| 47 | * nanoseconds from the epoch. The ID is formatted like: "startTime-endTime"
|
---|
| 48 | * where startTime and endTime are 64 bit integers.
|
---|
| 49 | * @param array $optParams Optional parameters.
|
---|
| 50 | * @throws \Google\Service\Exception
|
---|
| 51 | */
|
---|
| 52 | public function delete($userId, $dataSourceId, $datasetId, $optParams = [])
|
---|
| 53 | {
|
---|
| 54 | $params = ['userId' => $userId, 'dataSourceId' => $dataSourceId, 'datasetId' => $datasetId];
|
---|
| 55 | $params = array_merge($params, $optParams);
|
---|
| 56 | return $this->call('delete', [$params]);
|
---|
| 57 | }
|
---|
| 58 | /**
|
---|
| 59 | * Returns a dataset containing all data points whose start and end times
|
---|
| 60 | * overlap with the specified range of the dataset minimum start time and
|
---|
| 61 | * maximum end time. Specifically, any data point whose start time is less than
|
---|
| 62 | * or equal to the dataset end time and whose end time is greater than or equal
|
---|
| 63 | * to the dataset start time. (datasets.get)
|
---|
| 64 | *
|
---|
| 65 | * @param string $userId Retrieve a dataset for the person identified. Use me to
|
---|
| 66 | * indicate the authenticated user. Only me is supported at this time.
|
---|
| 67 | * @param string $dataSourceId The data stream ID of the data source that
|
---|
| 68 | * created the dataset.
|
---|
| 69 | * @param string $datasetId Dataset identifier that is a composite of the
|
---|
| 70 | * minimum data point start time and maximum data point end time represented as
|
---|
| 71 | * nanoseconds from the epoch. The ID is formatted like: "startTime-endTime"
|
---|
| 72 | * where startTime and endTime are 64 bit integers.
|
---|
| 73 | * @param array $optParams Optional parameters.
|
---|
| 74 | *
|
---|
| 75 | * @opt_param int limit If specified, no more than this many data points will be
|
---|
| 76 | * included in the dataset. If there are more data points in the dataset,
|
---|
| 77 | * nextPageToken will be set in the dataset response. The limit is applied from
|
---|
| 78 | * the end of the time range. That is, if pageToken is absent, the limit most
|
---|
| 79 | * recent data points will be returned.
|
---|
| 80 | * @opt_param string pageToken The continuation token, which is used to page
|
---|
| 81 | * through large datasets. To get the next page of a dataset, set this parameter
|
---|
| 82 | * to the value of nextPageToken from the previous response. Each subsequent
|
---|
| 83 | * call will yield a partial dataset with data point end timestamps that are
|
---|
| 84 | * strictly smaller than those in the previous partial response.
|
---|
| 85 | * @return Dataset
|
---|
| 86 | * @throws \Google\Service\Exception
|
---|
| 87 | */
|
---|
| 88 | public function get($userId, $dataSourceId, $datasetId, $optParams = [])
|
---|
| 89 | {
|
---|
| 90 | $params = ['userId' => $userId, 'dataSourceId' => $dataSourceId, 'datasetId' => $datasetId];
|
---|
| 91 | $params = array_merge($params, $optParams);
|
---|
| 92 | return $this->call('get', [$params], Dataset::class);
|
---|
| 93 | }
|
---|
| 94 | /**
|
---|
| 95 | * Adds data points to a dataset. The dataset need not be previously created.
|
---|
| 96 | * All points within the given dataset will be returned with subsquent calls to
|
---|
| 97 | * retrieve this dataset. Data points can belong to more than one dataset. This
|
---|
| 98 | * method does not use patch semantics: the data points provided are merely
|
---|
| 99 | * inserted, with no existing data replaced. (datasets.patch)
|
---|
| 100 | *
|
---|
| 101 | * @param string $userId Patch a dataset for the person identified. Use me to
|
---|
| 102 | * indicate the authenticated user. Only me is supported at this time.
|
---|
| 103 | * @param string $dataSourceId The data stream ID of the data source that
|
---|
| 104 | * created the dataset.
|
---|
| 105 | * @param string $datasetId This field is not used, and can be safely omitted.
|
---|
| 106 | * @param Dataset $postBody
|
---|
| 107 | * @param array $optParams Optional parameters.
|
---|
| 108 | * @return Dataset
|
---|
| 109 | * @throws \Google\Service\Exception
|
---|
| 110 | */
|
---|
| 111 | public function patch($userId, $dataSourceId, $datasetId, Dataset $postBody, $optParams = [])
|
---|
| 112 | {
|
---|
| 113 | $params = ['userId' => $userId, 'dataSourceId' => $dataSourceId, 'datasetId' => $datasetId, 'postBody' => $postBody];
|
---|
| 114 | $params = array_merge($params, $optParams);
|
---|
| 115 | return $this->call('patch', [$params], Dataset::class);
|
---|
| 116 | }
|
---|
| 117 | }
|
---|
| 118 |
|
---|
| 119 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 120 | class_alias(UsersDataSourcesDatasets::class, 'Google_Service_Fitness_Resource_UsersDataSourcesDatasets');
|
---|