com.google.api.services.mybusinessqanda.v1.MyBusinessQA Maven / Gradle / Ivy
/*
* 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://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.mybusinessqanda.v1;
/**
* Service definition for MyBusinessQA (v1).
*
*
* The My Business Q API allows questions and answers to be posted for specific listings. Note - If you have a quota of 0 after enabling the API, please request for GBP API access.
*
*
*
* For more information about this service, see the
* API Documentation
*
*
*
* This service uses {@link MyBusinessQARequestInitializer} to initialize global parameters via its
* {@link Builder}.
*
*
* @since 1.3
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public class MyBusinessQA 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 >= 32 ||
(com.google.api.client.googleapis.GoogleUtils.MINOR_VERSION == 31 &&
com.google.api.client.googleapis.GoogleUtils.BUGFIX_VERSION >= 1))) ||
com.google.api.client.googleapis.GoogleUtils.MAJOR_VERSION >= 2,
"You are currently running with version %s of google-api-client. " +
"You need at least version 1.31.1 of google-api-client to run version " +
"2.0.0 of the My Business Q&A 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://mybusinessqanda.googleapis.com/";
/**
* The default encoded mTLS root URL of the service. This is determined when the library is generated
* and normally should not be changed.
*
* @since 1.31
*/
public static final String DEFAULT_MTLS_ROOT_URL = "https://mybusinessqanda.mtls.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 = "";
/**
* The default encoded batch path of the service. This is determined when the library is
* generated and normally should not be changed.
*
* @since 1.23
*/
public static final String DEFAULT_BATCH_PATH = "batch";
/**
* 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 MyBusinessQA(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
*/
MyBusinessQA(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 Locations collection.
*
* The typical use is:
*
* {@code MyBusinessQA mybusinessqanda = new MyBusinessQA(...);}
* {@code MyBusinessQA.Locations.List request = mybusinessqanda.locations().list(parameters ...)}
*
*
* @return the resource collection
*/
public Locations locations() {
return new Locations();
}
/**
* The "locations" collection of methods.
*/
public class Locations {
/**
* An accessor for creating requests from the Questions collection.
*
* The typical use is:
*
* {@code MyBusinessQA mybusinessqanda = new MyBusinessQA(...);}
* {@code MyBusinessQA.Questions.List request = mybusinessqanda.questions().list(parameters ...)}
*
*
* @return the resource collection
*/
public Questions questions() {
return new Questions();
}
/**
* The "questions" collection of methods.
*/
public class Questions {
/**
* Adds a question for the specified location.
*
* Create a request for the method "questions.create".
*
* This request holds the parameters needed by the mybusinessqanda server. After setting any
* optional parameters, call the {@link Create#execute()} method to invoke the remote operation.
*
* @param parent Required. The name of the location to write a question for.
* @param content the {@link com.google.api.services.mybusinessqanda.v1.model.Question}
* @return the request
*/
public Create create(java.lang.String parent, com.google.api.services.mybusinessqanda.v1.model.Question content) throws java.io.IOException {
Create result = new Create(parent, content);
initialize(result);
return result;
}
public class Create extends MyBusinessQARequest {
private static final String REST_PATH = "v1/{+parent}";
private final java.util.regex.Pattern PARENT_PATTERN =
java.util.regex.Pattern.compile("^locations/[^/]+/questions$");
/**
* Adds a question for the specified location.
*
* Create a request for the method "questions.create".
*
* This request holds the parameters needed by the the mybusinessqanda server. After setting any
* optional parameters, call the {@link Create#execute()} method to invoke the remote operation.
* {@link
* Create#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor.
*
* @param parent Required. The name of the location to write a question for.
* @param content the {@link com.google.api.services.mybusinessqanda.v1.model.Question}
* @since 1.13
*/
protected Create(java.lang.String parent, com.google.api.services.mybusinessqanda.v1.model.Question content) {
super(MyBusinessQA.this, "POST", REST_PATH, content, com.google.api.services.mybusinessqanda.v1.model.Question.class);
this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^locations/[^/]+/questions$");
}
}
@Override
public Create set$Xgafv(java.lang.String $Xgafv) {
return (Create) super.set$Xgafv($Xgafv);
}
@Override
public Create setAccessToken(java.lang.String accessToken) {
return (Create) super.setAccessToken(accessToken);
}
@Override
public Create setAlt(java.lang.String alt) {
return (Create) super.setAlt(alt);
}
@Override
public Create setCallback(java.lang.String callback) {
return (Create) super.setCallback(callback);
}
@Override
public Create setFields(java.lang.String fields) {
return (Create) super.setFields(fields);
}
@Override
public Create setKey(java.lang.String key) {
return (Create) super.setKey(key);
}
@Override
public Create setOauthToken(java.lang.String oauthToken) {
return (Create) super.setOauthToken(oauthToken);
}
@Override
public Create setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Create) super.setPrettyPrint(prettyPrint);
}
@Override
public Create setQuotaUser(java.lang.String quotaUser) {
return (Create) super.setQuotaUser(quotaUser);
}
@Override
public Create setUploadType(java.lang.String uploadType) {
return (Create) super.setUploadType(uploadType);
}
@Override
public Create setUploadProtocol(java.lang.String uploadProtocol) {
return (Create) super.setUploadProtocol(uploadProtocol);
}
/** Required. The name of the location to write a question for. */
@com.google.api.client.util.Key
private java.lang.String parent;
/** Required. The name of the location to write a question for.
*/
public java.lang.String getParent() {
return parent;
}
/** Required. The name of the location to write a question for. */
public Create setParent(java.lang.String parent) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^locations/[^/]+/questions$");
}
this.parent = parent;
return this;
}
@Override
public Create set(String parameterName, Object value) {
return (Create) super.set(parameterName, value);
}
}
/**
* Deletes a specific question written by the current user.
*
* Create a request for the method "questions.delete".
*
* This request holds the parameters needed by the mybusinessqanda server. After setting any
* optional parameters, call the {@link Delete#execute()} method to invoke the remote operation.
*
* @param name Required. The name of the question to delete.
* @return the request
*/
public Delete delete(java.lang.String name) throws java.io.IOException {
Delete result = new Delete(name);
initialize(result);
return result;
}
public class Delete extends MyBusinessQARequest {
private static final String REST_PATH = "v1/{+name}";
private final java.util.regex.Pattern NAME_PATTERN =
java.util.regex.Pattern.compile("^locations/[^/]+/questions/[^/]+$");
/**
* Deletes a specific question written by the current user.
*
* Create a request for the method "questions.delete".
*
* This request holds the parameters needed by the the mybusinessqanda 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 name Required. The name of the question to delete.
* @since 1.13
*/
protected Delete(java.lang.String name) {
super(MyBusinessQA.this, "DELETE", REST_PATH, null, com.google.api.services.mybusinessqanda.v1.model.Empty.class);
this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^locations/[^/]+/questions/[^/]+$");
}
}
@Override
public Delete set$Xgafv(java.lang.String $Xgafv) {
return (Delete) super.set$Xgafv($Xgafv);
}
@Override
public Delete setAccessToken(java.lang.String accessToken) {
return (Delete) super.setAccessToken(accessToken);
}
@Override
public Delete setAlt(java.lang.String alt) {
return (Delete) super.setAlt(alt);
}
@Override
public Delete setCallback(java.lang.String callback) {
return (Delete) super.setCallback(callback);
}
@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 setUploadType(java.lang.String uploadType) {
return (Delete) super.setUploadType(uploadType);
}
@Override
public Delete setUploadProtocol(java.lang.String uploadProtocol) {
return (Delete) super.setUploadProtocol(uploadProtocol);
}
/** Required. The name of the question to delete. */
@com.google.api.client.util.Key
private java.lang.String name;
/** Required. The name of the question to delete.
*/
public java.lang.String getName() {
return name;
}
/** Required. The name of the question to delete. */
public Delete setName(java.lang.String name) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^locations/[^/]+/questions/[^/]+$");
}
this.name = name;
return this;
}
@Override
public Delete set(String parameterName, Object value) {
return (Delete) super.set(parameterName, value);
}
}
/**
* Returns the paginated list of questions and some of its answers for a specified location. This
* operation is only valid if the specified location is verified.
*
* Create a request for the method "questions.list".
*
* This request holds the parameters needed by the mybusinessqanda server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @param parent Required. The name of the location to fetch questions for.
* @return the request
*/
public List list(java.lang.String parent) throws java.io.IOException {
List result = new List(parent);
initialize(result);
return result;
}
public class List extends MyBusinessQARequest {
private static final String REST_PATH = "v1/{+parent}";
private final java.util.regex.Pattern PARENT_PATTERN =
java.util.regex.Pattern.compile("^locations/[^/]+/questions$");
/**
* Returns the paginated list of questions and some of its answers for a specified location. This
* operation is only valid if the specified location is verified.
*
* Create a request for the method "questions.list".
*
* This request holds the parameters needed by the the mybusinessqanda 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.
*
* @param parent Required. The name of the location to fetch questions for.
* @since 1.13
*/
protected List(java.lang.String parent) {
super(MyBusinessQA.this, "GET", REST_PATH, null, com.google.api.services.mybusinessqanda.v1.model.ListQuestionsResponse.class);
this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^locations/[^/]+/questions$");
}
}
@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 set$Xgafv(java.lang.String $Xgafv) {
return (List) super.set$Xgafv($Xgafv);
}
@Override
public List setAccessToken(java.lang.String accessToken) {
return (List) super.setAccessToken(accessToken);
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setCallback(java.lang.String callback) {
return (List) super.setCallback(callback);
}
@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 setUploadType(java.lang.String uploadType) {
return (List) super.setUploadType(uploadType);
}
@Override
public List setUploadProtocol(java.lang.String uploadProtocol) {
return (List) super.setUploadProtocol(uploadProtocol);
}
/** Required. The name of the location to fetch questions for. */
@com.google.api.client.util.Key
private java.lang.String parent;
/** Required. The name of the location to fetch questions for.
*/
public java.lang.String getParent() {
return parent;
}
/** Required. The name of the location to fetch questions for. */
public List setParent(java.lang.String parent) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^locations/[^/]+/questions$");
}
this.parent = parent;
return this;
}
/**
* Optional. How many answers to fetch per question. The default and maximum
* `answers_per_question` values are 10.
*/
@com.google.api.client.util.Key
private java.lang.Integer answersPerQuestion;
/** Optional. How many answers to fetch per question. The default and maximum `answers_per_question`
values are 10.
*/
public java.lang.Integer getAnswersPerQuestion() {
return answersPerQuestion;
}
/**
* Optional. How many answers to fetch per question. The default and maximum
* `answers_per_question` values are 10.
*/
public List setAnswersPerQuestion(java.lang.Integer answersPerQuestion) {
this.answersPerQuestion = answersPerQuestion;
return this;
}
/**
* Optional. A filter constraining the questions to return. The only filter currently
* supported is "ignore_answered=true"
*/
@com.google.api.client.util.Key
private java.lang.String filter;
/** Optional. A filter constraining the questions to return. The only filter currently supported is
"ignore_answered=true"
*/
public java.lang.String getFilter() {
return filter;
}
/**
* Optional. A filter constraining the questions to return. The only filter currently
* supported is "ignore_answered=true"
*/
public List setFilter(java.lang.String filter) {
this.filter = filter;
return this;
}
/**
* Optional. The order to return the questions. Valid options include 'update_time desc' and
* 'upvote_count desc', which will return the questions sorted descendingly by the requested
* field. The default sort order is 'update_time desc'.
*/
@com.google.api.client.util.Key
private java.lang.String orderBy;
/** Optional. The order to return the questions. Valid options include 'update_time desc' and
'upvote_count desc', which will return the questions sorted descendingly by the requested field.
The default sort order is 'update_time desc'.
*/
public java.lang.String getOrderBy() {
return orderBy;
}
/**
* Optional. The order to return the questions. Valid options include 'update_time desc' and
* 'upvote_count desc', which will return the questions sorted descendingly by the requested
* field. The default sort order is 'update_time desc'.
*/
public List setOrderBy(java.lang.String orderBy) {
this.orderBy = orderBy;
return this;
}
/**
* Optional. How many questions to fetch per page. The default and maximum `page_size`
* values are 10.
*/
@com.google.api.client.util.Key
private java.lang.Integer pageSize;
/** Optional. How many questions to fetch per page. The default and maximum `page_size` values are 10.
*/
public java.lang.Integer getPageSize() {
return pageSize;
}
/**
* Optional. How many questions to fetch per page. The default and maximum `page_size`
* values are 10.
*/
public List setPageSize(java.lang.Integer pageSize) {
this.pageSize = pageSize;
return this;
}
/** Optional. If specified, the next page of questions is retrieved. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Optional. If specified, the next page of questions is retrieved.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Optional. If specified, the next page of questions is retrieved. */
public List setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
/**
* Updates a specific question written by the current user.
*
* Create a request for the method "questions.patch".
*
* This request holds the parameters needed by the mybusinessqanda server. After setting any
* optional parameters, call the {@link Patch#execute()} method to invoke the remote operation.
*
* @param name Immutable. The unique name for the question. locations/questions This field will be ignored if set
* during question creation.
* @param content the {@link com.google.api.services.mybusinessqanda.v1.model.Question}
* @return the request
*/
public Patch patch(java.lang.String name, com.google.api.services.mybusinessqanda.v1.model.Question content) throws java.io.IOException {
Patch result = new Patch(name, content);
initialize(result);
return result;
}
public class Patch extends MyBusinessQARequest {
private static final String REST_PATH = "v1/{+name}";
private final java.util.regex.Pattern NAME_PATTERN =
java.util.regex.Pattern.compile("^locations/[^/]+/questions/[^/]+$");
/**
* Updates a specific question written by the current user.
*
* Create a request for the method "questions.patch".
*
* This request holds the parameters needed by the the mybusinessqanda server. After setting any
* optional parameters, call the {@link Patch#execute()} method to invoke the remote operation.
* {@link
* Patch#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor.
*
* @param name Immutable. The unique name for the question. locations/questions This field will be ignored if set
* during question creation.
* @param content the {@link com.google.api.services.mybusinessqanda.v1.model.Question}
* @since 1.13
*/
protected Patch(java.lang.String name, com.google.api.services.mybusinessqanda.v1.model.Question content) {
super(MyBusinessQA.this, "PATCH", REST_PATH, content, com.google.api.services.mybusinessqanda.v1.model.Question.class);
this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^locations/[^/]+/questions/[^/]+$");
}
}
@Override
public Patch set$Xgafv(java.lang.String $Xgafv) {
return (Patch) super.set$Xgafv($Xgafv);
}
@Override
public Patch setAccessToken(java.lang.String accessToken) {
return (Patch) super.setAccessToken(accessToken);
}
@Override
public Patch setAlt(java.lang.String alt) {
return (Patch) super.setAlt(alt);
}
@Override
public Patch setCallback(java.lang.String callback) {
return (Patch) super.setCallback(callback);
}
@Override
public Patch setFields(java.lang.String fields) {
return (Patch) super.setFields(fields);
}
@Override
public Patch setKey(java.lang.String key) {
return (Patch) super.setKey(key);
}
@Override
public Patch setOauthToken(java.lang.String oauthToken) {
return (Patch) super.setOauthToken(oauthToken);
}
@Override
public Patch setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Patch) super.setPrettyPrint(prettyPrint);
}
@Override
public Patch setQuotaUser(java.lang.String quotaUser) {
return (Patch) super.setQuotaUser(quotaUser);
}
@Override
public Patch setUploadType(java.lang.String uploadType) {
return (Patch) super.setUploadType(uploadType);
}
@Override
public Patch setUploadProtocol(java.lang.String uploadProtocol) {
return (Patch) super.setUploadProtocol(uploadProtocol);
}
/**
* Immutable. The unique name for the question. locations/questions This field will be
* ignored if set during question creation.
*/
@com.google.api.client.util.Key
private java.lang.String name;
/** Immutable. The unique name for the question. locations/questions This field will be ignored if set
during question creation.
*/
public java.lang.String getName() {
return name;
}
/**
* Immutable. The unique name for the question. locations/questions This field will be
* ignored if set during question creation.
*/
public Patch setName(java.lang.String name) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^locations/[^/]+/questions/[^/]+$");
}
this.name = name;
return this;
}
/** Required. The specific fields to update. Only question text can be updated. */
@com.google.api.client.util.Key
private String updateMask;
/** Required. The specific fields to update. Only question text can be updated.
*/
public String getUpdateMask() {
return updateMask;
}
/** Required. The specific fields to update. Only question text can be updated. */
public Patch setUpdateMask(String updateMask) {
this.updateMask = updateMask;
return this;
}
@Override
public Patch set(String parameterName, Object value) {
return (Patch) super.set(parameterName, value);
}
}
/**
* An accessor for creating requests from the Answers collection.
*
* The typical use is:
*
* {@code MyBusinessQA mybusinessqanda = new MyBusinessQA(...);}
* {@code MyBusinessQA.Answers.List request = mybusinessqanda.answers().list(parameters ...)}
*
*
* @return the resource collection
*/
public Answers answers() {
return new Answers();
}
/**
* The "answers" collection of methods.
*/
public class Answers {
/**
* Deletes the answer written by the current user to a question.
*
* Create a request for the method "answers.delete".
*
* This request holds the parameters needed by the mybusinessqanda server. After setting any
* optional parameters, call the {@link Delete#execute()} method to invoke the remote operation.
*
* @param name Required. The name of the question to delete an answer for.
* @return the request
*/
public Delete delete(java.lang.String name) throws java.io.IOException {
Delete result = new Delete(name);
initialize(result);
return result;
}
public class Delete extends MyBusinessQARequest {
private static final String REST_PATH = "v1/{+name}/answers:delete";
private final java.util.regex.Pattern NAME_PATTERN =
java.util.regex.Pattern.compile("^locations/[^/]+/questions/[^/]+$");
/**
* Deletes the answer written by the current user to a question.
*
* Create a request for the method "answers.delete".
*
* This request holds the parameters needed by the the mybusinessqanda 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 name Required. The name of the question to delete an answer for.
* @since 1.13
*/
protected Delete(java.lang.String name) {
super(MyBusinessQA.this, "DELETE", REST_PATH, null, com.google.api.services.mybusinessqanda.v1.model.Empty.class);
this.name = com.google.api.client.util.Preconditions.checkNotNull(name, "Required parameter name must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^locations/[^/]+/questions/[^/]+$");
}
}
@Override
public Delete set$Xgafv(java.lang.String $Xgafv) {
return (Delete) super.set$Xgafv($Xgafv);
}
@Override
public Delete setAccessToken(java.lang.String accessToken) {
return (Delete) super.setAccessToken(accessToken);
}
@Override
public Delete setAlt(java.lang.String alt) {
return (Delete) super.setAlt(alt);
}
@Override
public Delete setCallback(java.lang.String callback) {
return (Delete) super.setCallback(callback);
}
@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 setUploadType(java.lang.String uploadType) {
return (Delete) super.setUploadType(uploadType);
}
@Override
public Delete setUploadProtocol(java.lang.String uploadProtocol) {
return (Delete) super.setUploadProtocol(uploadProtocol);
}
/** Required. The name of the question to delete an answer for. */
@com.google.api.client.util.Key
private java.lang.String name;
/** Required. The name of the question to delete an answer for.
*/
public java.lang.String getName() {
return name;
}
/** Required. The name of the question to delete an answer for. */
public Delete setName(java.lang.String name) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(NAME_PATTERN.matcher(name).matches(),
"Parameter name must conform to the pattern " +
"^locations/[^/]+/questions/[^/]+$");
}
this.name = name;
return this;
}
@Override
public Delete set(String parameterName, Object value) {
return (Delete) super.set(parameterName, value);
}
}
/**
* Returns the paginated list of answers for a specified question.
*
* Create a request for the method "answers.list".
*
* This request holds the parameters needed by the mybusinessqanda server. After setting any
* optional parameters, call the {@link List#execute()} method to invoke the remote operation.
*
* @param parent Required. The name of the question to fetch answers for.
* @return the request
*/
public List list(java.lang.String parent) throws java.io.IOException {
List result = new List(parent);
initialize(result);
return result;
}
public class List extends MyBusinessQARequest {
private static final String REST_PATH = "v1/{+parent}/answers";
private final java.util.regex.Pattern PARENT_PATTERN =
java.util.regex.Pattern.compile("^locations/[^/]+/questions/[^/]+$");
/**
* Returns the paginated list of answers for a specified question.
*
* Create a request for the method "answers.list".
*
* This request holds the parameters needed by the the mybusinessqanda 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.
*
* @param parent Required. The name of the question to fetch answers for.
* @since 1.13
*/
protected List(java.lang.String parent) {
super(MyBusinessQA.this, "GET", REST_PATH, null, com.google.api.services.mybusinessqanda.v1.model.ListAnswersResponse.class);
this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^locations/[^/]+/questions/[^/]+$");
}
}
@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 set$Xgafv(java.lang.String $Xgafv) {
return (List) super.set$Xgafv($Xgafv);
}
@Override
public List setAccessToken(java.lang.String accessToken) {
return (List) super.setAccessToken(accessToken);
}
@Override
public List setAlt(java.lang.String alt) {
return (List) super.setAlt(alt);
}
@Override
public List setCallback(java.lang.String callback) {
return (List) super.setCallback(callback);
}
@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 setUploadType(java.lang.String uploadType) {
return (List) super.setUploadType(uploadType);
}
@Override
public List setUploadProtocol(java.lang.String uploadProtocol) {
return (List) super.setUploadProtocol(uploadProtocol);
}
/** Required. The name of the question to fetch answers for. */
@com.google.api.client.util.Key
private java.lang.String parent;
/** Required. The name of the question to fetch answers for.
*/
public java.lang.String getParent() {
return parent;
}
/** Required. The name of the question to fetch answers for. */
public List setParent(java.lang.String parent) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^locations/[^/]+/questions/[^/]+$");
}
this.parent = parent;
return this;
}
/**
* Optional. The order to return the answers. Valid options include 'update_time desc' and
* 'upvote_count desc', which will return the answers sorted descendingly by the requested
* field. The default sort order is 'update_time desc'.
*/
@com.google.api.client.util.Key
private java.lang.String orderBy;
/** Optional. The order to return the answers. Valid options include 'update_time desc' and
'upvote_count desc', which will return the answers sorted descendingly by the requested field. The
default sort order is 'update_time desc'.
*/
public java.lang.String getOrderBy() {
return orderBy;
}
/**
* Optional. The order to return the answers. Valid options include 'update_time desc' and
* 'upvote_count desc', which will return the answers sorted descendingly by the requested
* field. The default sort order is 'update_time desc'.
*/
public List setOrderBy(java.lang.String orderBy) {
this.orderBy = orderBy;
return this;
}
/**
* Optional. How many answers to fetch per page. The default and maximum `page_size`
* values are 10.
*/
@com.google.api.client.util.Key
private java.lang.Integer pageSize;
/** Optional. How many answers to fetch per page. The default and maximum `page_size` values are 10.
*/
public java.lang.Integer getPageSize() {
return pageSize;
}
/**
* Optional. How many answers to fetch per page. The default and maximum `page_size`
* values are 10.
*/
public List setPageSize(java.lang.Integer pageSize) {
this.pageSize = pageSize;
return this;
}
/** Optional. If specified, the next page of answers is retrieved. */
@com.google.api.client.util.Key
private java.lang.String pageToken;
/** Optional. If specified, the next page of answers is retrieved.
*/
public java.lang.String getPageToken() {
return pageToken;
}
/** Optional. If specified, the next page of answers is retrieved. */
public List setPageToken(java.lang.String pageToken) {
this.pageToken = pageToken;
return this;
}
@Override
public List set(String parameterName, Object value) {
return (List) super.set(parameterName, value);
}
}
/**
* Creates an answer or updates the existing answer written by the user for the specified question.
* A user can only create one answer per question.
*
* Create a request for the method "answers.upsert".
*
* This request holds the parameters needed by the mybusinessqanda server. After setting any
* optional parameters, call the {@link Upsert#execute()} method to invoke the remote operation.
*
* @param parent Required. The name of the question to write an answer for.
* @param content the {@link com.google.api.services.mybusinessqanda.v1.model.UpsertAnswerRequest}
* @return the request
*/
public Upsert upsert(java.lang.String parent, com.google.api.services.mybusinessqanda.v1.model.UpsertAnswerRequest content) throws java.io.IOException {
Upsert result = new Upsert(parent, content);
initialize(result);
return result;
}
public class Upsert extends MyBusinessQARequest {
private static final String REST_PATH = "v1/{+parent}/answers:upsert";
private final java.util.regex.Pattern PARENT_PATTERN =
java.util.regex.Pattern.compile("^locations/[^/]+/questions/[^/]+$");
/**
* Creates an answer or updates the existing answer written by the user for the specified
* question. A user can only create one answer per question.
*
* Create a request for the method "answers.upsert".
*
* This request holds the parameters needed by the the mybusinessqanda server. After setting any
* optional parameters, call the {@link Upsert#execute()} method to invoke the remote operation.
* {@link
* Upsert#initialize(com.google.api.client.googleapis.services.AbstractGoogleClientRequest)} must
* be called to initialize this instance immediately after invoking the constructor.
*
* @param parent Required. The name of the question to write an answer for.
* @param content the {@link com.google.api.services.mybusinessqanda.v1.model.UpsertAnswerRequest}
* @since 1.13
*/
protected Upsert(java.lang.String parent, com.google.api.services.mybusinessqanda.v1.model.UpsertAnswerRequest content) {
super(MyBusinessQA.this, "POST", REST_PATH, content, com.google.api.services.mybusinessqanda.v1.model.Answer.class);
this.parent = com.google.api.client.util.Preconditions.checkNotNull(parent, "Required parameter parent must be specified.");
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^locations/[^/]+/questions/[^/]+$");
}
}
@Override
public Upsert set$Xgafv(java.lang.String $Xgafv) {
return (Upsert) super.set$Xgafv($Xgafv);
}
@Override
public Upsert setAccessToken(java.lang.String accessToken) {
return (Upsert) super.setAccessToken(accessToken);
}
@Override
public Upsert setAlt(java.lang.String alt) {
return (Upsert) super.setAlt(alt);
}
@Override
public Upsert setCallback(java.lang.String callback) {
return (Upsert) super.setCallback(callback);
}
@Override
public Upsert setFields(java.lang.String fields) {
return (Upsert) super.setFields(fields);
}
@Override
public Upsert setKey(java.lang.String key) {
return (Upsert) super.setKey(key);
}
@Override
public Upsert setOauthToken(java.lang.String oauthToken) {
return (Upsert) super.setOauthToken(oauthToken);
}
@Override
public Upsert setPrettyPrint(java.lang.Boolean prettyPrint) {
return (Upsert) super.setPrettyPrint(prettyPrint);
}
@Override
public Upsert setQuotaUser(java.lang.String quotaUser) {
return (Upsert) super.setQuotaUser(quotaUser);
}
@Override
public Upsert setUploadType(java.lang.String uploadType) {
return (Upsert) super.setUploadType(uploadType);
}
@Override
public Upsert setUploadProtocol(java.lang.String uploadProtocol) {
return (Upsert) super.setUploadProtocol(uploadProtocol);
}
/** Required. The name of the question to write an answer for. */
@com.google.api.client.util.Key
private java.lang.String parent;
/** Required. The name of the question to write an answer for.
*/
public java.lang.String getParent() {
return parent;
}
/** Required. The name of the question to write an answer for. */
public Upsert setParent(java.lang.String parent) {
if (!getSuppressPatternChecks()) {
com.google.api.client.util.Preconditions.checkArgument(PARENT_PATTERN.matcher(parent).matches(),
"Parameter parent must conform to the pattern " +
"^locations/[^/]+/questions/[^/]+$");
}
this.parent = parent;
return this;
}
@Override
public Upsert set(String parameterName, Object value) {
return (Upsert) super.set(parameterName, value);
}
}
}
}
}
/**
* Builder for {@link MyBusinessQA}.
*
*
* Implementation is not thread-safe.
*
*
* @since 1.3.0
*/
public static final class Builder extends com.google.api.client.googleapis.services.json.AbstractGoogleJsonClient.Builder {
private static String chooseEndpoint(com.google.api.client.http.HttpTransport transport) {
// If the GOOGLE_API_USE_MTLS_ENDPOINT environment variable value is "always", use mTLS endpoint.
// If the env variable is "auto", use mTLS endpoint if and only if the transport is mTLS.
// Use the regular endpoint for all other cases.
String useMtlsEndpoint = System.getenv("GOOGLE_API_USE_MTLS_ENDPOINT");
useMtlsEndpoint = useMtlsEndpoint == null ? "auto" : useMtlsEndpoint;
if ("always".equals(useMtlsEndpoint) || ("auto".equals(useMtlsEndpoint) && transport != null && transport.isMtls())) {
return DEFAULT_MTLS_ROOT_URL;
}
return DEFAULT_ROOT_URL;
}
/**
* 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,
Builder.chooseEndpoint(transport),
DEFAULT_SERVICE_PATH,
httpRequestInitializer,
false);
setBatchPath(DEFAULT_BATCH_PATH);
}
/** Builds a new instance of {@link MyBusinessQA}. */
@Override
public MyBusinessQA build() {
return new MyBusinessQA(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 setBatchPath(String batchPath) {
return (Builder) super.setBatchPath(batchPath);
}
@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 MyBusinessQARequestInitializer}.
*
* @since 1.12
*/
public Builder setMyBusinessQARequestInitializer(
MyBusinessQARequestInitializer mybusinessqaRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(mybusinessqaRequestInitializer);
}
@Override
public Builder setGoogleClientRequestInitializer(
com.google.api.client.googleapis.services.GoogleClientRequestInitializer googleClientRequestInitializer) {
return (Builder) super.setGoogleClientRequestInitializer(googleClientRequestInitializer);
}
}
}