Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

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