public class Client extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
Client.ResponseCreator<T>
Defines an interface for deserializing HTTP responses into objects.
|
| 构造器和说明 |
|---|
Client() |
Client(int maxConPerHost,
int conTimeOutMs,
int soTimeOutMs) |
Client(String url) |
Client(String url,
String accessToken) |
| 限定符和类型 | 方法和说明 |
|---|---|
String |
getAccessToken() |
boolean |
request(String action,
Object body)
Perform a single HTTP POST request against the API for a specific action, return
true or false
|
<T> T |
request(String action,
Object body,
Type tClass)
Perform a single HTTP POST request against the API for a specific action.
|
<T> T |
requestGet(String action,
Object body,
String key,
Type tClass)
requestGet
|
<T> T |
requestList(String action,
Object body,
Type tClass) |
public Client()
throws BytomException
BytomExceptionpublic Client(String url)
public Client(int maxConPerHost,
int conTimeOutMs,
int soTimeOutMs)
maxConPerHost - maxConPerHostconTimeOutMs - conTimeOutMssoTimeOutMs - soTimeOutMspublic boolean request(String action, Object body) throws BytomException
action - The requested API actionbody - Body payload sent to the API as JSONBytomException - Exceptionpublic <T> T request(String action, Object body, Type tClass) throws BytomException
T - Taction - The requested API actionbody - Body payload sent to the API as JSONtClass - Type of object to be deserialized from the response JSONBytomException - Exceptionpublic <T> T requestGet(String action, Object body, String key, Type tClass) throws BytomException
T - Taction - actionbody - bodykey - getKeytClass - tClassBytomException - Exceptionpublic <T> T requestList(String action, Object body, Type tClass) throws BytomException
BytomExceptionpublic String getAccessToken()
Copyright © 2018. All rights reserved.