1
1
package io .github .doocs .im .core ;
2
2
3
3
import io .github .doocs .im .ImClient ;
4
- import io .github .doocs .im .model .request .CreateOfficialAccountRequest ;
5
- import io .github .doocs .im .model .request .DestroyOfficialAccountRequest ;
6
- import io .github .doocs .im .model .request .GetOfficialAccountInfoRequest ;
7
- import io .github .doocs .im .model .request .GetSubscriberInfoRequest ;
8
- import io .github .doocs .im .model .request .ModifyOfficialAccountBaseInfoRequest ;
9
- import io .github .doocs .im .model .request .SendOfficialAccountMsgRequest ;
10
- import io .github .doocs .im .model .response .CreateOfficialAccountResult ;
11
- import io .github .doocs .im .model .response .DestroyOfficialAccountResult ;
12
- import io .github .doocs .im .model .response .GetOfficialAccountInfoResult ;
13
- import io .github .doocs .im .model .response .GetSubscriberInfoResult ;
14
- import io .github .doocs .im .model .response .ModifyOfficialAccountBaseInfoResult ;
15
- import io .github .doocs .im .model .response .SendOfficialAccountMsgResult ;
4
+ import io .github .doocs .im .model .request .*;
5
+ import io .github .doocs .im .model .response .*;
16
6
import io .github .doocs .im .util .HttpUtil ;
17
7
18
8
import java .io .IOException ;
@@ -36,8 +26,10 @@ public class OfficialAccount {
36
26
public static final String DESTROY_OFFICIAL_ACCOUNT = "destroy_official_account" ;
37
27
public static final String MODIFY_OFFICIAL_ACCOUNT_BASE_INFO = "modify_official_account_base_info" ;
38
28
public static final String SEND_OFFICIAL_ACCOUNT_MSG_COMMAND = "send_official_account_msg" ;
39
- public static final String GET_OFFICIAL_ACCOUNT_INFO = "get_official_account_info" ;
40
- public static final String GET_SUBSCRIBER_INFO = "get_subscriber_info" ;
29
+ public static final String GET_OFFICIAL_ACCOUNT_INFO_COMMAND = "get_official_account_info" ;
30
+ public static final String GET_SUBSCRIBER_INFO_COMMAND = "get_subscriber_info" ;
31
+ public static final String OFFICIAL_ACCOUNT_MSG_RECALL_COMMAND = "official_account_msg_recall" ;
32
+ public static final String OFFICIAL_ACCOUNT_MSG_GET_SIMPLE_COMMAND = "official_account_msg_get_simple" ;
41
33
42
34
private final ImClient imClient ;
43
35
@@ -121,12 +113,12 @@ public SendOfficialAccountMsgResult sendOfficialAccountMsg(SendOfficialAccountMs
121
113
* @throws IOException 异常
122
114
*/
123
115
public GetOfficialAccountInfoResult getOfficialAccountInfo (GetOfficialAccountInfoRequest getOfficialAccountInfoRequest ) throws IOException {
124
- String url = imClient .getUrl (SERVICE_NAME , GET_OFFICIAL_ACCOUNT_INFO );
116
+ String url = imClient .getUrl (SERVICE_NAME , GET_OFFICIAL_ACCOUNT_INFO_COMMAND );
125
117
return HttpUtil .post (url , getOfficialAccountInfoRequest , GetOfficialAccountInfoResult .class , imClient .getConfig ());
126
118
}
127
119
128
120
public GetOfficialAccountInfoResult getOfficialAccountInfo (GetOfficialAccountInfoRequest getOfficialAccountInfoRequest , long random ) throws IOException {
129
- String url = imClient .getUrl (SERVICE_NAME , GET_OFFICIAL_ACCOUNT_INFO , random );
121
+ String url = imClient .getUrl (SERVICE_NAME , GET_OFFICIAL_ACCOUNT_INFO_COMMAND , random );
130
122
return HttpUtil .post (url , getOfficialAccountInfoRequest , GetOfficialAccountInfoResult .class , imClient .getConfig ());
131
123
}
132
124
@@ -138,12 +130,46 @@ public GetOfficialAccountInfoResult getOfficialAccountInfo(GetOfficialAccountInf
138
130
* @throws IOException 异常
139
131
*/
140
132
public GetSubscriberInfoResult getSubscriberInfo (GetSubscriberInfoRequest getSubscriberInfoRequest ) throws IOException {
141
- String url = imClient .getUrl (SERVICE_NAME , GET_SUBSCRIBER_INFO );
133
+ String url = imClient .getUrl (SERVICE_NAME , GET_SUBSCRIBER_INFO_COMMAND );
142
134
return HttpUtil .post (url , getSubscriberInfoRequest , GetSubscriberInfoResult .class , imClient .getConfig ());
143
135
}
144
136
145
137
public GetSubscriberInfoResult getSubscriberInfo (GetSubscriberInfoRequest getSubscriberInfoRequest , long random ) throws IOException {
146
- String url = imClient .getUrl (SERVICE_NAME , GET_SUBSCRIBER_INFO , random );
138
+ String url = imClient .getUrl (SERVICE_NAME , GET_SUBSCRIBER_INFO_COMMAND , random );
147
139
return HttpUtil .post (url , getSubscriberInfoRequest , GetSubscriberInfoResult .class , imClient .getConfig ());
148
140
}
141
+
142
+ /**
143
+ * 撤回公众号消息
144
+ *
145
+ * @param officialAccountMsgRecallRequest 请求参数
146
+ * @return 结果
147
+ * @throws IOException 异常
148
+ */
149
+ public OfficialAccountMsgRecallResult msgRecall (OfficialAccountMsgRecallRequest officialAccountMsgRecallRequest ) throws IOException {
150
+ String url = imClient .getUrl (SERVICE_NAME , OFFICIAL_ACCOUNT_MSG_RECALL_COMMAND );
151
+ return HttpUtil .post (url , officialAccountMsgRecallRequest , OfficialAccountMsgRecallResult .class , imClient .getConfig ());
152
+ }
153
+
154
+ public OfficialAccountMsgRecallResult msgRecall (OfficialAccountMsgRecallRequest officialAccountMsgRecallRequest , long random ) throws IOException {
155
+ String url = imClient .getUrl (SERVICE_NAME , OFFICIAL_ACCOUNT_MSG_RECALL_COMMAND , random );
156
+ return HttpUtil .post (url , officialAccountMsgRecallRequest , OfficialAccountMsgRecallResult .class , imClient .getConfig ());
157
+ }
158
+
159
+ /**
160
+ * 拉取公众号用户历史消息
161
+ *
162
+ * @param officialAccountMsgGetSimpleRequest 请求参数
163
+ * @return 结果
164
+ * @throws IOException 异常
165
+ */
166
+ public OfficialAccountMsgGetSimpleResult msgGetSimple (OfficialAccountMsgGetSimpleRequest officialAccountMsgGetSimpleRequest ) throws IOException {
167
+ String url = imClient .getUrl (SERVICE_NAME , OFFICIAL_ACCOUNT_MSG_GET_SIMPLE_COMMAND );
168
+ return HttpUtil .post (url , officialAccountMsgGetSimpleRequest , OfficialAccountMsgGetSimpleResult .class , imClient .getConfig ());
169
+ }
170
+
171
+ public OfficialAccountMsgGetSimpleResult msgGetSimple (OfficialAccountMsgGetSimpleRequest officialAccountMsgGetSimpleRequest , long random ) throws IOException {
172
+ String url = imClient .getUrl (SERVICE_NAME , OFFICIAL_ACCOUNT_MSG_GET_SIMPLE_COMMAND , random );
173
+ return HttpUtil .post (url , officialAccountMsgGetSimpleRequest , OfficialAccountMsgGetSimpleResult .class , imClient .getConfig ());
174
+ }
149
175
}
0 commit comments