Back to project page AskTheUniverseAndroidApp.
The source code is released under:
MIT License
If you think the Android project AskTheUniverseAndroidApp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * 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 */* ww w .j a va 2 s . c o m*/ * 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: 2014-04-01 18:14:47 UTC) * on 2014-04-05 at 14:41:19 UTC * Modify at your own risk. */ package com.appspot.asktheuniverseaquestion.questionService; /** * Service definition for QuestionService (v1). * * <p> * Allows users to ask questions from remote apps * </p> * * <p> * For more information about this service, see the * <a href="" target="_blank">API Documentation</a> * </p> * * <p> * This service uses {@link QuestionServiceRequestInitializer} to initialize global parameters via its * {@link Builder}. * </p> * * @since 1.3 * @author Google, Inc. */ @SuppressWarnings("javadoc") public class QuestionService 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.18.0-rc of the questionService 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://asktheuniverseaquestion.appspot.com/_ah/api/"; /** * 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 = "questionService/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. * * <p> * Use {@link Builder} if you need to specify any of the optional parameters. * </p> * * @param transport HTTP transport, which should normally be: * <ul> * <li>Google App Engine: * {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li> * <li>Android: {@code newCompatibleTransport} from * {@code com.google.api.client.extensions.android.http.AndroidHttp}</li> * <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()} * </li> * </ul> * @param jsonFactory JSON factory, which may be: * <ul> * <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li> * <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li> * <li>Android Honeycomb or higher: * {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li> * </ul> * @param httpRequestInitializer HTTP request initializer or {@code null} for none * @since 1.7 */ public QuestionService(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 */ QuestionService(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 QuestionServiceOperations collection. * * <p>The typical use is:</p> * <pre> * {@code QuestionService questionService = new QuestionService(...);} * {@code QuestionService.QuestionServiceOperations.List request = questionService.questionService().list(parameters ...)} * </pre> * * @return the resource collection */ public QuestionServiceOperations questionService() { return new QuestionServiceOperations(); } /** * The "questionService" collection of methods. */ public class QuestionServiceOperations { /** * Create a request for the method "questionService.askQuestion". * * This request holds the parameters needed by the questionService server. After setting any * optional parameters, call the {@link AskQuestion#execute()} method to invoke the remote * operation. * * @param question * @return the request */ public AskQuestion askQuestion(java.lang.String question) throws java.io.IOException { AskQuestion result = new AskQuestion(question); initialize(result); return result; } public class AskQuestion extends QuestionServiceRequest<com.appspot.asktheuniverseaquestion.questionService.model.AskTheUniverseAQuestionQuestion> { private static final String REST_PATH = "questionServiceQuestion"; /** * Create a request for the method "questionService.askQuestion". * * This request holds the parameters needed by the the questionService server. After setting any * optional parameters, call the {@link AskQuestion#execute()} method to invoke the remote * operation. <p> {@link * AskQuestion#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} * must be called to initialize this instance immediately after invoking the constructor. </p> * * @param question * @since 1.13 */ protected AskQuestion(java.lang.String question) { super(QuestionService.this, "POST", REST_PATH, null, com.appspot.asktheuniverseaquestion.questionService.model.AskTheUniverseAQuestionQuestion.class); this.question = com.google.api.client.util.Preconditions.checkNotNull(question, "Required parameter question must be specified."); } @Override public AskQuestion setAlt(java.lang.String alt) { return (AskQuestion) super.setAlt(alt); } @Override public AskQuestion setFields(java.lang.String fields) { return (AskQuestion) super.setFields(fields); } @Override public AskQuestion setKey(java.lang.String key) { return (AskQuestion) super.setKey(key); } @Override public AskQuestion setOauthToken(java.lang.String oauthToken) { return (AskQuestion) super.setOauthToken(oauthToken); } @Override public AskQuestion setPrettyPrint(java.lang.Boolean prettyPrint) { return (AskQuestion) super.setPrettyPrint(prettyPrint); } @Override public AskQuestion setQuotaUser(java.lang.String quotaUser) { return (AskQuestion) super.setQuotaUser(quotaUser); } @Override public AskQuestion setUserIp(java.lang.String userIp) { return (AskQuestion) super.setUserIp(userIp); } @com.google.api.client.util.Key private java.lang.String question; /** */ public java.lang.String getQuestion() { return question; } public AskQuestion setQuestion(java.lang.String question) { this.question = question; return this; } @Override public AskQuestion set(String parameterName, Object value) { return (AskQuestion) super.set(parameterName, value); } } /** * Create a request for the method "questionService.getAllQuestions". * * This request holds the parameters needed by the questionService server. After setting any * optional parameters, call the {@link GetAllQuestions#execute()} method to invoke the remote * operation. * * @return the request */ public GetAllQuestions getAllQuestions() throws java.io.IOException { GetAllQuestions result = new GetAllQuestions(); initialize(result); return result; } public class GetAllQuestions extends QuestionServiceRequest<com.appspot.asktheuniverseaquestion.questionService.model.AskTheUniverseAQuestionQuestionCollection> { private static final String REST_PATH = "questionServiceList"; /** * Create a request for the method "questionService.getAllQuestions". * * This request holds the parameters needed by the the questionService server. After setting any * optional parameters, call the {@link GetAllQuestions#execute()} method to invoke the remote * operation. <p> {@link GetAllQuestions#initialize(com.google.api.client.googleapis.services.Abst * ractGoogleClientRequest)} must be called to initialize this instance immediately after invoking * the constructor. </p> * * @since 1.13 */ protected GetAllQuestions() { super(QuestionService.this, "GET", REST_PATH, null, com.appspot.asktheuniverseaquestion.questionService.model.AskTheUniverseAQuestionQuestionCollection.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 GetAllQuestions setAlt(java.lang.String alt) { return (GetAllQuestions) super.setAlt(alt); } @Override public GetAllQuestions setFields(java.lang.String fields) { return (GetAllQuestions) super.setFields(fields); } @Override public GetAllQuestions setKey(java.lang.String key) { return (GetAllQuestions) super.setKey(key); } @Override public GetAllQuestions setOauthToken(java.lang.String oauthToken) { return (GetAllQuestions) super.setOauthToken(oauthToken); } @Override public GetAllQuestions setPrettyPrint(java.lang.Boolean prettyPrint) { return (GetAllQuestions) super.setPrettyPrint(prettyPrint); } @Override public GetAllQuestions setQuotaUser(java.lang.String quotaUser) { return (GetAllQuestions) super.setQuotaUser(quotaUser); } @Override public GetAllQuestions setUserIp(java.lang.String userIp) { return (GetAllQuestions) super.setUserIp(userIp); } @Override public GetAllQuestions set(String parameterName, Object value) { return (GetAllQuestions) super.set(parameterName, value); } } /** * Create a request for the method "questionService.sendAnswer". * * This request holds the parameters needed by the questionService server. After setting any * optional parameters, call the {@link SendAnswer#execute()} method to invoke the remote operation. * * @param id * @param answer * @return the request */ public SendAnswer sendAnswer(java.lang.Long id, java.lang.String answer) throws java.io.IOException { SendAnswer result = new SendAnswer(id, answer); initialize(result); return result; } public class SendAnswer extends QuestionServiceRequest<com.appspot.asktheuniverseaquestion.questionService.model.AskTheUniverseAQuestionQuestion> { private static final String REST_PATH = "questionServiceAnswer"; /** * Create a request for the method "questionService.sendAnswer". * * This request holds the parameters needed by the the questionService server. After setting any * optional parameters, call the {@link SendAnswer#execute()} method to invoke the remote * operation. <p> {@link * SendAnswer#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} * must be called to initialize this instance immediately after invoking the constructor. </p> * * @param id * @param answer * @since 1.13 */ protected SendAnswer(java.lang.Long id, java.lang.String answer) { super(QuestionService.this, "POST", REST_PATH, null, com.appspot.asktheuniverseaquestion.questionService.model.AskTheUniverseAQuestionQuestion.class); this.id = com.google.api.client.util.Preconditions.checkNotNull(id, "Required parameter id must be specified."); this.answer = com.google.api.client.util.Preconditions.checkNotNull(answer, "Required parameter answer must be specified."); } @Override public SendAnswer setAlt(java.lang.String alt) { return (SendAnswer) super.setAlt(alt); } @Override public SendAnswer setFields(java.lang.String fields) { return (SendAnswer) super.setFields(fields); } @Override public SendAnswer setKey(java.lang.String key) { return (SendAnswer) super.setKey(key); } @Override public SendAnswer setOauthToken(java.lang.String oauthToken) { return (SendAnswer) super.setOauthToken(oauthToken); } @Override public SendAnswer setPrettyPrint(java.lang.Boolean prettyPrint) { return (SendAnswer) super.setPrettyPrint(prettyPrint); } @Override public SendAnswer setQuotaUser(java.lang.String quotaUser) { return (SendAnswer) super.setQuotaUser(quotaUser); } @Override public SendAnswer setUserIp(java.lang.String userIp) { return (SendAnswer) super.setUserIp(userIp); } @com.google.api.client.util.Key private java.lang.Long id; /** */ public java.lang.Long getId() { return id; } public SendAnswer setId(java.lang.Long id) { this.id = id; return this; } @com.google.api.client.util.Key private java.lang.String answer; /** */ public java.lang.String getAnswer() { return answer; } public SendAnswer setAnswer(java.lang.String answer) { this.answer = answer; return this; } @Override public SendAnswer set(String parameterName, Object value) { return (SendAnswer) super.set(parameterName, value); } } } /** * Builder for {@link QuestionService}. * * <p> * Implementation is not thread-safe. * </p> * * @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: * <ul> * <li>Google App Engine: * {@code com.google.api.client.extensions.appengine.http.UrlFetchTransport}</li> * <li>Android: {@code newCompatibleTransport} from * {@code com.google.api.client.extensions.android.http.AndroidHttp}</li> * <li>Java: {@link com.google.api.client.googleapis.javanet.GoogleNetHttpTransport#newTrustedTransport()} * </li> * </ul> * @param jsonFactory JSON factory, which may be: * <ul> * <li>Jackson: {@code com.google.api.client.json.jackson2.JacksonFactory}</li> * <li>Google GSON: {@code com.google.api.client.json.gson.GsonFactory}</li> * <li>Android Honeycomb or higher: * {@code com.google.api.client.extensions.android.json.AndroidJsonFactory}</li> * </ul> * @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 QuestionService}. */ @Override public QuestionService build() { return new QuestionService(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 QuestionServiceRequestInitializer}. * * @since 1.12 */ public Builder setQuestionServiceRequestInitializer( QuestionServiceRequestInitializer questionserviceRequestInitializer) { return (Builder) super.setGoogleClientRequestInitializer(questionserviceRequestInitializer); } @Override public Builder setGoogleClientRequestInitializer( com.google.api.client.googleapis.services.GoogleClientRequestInitializer googleClientRequestInitializer) { return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer); } } }