25 |
- |
1 |
<?php
|
|
|
2 |
/*
|
|
|
3 |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
|
|
4 |
* use this file except in compliance with the License. You may obtain a copy of
|
|
|
5 |
* the License at
|
|
|
6 |
*
|
|
|
7 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
8 |
*
|
|
|
9 |
* Unless required by applicable law or agreed to in writing, software
|
|
|
10 |
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
11 |
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
12 |
* License for the specific language governing permissions and limitations under
|
|
|
13 |
* the License.
|
|
|
14 |
*/
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* The "currentLocation" collection of methods.
|
|
|
19 |
* Typical usage is:
|
|
|
20 |
* <code>
|
|
|
21 |
* $latitudeService = new Google_LatitudeService(...);
|
|
|
22 |
* $currentLocation = $latitudeService->currentLocation;
|
|
|
23 |
* </code>
|
|
|
24 |
*/
|
|
|
25 |
class Google_CurrentLocationServiceResource extends Google_ServiceResource {
|
|
|
26 |
|
|
|
27 |
|
|
|
28 |
/**
|
|
|
29 |
* Updates or creates the user's current location. (currentLocation.insert)
|
|
|
30 |
*
|
|
|
31 |
* @param Google_Location $postBody
|
|
|
32 |
* @param array $optParams Optional parameters.
|
|
|
33 |
* @return Google_Location
|
|
|
34 |
*/
|
|
|
35 |
public function insert(Google_Location $postBody, $optParams = array()) {
|
|
|
36 |
$params = array('postBody' => $postBody);
|
|
|
37 |
$params = array_merge($params, $optParams);
|
|
|
38 |
$data = $this->__call('insert', array($params));
|
|
|
39 |
if ($this->useObjects()) {
|
|
|
40 |
return new Google_Location($data);
|
|
|
41 |
} else {
|
|
|
42 |
return $data;
|
|
|
43 |
}
|
|
|
44 |
}
|
|
|
45 |
/**
|
|
|
46 |
* Returns the authenticated user's current location. (currentLocation.get)
|
|
|
47 |
*
|
|
|
48 |
* @param array $optParams Optional parameters.
|
|
|
49 |
*
|
|
|
50 |
* @opt_param string granularity Granularity of the requested location.
|
|
|
51 |
* @return Google_Location
|
|
|
52 |
*/
|
|
|
53 |
public function get($optParams = array()) {
|
|
|
54 |
$params = array();
|
|
|
55 |
$params = array_merge($params, $optParams);
|
|
|
56 |
$data = $this->__call('get', array($params));
|
|
|
57 |
if ($this->useObjects()) {
|
|
|
58 |
return new Google_Location($data);
|
|
|
59 |
} else {
|
|
|
60 |
return $data;
|
|
|
61 |
}
|
|
|
62 |
}
|
|
|
63 |
/**
|
|
|
64 |
* Deletes the authenticated user's current location. (currentLocation.delete)
|
|
|
65 |
*
|
|
|
66 |
* @param array $optParams Optional parameters.
|
|
|
67 |
*/
|
|
|
68 |
public function delete($optParams = array()) {
|
|
|
69 |
$params = array();
|
|
|
70 |
$params = array_merge($params, $optParams);
|
|
|
71 |
$data = $this->__call('delete', array($params));
|
|
|
72 |
return $data;
|
|
|
73 |
}
|
|
|
74 |
}
|
|
|
75 |
|
|
|
76 |
/**
|
|
|
77 |
* The "location" collection of methods.
|
|
|
78 |
* Typical usage is:
|
|
|
79 |
* <code>
|
|
|
80 |
* $latitudeService = new Google_LatitudeService(...);
|
|
|
81 |
* $location = $latitudeService->location;
|
|
|
82 |
* </code>
|
|
|
83 |
*/
|
|
|
84 |
class Google_LocationServiceResource extends Google_ServiceResource {
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
/**
|
|
|
88 |
* Inserts or updates a location in the user's location history. (location.insert)
|
|
|
89 |
*
|
|
|
90 |
* @param Google_Location $postBody
|
|
|
91 |
* @param array $optParams Optional parameters.
|
|
|
92 |
* @return Google_Location
|
|
|
93 |
*/
|
|
|
94 |
public function insert(Google_Location $postBody, $optParams = array()) {
|
|
|
95 |
$params = array('postBody' => $postBody);
|
|
|
96 |
$params = array_merge($params, $optParams);
|
|
|
97 |
$data = $this->__call('insert', array($params));
|
|
|
98 |
if ($this->useObjects()) {
|
|
|
99 |
return new Google_Location($data);
|
|
|
100 |
} else {
|
|
|
101 |
return $data;
|
|
|
102 |
}
|
|
|
103 |
}
|
|
|
104 |
/**
|
|
|
105 |
* Reads a location from the user's location history. (location.get)
|
|
|
106 |
*
|
|
|
107 |
* @param string $locationId Timestamp of the location to read (ms since epoch).
|
|
|
108 |
* @param array $optParams Optional parameters.
|
|
|
109 |
*
|
|
|
110 |
* @opt_param string granularity Granularity of the location to return.
|
|
|
111 |
* @return Google_Location
|
|
|
112 |
*/
|
|
|
113 |
public function get($locationId, $optParams = array()) {
|
|
|
114 |
$params = array('locationId' => $locationId);
|
|
|
115 |
$params = array_merge($params, $optParams);
|
|
|
116 |
$data = $this->__call('get', array($params));
|
|
|
117 |
if ($this->useObjects()) {
|
|
|
118 |
return new Google_Location($data);
|
|
|
119 |
} else {
|
|
|
120 |
return $data;
|
|
|
121 |
}
|
|
|
122 |
}
|
|
|
123 |
/**
|
|
|
124 |
* Lists the user's location history. (location.list)
|
|
|
125 |
*
|
|
|
126 |
* @param array $optParams Optional parameters.
|
|
|
127 |
*
|
|
|
128 |
* @opt_param string max-results Maximum number of locations to return.
|
|
|
129 |
* @opt_param string max-time Maximum timestamp of locations to return (ms since epoch).
|
|
|
130 |
* @opt_param string min-time Minimum timestamp of locations to return (ms since epoch).
|
|
|
131 |
* @opt_param string granularity Granularity of the requested locations.
|
|
|
132 |
* @return Google_LocationFeed
|
|
|
133 |
*/
|
|
|
134 |
public function listLocation($optParams = array()) {
|
|
|
135 |
$params = array();
|
|
|
136 |
$params = array_merge($params, $optParams);
|
|
|
137 |
$data = $this->__call('list', array($params));
|
|
|
138 |
if ($this->useObjects()) {
|
|
|
139 |
return new Google_LocationFeed($data);
|
|
|
140 |
} else {
|
|
|
141 |
return $data;
|
|
|
142 |
}
|
|
|
143 |
}
|
|
|
144 |
/**
|
|
|
145 |
* Deletes a location from the user's location history. (location.delete)
|
|
|
146 |
*
|
|
|
147 |
* @param string $locationId Timestamp of the location to delete (ms since epoch).
|
|
|
148 |
* @param array $optParams Optional parameters.
|
|
|
149 |
*/
|
|
|
150 |
public function delete($locationId, $optParams = array()) {
|
|
|
151 |
$params = array('locationId' => $locationId);
|
|
|
152 |
$params = array_merge($params, $optParams);
|
|
|
153 |
$data = $this->__call('delete', array($params));
|
|
|
154 |
return $data;
|
|
|
155 |
}
|
|
|
156 |
}
|
|
|
157 |
|
|
|
158 |
/**
|
|
|
159 |
* Service definition for Google_Latitude (v1).
|
|
|
160 |
*
|
|
|
161 |
* <p>
|
|
|
162 |
* Lets you read and update your current location and work with your location history
|
|
|
163 |
* </p>
|
|
|
164 |
*
|
|
|
165 |
* <p>
|
|
|
166 |
* For more information about this service, see the
|
|
|
167 |
* <a href="https://developers.google.com/latitude/v1/using" target="_blank">API Documentation</a>
|
|
|
168 |
* </p>
|
|
|
169 |
*
|
|
|
170 |
* @author Google, Inc.
|
|
|
171 |
*/
|
|
|
172 |
class Google_LatitudeService extends Google_Service {
|
|
|
173 |
public $currentLocation;
|
|
|
174 |
public $location;
|
|
|
175 |
/**
|
|
|
176 |
* Constructs the internal representation of the Latitude service.
|
|
|
177 |
*
|
|
|
178 |
* @param Google_Client $client
|
|
|
179 |
*/
|
|
|
180 |
public function __construct(Google_Client $client) {
|
|
|
181 |
$this->servicePath = 'latitude/v1/';
|
|
|
182 |
$this->version = 'v1';
|
|
|
183 |
$this->serviceName = 'latitude';
|
|
|
184 |
|
|
|
185 |
$client->addService($this->serviceName, $this->version);
|
|
|
186 |
$this->currentLocation = new Google_CurrentLocationServiceResource($this, $this->serviceName, 'currentLocation', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/latitude.all.best", "https://www.googleapis.com/auth/latitude.all.city", "https://www.googleapis.com/auth/latitude.current.best", "https://www.googleapis.com/auth/latitude.current.city"], "request": {"$ref": "LatitudeCurrentlocationResourceJson"}, "response": {"$ref": "LatitudeCurrentlocationResourceJson"}, "httpMethod": "POST", "path": "currentLocation", "id": "latitude.currentLocation.insert"}, "get": {"scopes": ["https://www.googleapis.com/auth/latitude.all.best", "https://www.googleapis.com/auth/latitude.all.city", "https://www.googleapis.com/auth/latitude.current.best", "https://www.googleapis.com/auth/latitude.current.city"], "parameters": {"granularity": {"default": "city", "enum": ["best", "city"], "type": "string", "location": "query"}}, "response": {"$ref": "LatitudeCurrentlocationResourceJson"}, "httpMethod": "GET", "path": "currentLocation", "id": "latitude.currentLocation.get"}, "delete": {"path": "currentLocation", "scopes": ["https://www.googleapis.com/auth/latitude.all.best", "https://www.googleapis.com/auth/latitude.all.city", "https://www.googleapis.com/auth/latitude.current.best", "https://www.googleapis.com/auth/latitude.current.city"], "id": "latitude.currentLocation.delete", "httpMethod": "DELETE"}}}', true));
|
|
|
187 |
$this->location = new Google_LocationServiceResource($this, $this->serviceName, 'location', json_decode('{"methods": {"insert": {"scopes": ["https://www.googleapis.com/auth/latitude.all.best", "https://www.googleapis.com/auth/latitude.all.city"], "request": {"$ref": "Location"}, "response": {"$ref": "Location"}, "httpMethod": "POST", "path": "location", "id": "latitude.location.insert"}, "get": {"scopes": ["https://www.googleapis.com/auth/latitude.all.best", "https://www.googleapis.com/auth/latitude.all.city"], "parameters": {"locationId": {"required": true, "type": "string", "location": "path"}, "granularity": {"default": "city", "enum": ["best", "city"], "type": "string", "location": "query"}}, "id": "latitude.location.get", "httpMethod": "GET", "path": "location/{locationId}", "response": {"$ref": "Location"}}, "list": {"scopes": ["https://www.googleapis.com/auth/latitude.all.best", "https://www.googleapis.com/auth/latitude.all.city"], "parameters": {"max-results": {"type": "string", "location": "query"}, "max-time": {"type": "string", "location": "query"}, "min-time": {"type": "string", "location": "query"}, "granularity": {"default": "city", "enum": ["best", "city"], "type": "string", "location": "query"}}, "response": {"$ref": "LocationFeed"}, "httpMethod": "GET", "path": "location", "id": "latitude.location.list"}, "delete": {"scopes": ["https://www.googleapis.com/auth/latitude.all.best", "https://www.googleapis.com/auth/latitude.all.city"], "path": "location/{locationId}", "id": "latitude.location.delete", "parameters": {"locationId": {"required": true, "type": "string", "location": "path"}}, "httpMethod": "DELETE"}}}', true));
|
|
|
188 |
|
|
|
189 |
}
|
|
|
190 |
}
|
|
|
191 |
|
|
|
192 |
class Google_Location extends Google_Model {
|
|
|
193 |
public $kind;
|
|
|
194 |
public $altitude;
|
|
|
195 |
public $longitude;
|
|
|
196 |
public $activityId;
|
|
|
197 |
public $latitude;
|
|
|
198 |
public $altitudeAccuracy;
|
|
|
199 |
public $timestampMs;
|
|
|
200 |
public $speed;
|
|
|
201 |
public $heading;
|
|
|
202 |
public $accuracy;
|
|
|
203 |
public function setKind($kind) {
|
|
|
204 |
$this->kind = $kind;
|
|
|
205 |
}
|
|
|
206 |
public function getKind() {
|
|
|
207 |
return $this->kind;
|
|
|
208 |
}
|
|
|
209 |
public function setAltitude($altitude) {
|
|
|
210 |
$this->altitude = $altitude;
|
|
|
211 |
}
|
|
|
212 |
public function getAltitude() {
|
|
|
213 |
return $this->altitude;
|
|
|
214 |
}
|
|
|
215 |
public function setLongitude($longitude) {
|
|
|
216 |
$this->longitude = $longitude;
|
|
|
217 |
}
|
|
|
218 |
public function getLongitude() {
|
|
|
219 |
return $this->longitude;
|
|
|
220 |
}
|
|
|
221 |
public function setActivityId($activityId) {
|
|
|
222 |
$this->activityId = $activityId;
|
|
|
223 |
}
|
|
|
224 |
public function getActivityId() {
|
|
|
225 |
return $this->activityId;
|
|
|
226 |
}
|
|
|
227 |
public function setLatitude($latitude) {
|
|
|
228 |
$this->latitude = $latitude;
|
|
|
229 |
}
|
|
|
230 |
public function getLatitude() {
|
|
|
231 |
return $this->latitude;
|
|
|
232 |
}
|
|
|
233 |
public function setAltitudeAccuracy($altitudeAccuracy) {
|
|
|
234 |
$this->altitudeAccuracy = $altitudeAccuracy;
|
|
|
235 |
}
|
|
|
236 |
public function getAltitudeAccuracy() {
|
|
|
237 |
return $this->altitudeAccuracy;
|
|
|
238 |
}
|
|
|
239 |
public function setTimestampMs($timestampMs) {
|
|
|
240 |
$this->timestampMs = $timestampMs;
|
|
|
241 |
}
|
|
|
242 |
public function getTimestampMs() {
|
|
|
243 |
return $this->timestampMs;
|
|
|
244 |
}
|
|
|
245 |
public function setSpeed($speed) {
|
|
|
246 |
$this->speed = $speed;
|
|
|
247 |
}
|
|
|
248 |
public function getSpeed() {
|
|
|
249 |
return $this->speed;
|
|
|
250 |
}
|
|
|
251 |
public function setHeading($heading) {
|
|
|
252 |
$this->heading = $heading;
|
|
|
253 |
}
|
|
|
254 |
public function getHeading() {
|
|
|
255 |
return $this->heading;
|
|
|
256 |
}
|
|
|
257 |
public function setAccuracy($accuracy) {
|
|
|
258 |
$this->accuracy = $accuracy;
|
|
|
259 |
}
|
|
|
260 |
public function getAccuracy() {
|
|
|
261 |
return $this->accuracy;
|
|
|
262 |
}
|
|
|
263 |
}
|
|
|
264 |
|
|
|
265 |
class Google_LocationFeed extends Google_Model {
|
|
|
266 |
protected $__itemsType = 'Google_Location';
|
|
|
267 |
protected $__itemsDataType = 'array';
|
|
|
268 |
public $items;
|
|
|
269 |
public $kind;
|
|
|
270 |
public function setItems(/* array(Google_Location) */ $items) {
|
|
|
271 |
$this->assertIsArray($items, 'Google_Location', __METHOD__);
|
|
|
272 |
$this->items = $items;
|
|
|
273 |
}
|
|
|
274 |
public function getItems() {
|
|
|
275 |
return $this->items;
|
|
|
276 |
}
|
|
|
277 |
public function setKind($kind) {
|
|
|
278 |
$this->kind = $kind;
|
|
|
279 |
}
|
|
|
280 |
public function getKind() {
|
|
|
281 |
return $this->kind;
|
|
|
282 |
}
|
|
|
283 |
}
|