com.google.api.services.appstate.AppState Maven / Gradle / Ivy
/*
* Copyright 2010 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
/*
* This code was generated by https://code.google.com/p/google-apis-client-generator/
* (build: 2015-08-03 17:34:38 UTC)
* on 2015-11-17 at 05:55:28 UTC
* Modify at your own risk.
*/
package com.google.api.services.appstate;
/**
* Service definition for AppState (v1).
*
*
* The Google App State API.
*
*
*
* For more information about this service, see the
* API Documentation
*
*
*
* This service uses {@link AppStateRequestInitializer} to initialize global parameters via its
* {@link Builder}.
*
*
* @since 1.3
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public class AppState extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient {
// Note: Leave this static initializer at the top of the file.
static {
com.google.api.client.util.Preconditions.checkState(
com.google.api.client.googleapis.GoogleUtils.MAJOR_VERSION == 1 &&
com.google.api.client.googleapis.GoogleUtils.MINOR_VERSION >= 15,
"You are currently running with version %s of google-api-client. " +
"You need at least version 1.15 of google-api-client to run version " +
"1.19.1 of the Google App State API library.", com.google.api.client.googleapis.GoogleUtils.VERSION);
}
/**
* The default encoded root URL of the service. This is determined when the library is generated
* and normally should not be changed.
*
* @since 1.7
*/
public static final String DEFAULT_ROOT_URL = "https://www.googleapis.com/";
/**
* The default encoded service path of the service. This is determined when the library is
* generated and normally should not be changed.
*
* @since 1.7
*/
public static final String DEFAULT_SERVICE_PATH = "appstate/v1/";
/**
* The default encoded base URL of the service. This is determined when the library is generated
* and normally should not be changed.
*/
public static final String DEFAULT_BASE_URL = DEFAULT_ROOT_URL + DEFAULT_SERVICE_PATH;
/**
* Constructor.
*
*
* Use {@link Builder} if you need to specify any of the optional parameters.
*
*
* @param transport HTTP transport, which should normally be:
*
* - Google App Engine:
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}
* - Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}
* - Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
*
*
* @param jsonFactory JSON factory, which may be:
*
* - Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}
* - Google GSON: {@code com.google.api.client.json.gson.GsonFactory}
* - Android Honeycomb or higher:
* {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}
*
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @since 1.7
*/
public AppState(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
this(new Builder(transport, jsonFactory, httpRequestInitializer));
}
/**
* @param builder builder
*/
AppState(Builder builder) {
super(builder);
}
@Override
protected void initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest> httpClientRequest) throws java.io.IOException {
super.initialize(httpClientRequest);
}
/**
* An accessor for creating requests from the States collection.
*
* The typical use is:
*
* {@code AppState appstate = new AppState(...);}
* {@code AppState.States.List request = appstate.states().list(parameters ...)}
*
*
* @return the resource collection
*/
public States states() {
return new States();
}
/**
* The "states" collection of methods.
*/
public class States {
/**
* Clears (sets to empty) the data for the passed key if and only if the passed version matches the
* currently stored version. This method results in a conflict error on version mismatch.
*
* Create a request for the method "states.clear".
*
* This request holds the parameters needed by the appstate server. After setting any optional
* parameters, call the {@link Clear#execute()} method to invoke the remote operation.
*
* @param stateKey The key for the data to be retrieved.
[minimum: 0]
[maximum: 3]
* @return the request
*/
public Clear clear(java.lang.Integer stateKey) throws java.io.IOException {
Clear result = new Clear(stateKey);
initialize(result);
return result;
}
public class Clear extends AppStateRequest {
private static final String REST_PATH = "states/{stateKey}/clear";
/**
* Clears (sets to empty) the data for the passed key if and only if the passed version matches
* the currently stored version. This method results in a conflict error on version mismatch.
*
* Create a request for the method "states.clear".
*
* This request holds the parameters needed by the the appstate server. After setting any
* optional parameters, call the {@link Clear#execute()} method to invoke the remote operation.
* {@link
* Clear#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor.
*
* @param stateKey The key for the data to be retrieved.
[minimum: 0]
[maximum: 3]
* @since 1.13
*/
protected Clear(java.lang.Integer stateKey) {
super(AppState.this, "POST", REST_PATH, null, com.google.api.services.appstate.model.WriteResult.class);
this.stateKey = com.google.api.client.util.Preconditions.checkNotNull(stateKey, "Required parameter stateKey must be specified.");
}
@Override
public Clear setAlt(java.lang.String alt) {
return (Clear) super.setAlt(alt);
}
@Override
public Clear setFields(java.lang.String fields) {
return (Clear) super.setFields(fields);
}
@Override
public Clear setKey(java.lang.String key) {
return (Clear) super.setKey(key);
}
@Override
public Clear setOauthToken(java.lang.String oauthToken) {
return (Clear) super.setOauthToken(oauthToken);
}
@Override
public Clear setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Clear) super.setPrettyPrint(prettyPrint);
}
@Override
public Clear setQuotaUser(java.lang.String quotaUser) {
return (Clear) super.setQuotaUser(quotaUser);
}
@Override
public Clear setUserIp(java.lang.String userIp) {
return (Clear) super.setUserIp(userIp);
}
/** The key for the data to be retrieved. */
@com.google.api.client.util.Key
private java.lang.Integer stateKey;
/** The key for the data to be retrieved.
[minimum: 0] [maximum: 3]
*/
public java.lang.Integer getStateKey() {
return stateKey;
}
/** The key for the data to be retrieved. */
public Clear setStateKey(java.lang.Integer stateKey) {
this.stateKey = stateKey;
return this;
}
/** The version of the data to be cleared. Version strings are returned by the server. */
@com.google.api.client.util.Key
private java.lang.String currentDataVersion;
/** The version of the data to be cleared. Version strings are returned by the server.
*/
public java.lang.String getCurrentDataVersion() {
return currentDataVersion;
}
/** The version of the data to be cleared. Version strings are returned by the server. */
public Clear setCurrentDataVersion(java.lang.String currentDataVersion) {
this.currentDataVersion = currentDataVersion;
return this;
}
@Override
public Clear set(String parameterName, Object value) {
return (Clear) super.set(parameterName, value);
}
}
/**
* Deletes a key and the data associated with it. The key is removed and no longer counts against
* the key quota. Note that since this method is not safe in the face of concurrent modifications,
* it should only be used for development and testing purposes. Invoking this method in shipping
* code can result in data loss and data corruption.
*
* Create a request for the method "states.delete".
*
* This request holds the parameters needed by the appstate server. After setting any optional
* parameters, call the {@link Delete#execute()} method to invoke the remote operation.
*
* @param stateKey The key for the data to be retrieved.
[minimum: 0]
[maximum: 3]
* @return the request
*/
public Delete delete(java.lang.Integer stateKey) throws java.io.IOException {
Delete result = new Delete(stateKey);
initialize(result);
return result;
}
public class Delete extends AppStateRequest {
private static final String REST_PATH = "states/{stateKey}";
/**
* Deletes a key and the data associated with it. The key is removed and no longer counts against
* the key quota. Note that since this method is not safe in the face of concurrent modifications,
* it should only be used for development and testing purposes. Invoking this method in shipping
* code can result in data loss and data corruption.
*
* Create a request for the method "states.delete".
*
* This request holds the parameters needed by the the appstate server. After setting any
* optional parameters, call the {@link Delete#execute()} method to invoke the remote operation.
* {@link
* Delete#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor.
*
* @param stateKey The key for the data to be retrieved.
[minimum: 0]
[maximum: 3]
* @since 1.13
*/
protected Delete(java.lang.Integer stateKey) {
super(AppState.this, "DELETE", REST_PATH, null, Void.class);
this.stateKey = com.google.api.client.util.Preconditions.checkNotNull(stateKey, "Required parameter stateKey must be specified.");
}
@Override
public Delete setAlt(java.lang.String alt) {
return (Delete) super.setAlt(alt);
}
@Override
public Delete setFields(java.lang.String fields) {
return (Delete) super.setFields(fields);
}
@Override
public Delete setKey(java.lang.String key) {
return (Delete) super.setKey(key);
}
@Override
public Delete setOauthToken(java.lang.String oauthToken) {
return (Delete) super.setOauthToken(oauthToken);
}
@Override
public Delete setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Delete) super.setPrettyPrint(prettyPrint);
}
@Override
public Delete setQuotaUser(java.lang.String quotaUser) {
return (Delete) super.setQuotaUser(quotaUser);
}
@Override
public Delete setUserIp(java.lang.String userIp) {
return (Delete) super.setUserIp(userIp);
}
/** The key for the data to be retrieved. */
@com.google.api.client.util.Key
private java.lang.Integer stateKey;
/** The key for the data to be retrieved.
[minimum: 0] [maximum: 3]
*/
public java.lang.Integer getStateKey() {
return stateKey;
}
/** The key for the data to be retrieved. */
public Delete setStateKey(java.lang.Integer stateKey) {
this.stateKey = stateKey;
return this;
}
@Override
public Delete set(String parameterName, Object value) {
return (Delete) super.set(parameterName, value);
}
}
/**
* Retrieves the data corresponding to the passed key. If the key does not exist on the server, an
* HTTP 404 will be returned.
*
* Create a request for the method "states.get".
*
* This request holds the parameters needed by the appstate server. After setting any optional
* parameters, call the {@link Get#execute()} method to invoke the remote operation.
*
* @param stateKey The key for the data to be retrieved.
[minimum: 0]
[maximum: 3]
* @return the request
*/
public Get get(java.lang.Integer stateKey) throws java.io.IOException {
Get result = new Get(stateKey);
initialize(result);
return result;
}
public class Get extends AppStateRequest {
private static final String REST_PATH = "states/{stateKey}";
/**
* Retrieves the data corresponding to the passed key. If the key does not exist on the server, an
* HTTP 404 will be returned.
*
* Create a request for the method "states.get".
*
* This request holds the parameters needed by the the appstate server. After setting any
* optional parameters, call the {@link Get#execute()} method to invoke the remote operation.
* {@link Get#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor.
*
* @param stateKey The key for the data to be retrieved.
[minimum: 0]
[maximum: 3]
* @since 1.13
*/
protected Get(java.lang.Integer stateKey) {
super(AppState.this, "GET", REST_PATH, null, com.google.api.services.appstate.model.GetResponse.class);
this.stateKey = com.google.api.client.util.Preconditions.checkNotNull(stateKey, "Required parameter stateKey must be specified.");
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public Get setAlt(java.lang.String alt) {
return (Get) super.setAlt(alt);
}
@Override
public Get setFields(java.lang.String fields) {
return (Get) super.setFields(fields);
}
@Override
public Get setKey(java.lang.String key) {
return (Get) super.setKey(key);
}
@Override
public Get setOauthToken(java.lang.String oauthToken) {
return (Get) super.setOauthToken(oauthToken);
}
@Override
public Get setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Get) super.setPrettyPrint(prettyPrint);
}
@Override
public Get setQuotaUser(java.lang.String quotaUser) {
return (Get) super.setQuotaUser(quotaUser);
}
@Override
public Get setUserIp(java.lang.String userIp) {
return (Get) super.setUserIp(userIp);
}
/** The key for the data to be retrieved. */
@com.google.api.client.util.Key
private java.lang.Integer stateKey;
/** The key for the data to be retrieved.
[minimum: 0] [maximum: 3]
*/
public java.lang.Integer getStateKey() {
return stateKey;
}
/** The key for the data to be retrieved. */
public Get setStateKey(java.lang.Integer stateKey) {
this.stateKey = stateKey;
return this;
}
@Override
public Get set(String parameterName, Object value) {
return (Get) super.set(parameterName, value);
}
}
/**
* Lists all the states keys, and optionally the state data.
*
* Create a request for the method "states.list".
*
* This request holds the parameters needed by the appstate server. After setting any optional
* parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @return the request
*/
public List list() throws java.io.IOException {
List result = new List();
initialize(result);
return result;
}
public class List extends AppStateRequest {
private static final String REST_PATH = "states";
/**
* Lists all the states keys, and optionally the state data.
*
* Create a request for the method "states.list".
*
* This request holds the parameters needed by the the appstate server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation.
* {@link List#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)}
* must be called to initialize this instance immediately after invoking the constructor.
*
* @since 1.13
*/
protected List() {
super(AppState.this, "GET", REST_PATH, null, com.google.api.services.appstate.model.ListResponse.class);
}
@Override
public com.google.api.client.http.HttpResponse executeUsingHead() throws java.io.IOException {
return super.executeUsingHead();
}
@Override
public com.google.api.client.http.HttpRequest buildHttpRequestUsingHead() throws java.io.IOException {
return super.buildHttpRequestUsingHead();
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setFields(java.lang.String fields) {
return (List) super.setFields(fields);
}
@Override
public List setKey(java.lang.String key) {
return (List) super.setKey(key);
}
@Override
public List setOauthToken(java.lang.String oauthToken) {
return (List) super.setOauthToken(oauthToken);
}
@Override
public List setPrettyPrint(java.lang.Boolean prettyPrint) {
return (List) super.setPrettyPrint(prettyPrint);
}
@Override
public List setQuotaUser(java.lang.String quotaUser) {
return (List) super.setQuotaUser(quotaUser);
}
@Override
public List setUserIp(java.lang.String userIp) {
return (List) super.setUserIp(userIp);
}
/** Whether to include the full data in addition to the version number */
@com.google.api.client.util.Key
private java.lang.Boolean includeData;
/** Whether to include the full data in addition to the version number [default: false]
*/
public java.lang.Boolean getIncludeData() {
return includeData;
}
/** Whether to include the full data in addition to the version number */
public List setIncludeData(java.lang.Boolean includeData) {
this.includeData = includeData;
return this;
}
/**
* Convenience method that returns only {@link Boolean#TRUE} or {@link Boolean#FALSE}.
*
*
* Boolean properties can have four possible values:
* {@code null}, {@link com.google.api.client.util.Data#NULL_BOOLEAN}, {@link Boolean#TRUE}
* or {@link Boolean#FALSE}.
*
*
*
* This method returns {@link Boolean#TRUE} if the default of the property is {@link Boolean#TRUE}
* and it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
* {@link Boolean#FALSE} is returned if the default of the property is {@link Boolean#FALSE} and
* it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
*
*
*
* Whether to include the full data in addition to the version number
*
*/
public boolean isIncludeData() {
if (includeData == null || includeData == com.google.api.client.util.Data.NULL_BOOLEAN) {
return false;
}
return includeData;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
/**
* Update the data associated with the input key if and only if the passed version matches the
* currently stored version. This method is safe in the face of concurrent writes. Maximum per-key
* size is 128KB.
*
* Create a request for the method "states.update".
*
* This request holds the parameters needed by the appstate server. After setting any optional
* parameters, call the {@link Update#execute()} method to invoke the remote operation.
*
* @param stateKey The key for the data to be retrieved.
[minimum: 0]
[maximum: 3]
* @param content the {@link com.google.api.services.appstate.model.UpdateRequest}
* @return the request
*/
public Update update(java.lang.Integer stateKey, com.google.api.services.appstate.model.UpdateRequest content) throws java.io.IOException {
Update result = new Update(stateKey, content);
initialize(result);
return result;
}
public class Update extends AppStateRequest {
private static final String REST_PATH = "states/{stateKey}";
/**
* Update the data associated with the input key if and only if the passed version matches the
* currently stored version. This method is safe in the face of concurrent writes. Maximum per-key
* size is 128KB.
*
* Create a request for the method "states.update".
*
* This request holds the parameters needed by the the appstate server. After setting any
* optional parameters, call the {@link Update#execute()} method to invoke the remote operation.
* {@link
* Update#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor.
*
* @param stateKey The key for the data to be retrieved.
[minimum: 0]
[maximum: 3]
* @param content the {@link com.google.api.services.appstate.model.UpdateRequest}
* @since 1.13
*/
protected Update(java.lang.Integer stateKey, com.google.api.services.appstate.model.UpdateRequest content) {
super(AppState.this, "PUT", REST_PATH, content, com.google.api.services.appstate.model.WriteResult.class);
this.stateKey = com.google.api.client.util.Preconditions.checkNotNull(stateKey, "Required parameter stateKey must be specified.");
}
@Override
public Update setAlt(java.lang.String alt) {
return (Update) super.setAlt(alt);
}
@Override
public Update setFields(java.lang.String fields) {
return (Update) super.setFields(fields);
}
@Override
public Update setKey(java.lang.String key) {
return (Update) super.setKey(key);
}
@Override
public Update setOauthToken(java.lang.String oauthToken) {
return (Update) super.setOauthToken(oauthToken);
}
@Override
public Update setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Update) super.setPrettyPrint(prettyPrint);
}
@Override
public Update setQuotaUser(java.lang.String quotaUser) {
return (Update) super.setQuotaUser(quotaUser);
}
@Override
public Update setUserIp(java.lang.String userIp) {
return (Update) super.setUserIp(userIp);
}
/** The key for the data to be retrieved. */
@com.google.api.client.util.Key
private java.lang.Integer stateKey;
/** The key for the data to be retrieved.
[minimum: 0] [maximum: 3]
*/
public java.lang.Integer getStateKey() {
return stateKey;
}
/** The key for the data to be retrieved. */
public Update setStateKey(java.lang.Integer stateKey) {
this.stateKey = stateKey;
return this;
}
/**
* 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.
*/
@com.google.api.client.util.Key
private java.lang.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.
*/
public java.lang.String getCurrentStateVersion() {
return 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.
*/
public Update setCurrentStateVersion(java.lang.String currentStateVersion) {
this.currentStateVersion = currentStateVersion;
return this;
}
@Override
public Update set(String parameterName, Object value) {
return (Update) super.set(parameterName, value);
}
}
}
/**
* Builder for {@link AppState}.
*
*
* Implementation is not thread-safe.
*
*
* @since 1.3.0
*/
public static final class Builder extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient.Builder {
/**
* Returns an instance of a new builder.
*
* @param transport HTTP transport, which should normally be:
*
* - Google App Engine:
* {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}
* - Android: {@code newCompatibleTransport} from
* {@code com.google.api.client.extensions.android.http.AndroidHttp}
* - Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()}
*
*
* @param jsonFactory JSON factory, which may be:
*
* - Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}
* - Google GSON: {@code com.google.api.client.json.gson.GsonFactory}
* - Android Honeycomb or higher:
* {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}
*
* @param httpRequestInitializer HTTP request initializer or {@code null} for none
* @since 1.7
*/
public Builder(com.google.api.client.http.HttpTransport transport, com.google.api.client.json.JsonFactory jsonFactory,
com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
super(
transport,
jsonFactory,
DEFAULT_ROOT_URL,
DEFAULT_SERVICE_PATH,
httpRequestInitializer,
false);
}
/** Builds a new instance of {@link AppState}. */
@Override
public AppState build() {
return new AppState(this);
}
@Override
public Builder setRootUrl(String rootUrl) {
return (Builder) super.setRootUrl(rootUrl);
}
@Override
public Builder setServicePath(String servicePath) {
return (Builder) super.setServicePath(servicePath);
}
@Override
public Builder setHttpRequestInitializer(com.google.api.client.http.HttpRequestInitializer httpRequestInitializer) {
return (Builder) super.setHttpRequestInitializer(httpRequestInitializer);
}
@Override
public Builder setApplicationName(String applicationName) {
return (Builder) super.setApplicationName(applicationName);
}
@Override
public Builder setSuppressPatternChecks(boolean suppressPatternChecks) {
return (Builder) super.setSuppressPatternChecks(suppressPatternChecks);
}
@Override
public Builder setSuppressRequiredParameterChecks(boolean suppressRequiredParameterChecks) {
return (Builder) super.setSuppressRequiredParameterChecks(suppressRequiredParameterChecks);
}
@Override
public Builder setSuppressAllChecks(boolean suppressAllChecks) {
return (Builder) super.setSuppressAllChecks(suppressAllChecks);
}
/**
* Set the {@link AppStateRequestInitializer}.
*
* @since 1.12
*/
public Builder setAppStateRequestInitializer(
AppStateRequestInitializer appstateRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(appstateRequestInitializer);
}
@Override
public Builder setGoogleClientRequestInitializer(
com.google.api.client.googleapis.services.GoogleClientRequestInitializer googleClientRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer);
}
}
}