public class DataSiftConfig extends Object
| Modifier and Type | Field and Description |
|---|---|
protected String |
apiKey |
protected String |
host |
protected io.higgs.http.client.HttpRequestBuilder |
http
This instance should be used as a base for configurations.
|
protected String |
proxyHost |
protected int |
proxyPort |
protected boolean |
sslEnabled |
protected String |
username |
| Constructor and Description |
|---|
DataSiftConfig() |
DataSiftConfig(String username,
String apiKey)
Initialize a new config instance with the given username and api key
|
| Modifier and Type | Method and Description |
|---|---|
DataSiftConfig |
auth(String username,
String apiKey)
Provide the user credentials that should be used for authentication
|
String |
authAsHeader() |
URI |
baseURL() |
String |
getApiKey() |
String |
getUsername() |
String |
host() |
io.higgs.http.client.HttpRequestBuilder |
http() |
boolean |
isSslEnabled() |
URI |
newAPIEndpointURI(String endpoint)
Generate a new URI object given an endpoint relative to the base url of this configuration.
|
URI |
newAPIEndpointURI(URI endpoint)
Generate a new URI object given an endpoint relative to the base url of this configuration.
|
int |
port() |
String |
protocol() |
void |
setSslEnabled(boolean sslEnabled) |
String |
urlEncodingFormat() |
DataSiftConfig |
urlEncodingFormat(String format)
Sets the format that should be used to encode URL parameters when the option arises
e.g.
|
String |
versionPrefix() |
protected String proxyHost
protected int proxyPort
protected String username
protected String apiKey
protected boolean sslEnabled
protected String host
protected io.higgs.http.client.HttpRequestBuilder http
HttpRequestBuilder.copy()
Although a single instance would work, this keeps things simple and ensures no stale data is passed in
subsequent requests.
It is also very cheap in terms of Netty's thread usage because Higgs re-uses the same event loop group
so it'll never be creating a whole new load of resources for each instance.public DataSiftConfig auth(String username, String apiKey)
username - the DataSift usernameapiKey - the DataSift API keypublic String protocol()
public String host()
public int port()
public URI baseURL()
public URI newAPIEndpointURI(String endpoint)
URI.resolve(String) is acceptableendpoint - the endpoint to return a URI for.public URI newAPIEndpointURI(URI endpoint)
URI.resolve(URI) is acceptableendpoint - the endpoint to return a URI for.public String versionPrefix()
public String getUsername()
public String getApiKey()
public boolean isSslEnabled()
public void setSslEnabled(boolean sslEnabled)
public String authAsHeader()
public io.higgs.http.client.HttpRequestBuilder http()
public String urlEncodingFormat()
public DataSiftConfig urlEncodingFormat(String format)
format - the formatCopyright © 2013. All Rights Reserved.