| 1 |
<?php |
| 2 |
/* |
| 3 |
* Copyright 2010 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 |
/** |
| 19 |
* Service definition for AppState (v1). |
| 20 |
* |
| 21 |
* <p> |
| 22 |
* The Google App State API. |
| 23 |
* </p> |
| 24 |
* |
| 25 |
* <p> |
| 26 |
* For more information about this service, see the API |
| 27 |
* <a href="https://developers.google.com/games/services/web/api/states" target="_blank">Documentation</a> |
| 28 |
* </p> |
| 29 |
* |
| 30 |
* @author Google, Inc. |
| 31 |
*/ |
| 32 |
class Analytify_Google_Service_AppState extends Analytify_Google_Service |
| 33 |
{ |
| 34 |
/** View and manage your data for this application. */ |
| 35 |
const APPSTATE = "https://www.googleapis.com/auth/appstate"; |
| 36 |
|
| 37 |
public $states; |
| 38 |
|
| 39 |
|
| 40 |
/** |
| 41 |
* Constructs the internal representation of the AppState service. |
| 42 |
* |
| 43 |
* @param Analytify_Google_Client $client |
| 44 |
*/ |
| 45 |
public function __construct(Analytify_Google_Client $client) |
| 46 |
{ |
| 47 |
parent::__construct($client); |
| 48 |
$this->servicePath = 'appstate/v1/'; |
| 49 |
$this->version = 'v1'; |
| 50 |
$this->serviceName = 'appstate'; |
| 51 |
|
| 52 |
$this->states = new Analytify_Google_Service_AppState_States_Resource( |
| 53 |
$this, |
| 54 |
$this->serviceName, |
| 55 |
'states', |
| 56 |
array( |
| 57 |
'methods' => array( |
| 58 |
'clear' => array( |
| 59 |
'path' => 'states/{stateKey}/clear', |
| 60 |
'httpMethod' => 'POST', |
| 61 |
'parameters' => array( |
| 62 |
'stateKey' => array( |
| 63 |
'location' => 'path', |
| 64 |
'type' => 'integer', |
| 65 |
'required' => true, |
| 66 |
), |
| 67 |
'currentDataVersion' => array( |
| 68 |
'location' => 'query', |
| 69 |
'type' => 'string', |
| 70 |
), |
| 71 |
), |
| 72 |
),'delete' => array( |
| 73 |
'path' => 'states/{stateKey}', |
| 74 |
'httpMethod' => 'DELETE', |
| 75 |
'parameters' => array( |
| 76 |
'stateKey' => array( |
| 77 |
'location' => 'path', |
| 78 |
'type' => 'integer', |
| 79 |
'required' => true, |
| 80 |
), |
| 81 |
), |
| 82 |
),'get' => array( |
| 83 |
'path' => 'states/{stateKey}', |
| 84 |
'httpMethod' => 'GET', |
| 85 |
'parameters' => array( |
| 86 |
'stateKey' => array( |
| 87 |
'location' => 'path', |
| 88 |
'type' => 'integer', |
| 89 |
'required' => true, |
| 90 |
), |
| 91 |
), |
| 92 |
),'list' => array( |
| 93 |
'path' => 'states', |
| 94 |
'httpMethod' => 'GET', |
| 95 |
'parameters' => array( |
| 96 |
'includeData' => array( |
| 97 |
'location' => 'query', |
| 98 |
'type' => 'boolean', |
| 99 |
), |
| 100 |
), |
| 101 |
),'update' => array( |
| 102 |
'path' => 'states/{stateKey}', |
| 103 |
'httpMethod' => 'PUT', |
| 104 |
'parameters' => array( |
| 105 |
'stateKey' => array( |
| 106 |
'location' => 'path', |
| 107 |
'type' => 'integer', |
| 108 |
'required' => true, |
| 109 |
), |
| 110 |
'currentStateVersion' => array( |
| 111 |
'location' => 'query', |
| 112 |
'type' => 'string', |
| 113 |
), |
| 114 |
), |
| 115 |
), |
| 116 |
) |
| 117 |
) |
| 118 |
); |
| 119 |
} |
| 120 |
} |
| 121 |
|
| 122 |
|
| 123 |
/** |
| 124 |
* The "states" collection of methods. |
| 125 |
* Typical usage is: |
| 126 |
* <code> |
| 127 |
* $appstateService = new Analytify_Google_Service_AppState(...); |
| 128 |
* $states = $appstateService->states; |
| 129 |
* </code> |
| 130 |
*/ |
| 131 |
class Analytify_Google_Service_AppState_States_Resource extends Analytify_Google_Service_Resource |
| 132 |
{ |
| 133 |
|
| 134 |
/** |
| 135 |
* Clears (sets to empty) the data for the passed key if and only if the passed |
| 136 |
* version matches the currently stored version. This method results in a |
| 137 |
* conflict error on version mismatch. (states.clear) |
| 138 |
* |
| 139 |
* @param int $stateKey |
| 140 |
* The key for the data to be retrieved. |
| 141 |
* @param array $optParams Optional parameters. |
| 142 |
* |
| 143 |
* @opt_param string currentDataVersion |
| 144 |
* The version of the data to be cleared. Version strings are returned by the server. |
| 145 |
* @return Analytify_Google_Service_AppState_WriteResult |
| 146 |
*/ |
| 147 |
public function clear($stateKey, $optParams = array()) |
| 148 |
{ |
| 149 |
$params = array('stateKey' => $stateKey); |
| 150 |
$params = array_merge($params, $optParams); |
| 151 |
return $this->call('clear', array($params), "Analytify_Google_Service_AppState_WriteResult"); |
| 152 |
} |
| 153 |
/** |
| 154 |
* Deletes a key and the data associated with it. The key is removed and no |
| 155 |
* longer counts against the key quota. Note that since this method is not safe |
| 156 |
* in the face of concurrent modifications, it should only be used for |
| 157 |
* development and testing purposes. Invoking this method in shipping code can |
| 158 |
* result in data loss and data corruption. (states.delete) |
| 159 |
* |
| 160 |
* @param int $stateKey |
| 161 |
* The key for the data to be retrieved. |
| 162 |
* @param array $optParams Optional parameters. |
| 163 |
*/ |
| 164 |
public function delete($stateKey, $optParams = array()) |
| 165 |
{ |
| 166 |
$params = array('stateKey' => $stateKey); |
| 167 |
$params = array_merge($params, $optParams); |
| 168 |
return $this->call('delete', array($params)); |
| 169 |
} |
| 170 |
/** |
| 171 |
* Retrieves the data corresponding to the passed key. If the key does not exist |
| 172 |
* on the server, an HTTP 404 will be returned. (states.get) |
| 173 |
* |
| 174 |
* @param int $stateKey |
| 175 |
* The key for the data to be retrieved. |
| 176 |
* @param array $optParams Optional parameters. |
| 177 |
* @return Analytify_Google_Service_AppState_GetResponse |
| 178 |
*/ |
| 179 |
public function get($stateKey, $optParams = array()) |
| 180 |
{ |
| 181 |
$params = array('stateKey' => $stateKey); |
| 182 |
$params = array_merge($params, $optParams); |
| 183 |
return $this->call('get', array($params), "Analytify_Google_Service_AppState_GetResponse"); |
| 184 |
} |
| 185 |
/** |
| 186 |
* Lists all the states keys, and optionally the state data. (states.listStates) |
| 187 |
* |
| 188 |
* @param array $optParams Optional parameters. |
| 189 |
* |
| 190 |
* @opt_param bool includeData |
| 191 |
* Whether to include the full data in addition to the version number |
| 192 |
* @return Analytify_Google_Service_AppState_ListResponse |
| 193 |
*/ |
| 194 |
public function listStates($optParams = array()) |
| 195 |
{ |
| 196 |
$params = array(); |
| 197 |
$params = array_merge($params, $optParams); |
| 198 |
return $this->call('list', array($params), "Analytify_Google_Service_AppState_ListResponse"); |
| 199 |
} |
| 200 |
/** |
| 201 |
* Update the data associated with the input key if and only if the passed |
| 202 |
* version matches the currently stored version. This method is safe in the face |
| 203 |
* of concurrent writes. Maximum per-key size is 128KB. (states.update) |
| 204 |
* |
| 205 |
* @param int $stateKey |
| 206 |
* The key for the data to be retrieved. |
| 207 |
* @param Analytify_Google_UpdateRequest $postBody |
| 208 |
* @param array $optParams Optional parameters. |
| 209 |
* |
| 210 |
* @opt_param string currentStateVersion |
| 211 |
* The version of the app state your application is attempting to update. If this does not match |
| 212 |
* the current version, this method will return a conflict error. If there is no data stored on the |
| 213 |
* server for this key, the update will succeed irrespective of the value of this parameter. |
| 214 |
* @return Analytify_Google_Service_AppState_WriteResult |
| 215 |
*/ |
| 216 |
public function update($stateKey, Analytify_Google_Service_AppState_UpdateRequest $postBody, $optParams = array()) |
| 217 |
{ |
| 218 |
$params = array('stateKey' => $stateKey, 'postBody' => $postBody); |
| 219 |
$params = array_merge($params, $optParams); |
| 220 |
return $this->call('update', array($params), "Analytify_Google_Service_AppState_WriteResult"); |
| 221 |
} |
| 222 |
} |
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
class Analytify_Google_Service_AppState_GetResponse extends Analytify_Google_Model |
| 228 |
{ |
| 229 |
public $currentStateVersion; |
| 230 |
public $data; |
| 231 |
public $kind; |
| 232 |
public $stateKey; |
| 233 |
|
| 234 |
public function setCurrentStateVersion($currentStateVersion) |
| 235 |
{ |
| 236 |
$this->currentStateVersion = $currentStateVersion; |
| 237 |
} |
| 238 |
|
| 239 |
public function getCurrentStateVersion() |
| 240 |
{ |
| 241 |
return $this->currentStateVersion; |
| 242 |
} |
| 243 |
|
| 244 |
public function setData($data) |
| 245 |
{ |
| 246 |
$this->data = $data; |
| 247 |
} |
| 248 |
|
| 249 |
public function getData() |
| 250 |
{ |
| 251 |
return $this->data; |
| 252 |
} |
| 253 |
|
| 254 |
public function setKind($kind) |
| 255 |
{ |
| 256 |
$this->kind = $kind; |
| 257 |
} |
| 258 |
|
| 259 |
public function getKind() |
| 260 |
{ |
| 261 |
return $this->kind; |
| 262 |
} |
| 263 |
|
| 264 |
public function setStateKey($stateKey) |
| 265 |
{ |
| 266 |
$this->stateKey = $stateKey; |
| 267 |
} |
| 268 |
|
| 269 |
public function getStateKey() |
| 270 |
{ |
| 271 |
return $this->stateKey; |
| 272 |
} |
| 273 |
} |
| 274 |
|
| 275 |
class Analytify_Google_Service_AppState_ListResponse extends Analytify_Google_Collection |
| 276 |
{ |
| 277 |
protected $itemsType = 'Analytify_Google_Service_AppState_GetResponse'; |
| 278 |
protected $itemsDataType = 'array'; |
| 279 |
public $kind; |
| 280 |
public $maximumKeyCount; |
| 281 |
|
| 282 |
public function setItems($items) |
| 283 |
{ |
| 284 |
$this->items = $items; |
| 285 |
} |
| 286 |
|
| 287 |
public function getItems() |
| 288 |
{ |
| 289 |
return $this->items; |
| 290 |
} |
| 291 |
|
| 292 |
public function setKind($kind) |
| 293 |
{ |
| 294 |
$this->kind = $kind; |
| 295 |
} |
| 296 |
|
| 297 |
public function getKind() |
| 298 |
{ |
| 299 |
return $this->kind; |
| 300 |
} |
| 301 |
|
| 302 |
public function setMaximumKeyCount($maximumKeyCount) |
| 303 |
{ |
| 304 |
$this->maximumKeyCount = $maximumKeyCount; |
| 305 |
} |
| 306 |
|
| 307 |
public function getMaximumKeyCount() |
| 308 |
{ |
| 309 |
return $this->maximumKeyCount; |
| 310 |
} |
| 311 |
} |
| 312 |
|
| 313 |
class Analytify_Google_Service_AppState_UpdateRequest extends Analytify_Google_Model |
| 314 |
{ |
| 315 |
public $data; |
| 316 |
public $kind; |
| 317 |
|
| 318 |
public function setData($data) |
| 319 |
{ |
| 320 |
$this->data = $data; |
| 321 |
} |
| 322 |
|
| 323 |
public function getData() |
| 324 |
{ |
| 325 |
return $this->data; |
| 326 |
} |
| 327 |
|
| 328 |
public function setKind($kind) |
| 329 |
{ |
| 330 |
$this->kind = $kind; |
| 331 |
} |
| 332 |
|
| 333 |
public function getKind() |
| 334 |
{ |
| 335 |
return $this->kind; |
| 336 |
} |
| 337 |
} |
| 338 |
|
| 339 |
class Analytify_Google_Service_AppState_WriteResult extends Analytify_Google_Model |
| 340 |
{ |
| 341 |
public $currentStateVersion; |
| 342 |
public $kind; |
| 343 |
public $stateKey; |
| 344 |
|
| 345 |
public function setCurrentStateVersion($currentStateVersion) |
| 346 |
{ |
| 347 |
$this->currentStateVersion = $currentStateVersion; |
| 348 |
} |
| 349 |
|
| 350 |
public function getCurrentStateVersion() |
| 351 |
{ |
| 352 |
return $this->currentStateVersion; |
| 353 |
} |
| 354 |
|
| 355 |
public function setKind($kind) |
| 356 |
{ |
| 357 |
$this->kind = $kind; |
| 358 |
} |
| 359 |
|
| 360 |
public function getKind() |
| 361 |
{ |
| 362 |
return $this->kind; |
| 363 |
} |
| 364 |
|
| 365 |
public function setStateKey($stateKey) |
| 366 |
{ |
| 367 |
$this->stateKey = $stateKey; |
| 368 |
} |
| 369 |
|
| 370 |
public function getStateKey() |
| 371 |
{ |
| 372 |
return $this->stateKey; |
| 373 |
} |
| 374 |
} |
| 375 |
|