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 Details

    • followRedirects

      default A2AHttpClient.GetBuilder followRedirects(boolean follow)
      Controls whether the HTTP client follows at most one redirect for this synchronous GET request. When set to true, the SDK issues a follow-up GET to the Location URL with headers filtered by RedirectHeaderPolicy to prevent credential leakage. getAsyncSSE is never redirected regardless of this flag.

      Note for implementors: The default implementation is a no-op. Third-party A2AHttpClient implementations MUST override this method to honour the setting.

      Parameters:
      follow - true to follow one redirect hop, false to disable (default)
      Returns:
      this builder for chaining
    • get

      Executes a synchronous GET request.
      Returns:
      the HTTP response
      Throws:
      IOException - if an I/O error occurs
      InterruptedException - 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 received
      errorConsumer - callback for errors during streaming
      completeRunnable - callback when the stream completes normally
      Returns:
      a CompletableFuture that completes when streaming ends
      Throws:
      IOException - if an I/O error occurs
      InterruptedException - if the operation is interrupted