Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 401 and 402] [Versions 401 and 403]

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