public abstract class AbstractClient extends Object
Modifier and Type | Field and Description |
---|---|
com.google.gson.Gson |
gson |
static int |
HTTP_RSP_OK |
static String |
SDK_VERSION |
Constructor and Description |
---|
AbstractClient(String endpoint,
String version,
Credential credential,
String region) |
AbstractClient(String endpoint,
String version,
Credential credential,
String region,
ClientProfile profile) |
Modifier and Type | Method and Description |
---|---|
String |
call(String action,
String jsonPayload)
Use post/json with tc3-hmac-sha256 signature to call any action.
|
String |
callOctetStream(String action,
HashMap<String,String> headers,
byte[] body)
Use post application/octet-stream with tc3-hmac-sha256 signature to call specific action.
|
ClientProfile |
getClientProfile() |
Credential |
getCredential() |
String |
getRegion() |
CircuitBreaker |
getRegionBreaker() |
protected String |
internalRequest(AbstractModel request,
String actionName) |
protected <T> T |
internalRequest(AbstractModel request,
String actionName,
Class<T> typeOfT) |
protected okhttp3.Response |
internalRequestRaw(AbstractModel request,
String actionName) |
protected <T> T |
processResponseJson(okhttp3.Response resp,
Class<T> typeOfT,
CircuitBreaker.Token breakerToken) |
protected <T> T |
processResponseSSE(okhttp3.Response resp,
Class<T> typeOfT,
CircuitBreaker.Token breakerToken) |
Object |
retry(AbstractModel req,
int retryTimes)
请注意购买类接口谨慎调用,可能导致多次购买
仅幂等接口推荐使用
|
void |
setClientProfile(ClientProfile profile) |
void |
setCredential(Credential credential) |
void |
setRegion(String region) |
void |
setRegionBreaker(CircuitBreaker regionBreaker) |
public static final int HTTP_RSP_OK
public static final String SDK_VERSION
public com.google.gson.Gson gson
public AbstractClient(String endpoint, String version, Credential credential, String region)
public AbstractClient(String endpoint, String version, Credential credential, String region, ClientProfile profile)
public String getRegion()
public void setRegion(String region)
public ClientProfile getClientProfile()
public void setClientProfile(ClientProfile profile)
public Credential getCredential()
public void setCredential(Credential credential)
public String call(String action, String jsonPayload) throws TencentCloudSDKException
action
- Name of action to be called.jsonPayload
- Parameters of action serialized in json string format.TencentCloudSDKException
public String callOctetStream(String action, HashMap<String,String> headers, byte[] body) throws TencentCloudSDKException
action
- Name of action to be called.headers
- Parameters of the action, will be put in http header.body
- octet-stream binary body.TencentCloudSDKException
protected String internalRequest(AbstractModel request, String actionName) throws TencentCloudSDKException
TencentCloudSDKException
protected <T> T internalRequest(AbstractModel request, String actionName, Class<T> typeOfT) throws TencentCloudSDKException
TencentCloudSDKException
protected <T> T processResponseSSE(okhttp3.Response resp, Class<T> typeOfT, CircuitBreaker.Token breakerToken) throws TencentCloudSDKException
TencentCloudSDKException
protected <T> T processResponseJson(okhttp3.Response resp, Class<T> typeOfT, CircuitBreaker.Token breakerToken) throws TencentCloudSDKException
TencentCloudSDKException
protected okhttp3.Response internalRequestRaw(AbstractModel request, String actionName) throws TencentCloudSDKException, IOException
TencentCloudSDKException
IOException
public Object retry(AbstractModel req, int retryTimes) throws TencentCloudSDKException
req
- retryTimes
- TencentCloudSDKException
public CircuitBreaker getRegionBreaker()
public void setRegionBreaker(CircuitBreaker regionBreaker)
Copyright © 2024. All rights reserved.