Search in sources :

Example 1 with EssbasicClient

use of com.tencentcloudapi.essbasic.v20201222.EssbasicClient in project tencentcloud-sdk-java by TencentCloud.

the class UploadFiles method main.

public static void main(String[] args) {
    try {
        ClientProfile cp = new ClientProfile();
        HttpProfile hp = new HttpProfile();
        hp.setEndpoint(FileEndPoint);
        cp.setHttpProfile(hp);
        EssbasicClient client = new EssbasicClient(new Credential(Ak, Sk), "ap-guangzhou", cp);
        UploadFilesRequest request = new UploadFilesRequest();
        Caller caller = new Caller();
        caller.setApplicationId(Appid);
        caller.setOperatorId(OperatorId);
        request.setCaller(caller);
        request.setBusinessType("FLOW");
        UploadFile[] fileInfos = new UploadFile[1];
        request.setFileInfos(fileInfos);
        UploadFile file = new UploadFile();
        fileInfos[0] = file;
        file.setFileName("************");
        file.setFileBody(getFileBody());
        request.setCoverRect(false);
        UploadFilesResponse response = client.UploadFiles(request);
        System.out.println(client.gson.toJson(response));
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : Credential(com.tencentcloudapi.common.Credential) UploadFile(com.tencentcloudapi.essbasic.v20201222.models.UploadFile) ClientProfile(com.tencentcloudapi.common.profile.ClientProfile) Caller(com.tencentcloudapi.essbasic.v20201222.models.Caller) HttpProfile(com.tencentcloudapi.common.profile.HttpProfile) UploadFilesRequest(com.tencentcloudapi.essbasic.v20201222.models.UploadFilesRequest) EssbasicClient(com.tencentcloudapi.essbasic.v20201222.EssbasicClient) UploadFilesResponse(com.tencentcloudapi.essbasic.v20201222.models.UploadFilesResponse)

Aggregations

Credential (com.tencentcloudapi.common.Credential)1 ClientProfile (com.tencentcloudapi.common.profile.ClientProfile)1 HttpProfile (com.tencentcloudapi.common.profile.HttpProfile)1 EssbasicClient (com.tencentcloudapi.essbasic.v20201222.EssbasicClient)1 Caller (com.tencentcloudapi.essbasic.v20201222.models.Caller)1 UploadFile (com.tencentcloudapi.essbasic.v20201222.models.UploadFile)1 UploadFilesRequest (com.tencentcloudapi.essbasic.v20201222.models.UploadFilesRequest)1 UploadFilesResponse (com.tencentcloudapi.essbasic.v20201222.models.UploadFilesResponse)1