Class DocumentRequest<O extends Options>

java.lang.Object
com.basistech.rosette.apimodel.Request
com.basistech.rosette.apimodel.DocumentRequest<O>

public final class DocumentRequest<O extends Options> extends Request
This class represents the common information for all document processing requests to the Rosette API. Most applications do not use this class directly; the methods of the RosetteAPI class create request objects. More complex applications may create objects of this class for themselves via the DocumentRequest.DocumentRequestBuilder.
On the wire, a request is a json object. All the endpoints accept the same set of items, represented here, that describe the input document.
Applications specify the text to process in three ways:
  1. Plain text, as the content item in the Json object.
  2. A binary file image, attached as an additional MIME part to the request. The application provides a MIME content type in contentType.
  3. A URL of a data to download. The application provides the URL in contentUri. Note that the Rosette API respects the content type returned by the server for downloaded data.
In this object the 'content' item is an Object; it contains a String for plain text, or an InputStream for binary data. DocumentRequest.DocumentRequestBuilder provides several alternative methods for setting this information.
  • Constructor Details

    • DocumentRequest

      public DocumentRequest(String profileId, com.basistech.util.LanguageCode language, Object content, String contentUri, String contentType, O options)
    • DocumentRequest

      public DocumentRequest(String profileId, com.basistech.util.LanguageCode language, Object content, String contentUri, String contentType, @Deprecated String genre, O options)
  • Method Details

    • getContent

      public String getContent()
      get content to process if it's a String.
      Returns:
      the content if a String, else null.
    • getContentBytes

      public InputStream getContentBytes()
      get the content as an array of bytes
      Returns:
      the content as bytes
    • getRawContent

      public Object getRawContent()
      get content as an object
      Returns:
      the content as object
    • builder

      public static <O extends Options> DocumentRequest.DocumentRequestBuilder<O> builder()
    • getLanguage

      public com.basistech.util.LanguageCode getLanguage()
      Returns:
      the language code
    • getContentUri

      public String getContentUri()
      Returns:
      the URI of request content
    • getContentType

      public String getContentType()
      Returns:
      request content type
    • getGenre

      @Deprecated public String getGenre()
      Deprecated.
      Returns:
      request genre
    • getOptions

      public O getOptions()
      Returns:
      request options
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Request
    • canEqual

      protected boolean canEqual(Object other)
      Overrides:
      canEqual in class Request
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Request
    • toString

      public String toString()
      Overrides:
      toString in class Request