public abstract class APIClientBuilder extends Object
| Constructor and Description |
|---|
APIClientBuilder(String applicationId,
String apiKey)
Initialize this builder with the applicationId and apiKey
|
| Modifier and Type | Method and Description |
|---|---|
APIClient |
build()
Build the APIClient
|
protected abstract APIClient |
build(APIClientConfiguration configuration) |
protected List<String> |
generateBuildHosts() |
protected Map<String,String> |
generateHeaders() |
protected List<String> |
generateQueryHosts() |
APIClientBuilder |
setConnectTimeout(int connectTimeout)
Set the connect timeout of the HTTP client
|
APIClientBuilder |
setExtraHeader(String key,
String value)
Set extra headers to the requests
|
APIClientBuilder |
setObjectMapper(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Set the Jackson ObjectMapper
|
APIClientBuilder |
setReadTimeout(int readTimeout)
Set the read timeout of the HTTP client
|
APIClientBuilder |
setUserAgent(String customAgent,
String customAgentVersion)
Customize the user agent
|
public APIClientBuilder(@Nonnull String applicationId, @Nonnull String apiKey)
applicationId - APP_ID can be found on https://www.algolia.com/api-keysapiKey - Algolia API_KEY can also be found on https://www.algolia.com/api-keyspublic APIClientBuilder setUserAgent(@Nonnull String customAgent, @Nonnull String customAgentVersion)
customAgent - key to add to the user agentcustomAgentVersion - value of this key to add to the user agentpublic APIClientBuilder setExtraHeader(@Nonnull String key, String value)
key - name of the headervalue - value of the headerpublic APIClientBuilder setConnectTimeout(int connectTimeout)
connectTimeout - the value in mspublic APIClientBuilder setReadTimeout(int readTimeout)
readTimeout - the value in mspublic APIClientBuilder setObjectMapper(@Nonnull com.fasterxml.jackson.databind.ObjectMapper objectMapper)
objectMapper - the mapperprotected abstract APIClient build(@Nonnull APIClientConfiguration configuration)
public APIClient build()
Copyright © 2016. All rights reserved.