public class DefaultClient extends AbstractIClient
| 构造器和说明 |
|---|
DefaultClient() |
DefaultClient(String host,
String clientId,
String clientSecret)
客户端认证
|
DefaultClient(String host,
String username,
String password,
String pwdClientId,
String pwdClientSecret)
密码认证
|
| 限定符和类型 | 方法和说明 |
|---|---|
String |
doAction(IccHttpHttpRequest request)
请求结果以String
实现类已设置鉴权,无需再次设置accessToken
|
<T extends IccResponse> |
doAction(IccHttpHttpRequest request,
Class<T> tClass)
请求结果以对象返回
实现类已设置鉴权,无需再次设置accessToken
|
IccTokenResponse.IccToken |
getAccessToken()
使用默认类型,获取access_token
|
IccTokenResponse.IccToken |
getAccessToken(GrantType grantType)
根据grantType类型,获取access_token
|
<T extends IccResponse> |
unmarshal(Class<T> clasz,
String content)
字符串转换对象
|
public DefaultClient()
throws com.dahuatech.icc.exception.ClientException
com.dahuatech.icc.exception.ClientExceptionpublic DefaultClient(String host, String clientId, String clientSecret) throws com.dahuatech.icc.exception.ClientException
host - 服务地址clientId - 客户端IDclientSecret - 客户端秘钥com.dahuatech.icc.exception.ClientException - 客户端异常public DefaultClient(String host, String username, String password, String pwdClientId, String pwdClientSecret) throws com.dahuatech.icc.exception.ClientException
host - 服务地址username - 用户名password - 密码pwdClientId - 客户端IDpwdClientSecret - 客户端秘钥com.dahuatech.icc.exception.ClientException - 客户端异常public String doAction(IccHttpHttpRequest request) throws com.dahuatech.icc.exception.ClientException, com.dahuatech.icc.exception.ServerException
IClient实现类已设置鉴权,无需再次设置accessToken
request - icc请求com.dahuatech.icc.exception.ClientException - 客户端异常com.dahuatech.icc.exception.ServerException - 服务异常public <T extends IccResponse> T doAction(IccHttpHttpRequest request, Class<T> tClass) throws com.dahuatech.icc.exception.ClientException, com.dahuatech.icc.exception.ServerException
IClient实现类已设置鉴权,无需再次设置accessToken
T - 泛型 对象request - icc请求tClass - response 对象com.dahuatech.icc.exception.ClientException - 客户端异常com.dahuatech.icc.exception.ServerException - 服务异常public IccTokenResponse.IccToken getAccessToken(GrantType grantType)
IClientgrantType - 使用鉴权类型public IccTokenResponse.IccToken getAccessToken()
IClientpublic <T extends IccResponse> T unmarshal(Class<T> clasz, String content) throws com.dahuatech.icc.exception.ClientException
UnmarshallerT - 对象类clasz - 对象content - 字符串JSONcom.dahuatech.icc.exception.ClientException - 异常信息Copyright © 2023. All rights reserved.