[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/google/Google/Service/ -> AppState.php (source)

   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 Google_Service_AppState extends 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 Google_Client $client
  44     */
  45    public function __construct(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 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 Google_Service_AppState(...);
 128   *   $states = $appstateService->states;
 129   *  </code>
 130   */
 131  class Google_Service_AppState_States_Resource extends 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 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), "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 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), "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 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), "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 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 Google_Service_AppState_WriteResult
 215     */
 216    public function update($stateKey, 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), "Google_Service_AppState_WriteResult");
 221    }
 222  }
 223  
 224  
 225  
 226  
 227  class Google_Service_AppState_GetResponse extends 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 Google_Service_AppState_ListResponse extends Google_Collection
 276  {
 277    protected $collection_key = 'items';
 278    protected $itemsType = 'Google_Service_AppState_GetResponse';
 279    protected $itemsDataType = 'array';
 280    public $kind;
 281    public $maximumKeyCount;
 282  
 283    public function setItems($items)
 284    {
 285      $this->items = $items;
 286    }
 287  
 288    public function getItems()
 289    {
 290      return $this->items;
 291    }
 292  
 293    public function setKind($kind)
 294    {
 295      $this->kind = $kind;
 296    }
 297  
 298    public function getKind()
 299    {
 300      return $this->kind;
 301    }
 302  
 303    public function setMaximumKeyCount($maximumKeyCount)
 304    {
 305      $this->maximumKeyCount = $maximumKeyCount;
 306    }
 307  
 308    public function getMaximumKeyCount()
 309    {
 310      return $this->maximumKeyCount;
 311    }
 312  }
 313  
 314  class Google_Service_AppState_UpdateRequest extends Google_Model
 315  {
 316    public $data;
 317    public $kind;
 318  
 319    public function setData($data)
 320    {
 321      $this->data = $data;
 322    }
 323  
 324    public function getData()
 325    {
 326      return $this->data;
 327    }
 328  
 329    public function setKind($kind)
 330    {
 331      $this->kind = $kind;
 332    }
 333  
 334    public function getKind()
 335    {
 336      return $this->kind;
 337    }
 338  }
 339  
 340  class Google_Service_AppState_WriteResult extends Google_Model
 341  {
 342    public $currentStateVersion;
 343    public $kind;
 344    public $stateKey;
 345  
 346    public function setCurrentStateVersion($currentStateVersion)
 347    {
 348      $this->currentStateVersion = $currentStateVersion;
 349    }
 350  
 351    public function getCurrentStateVersion()
 352    {
 353      return $this->currentStateVersion;
 354    }
 355  
 356    public function setKind($kind)
 357    {
 358      $this->kind = $kind;
 359    }
 360  
 361    public function getKind()
 362    {
 363      return $this->kind;
 364    }
 365  
 366    public function setStateKey($stateKey)
 367    {
 368      $this->stateKey = $stateKey;
 369    }
 370  
 371    public function getStateKey()
 372    {
 373      return $this->stateKey;
 374    }
 375  }


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1