1
1
package me .chanjar .weixin .mp .api ;
2
2
3
+ import me .chanjar .weixin .common .bean .subscribemsg .CategoryData ;
4
+ import me .chanjar .weixin .common .bean .subscribemsg .PubTemplateKeyword ;
5
+ import me .chanjar .weixin .common .bean .subscribemsg .PubTemplateTitleListResult ;
6
+ import me .chanjar .weixin .common .bean .subscribemsg .TemplateInfo ;
3
7
import me .chanjar .weixin .common .error .WxErrorException ;
4
8
import me .chanjar .weixin .mp .bean .subscribe .WxMpSubscribeMessage ;
5
9
10
+ import java .util .List ;
11
+
6
12
/**
7
13
* <pre>
8
- * 一次性订阅消息接口
9
- * https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1500374289_66bvB
14
+ * 订阅消息服务接口
10
15
* </pre>
11
16
*
12
17
* @author Mklaus
13
- * @date 2018-01-22 上午11:07
18
+ * @date 2018 -01-22 上午11:07
14
19
*/
15
20
public interface WxMpSubscribeMsgService {
16
21
/**
@@ -20,9 +25,9 @@ public interface WxMpSubscribeMsgService {
20
25
* </pre>
21
26
*
22
27
* @param redirectURI 用户授权完成后的重定向链接,无需urlencode, 方法内会进行encode
23
- * @param scene 重定向后会带上scene参数,开发者可以填0-10000的整形值,用来标识订阅场景值
24
- * @param reserved 用于保持请求和回调的状态,授权请后原样带回给第三方 (最多128字节,要求做urlencode)
25
- * @return url
28
+ * @param scene 重定向后会带上scene参数,开发者可以填0-10000的整形值,用来标识订阅场景值
29
+ * @param reserved 用于保持请求和回调的状态,授权请后原样带回给第三方 (最多128字节,要求做urlencode)
30
+ * @return url string
26
31
*/
27
32
String subscribeMsgAuthorizationUrl (String redirectURI , int scene , String reserved );
28
33
@@ -32,8 +37,106 @@ public interface WxMpSubscribeMsgService {
32
37
* 详情请见: https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1500374289_66bvB
33
38
* </pre>
34
39
*
35
- * @return 消息Id
40
+ * @param message the message
41
+ * @return 消息Id boolean
42
+ * @throws WxErrorException the wx error exception
43
+ */
44
+ boolean sendOnce (WxMpSubscribeMessage message ) throws WxErrorException ;
45
+
46
+ /**
47
+ * <pre>
48
+ * 获取帐号所属类目下的公共模板标题
49
+ *
50
+ * 详情请见: <a href="https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/subscribe-message/subscribeMessage.getPubTemplateTitleList.html">获取帐号所属类目下的公共模板标题</a>
51
+ * 接口url格式: https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatetitles?access_token=ACCESS_TOKEN
52
+ * </pre>
53
+ *
54
+ * @param ids 类目 id,多个用逗号隔开
55
+ * @param start 用于分页,表示从 start 开始。从 0 开始计数。
56
+ * @param limit 用于分页,表示拉取 limit 条记录。最大为 30。
57
+ * @return . pub template title list
58
+ * @throws WxErrorException .
59
+ */
60
+ PubTemplateTitleListResult getPubTemplateTitleList (String [] ids , int start , int limit ) throws WxErrorException ;
61
+
62
+ /**
63
+ * <pre>
64
+ * 获取模板库某个模板标题下关键词库
65
+ *
66
+ * 详情请见: https://developers.weixin.qq.com/doc/offiaccount/Subscription_Messages/api.html
67
+ * 接口url格式: GET https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatekeywords?access_token=ACCESS_TOKEN
68
+ * </pre>
69
+ *
70
+ * @param id 模板标题 id,可通过接口获取
71
+ * @return . pub template key words by id
72
+ * @throws WxErrorException .
73
+ */
74
+ List <PubTemplateKeyword > getPubTemplateKeyWordsById (String id ) throws WxErrorException ;
75
+
76
+ /**
77
+ * <pre>
78
+ * 组合模板并添加至帐号下的个人模板库
79
+ *
80
+ * 详情请见: https://developers.weixin.qq.com/doc/offiaccount/Subscription_Messages/api.html
81
+ * 接口url格式: POST https://api.weixin.qq.com/wxaapi/newtmpl/addtemplate?access_token=ACCESS_TOKEN
82
+ * </pre>
83
+ *
84
+ * @param id 模板标题 id,可通过接口获取,也可登录小程序后台查看获取
85
+ * @param keywordIdList 模板关键词列表
86
+ * @param sceneDesc 服务场景描述,15个字以内
87
+ * @return 添加至帐号下的模板id ,发送小程序订阅消息时所需
88
+ * @throws WxErrorException .
89
+ */
90
+ String addTemplate (String id , List <Integer > keywordIdList , String sceneDesc ) throws WxErrorException ;
91
+
92
+ /**
93
+ * <pre>
94
+ * 获取当前帐号下的个人模板列表
95
+ *
96
+ * 详情请见: https://developers.weixin.qq.com/doc/offiaccount/Subscription_Messages/api.html
97
+ * 接口url格式: GET https://api.weixin.qq.com/wxaapi/newtmpl/gettemplate?access_token=ACCESS_TOKEN
98
+ * </pre>
99
+ *
100
+ * @return . template list
101
+ * @throws WxErrorException .
102
+ */
103
+ List <TemplateInfo > getTemplateList () throws WxErrorException ;
104
+
105
+ /**
106
+ * <pre>
107
+ * 删除帐号下的某个模板
108
+ *
109
+ * 详情请见: https://developers.weixin.qq.com/doc/offiaccount/Subscription_Messages/api.html
110
+ * 接口url格式: POST https://api.weixin.qq.com/wxaapi/newtmpl/deltemplate?access_token=ACCESS_TOKEN
111
+ * </pre>
112
+ *
113
+ * @param templateId 要删除的模板id
114
+ * @return 删除是否成功 boolean
115
+ * @throws WxErrorException .
116
+ */
117
+ boolean delTemplate (String templateId ) throws WxErrorException ;
118
+
119
+ /**
120
+ * <pre>
121
+ * 获取公众号类目
122
+ * https://developers.weixin.qq.com/doc/offiaccount/Subscription_Messages/api.html
123
+ * GET https://api.weixin.qq.com/wxaapi/newtmpl/getcategory?access_token=ACCESS_TOKEN
124
+ * </pre>
125
+ *
126
+ * @return . category
127
+ * @throws WxErrorException .
128
+ */
129
+ List <CategoryData > getCategory () throws WxErrorException ;
130
+
131
+ /**
132
+ * <pre>
133
+ * 发送订阅消息
134
+ * https://developers.weixin.qq.com/doc/offiaccount/Subscription_Messages/api.html
135
+ * </pre>
136
+ *
137
+ * @param subscribeMessage 订阅消息
138
+ * @throws WxErrorException .
36
139
*/
37
- boolean sendSubscribeMessage (WxMpSubscribeMessage message ) throws WxErrorException ;
140
+ void send (WxMpSubscribeMessage subscribeMessage ) throws WxErrorException ;
38
141
39
142
}
0 commit comments