Package com.google.genai
Class HttpApiClient
java.lang.Object
com.google.genai.ApiClient
com.google.genai.HttpApiClient
Base client for the HTTP APIs. This is for internal use only.
-
Constructor Summary
ConstructorsConstructorDescriptionHttpApiClient(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<com.google.auth.oauth2.GoogleCredentials> credentials, Optional<HttpOptions> httpOptions, Optional<ClientOptions> clientOptions) Constructs an ApiClient for Vertex AI APIs. -
Method Summary
Modifier and TypeMethodDescriptionasyncRequest(String httpMethod, String url, byte[] requestBytes, Optional<HttpOptions> requestHttpOptions) Sends an asynchronous Http request given the http method, path, request bytes, and http options.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.com.google.genai.HttpApiResponserequest(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.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.Methods inherited from class com.google.genai.ApiClient
apiKey, defaultEnvironmentVariables, httpClient, httpOptions, location, project, setDefaultBaseUrls, vertexAI
-
Constructor Details
-
HttpApiClient
public HttpApiClient(Optional<String> apiKey, Optional<HttpOptions> httpOptions, Optional<ClientOptions> clientOptions) Constructs an ApiClient for Google AI APIs. -
HttpApiClient
public HttpApiClient(Optional<String> apiKey, Optional<String> project, Optional<String> location, Optional<com.google.auth.oauth2.GoogleCredentials> credentials, Optional<HttpOptions> httpOptions, Optional<ClientOptions> clientOptions) Constructs an ApiClient for 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<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.- Specified by:
asyncRequestin classApiClient
-
asyncRequest
public CompletableFuture<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.- Specified by:
asyncRequestin classApiClient
-