public abstract class AlchemyService extends WatsonService
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
ENDPOINT
The Constant ENDPOINT.
|
protected static java.lang.String |
JSONP
The Constant JSONP.
|
protected static java.lang.String |
OUTPUT_MODE
The Constant OUTPUT_MODE.
|
defaultHeaders, MESSAGE_CODE, MESSAGE_ERROR, skipAuthentication, VERSION
Constructor and Description |
---|
AlchemyService()
Instantiates a new alchemy service.
|
AlchemyService(java.lang.String apiKey)
Instantiates a new alchemy service by apiKey.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
getInputFormat(java.util.Map<java.lang.String,java.lang.Object> params,
java.lang.String... acceptedFormats)
Returns the first non-null accepted format from the parameter map.
|
protected <T> T |
processServiceCall(ResponseConverter<T> converter,
okhttp3.Response response)
Process service call.
|
protected void |
setAuthentication(okhttp3.Request.Builder builder)
Sets the authentication.
|
configureHttpClient, createServiceCall, getApiKey, getEndPoint, getName, getToken, setApiKey, setDefaultHeaders, setDefaultHeaders, setEndPoint, setSkipAuthentication, setUsernameAndPassword, toString
protected static final java.lang.String ENDPOINT
protected static final java.lang.String JSONP
protected static final java.lang.String OUTPUT_MODE
public AlchemyService()
public AlchemyService(java.lang.String apiKey)
apiKey
- The API keyprotected <T> T processServiceCall(ResponseConverter<T> converter, okhttp3.Response response)
WatsonService
processServiceCall
in class WatsonService
T
- the generic typeconverter
- the converterresponse
- the responseprotected java.lang.String getInputFormat(java.util.Map<java.lang.String,java.lang.Object> params, java.lang.String... acceptedFormats)
params
- the request parametersacceptedFormats
- the accepted formatsprotected void setAuthentication(okhttp3.Request.Builder builder)
WatsonService
setAuthentication
in class WatsonService
builder
- the new authentication