Class InteractionsHandler

java.lang.Object
io.github.glaforge.gemini.interactions.server.InteractionsHandler
All Implemented Interfaces:
HttpHandler

public abstract class InteractionsHandler extends Object implements HttpHandler
Base class for handling Gemini Interactions API requests in an HttpHandler.

Subclasses must implement the abstract methods to provide the actual logic for creating, retrieving, deleting, and cancelling interactions, as well as streaming events.

  • Constructor Details

    • InteractionsHandler

      protected InteractionsHandler()
      Default constructor for InteractionsHandler.
  • Method Details

    • handle

      public void handle(HttpExchange exchange) throws IOException
      Specified by:
      handle in interface HttpHandler
      Throws:
      IOException
    • create

      public abstract Interaction create(InteractionParams.Request request)
      Creates a new interaction.
      Parameters:
      request - The interaction request parameters.
      Returns:
      The created Interaction.
    • get

      public abstract Interaction get(String id)
      Retrieves an interaction by ID.
      Parameters:
      id - The interaction ID.
      Returns:
      The Interaction, or null if not found.
    • delete

      public abstract void delete(String id)
      Deletes an interaction by ID.
      Parameters:
      id - The interaction ID.
    • cancel

      public abstract Interaction cancel(String id)
      Cancels an interaction by ID.
      Parameters:
      id - The interaction ID.
      Returns:
      The updated Interaction.
    • stream

      public abstract Stream<Events> stream(InteractionParams.Request request)
      Returns a stream of events for an interaction request.
      Parameters:
      request - The interaction request parameters.
      Returns:
      A stream of Events.