public class CommonClient extends AbstractClient
gson, HTTP_RSP_OK, SDK_VERSION
Constructor and Description |
---|
CommonClient(String productName,
String version,
Credential credential,
String region)
Constructor to initialize the CommonClient with basic settings.
|
CommonClient(String productName,
String version,
Credential credential,
String region,
ClientProfile profile)
Constructor to initialize the CommonClient with custom ClientProfile.
|
Modifier and Type | Method and Description |
---|---|
String |
commonRequest(AbstractModel req,
String actionName)
Sends a request to Tencent Cloud API with the specified action name.
|
<T> T |
commonRequest(AbstractModel req,
String actionName,
Class<T> typeOfT)
Sends a request to Tencent Cloud API and parses the response into the specified type.
|
call, callOctetStream, getClientProfile, getCredential, getRegion, getRegionBreaker, internalRequest, internalRequest, internalRequestRaw, processResponseJson, processResponseSSE, retry, setClientProfile, setCredential, setRegion, setRegionBreaker
public CommonClient(String productName, String version, Credential credential, String region)
productName
- The product name (e.g., "cvm").version
- The API version (e.g., "v1").credential
- The authentication credentials (e.g., API keys).region
- The region to target (e.g., "ap-shanghai").public CommonClient(String productName, String version, Credential credential, String region, ClientProfile profile)
productName
- The product name (e.g., "cvm").version
- The API version (e.g., "v1").credential
- The authentication credentials (e.g., API keys).region
- The region to target (e.g., "ap-shanghai").profile
- Custom configuration for the client (timeouts, retries, etc.).public String commonRequest(AbstractModel req, String actionName) throws TencentCloudSDKException
req
- The request model, containing necessary parameters.actionName
- The API action to perform (e.g., "DescribeInstances").TencentCloudSDKException
- If the request fails or encounters an error.public <T> T commonRequest(AbstractModel req, String actionName, Class<T> typeOfT) throws TencentCloudSDKException
T
- The type of the response model.req
- The request model, containing necessary parameters.actionName
- The API action to perform (e.g., "DescribeInstances").typeOfT
- The class type to deserialize the response into (e.g., ResponseModel.class).TencentCloudSDKException
- If the request fails or encounters an error.Copyright © 2025. All rights reserved.