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