1<?php
2/*
3 * Copyright 2014 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 * The "states" collection of methods.
20 * Typical usage is:
21 *  <code>
22 *   $appstateService = new Google_Service_AppState(...);
23 *   $states = $appstateService->states;
24 *  </code>
25 */
26class Google_Service_AppState_Resource_States extends Google_Service_Resource
27{
28  /**
29   * Clears (sets to empty) the data for the passed key if and only if the passed
30   * version matches the currently stored version. This method results in a
31   * conflict error on version mismatch. (states.clear)
32   *
33   * @param int $stateKey The key for the data to be retrieved.
34   * @param array $optParams Optional parameters.
35   *
36   * @opt_param string currentDataVersion The version of the data to be cleared.
37   * Version strings are returned by the server.
38   * @return Google_Service_AppState_WriteResult
39   */
40  public function clear($stateKey, $optParams = array())
41  {
42    $params = array('stateKey' => $stateKey);
43    $params = array_merge($params, $optParams);
44    return $this->call('clear', array($params), "Google_Service_AppState_WriteResult");
45  }
46  /**
47   * Deletes a key and the data associated with it. The key is removed and no
48   * longer counts against the key quota. Note that since this method is not safe
49   * in the face of concurrent modifications, it should only be used for
50   * development and testing purposes. Invoking this method in shipping code can
51   * result in data loss and data corruption. (states.delete)
52   *
53   * @param int $stateKey The key for the data to be retrieved.
54   * @param array $optParams Optional parameters.
55   */
56  public function delete($stateKey, $optParams = array())
57  {
58    $params = array('stateKey' => $stateKey);
59    $params = array_merge($params, $optParams);
60    return $this->call('delete', array($params));
61  }
62  /**
63   * Retrieves the data corresponding to the passed key. If the key does not exist
64   * on the server, an HTTP 404 will be returned. (states.get)
65   *
66   * @param int $stateKey The key for the data to be retrieved.
67   * @param array $optParams Optional parameters.
68   * @return Google_Service_AppState_GetResponse
69   */
70  public function get($stateKey, $optParams = array())
71  {
72    $params = array('stateKey' => $stateKey);
73    $params = array_merge($params, $optParams);
74    return $this->call('get', array($params), "Google_Service_AppState_GetResponse");
75  }
76  /**
77   * Lists all the states keys, and optionally the state data. (states.listStates)
78   *
79   * @param array $optParams Optional parameters.
80   *
81   * @opt_param bool includeData Whether to include the full data in addition to
82   * the version number
83   * @return Google_Service_AppState_ListResponse
84   */
85  public function listStates($optParams = array())
86  {
87    $params = array();
88    $params = array_merge($params, $optParams);
89    return $this->call('list', array($params), "Google_Service_AppState_ListResponse");
90  }
91  /**
92   * Update the data associated with the input key if and only if the passed
93   * version matches the currently stored version. This method is safe in the face
94   * of concurrent writes. Maximum per-key size is 128KB. (states.update)
95   *
96   * @param int $stateKey The key for the data to be retrieved.
97   * @param Google_Service_AppState_UpdateRequest $postBody
98   * @param array $optParams Optional parameters.
99   *
100   * @opt_param string currentStateVersion The version of the app state your
101   * application is attempting to update. If this does not match the current
102   * version, this method will return a conflict error. If there is no data stored
103   * on the server for this key, the update will succeed irrespective of the value
104   * of this parameter.
105   * @return Google_Service_AppState_WriteResult
106   */
107  public function update($stateKey, Google_Service_AppState_UpdateRequest $postBody, $optParams = array())
108  {
109    $params = array('stateKey' => $stateKey, 'postBody' => $postBody);
110    $params = array_merge($params, $optParams);
111    return $this->call('update', array($params), "Google_Service_AppState_WriteResult");
112  }
113}
114