Package org.a2aproject.sdk.client.http
Interface A2AHttpClient.GetBuilder
- All Superinterfaces:
A2AHttpClient.Builder<A2AHttpClient.GetBuilder>
- Enclosing interface:
- A2AHttpClient
public static interface A2AHttpClient.GetBuilder
extends A2AHttpClient.Builder<A2AHttpClient.GetBuilder>
Builder for HTTP GET requests.
Supports both synchronous requests and asynchronous Server-Sent Events (SSE) streaming.
-
Method Summary
Modifier and TypeMethodDescriptionget()Executes a synchronous GET request.getAsyncSSE(Consumer<ServerSentEvent> messageConsumer, Consumer<Throwable> errorConsumer, Runnable completeRunnable) Executes an asynchronous GET request expecting Server-Sent Events (SSE).Methods inherited from interface org.a2aproject.sdk.client.http.A2AHttpClient.Builder
addHeader, addHeaders, url
-
Method Details
-
get
Executes a synchronous GET request.- Returns:
- the HTTP response
- Throws:
IOException- if an I/O error occursInterruptedException- if the operation is interrupted
-
getAsyncSSE
CompletableFuture<Void> getAsyncSSE(Consumer<ServerSentEvent> messageConsumer, Consumer<Throwable> errorConsumer, Runnable completeRunnable) throws IOException, InterruptedException Executes an asynchronous GET request expecting Server-Sent Events (SSE).The request will stream SSE messages asynchronously, invoking the provided consumers for each event, error, or completion.
- Parameters:
messageConsumer- callback for each SSE message receivederrorConsumer- callback for errors during streamingcompleteRunnable- callback when the stream completes normally- Returns:
- a CompletableFuture that completes when streaming ends
- Throws:
IOException- if an I/O error occursInterruptedException- if the operation is interrupted
-