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\ListSessionsResponse;
|
---|
21 | use Google\Service\Fitness\Session;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The "sessions" collection of methods.
|
---|
25 | * Typical usage is:
|
---|
26 | * <code>
|
---|
27 | * $fitnessService = new Google\Service\Fitness(...);
|
---|
28 | * $sessions = $fitnessService->users_sessions;
|
---|
29 | * </code>
|
---|
30 | */
|
---|
31 | class UsersSessions extends \Google\Service\Resource
|
---|
32 | {
|
---|
33 | /**
|
---|
34 | * Deletes a session specified by the given session ID. (sessions.delete)
|
---|
35 | *
|
---|
36 | * @param string $userId Delete a session for the person identified. Use me to
|
---|
37 | * indicate the authenticated user. Only me is supported at this time.
|
---|
38 | * @param string $sessionId The ID of the session to be deleted.
|
---|
39 | * @param array $optParams Optional parameters.
|
---|
40 | * @throws \Google\Service\Exception
|
---|
41 | */
|
---|
42 | public function delete($userId, $sessionId, $optParams = [])
|
---|
43 | {
|
---|
44 | $params = ['userId' => $userId, 'sessionId' => $sessionId];
|
---|
45 | $params = array_merge($params, $optParams);
|
---|
46 | return $this->call('delete', [$params]);
|
---|
47 | }
|
---|
48 | /**
|
---|
49 | * Lists sessions previously created. (sessions.listUsersSessions)
|
---|
50 | *
|
---|
51 | * @param string $userId List sessions for the person identified. Use me to
|
---|
52 | * indicate the authenticated user. Only me is supported at this time.
|
---|
53 | * @param array $optParams Optional parameters.
|
---|
54 | *
|
---|
55 | * @opt_param int activityType If non-empty, only sessions with these activity
|
---|
56 | * types should be returned.
|
---|
57 | * @opt_param string endTime An RFC3339 timestamp. Only sessions ending between
|
---|
58 | * the start and end times will be included in the response. If this time is
|
---|
59 | * omitted but startTime is specified, all sessions from startTime to the end of
|
---|
60 | * time will be returned.
|
---|
61 | * @opt_param bool includeDeleted If true, and if both startTime and endTime are
|
---|
62 | * omitted, session deletions will be returned.
|
---|
63 | * @opt_param string pageToken The continuation token, which is used for
|
---|
64 | * incremental syncing. To get the next batch of changes, set this parameter to
|
---|
65 | * the value of nextPageToken from the previous response. The page token is
|
---|
66 | * ignored if either start or end time is specified. If none of start time, end
|
---|
67 | * time, and the page token is specified, sessions modified in the last 30 days
|
---|
68 | * are returned.
|
---|
69 | * @opt_param string startTime An RFC3339 timestamp. Only sessions ending
|
---|
70 | * between the start and end times will be included in the response. If this
|
---|
71 | * time is omitted but endTime is specified, all sessions from the start of time
|
---|
72 | * up to endTime will be returned.
|
---|
73 | * @return ListSessionsResponse
|
---|
74 | * @throws \Google\Service\Exception
|
---|
75 | */
|
---|
76 | public function listUsersSessions($userId, $optParams = [])
|
---|
77 | {
|
---|
78 | $params = ['userId' => $userId];
|
---|
79 | $params = array_merge($params, $optParams);
|
---|
80 | return $this->call('list', [$params], ListSessionsResponse::class);
|
---|
81 | }
|
---|
82 | /**
|
---|
83 | * Updates or insert a given session. (sessions.update)
|
---|
84 | *
|
---|
85 | * @param string $userId Create sessions for the person identified. Use me to
|
---|
86 | * indicate the authenticated user. Only me is supported at this time.
|
---|
87 | * @param string $sessionId The ID of the session to be created.
|
---|
88 | * @param Session $postBody
|
---|
89 | * @param array $optParams Optional parameters.
|
---|
90 | * @return Session
|
---|
91 | * @throws \Google\Service\Exception
|
---|
92 | */
|
---|
93 | public function update($userId, $sessionId, Session $postBody, $optParams = [])
|
---|
94 | {
|
---|
95 | $params = ['userId' => $userId, 'sessionId' => $sessionId, 'postBody' => $postBody];
|
---|
96 | $params = array_merge($params, $optParams);
|
---|
97 | return $this->call('update', [$params], Session::class);
|
---|
98 | }
|
---|
99 | }
|
---|
100 |
|
---|
101 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
102 | class_alias(UsersSessions::class, 'Google_Service_Fitness_Resource_UsersSessions');
|
---|