类 HttpClient
java.lang.Object
cn.tbox.sdk.core.http.HttpClient
HTTP client for making API requests.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明okhttp3.ResponseMakes a GET request to the specified URL.Makes a POST request to the specified path.Makes a streaming POST request to the specified path.
-
构造器详细资料
-
HttpClient
-
-
方法详细资料
-
post
public String post(String path, Map<String, Object> data, Map<String, throws TboxClientConfigException, TboxHttpResponseExceptionString> headers) Makes a POST request to the specified path.- 参数:
path- API pathdata- Request dataheaders- Additional headers (optional)- 返回:
- Response as string
- 抛出:
TboxClientConfigException- if there's a configuration errorTboxHttpResponseException- if there's an HTTP response error
-
postStream
public Iterable<HttpResponseEvent> postStream(String path, Map<String, Object> data, Map<String, throws TboxClientConfigExceptionString> headers, int timeout) Makes a streaming POST request to the specified path.- 参数:
path- API pathdata- Request dataheaders- Additional headers (optional)timeout- Timeout in seconds- 返回:
- Iterable of HttpResponseEvent
- 抛出:
TboxClientConfigException- if there's a configuration error
-
get
public okhttp3.Response get(String url, Map<String, String> query, Map<String, throws TboxHttpResponseExceptionString> headers) Makes a GET request to the specified URL.- 参数:
url- API URLquery- Query parametersheaders- Additional headers (optional)- 返回:
- Response
- 抛出:
TboxHttpResponseException- if there's an HTTP response error
-