Datasets:

ArXiv:
License:
File size: 3,666 Bytes
c574d3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package sms.v20190711;

import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;

//导入可选配置类
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;

// 导入对应SMS模块的client
import com.tencentcloudapi.sms.v20190711.SmsClient;

// 导入要请求接口对应的request response类
import com.tencentcloudapi.sms.v20190711.models.PullSmsSendStatusByPhoneNumberRequest;
import com.tencentcloudapi.sms.v20190711.models.PullSmsSendStatusByPhoneNumberResponse;

/**
 * Tencent Cloud Sms PullSmsSendStatusByPhoneNumber
 * https://cloud.tencent.com/document/product/382/38773
 *
 */
public class PullSmsSendStatusByPhoneNumber {

    public static void main(String[] args) {
        try {
            // 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey
            Credential cred = new Credential("secretId", "secretKey");

            // 实例化一个http选项,可选,没有特殊需求可以跳过
            HttpProfile httpProfile = new HttpProfile();
            // 设置代理
            httpProfile.setProxyHost("host");
            httpProfile.setProxyPort(port);
            // 指定请求方法,['GET', 'POST'], 默认为 'POST'
            httpProfile.setReqMethod("POST");
            // 请求连接超时时间,单位为秒,默认为 60
            httpProfile.setConnTimeout(60);
            // 指定接入域名
            httpProfile.setEndpoint("sms.tencentcloudapi.com");

            // 实例化一个client选项,可选,没有特殊需求可以跳过
            ClientProfile clientProfile = new ClientProfile();
            // 指定签名算法,默认为 'HmacSHA256'
            clientProfile.setSignMethod("HmacSHA256");
            clientProfile.setHttpProfile(httpProfile);

            // 实例化 sms 的client对象,clientProfile是可选的
            SmsClient client = new SmsClient(cred, "",clientProfile);

            // 实例化一个sms实例发送短信请求对象,每个接口都会对应一个request对象。
            SendSmsRequest req = new SendSmsRequest();

            // 填充请求参数,这里request对象的成员变量即对应接口的入参
            // 你可以通过官网接口文档或跳转到request对象的定义处查看请求参数的定义
            // 设置短信应用 SDKAPPID
            String appid = "1400009099";
            req.setSmsSdkAppid(appid);

            // 设置拉取手机号码
            String phoneNumber = "+8621212313123";
            req.setPhoneNumber(phoneNumber);

            // 设置拉取起始时间,UNIX时间戳(时间:秒)
            String sendDateTime = "1572859620";
            req.setSendDateTime(sendDateTime);

            // 设置偏移量,默认为 0
            Long offset = 0L;
            req.setOffset(offset);

            // 设置拉取最大条数, 最多 100
            Long limit = 100L;
            req.setLimit(limit);

            // 通过 client 对象调用 PullSmsSendStatusByPhoneNumber 方法发起请求。注意请求方法名与请求对象是对应的
            // 返回的 res 是一个 PullSmsSendStatusByPhoneNumberResponse 类的实例,与请求对象对应
            PullSmsSendStatusByPhoneNumberResponse res = client.PullSmsSendStatusByPhoneNumber(req);

            // 输出json格式的字符串回包
            System.out.println(PullSmsSendStatusByPhoneNumberResponse.toJsonString(res));

        } catch (TencentCloudSDKException e) {
            e.printStackTrace();
        }
    }
}