RestUtils (Java Application API for IBM Streams)
Date: 2020-08-07

com.ibm.streamsx.rest.internal

## Interface RestUtils

-     public interface RestUtils

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `AUTH_BASIC`
    `static java.lang.String` | `AUTH_BEARER`
    `static int` | `CONNECT_TIMEOUT_MILLISECONDS`
    `static java.lang.String` | `MEMBER_PASSWORD`
    `static java.lang.String` | `MEMBER_USERID`
    `static java.util.logging.Logger` | `TRACE`

  - ### Method Summary

    All Methods Static Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `createBasicAuth(com.google.gson.JsonObject credentials)` Create an encoded Basic auth header for the given credentials.
    `static java.lang.String` | `createBasicAuth(java.lang.String userName, java.lang.String authToken)` Create an encoded Basic auth header for the given userName and authToken
    `static java.lang.String` | `createBearerAuth(java.lang.String tokenBase64)` Create an encoded Bearer auth header for the given token.
    `static org.apache.http.client.fluent.Executor` | `createExecutor()`
    `static org.apache.http.client.fluent.Executor` | `createExecutor(boolean allowInsecure)`
    `static org.apache.http.impl.client.CloseableHttpClient` | `createHttpClient()`
    `static org.apache.http.impl.client.CloseableHttpClient` | `createHttpClient(boolean allowInsecure)`
    `static com.google.gson.JsonObject` | `getGsonResponse(org.apache.http.client.fluent.Executor executor, java.lang.String auth, java.lang.String url)` Gets a JSON response to an HTTP GET call
    `static com.google.gson.JsonObject` | `getGsonResponse(org.apache.http.client.fluent.Executor executor, java.lang.String auth, java.net.URL url)`
    `static com.google.gson.JsonObject` | `gsonFromResponse(org.apache.http.HttpResponse response)`
    `static com.google.gson.JsonObject` | `requestGsonResponse(org.apache.http.client.fluent.Executor executor, org.apache.http.client.fluent.Request request)` Gets a JSON response to an HTTP request call

- - ### Field Detail

    - #### TRACE

          static final java.util.logging.Logger TRACE

    - #### MEMBER_PASSWORD

          static final java.lang.String MEMBER_PASSWORD

      See Also:
        Constant Field Values

    - #### MEMBER_USERID

          static final java.lang.String MEMBER_USERID

      See Also:
        Constant Field Values

    - #### AUTH_BEARER

          static final java.lang.String AUTH_BEARER

      See Also:
        Constant Field Values

    - #### AUTH_BASIC

          static final java.lang.String AUTH_BASIC

      See Also:
        Constant Field Values

    - #### CONNECT_TIMEOUT_MILLISECONDS

          static final int CONNECT_TIMEOUT_MILLISECONDS

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### createBasicAuth

          static java.lang.String createBasicAuth(com.google.gson.JsonObject credentials)

      Create an encoded Basic auth header for the given credentials.
      Parameters:
        `credentials` - Service credentials.
      Returns:
        the body of a Authentication: Basic header using the user and password contained in the credentials.

    - #### createBasicAuth

          static java.lang.String createBasicAuth(java.lang.String userName,
                                                  java.lang.String authToken)

      Create an encoded Basic auth header for the given userName and authToken
      Parameters:
        `userName` - The user name for authentication
        `authToken` - The password for authentication
      Returns:
        the body of a Authentication: Basic header using the userName and authToken

    - #### createBearerAuth

          static java.lang.String createBearerAuth(java.lang.String tokenBase64)

      Create an encoded Bearer auth header for the given token.
      Parameters:
        `tokenBase64` - An authentication token, expected to be already encoded in base64, as it is when returned from the IAM server
      Returns:
        the body of a Authentication: Bearer header using tokenBase64

    - #### createExecutor

          static org.apache.http.client.fluent.Executor createExecutor()

    - #### createExecutor

          static org.apache.http.client.fluent.Executor createExecutor(boolean allowInsecure)

    - #### createHttpClient

          static org.apache.http.impl.client.CloseableHttpClient createHttpClient()

    - #### createHttpClient

          static org.apache.http.impl.client.CloseableHttpClient createHttpClient(boolean allowInsecure)

    - #### getGsonResponse

          static com.google.gson.JsonObject getGsonResponse(org.apache.http.client.fluent.Executor executor,
                                                            java.lang.String auth,
                                                            java.lang.String url)
                                                     throws java.io.IOException

      Gets a JSON response to an HTTP GET call
      Parameters:
        `executor` - HTTP client executor to use for call
        `auth` - Authentication header contents, or null
        `inputString` - REST call to make
      Returns:
        response from the inputString
      Throws:
        `java.io.IOException`

    - #### getGsonResponse

          static com.google.gson.JsonObject getGsonResponse(org.apache.http.client.fluent.Executor executor,
                                                            java.lang.String auth,
                                                            java.net.URL url)
                                                     throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### requestGsonResponse

          static com.google.gson.JsonObject requestGsonResponse(org.apache.http.client.fluent.Executor executor,
                                                                org.apache.http.client.fluent.Request request)
                                                         throws java.io.IOException

      Gets a JSON response to an HTTP request call
      Throws:
        `java.io.IOException`

    - #### gsonFromResponse

          static com.google.gson.JsonObject gsonFromResponse(org.apache.http.HttpResponse response)
                                                      throws java.io.IOException

      Throws:
        `java.io.IOException`