Package com.google.genai
Class HttpApiClient
-
- All Implemented Interfaces:
-
java.lang.AutoCloseable
@InternalApi() public class HttpApiClient extends ApiClient
Base client for the HTTP APIs. This is for internal use only.
-
-
Constructor Summary
Constructors Constructor Description HttpApiClient(Optional<String> apiKey, Optional<HttpOptions> httpOptions, Optional<ClientOptions> clientOptions)Constructs an ApiClient for Google AI APIs. HttpApiClient(Optional<String> apiKey, Optional<String> project, Optional<String> location, Optional<GoogleCredentials> credentials, Optional<HttpOptions> httpOptions, Optional<ClientOptions> clientOptions)Constructs an ApiClient for Vertex AI APIs.
-
Method Summary
Modifier and Type Method Description HttpApiResponserequest(String httpMethod, String path, String requestJson, Optional<HttpOptions> requestHttpOptions)Sends a Http request given the http method, path, request json string, and http options. HttpApiResponserequest(String httpMethod, String url, Array<byte> requestBytes, Optional<HttpOptions> requestHttpOptions)Sends a Http request given the http method, path, request bytes, and http options. CompletableFuture<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. CompletableFuture<ApiResponse>asyncRequest(String httpMethod, String url, Array<byte> requestBytes, Optional<HttpOptions> requestHttpOptions)Sends an asynchronous Http request given the http method, path, request bytes, and http options. -
Methods inherited from class com.google.genai.ApiClient
apiKey, close, credentials, customBaseUrl, defaultEnvironmentVariables, httpClient, httpOptions, location, project, setDefaultBaseUrls, vertexAI -
Methods inherited from class java.lang.AutoCloseable
close -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Constructor Detail
-
HttpApiClient
HttpApiClient(Optional<String> apiKey, Optional<HttpOptions> httpOptions, Optional<ClientOptions> clientOptions)
Constructs an ApiClient for Google AI APIs.
-
-
Method Detail
-
request
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
HttpApiResponse request(String httpMethod, String url, Array<byte> requestBytes, Optional<HttpOptions> requestHttpOptions)
Sends a Http request given the http method, path, request bytes, and http options.
-
asyncRequest
CompletableFuture<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
CompletableFuture<ApiResponse> asyncRequest(String httpMethod, String url, Array<byte> requestBytes, Optional<HttpOptions> requestHttpOptions)
Sends an asynchronous Http request given the http method, path, request bytes, and http options.
-
-
-
-