Package com.google.genai
Class HttpApiClient
java.lang.Object
com.google.genai.HttpApiClient
Base client for the HTTP APIs. This is for internal use only.
-
Method Summary
Modifier and TypeMethodDescription@Nullable String
apiKey()
Returns the API key for Google AI APIs.CompletableFuture<com.google.genai.ApiResponse>
asyncRequest
(String httpMethod, String url, byte[] requestBytes, Optional<HttpOptions> requestHttpOptions) Sends an asynchronous Http request given the http method, path, request bytes, and http options.CompletableFuture<com.google.genai.ApiResponse>
asyncRequest
(String httpMethod, String path, String requestJson, Optional<HttpOptions> requestHttpOptions) Sends an asynchronous Http request given the http method, path, request json string, and http options.@Nullable String
location()
Returns the location for Vertex AI APIs.@Nullable String
project()
Returns the project ID for Vertex AI APIs.com.google.genai.HttpApiResponse
request
(String httpMethod, String url, byte[] requestBytes, Optional<HttpOptions> requestHttpOptions) Sends a Http request given the http method, path, request bytes, and http options.com.google.genai.HttpApiResponse
request
(String httpMethod, String path, String requestJson, Optional<HttpOptions> requestHttpOptions) Sends a Http request given the http method, path, request json string, and http options.boolean
vertexAI()
Returns whether the client is using Vertex AI APIs.
-
Method Details
-
request
public com.google.genai.HttpApiResponse request(String httpMethod, String path, String requestJson, Optional<HttpOptions> requestHttpOptions) Sends a Http request given the http method, path, request json string, and http options. Request bodies included for non-POST/PUT/PATCH methods will be ignored. -
request
public com.google.genai.HttpApiResponse request(String httpMethod, String url, byte[] requestBytes, Optional<HttpOptions> requestHttpOptions) Sends a Http request given the http method, path, request bytes, and http options. -
asyncRequest
public CompletableFuture<com.google.genai.ApiResponse> asyncRequest(String httpMethod, String path, String requestJson, Optional<HttpOptions> requestHttpOptions) Sends an asynchronous Http request given the http method, path, request json string, and http options. -
asyncRequest
public CompletableFuture<com.google.genai.ApiResponse> asyncRequest(String httpMethod, String url, byte[] requestBytes, Optional<HttpOptions> requestHttpOptions) Sends an asynchronous Http request given the http method, path, request bytes, and http options. -
vertexAI
public boolean vertexAI()Returns whether the client is using Vertex AI APIs. -
project
Returns the project ID for Vertex AI APIs. -
location
Returns the location for Vertex AI APIs. -
apiKey
Returns the API key for Google AI APIs.
-