wp-database-backup
/
includes
/
admin
/
Destination
/
Google
/
google-api-php-client
/
src
/
contrib
/
Google_AppstateService.php
Google_AppstateService.php in WP Database Backup – Unlimited Database & Files Backup by Backup for WP 6.11, at includes/admin/Destination/Google/google-api-php-client/src/contrib/Google_AppstateService.php
| 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 "states" collection of methods. |
| 19 | * Typical usage is: |
| 20 | * <code> |
| 21 | * $appstateService = new Google_AppstateService(...); |
| 22 | * $states = $appstateService->states; |
| 23 | * </code> |
| 24 | */ |
| 25 | class Google_StatesServiceResource extends Google_ServiceResource { |
| 26 | |
| 27 | /** |
| 28 | * Clears (sets to empty) the data for the passed key if and only if the passed version matches the |
| 29 | * currently stored version. This method results in a conflict error on version mismatch. |
| 30 | * (states.clear) |
| 31 | * |
| 32 | * @param int $stateKey The key for the data to be retrieved. |
| 33 | * @param array $optParams Optional parameters. |
| 34 | * |
| 35 | * @opt_param string currentDataVersion The version of the data to be cleared. Version strings are returned by the server. |
| 36 | * @return Google_WriteResult |
| 37 | */ |
| 38 | public function clear($stateKey, $optParams = array()) { |
| 39 | $params = array('stateKey' => $stateKey); |
| 40 | $params = array_merge($params, $optParams); |
| 41 | $data = $this->__call('clear', array($params)); |
| 42 | if ($this->useObjects()) { |
| 43 | return new Google_WriteResult($data); |
| 44 | } else { |
| 45 | return $data; |
| 46 | } |
| 47 | } |
| 48 | /** |
| 49 | * Deletes a key and the data associated with it. The key is removed and no longer counts against |
| 50 | * the key quota. Note that since this method is not safe in the face of concurrent modifications, |
| 51 | * it should only be used for development and testing purposes. Invoking this method in shipping |
| 52 | * code can result in data loss and data corruption. (states.delete) |
| 53 | * |
| 54 | * @param int $stateKey The key for the data to be retrieved. |
| 55 | * @param array $optParams Optional parameters. |
| 56 | */ |
| 57 | public function delete($stateKey, $optParams = array()) { |
| 58 | $params = array('stateKey' => $stateKey); |
| 59 | $params = array_merge($params, $optParams); |
| 60 | $data = $this->__call('delete', array($params)); |
| 61 | return $data; |
| 62 | } |
| 63 | /** |
| 64 | * Retrieves the data corresponding to the passed key. (states.get) |
| 65 | * |
| 66 | * @param int $stateKey The key for the data to be retrieved. |
| 67 | * @param array $optParams Optional parameters. |
| 68 | * @return Google_GetResponse |
| 69 | */ |
| 70 | public function get($stateKey, $optParams = array()) { |
| 71 | $params = array('stateKey' => $stateKey); |
| 72 | $params = array_merge($params, $optParams); |
| 73 | $data = $this->__call('get', array($params)); |
| 74 | if ($this->useObjects()) { |
| 75 | return new Google_GetResponse($data); |
| 76 | } else { |
| 77 | return $data; |
| 78 | } |
| 79 | } |
| 80 | /** |
| 81 | * Lists all the states keys, and optionally the state data. (states.list) |
| 82 | * |
| 83 | * @param array $optParams Optional parameters. |
| 84 | * |
| 85 | * @opt_param bool includeData Whether to include the full data in addition to the version number |
| 86 | * @return Google_ListResponse |
| 87 | */ |
| 88 | public function listStates($optParams = array()) { |
| 89 | $params = array(); |
| 90 | $params = array_merge($params, $optParams); |
| 91 | $data = $this->__call('list', array($params)); |
| 92 | if ($this->useObjects()) { |
| 93 | return new Google_ListResponse($data); |
| 94 | } else { |
| 95 | return $data; |
| 96 | } |
| 97 | } |
| 98 | /** |
| 99 | * Update the data associated with the input key if and only if the passed version matches the |
| 100 | * currently stored version. This method is safe in the face of concurrent writes. Maximum per-key |
| 101 | * size is 128KB. (states.update) |
| 102 | * |
| 103 | * @param int $stateKey The key for the data to be retrieved. |
| 104 | * @param Google_UpdateRequest $postBody |
| 105 | * @param array $optParams Optional parameters. |
| 106 | * |
| 107 | * @opt_param string currentStateVersion The version of the app state your application is attempting to update. If this does not match the current version, this method will return a conflict error. If there is no data stored on the server for this key, the update will succeed irrespective of the value of this parameter. |
| 108 | * @return Google_WriteResult |
| 109 | */ |
| 110 | public function update($stateKey, Google_UpdateRequest $postBody, $optParams = array()) { |
| 111 | $params = array('stateKey' => $stateKey, 'postBody' => $postBody); |
| 112 | $params = array_merge($params, $optParams); |
| 113 | $data = $this->__call('update', array($params)); |
| 114 | if ($this->useObjects()) { |
| 115 | return new Google_WriteResult($data); |
| 116 | } else { |
| 117 | return $data; |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * Service definition for Google_Appstate (v1). |
| 124 | * |
| 125 | * <p> |
| 126 | * The Google App State API. |
| 127 | * </p> |
| 128 | * |
| 129 | * <p> |
| 130 | * For more information about this service, see the |
| 131 | * <a href="https://developers.google.com/games/services/web/api/states" target="_blank">API Documentation</a> |
| 132 | * </p> |
| 133 | * |
| 134 | * @author Google, Inc. |
| 135 | */ |
| 136 | class Google_AppstateService extends Google_Service { |
| 137 | public $states; |
| 138 | /** |
| 139 | * Constructs the internal representation of the Appstate service. |
| 140 | * |
| 141 | * @param Google_Client $client |
| 142 | */ |
| 143 | public function __construct(Google_Client $client) { |
| 144 | $this->servicePath = 'appstate/v1/'; |
| 145 | $this->version = 'v1'; |
| 146 | $this->serviceName = 'appstate'; |
| 147 | |
| 148 | $client->addService($this->serviceName, $this->version); |
| 149 | $this->states = new Google_StatesServiceResource($this, $this->serviceName, 'states', json_decode('{"methods": {"clear": {"id": "appstate.states.clear", "path": "states/{stateKey}/clear", "httpMethod": "POST", "parameters": {"currentDataVersion": {"type": "string", "location": "query"}, "stateKey": {"type": "integer", "required": true, "format": "int32", "minimum": "0", "maximum": "3", "location": "path"}}, "response": {"$ref": "WriteResult"}, "scopes": ["https://www.googleapis.com/auth/appstate"]}, "delete": {"id": "appstate.states.delete", "path": "states/{stateKey}", "httpMethod": "DELETE", "parameters": {"stateKey": {"type": "integer", "required": true, "format": "int32", "minimum": "0", "maximum": "3", "location": "path"}}, "scopes": ["https://www.googleapis.com/auth/appstate"]}, "get": {"id": "appstate.states.get", "path": "states/{stateKey}", "httpMethod": "GET", "parameters": {"stateKey": {"type": "integer", "required": true, "format": "int32", "minimum": "0", "maximum": "3", "location": "path"}}, "response": {"$ref": "GetResponse"}, "scopes": ["https://www.googleapis.com/auth/appstate"]}, "list": {"id": "appstate.states.list", "path": "states", "httpMethod": "GET", "parameters": {"includeData": {"type": "boolean", "default": "false", "location": "query"}}, "response": {"$ref": "ListResponse"}, "scopes": ["https://www.googleapis.com/auth/appstate"]}, "update": {"id": "appstate.states.update", "path": "states/{stateKey}", "httpMethod": "PUT", "parameters": {"currentStateVersion": {"type": "string", "location": "query"}, "stateKey": {"type": "integer", "required": true, "format": "int32", "minimum": "0", "maximum": "3", "location": "path"}}, "request": {"$ref": "UpdateRequest"}, "response": {"$ref": "WriteResult"}, "scopes": ["https://www.googleapis.com/auth/appstate"]}}}', true)); |
| 150 | |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | |
| 155 | |
| 156 | class Google_GetResponse extends Google_Model { |
| 157 | public $currentStateVersion; |
| 158 | public $data; |
| 159 | public $kind; |
| 160 | public $stateKey; |
| 161 | public function setCurrentStateVersion( $currentStateVersion) { |
| 162 | $this->currentStateVersion = $currentStateVersion; |
| 163 | } |
| 164 | public function getCurrentStateVersion() { |
| 165 | return $this->currentStateVersion; |
| 166 | } |
| 167 | public function setData( $data) { |
| 168 | $this->data = $data; |
| 169 | } |
| 170 | public function getData() { |
| 171 | return $this->data; |
| 172 | } |
| 173 | public function setKind( $kind) { |
| 174 | $this->kind = $kind; |
| 175 | } |
| 176 | public function getKind() { |
| 177 | return $this->kind; |
| 178 | } |
| 179 | public function setStateKey( $stateKey) { |
| 180 | $this->stateKey = $stateKey; |
| 181 | } |
| 182 | public function getStateKey() { |
| 183 | return $this->stateKey; |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | class Google_ListResponse extends Google_Model { |
| 188 | protected $__itemsType = 'Google_GetResponse'; |
| 189 | protected $__itemsDataType = 'array'; |
| 190 | public $items; |
| 191 | public $kind; |
| 192 | public $maximumKeyCount; |
| 193 | public function setItems(/* array(Google_GetResponse) */ $items) { |
| 194 | $this->assertIsArray($items, 'Google_GetResponse', __METHOD__); |
| 195 | $this->items = $items; |
| 196 | } |
| 197 | public function getItems() { |
| 198 | return $this->items; |
| 199 | } |
| 200 | public function setKind( $kind) { |
| 201 | $this->kind = $kind; |
| 202 | } |
| 203 | public function getKind() { |
| 204 | return $this->kind; |
| 205 | } |
| 206 | public function setMaximumKeyCount( $maximumKeyCount) { |
| 207 | $this->maximumKeyCount = $maximumKeyCount; |
| 208 | } |
| 209 | public function getMaximumKeyCount() { |
| 210 | return $this->maximumKeyCount; |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | class Google_UpdateRequest extends Google_Model { |
| 215 | public $data; |
| 216 | public $kind; |
| 217 | public function setData( $data) { |
| 218 | $this->data = $data; |
| 219 | } |
| 220 | public function getData() { |
| 221 | return $this->data; |
| 222 | } |
| 223 | public function setKind( $kind) { |
| 224 | $this->kind = $kind; |
| 225 | } |
| 226 | public function getKind() { |
| 227 | return $this->kind; |
| 228 | } |
| 229 | } |
| 230 | |
| 231 | class Google_WriteResult extends Google_Model { |
| 232 | public $currentStateVersion; |
| 233 | public $kind; |
| 234 | public $stateKey; |
| 235 | public function setCurrentStateVersion( $currentStateVersion) { |
| 236 | $this->currentStateVersion = $currentStateVersion; |
| 237 | } |
| 238 | public function getCurrentStateVersion() { |
| 239 | return $this->currentStateVersion; |
| 240 | } |
| 241 | public function setKind( $kind) { |
| 242 | $this->kind = $kind; |
| 243 | } |
| 244 | public function getKind() { |
| 245 | return $this->kind; |
| 246 | } |
| 247 | public function setStateKey( $stateKey) { |
| 248 | $this->stateKey = $stateKey; |
| 249 | } |
| 250 | public function getStateKey() { |
| 251 | return $this->stateKey; |
| 252 | } |
| 253 | } |
| 254 |