2.9.3 (latest) 2.9.2 2.8.1 2.7.2 2.6.0 2.5.1 2.4.1 2.1.2 2.0.1 1.35.2 1.34.1 1.33.4

```java
public abstract class AbstractGoogleClientRequest<T> extends GenericData
```
Abstract Google client request for a [AbstractGoogleClient](https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.services.AbstractGoogleClient.md.txt).

Implementation is not thread-safe.

## Inheritance

[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> java.util.AbstractMap \> com.google.api.client.util.GenericData \> AbstractGoogleClientRequest\<T\>

## Inherited Members

com.google.api.client.util.GenericData.clone() com.google.api.client.util.GenericData.entrySet() com.google.api.client.util.GenericData.equals(java.lang.Object) com.google.api.client.util.GenericData.get(java.lang.Object) com.google.api.client.util.GenericData.getClassInfo() com.google.api.client.util.GenericData.getUnknownKeys() com.google.api.client.util.GenericData.hashCode() com.google.api.client.util.GenericData.put(java.lang.String,java.lang.Object) com.google.api.client.util.GenericData.putAll(java.util.Map\<? extends java.lang.String,?\>) com.google.api.client.util.GenericData.remove(java.lang.Object) com.google.api.client.util.GenericData.set(java.lang.String,java.lang.Object) com.google.api.client.util.GenericData.setUnknownKeys(java.util.Map\<java.lang.String,java.lang.Object\>) com.google.api.client.util.GenericData.toString() [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-) [AbstractMap.clear()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#clear--) [AbstractMap.containsKey(Object)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#containsKey-java.lang.Object-) [AbstractMap.containsValue(Object)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#containsValue-java.lang.Object-) [AbstractMap.isEmpty()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#isEmpty--) [AbstractMap.keySet()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#keySet--) [AbstractMap.put(K,V)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#put-K-V-) [AbstractMap.putAll(Map\<? extends K,? extends V\>)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#putAll-java.util.Map<? extends K-? extends V>-) [AbstractMap.size()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#size--) [AbstractMap.values()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#values--)

| ## Type Parameter ||
|---|---|
| **Name** | **Description** |
| `T` |   |

## Static Fields

### API_VERSION_HEADER

```java
protected static final String API_VERSION_HEADER
```
The generated request class will pass this constant as part of the header if the RPC supports
ApiVersion.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `String` |   |

### USER_AGENT_SUFFIX

```java
public static final String USER_AGENT_SUFFIX
```
User agent suffix for all requests.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `String` |   |

## Constructors

### AbstractGoogleClientRequest(AbstractGoogleClient abstractGoogleClient, String requestMethod, String uriTemplate, HttpContent httpContent, Class\<T\> responseClass)

```java
protected AbstractGoogleClientRequest(AbstractGoogleClient abstractGoogleClient, String requestMethod, String uriTemplate, HttpContent httpContent, Class<T> responseClass)
```

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `abstractGoogleClient` | `AbstractGoogleClient` Google client |
| `requestMethod` | `String` HTTP Method |
| `uriTemplate` | `String` URI template for the path relative to the base URL. If it starts with a "/" the base path from the base URL will be stripped out. The URI template can also be a full URL. URI template expansion is done using UriTemplate#expand(String, String, Object, boolean) |
| `httpContent` | `com.google.api.client.http.HttpContent` HTTP content or `null` for none |
| `responseClass` | `Class<T>` response class to parse into |

## Methods

### \<E\>queue(BatchRequest batchRequest, Class\<E\> errorClass, BatchCallback\<T,E\> callback)

```java
public final void <E>queue(BatchRequest batchRequest, Class<E> errorClass, BatchCallback<T,E> callback)
```
Queues the request into the specified batch request container using the specified error class.

Batched requests are then executed when [BatchRequest#execute()](https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.batch.BatchRequest.md.txt#com_google_api_client_googleapis_batch_BatchRequest_execute__) is called.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `batchRequest` | `BatchRequest` batch request container |
| `errorClass` | `Class<E>` data class the unsuccessful response will be parsed into or ` Void.class` to ignore the content |
| `callback` | `BatchCallback<T,E>` batch callback |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `IOException` |   |

### buildHttpRequest()

```java
public HttpRequest buildHttpRequest()
```
Create a request suitable for use against this service.

Subclasses may override by calling the super implementation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.api.client.http.HttpRequest` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `IOException` |   |

### buildHttpRequestUrl()

```java
public GenericUrl buildHttpRequestUrl()
```
Creates a new instance of GenericUrl suitable for use against this service.

Subclasses may override by calling the super implementation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.api.client.http.GenericUrl` | newly created GenericUrl |

### buildHttpRequestUsingHead()

```java
protected HttpRequest buildHttpRequestUsingHead()
```
Create a request suitable for use against this service, but using HEAD instead of GET.

Only supported when the original request method is GET.

Subclasses may override by calling the super implementation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.api.client.http.HttpRequest` |   |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `IOException` |   |

### checkRequiredParameter(Object value, String name)

```java
protected final void checkRequiredParameter(Object value, String name)
```
Ensures that the specified required parameter is not null or [AbstractGoogleClient#getSuppressRequiredParameterChecks()](https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.services.AbstractGoogleClient.md.txt#com_google_api_client_googleapis_services_AbstractGoogleClient_getSuppressRequiredParameterChecks__) is true.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `value` | `Object` the value of the required parameter |
| `name` | `String` the name of the required parameter |

### execute()

```java
public T execute()
```
Sends the metadata request to the server and returns the parsed metadata response.

Subclasses may override by calling the super implementation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `T` | parsed HTTP response |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `IOException` |   |

### executeAndDownloadTo(OutputStream outputStream)

```java
public void executeAndDownloadTo(OutputStream outputStream)
```
Sends the metadata request to the server and writes the metadata content input stream of HttpResponse into the given destination output stream.

This method closes the content of the HTTP response from [HttpResponse#getContent()](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpResponse.md.txt#com_google_api_client_http_HttpResponse_getContent_).

Subclasses may override by calling the super implementation.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `outputStream` | `OutputStream` destination output stream |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `IOException` |   |

### executeAsInputStream()

```java
public InputStream executeAsInputStream()
```
Sends the metadata request to the server and returns the metadata content input stream of
HttpResponse.

Callers are responsible for closing the input stream after it is processed. Example sample:

```java

 InputStream is = request.executeAsInputStream();
 try {
   // Process input stream..
 } finally {
   is.close();
 }
 
```

Subclasses may override by calling the super implementation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `InputStream` | input stream of the response content |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `IOException` |   |

### executeMedia()

```java
protected HttpResponse executeMedia()
```
Sends the media request to the server and returns the raw media HttpResponse.

Callers are responsible for disconnecting the HTTP response by calling HttpResponse#disconnect. Example usage:

```java

 HttpResponse response = request.executeMedia();
 try {
   // process response..
 } finally {
   response.disconnect();
 }
 
```

Subclasses may override by calling the super implementation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.api.client.http.HttpResponse` | the HttpResponse |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `IOException` |   |

### executeMediaAndDownloadTo(OutputStream outputStream)

```java
protected void executeMediaAndDownloadTo(OutputStream outputStream)
```
Sends the media request to the server and writes the media content input stream of HttpResponse into the given destination output stream.

This method closes the content of the HTTP response from [HttpResponse#getContent()](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpResponse.md.txt#com_google_api_client_http_HttpResponse_getContent_).

Subclasses may override by calling the super implementation.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `outputStream` | `OutputStream` destination output stream |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `IOException` |   |

### executeMediaAsInputStream()

```java
protected InputStream executeMediaAsInputStream()
```
Sends the media request to the server and returns the media content input stream of HttpResponse.

Callers are responsible for closing the input stream after it is processed. Example sample:

```java

 InputStream is = request.executeMediaAsInputStream();
 try {
   // Process input stream..
 } finally {
   is.close();
 }
 
```

Subclasses may override by calling the super implementation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `InputStream` | input stream of the response content |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `IOException` |   |

### executeUnparsed()

```java
public HttpResponse executeUnparsed()
```
Sends the metadata request to the server and returns the raw metadata HttpResponse.

Callers are responsible for disconnecting the HTTP response by calling HttpResponse#disconnect. Example usage:

```java

 HttpResponse response = request.executeUnparsed();
 try {
   // process response..
 } finally {
   response.disconnect();
 }
 
```

Subclasses may override by calling the super implementation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.api.client.http.HttpResponse` | the HttpResponse |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `IOException` |   |

### executeUsingHead()

```java
protected HttpResponse executeUsingHead()
```
Sends the metadata request using HEAD to the server and returns the raw metadata HttpResponse for the response headers.

Only supported when the original request method is GET. The response content is assumed to
be empty and ignored. Calls [HttpResponse#ignore()](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpResponse.md.txt#com_google_api_client_http_HttpResponse_ignore_) so there is no need to disconnect the
response. Example usage:

```java

 HttpResponse response = request.executeUsingHead();
 // look at response.getHeaders()
 
```

Subclasses may override by calling the super implementation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.api.client.http.HttpResponse` | the HttpResponse |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `IOException` |   |

### getAbstractGoogleClient()

```java
public AbstractGoogleClient getAbstractGoogleClient()
```
Returns the Google client.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `AbstractGoogleClient` |   |

### getDisableGZipContent()

```java
public final boolean getDisableGZipContent()
```
Returns whether to disable GZip compression of HTTP content.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `boolean` |   |

### getHttpContent()

```java
public final HttpContent getHttpContent()
```
Returns the HTTP content or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.api.client.http.HttpContent` |   |

### getLastResponseHeaders()

```java
public final HttpHeaders getLastResponseHeaders()
```
Returns the HTTP headers of the last response or `null` before request has been executed.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.api.client.http.HttpHeaders` |   |

### getLastStatusCode()

```java
public final int getLastStatusCode()
```
Returns the status code of the last response or `-1` before request has been executed.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### getLastStatusMessage()

```java
public final String getLastStatusMessage()
```
Returns the status message of the last response or `null` before request has been
executed.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `String` |   |

### getMediaHttpDownloader()

```java
public final MediaHttpDownloader getMediaHttpDownloader()
```
Returns the media HTTP downloader or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `MediaHttpDownloader` |   |

### getMediaHttpUploader()

```java
public final MediaHttpUploader getMediaHttpUploader()
```
Returns the media HTTP Uploader or `null` for none.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `MediaHttpUploader` |   |

### getRequestHeaders()

```java
public final HttpHeaders getRequestHeaders()
```
Returns the HTTP headers used for the Google client request.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.api.client.http.HttpHeaders` |   |

### getRequestMethod()

```java
public final String getRequestMethod()
```
Returns the HTTP method.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `String` |   |

### getResponseClass()

```java
public final Class<T> getResponseClass()
```
Returns the response class to parse into.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Class<T>` |   |

### getReturnRawInputSteam()

```java
public final boolean getReturnRawInputSteam()
```
Returns whether response should return raw input stream.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `boolean` |   |

### getUriTemplate()

```java
public final String getUriTemplate()
```
Returns the URI template for the path relative to the base URL.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `String` |   |

### initializeMediaDownload()

```java
protected final void initializeMediaDownload()
```
Initializes the media HTTP downloader.

### initializeMediaUpload(AbstractInputStreamContent mediaContent)

```java
protected final void initializeMediaUpload(AbstractInputStreamContent mediaContent)
```
Initializes the media HTTP uploader based on the media content.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `mediaContent` | `com.google.api.client.http.AbstractInputStreamContent` media content |

### newExceptionOnError(HttpResponse response)

```java
protected IOException newExceptionOnError(HttpResponse response)
```
Returns the exception to throw on an HTTP error response as defined by [HttpResponse#isSuccessStatusCode()](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpResponse.md.txt#com_google_api_client_http_HttpResponse_isSuccessStatusCode_).

It is guaranteed that [HttpResponse#isSuccessStatusCode()](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpResponse.md.txt#com_google_api_client_http_HttpResponse_isSuccessStatusCode_) is `false`. Default
implementation is to call [HttpResponseException#HttpResponseException(HttpResponse)](https://docs.cloud.google.com/java/docs/reference/google-http-client/latest/com.google.api.client.http.HttpResponseException.md.txt#com_google_api_client_http_HttpResponseException_HttpResponseException_),
but subclasses may override.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `response` | `com.google.api.client.http.HttpResponse` HTTP response |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `IOException` | exception to throw |

### set(String fieldName, Object value)

```java
public AbstractGoogleClientRequest<T> set(String fieldName, Object value)
```

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldName` | `String` |
| `value` | `Object` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `AbstractGoogleClientRequest<T>` |   |

**Overrides** com.google.api.client.util.GenericData.set(java.lang.String,java.lang.Object)

### setDisableGZipContent(boolean disableGZipContent)

```java
public AbstractGoogleClientRequest<T> setDisableGZipContent(boolean disableGZipContent)
```
Sets whether to disable GZip compression of HTTP content.

By default it is `false`.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `disableGZipContent` | `boolean` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `AbstractGoogleClientRequest<T>` |   |

### setRequestHeaders(HttpHeaders headers)

```java
public AbstractGoogleClientRequest<T> setRequestHeaders(HttpHeaders headers)
```
Sets the HTTP headers used for the Google client request.

These headers are set on the request after #buildHttpRequest is called, this means
that HttpRequestInitializer#initialize is called first.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `headers` | `com.google.api.client.http.HttpHeaders` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `AbstractGoogleClientRequest<T>` |   |

### setReturnRawInputStream(boolean returnRawInputStream)

```java
public AbstractGoogleClientRequest<T> setReturnRawInputStream(boolean returnRawInputStream)
```
Sets whether the response should return raw input stream or not.

By default it is `false`.

When the response contains a known content-encoding header, the response stream is wrapped
with an InputStream that decodes the content. This fails when we download large files in chunks
(see [#1009](https://github.com/googleapis/google-api-java-client/issues/1009)).
Setting this to true will make the response return the raw input stream.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `returnRawInputStream` | `boolean` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `AbstractGoogleClientRequest<T>` |   |