ServiceClient Class

  • java.lang.Object
    • com.microsoft.bot.restclient.ServiceClient

public abstract class ServiceClient

ServiceClient is the abstraction for accessing REST operations and their payload data types.

Constructor Summary

Modifier Constructor Description
protected ServiceClient(RestClient restClient)

Initializes a new instance of the ServiceClient class.

protected ServiceClient(String baseUrl)

Initializes a new instance of the ServiceClient class.

protected ServiceClient(String baseUrl, ServiceClientCredentials credentials)
protected ServiceClient(String baseUrl, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder)

Initializes a new instance of the ServiceClient class.

protected ServiceClient(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder)

Initializes a new instance of the ServiceClient class.

Method Summary

Modifier and Type Method and Description
okhttp3.OkHttpClient httpClient()
RestClient restClient()
retrofit2.Retrofit retrofit()
SerializerAdapter<?> serializerAdapter()
java.lang.String userAgent()

The default User-Agent header.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

ServiceClient

protected ServiceClient(RestClient restClient)

Initializes a new instance of the ServiceClient class.

Parameters:

restClient - the REST client

ServiceClient

protected ServiceClient(String baseUrl)

Initializes a new instance of the ServiceClient class.

Parameters:

baseUrl - the service endpoint

ServiceClient

protected ServiceClient(String baseUrl, ServiceClientCredentials credentials)

Parameters:

baseUrl
credentials

ServiceClient

protected ServiceClient(String baseUrl, ServiceClientCredentials credentials, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder)

Initializes a new instance of the ServiceClient class.

Parameters:

baseUrl - the service base uri
credentials - the credentials
clientBuilder - the http client builder
restBuilder - the retrofit rest client builder

ServiceClient

protected ServiceClient(String baseUrl, OkHttpClient.Builder clientBuilder, Retrofit.Builder restBuilder)

Initializes a new instance of the ServiceClient class.

Parameters:

baseUrl - the service base uri
clientBuilder - the http client builder
restBuilder - the retrofit rest client builder

Method Details

httpClient

public OkHttpClient httpClient()

Returns:

the HTTP client.

restClient

public RestClient restClient()

Returns:

the RestClient instance.

retrofit

public Retrofit retrofit()

Returns:

the Retrofit instance.

serializerAdapter

public SerializerAdapter serializerAdapter()

Returns:

the adapter to a Jackson com.fasterxml.jackson.databind.ObjectMapper.

userAgent

public String userAgent()

The default User-Agent header. Override this method to override the user agent.

Returns:

the user agent string.

Applies to