Class HttpOperations

java.lang.Object
ai.docling.serve.client.operations.HttpOperations
Direct Known Subclasses:
DoclingServeClient

public abstract class HttpOperations extends Object
Abstract base class for HTTP operations. Provides methods for executing HTTP requests such as GET and POST and deserializing responses into specified types. This class is intended to be extended by subclasses that implement these operations for specific use cases.
  • Field Details

    • API_KEY_HEADER_NAME

      public static final String API_KEY_HEADER_NAME
      The header name used to specify the API key in HTTP requests. This constant is commonly utilized in authentication mechanisms to include the API key in request headers.
      See Also:
  • Constructor Details

    • HttpOperations

      public HttpOperations()
  • Method Details

    • executeGet

      protected abstract <I, O> O executeGet(RequestContext<I,O> requestContext)
      Executes an HTTP GET request using the details specified in the provided RequestContext.
      Type Parameters:
      I - the type of the request payload
      O - the type of the response object
      Parameters:
      requestContext - the context containing details such as the URI, request payload, and expected response type of the GET operation
      Returns:
      an instance of the response type O, which represents the deserialized response data
    • executePost

      protected abstract <I, O> O executePost(RequestContext<I,O> requestContext)
      Executes an HTTP POST request using the details provided in the RequestContext. This method is designed to be implemented by subclasses and facilitates sending POST requests with a specified request payload and receiving a deserialized response.
      Type Parameters:
      I - the type of the request payload
      O - the type of the response object
      Parameters:
      requestContext - the context containing details such as the URI, request payload, and expected response type of the POST operation
      Returns:
      an instance of the response type O, which represents the deserialized response data