Canceling an Animated GIF Task

Notes

  • To cancel a task, you need to provide the task ID.
  • The task to be canceled must be a task in the task queue. An animated GIF task that has been started or completed cannot be deleted.

Core Code

1
2
3
String taskId = "1234";
BaseResponse deleteResponse = mpcClient.deleteAnimatedGraphicsTask(taskId);
System.out.println(gson.toJson(deleteResponse));

Full Code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
import com.google.gson.Gson;
import com.huawei.mpc.client.MpcClient;
import com.huawei.mpc.client.MpcConfig;
import com.huawei.mpc.model.BaseResponse;
import com.huawei.mpc.model.CommonTask;
import com.huawei.mpc.model.animated.QueryAnimatedGraphicsTaskReq;
import com.huawei.mpc.model.animated.QueryAnimatedGraphicsTaskRsp;

import java.util.LinkedList;Gson gson = new Gson();

// Initialize the client.
MpcConfig mpcConfig = new MpcConfig();
mpcConfig.setEndPoint("mpc.cn-north-4.myhuaweicloud.com");
mpcConfig.setProjectId("Your project ID");
mpcConfig.setAk("*************");
mpcConfig.setSk("*****************************");

MpcClient mpcClient = new MpcClient(mpcConfig);

String taskId = "1234";
BaseResponse deleteResponse = mpcClient.deleteAnimatedGraphicsTask(taskId);
System.out.println(gson.toJson(deleteResponse));