Class HttpRosetteAPI.Builder

java.lang.Object
com.basistech.rosette.api.HttpRosetteAPI.Builder
Enclosing class:
HttpRosetteAPI

public static class HttpRosetteAPI.Builder extends Object
Builder for HttpRosetteAPI objects.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • key

      public HttpRosetteAPI.Builder key(String key)
      Specify the API key. This is required for use with the public API, and not necessary with on-premise deployments.
      Parameters:
      key - the key string.
      Returns:
      this.
    • url

      public HttpRosetteAPI.Builder url(String url)
      Specify the URL for the service. This is required for use with on-premise deployments, but should not be called for uses of the public API.
      Parameters:
      url - the URL.
      Returns:
      this.
    • failureRetries

      public HttpRosetteAPI.Builder failureRetries(Integer failureRetries)
      How many times to retry 5xx errors from the service. Some 5xx errors result from transient infrastructure problems.
      Parameters:
      failureRetries - the number of retries. The default is 1.
      Returns:
      this.
    • connectionConcurrency

      public HttpRosetteAPI.Builder connectionConcurrency(Integer concurrency)
      The maximum number of concurrent requests that may be in progress. The default value is 2. For the public API, you should only specify a larger value if you have signed up for a plan that allows for more concurrency.
      Parameters:
      concurrency - the number of concurrent connections. The default is 2.
      Returns:
      this.
    • httpClient

      public HttpRosetteAPI.Builder httpClient(org.apache.http.impl.client.CloseableHttpClient httpClient)
      The Apache HTTP components client object to use for communications with the service. If this is not called (or is null), HttpRosetteAPI will create a client object.
      Parameters:
      httpClient - the client object.
      Returns:
      this.
    • additionalHeader

      public HttpRosetteAPI.Builder additionalHeader(String name, String value)
      Specify an additional header value to include in all requests. This can be helpful for use with corporate proxies, or as directed by Basis Technology customer engineering.
      Parameters:
      name - the header name.
      value - the header value.
      Returns:
      this.
    • onlyAcceptKnownFields

      public HttpRosetteAPI.Builder onlyAcceptKnownFields(boolean onlyAcceptKnownFields)
      Only process the response from server if all fields are recognized. If set and a new field is returned in the response, exception will be thrown.
      Parameters:
      onlyAcceptKnownFields - whether to accept known fields.
      Returns:
      this.
    • build

      public HttpRosetteAPI build() throws HttpRosetteAPIException
      Build the API object.
      Returns:
      the new API object.
      Throws:
      HttpRosetteAPIException - for some error encountered.