forked from binarywang/WxJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWxMaLiveService.java
More file actions
219 lines (207 loc) · 8.11 KB
/
WxMaLiveService.java
File metadata and controls
219 lines (207 loc) · 8.11 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
package cn.binarywang.wx.miniapp.api;
import cn.binarywang.wx.miniapp.bean.live.WxMaAssistantResult;
import cn.binarywang.wx.miniapp.bean.live.WxMaLiveAssistantInfo;
import cn.binarywang.wx.miniapp.bean.live.WxMaLiveResult;
import cn.binarywang.wx.miniapp.bean.live.WxMaLiveRoomInfo;
import me.chanjar.weixin.common.error.WxErrorException;
import java.util.List;
/**
* <pre>
* 直播相关操作接口.
* Created by yjwang on 2020/4/5.
* </pre>
*
* @author <a href="https://github.com/yjwang3300300">yjwang</a>
*/
public interface WxMaLiveService {
String GET_LIVE_INFO = "https://api.weixin.qq.com/wxa/business/getliveinfo";
String CREATE_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/create";
String ADD_GOODS = "https://api.weixin.qq.com/wxaapi/broadcast/room/addgoods";
String DELETE_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/deleteroom";
String EDIT_ROOM = "https://api.weixin.qq.com/wxaapi/broadcast/room/editroom";
String GET_PUSH_URL = "https://api.weixin.qq.com/wxaapi/broadcast/room/getpushurl";
String GET_SHARED_CODE = "https://api.weixin.qq.com/wxaapi/broadcast/room/getsharedcode";
String ADD_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/addassistant";
String MODIFY_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/modifyassistant";
String REMOVE_ASSISTANT = "https://api.weixin.qq.com/wxaapi/broadcast/room/removeassistant";
String GET_ASSISTANT_LIST = "https://api.weixin.qq.com/wxaapi/broadcast/room/getassistantlist";
/**
* 创建直播间
* <pre>
* 调用此接口创建直播间,创建成功后将在直播间列表展示,调用额度:10000次/一天
* 文档地址:https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/studio-api.html#1
* http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/create?access_token=ACCESS_TOKEN
* </pre>
*
* @param roomInfo 直播间信息
* @return .
* @throws WxErrorException .
*/
Integer createRoom(WxMaLiveRoomInfo roomInfo) throws WxErrorException;
/**
* 删除直播间
* <pre>
* 调用额度:10000次/一天
* 文档地址:https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/studio-api.html#5
* http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/deleteroom?access_token=ACCESS_TOKEN
* </pre>
*
* @param roomId 直播间id
* @return .
* @throws WxErrorException .
*/
boolean deleteRoom(Integer roomId) throws WxErrorException;
/**
* 编辑直播间
* <pre>
* 调用此接口编辑直播间,调用额度:10000次/一天
* 文档地址:https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/studio-api.html#6
* http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/editroom?access_token=ACCESS_TOKEN
* </pre>
*
* @param roomInfo 直播间信息
* @return .
* @throws WxErrorException .
*/
boolean editRoom(WxMaLiveRoomInfo roomInfo) throws WxErrorException;
/**
* 获取直播间推流地址
* <pre>
* 调用额度:10000次/一天
* 文档地址:https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/studio-api.html#7
* http请求方式:GET https://api.weixin.qq.com/wxaapi/broadcast/room/getpushurl?access_token=ACCESS_TOKEN
* </pre>
*
* @param roomId 直播间id
* @return .
* @throws WxErrorException .
*/
String getPushUrl(Integer roomId) throws WxErrorException;
/**
* 获取直播间分享二维码
* <pre>
* 调用额度:10000次/一天
* 文档地址:https://developers.weixin.qq.com/miniprogram/dev/framework/liveplayer/studio-api.html#8
* http请求方式:GET https://api.weixin.qq.com/wxaapi/broadcast/room/getsharedcode?access_token=ACCESS_TOKEN
* </pre>
*
* @param roomId 直播间id
* @return .
* @throws WxErrorException .
*/
String getSharedCode(Integer roomId, String params) throws WxErrorException;
/**
* 获取直播房间列表.(分页)
*
* @param start 起始拉取房间,start = 0 表示从第 1 个房间开始拉取
* @param limit 每次拉取的个数上限,不要设置过大,建议 100 以内
* @return .
* @throws WxErrorException .
*/
WxMaLiveResult getLiveInfo(Integer start, Integer limit) throws WxErrorException;
/**
* 获取所有直播间信息(没有分页直接获取全部)
*
* @return .
* @throws WxErrorException .
*/
List<WxMaLiveResult.RoomInfo> getLiveInfos() throws WxErrorException;
/**
* 获取直播房间回放数据信息.
*
* @param action 获取回放
* @param roomId 直播间 id
* @param start 起始拉取视频,start = 0 表示从第 1 个视频片段开始拉取
* @param limit 每次拉取的个数上限,不要设置过大,建议 100 以内
* @return .
* @throws WxErrorException .
*/
WxMaLiveResult getLiveReplay(String action, Integer roomId, Integer start, Integer limit) throws WxErrorException;
/**
* 获取直播房间回放数据信息.
* <p>
* 获取回放 (默认:get_replay)
*
* @param roomId 直播间 id
* @param start 起始拉取视频,start = 0 表示从第 1 个视频片段开始拉取
* @param limit 每次拉取的个数上限,不要设置过大,建议 100 以内
* @return .
* @throws WxErrorException .
*/
WxMaLiveResult getLiveReplay(Integer roomId, Integer start, Integer limit) throws WxErrorException;
/**
* 直播间导入商品
* <p>
* 调用接口往指定直播间导入已入库的商品
* 调用频率
* 调用额度:10000次/一天
* <p>
* http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/addgoods?access_token=ACCESS_TOKEN
* <pre>
* @param roomId 房间ID
* @param goodsIds 数组列表,可传入多个,里面填写 商品 ID
* @return 导入商品是否成功
* @throws WxErrorException .
*/
boolean addGoodsToRoom(Integer roomId, List<Integer> goodsIds) throws WxErrorException;
/**
* 添加管理直播间小助手
* <p>
* 调用接口往指定直播间添加管理直播间小助手
* 调用频率
* 调用额度:10000次/一天
* <p>
* http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/addassistant?access_token=ACCESS_TOKEN
* <pre>
* @param roomId 房间ID
* @param users 数组列表,可传入多个,"users": [{"username":"testwechat","nickname":"testnick"}]
* @return 添加管理直播间小助手是否成功
* @throws WxErrorException .
*/
boolean addAssistant(Integer roomId, List<WxMaLiveAssistantInfo> users) throws WxErrorException;
/**
* 修改直播间小助手昵称
* <p>
* 调用接口修改直播间小助手昵称
* 调用频率
* 调用额度:10000次/一天
* <p>
* http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/modifyassistant?access_token=ACCESS_TOKEN
* <pre>
* @param roomId 房间ID
* @param username 小助手微信号
* @param nickname 小助手直播间昵称
* @return 修改小助手昵称是否成功
* @throws WxErrorException .
*/
boolean modifyAssistant(Integer roomId, String username,String nickname) throws WxErrorException;
/**
* 删除直播间小助手
* <p>
* 删除直播间小助手
* 调用频率
* 调用额度:10000次/一天
* <p>
* http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/removeassistant?access_token=ACCESS_TOKEN
* <pre>
* @param roomId 房间ID
* @param username 小助手微信号
* @return 删除小助手昵称是否成功
* @throws WxErrorException .
*/
boolean removeAssistant(Integer roomId, String username) throws WxErrorException;
/**
* 查询直播间小助手
* <p>
* 查询直播间小助手
* 调用频率
* 调用额度:10000次/一天
* <p>
* http请求方式:POST https://api.weixin.qq.com/wxaapi/broadcast/room/getassistantlist?access_token=ACCESS_TOKEN
* <pre>
* @param roomId 房间ID
* @return 小助手列表
* @throws WxErrorException .
*/
List<WxMaAssistantResult.Assistant> getAssistantList(Integer roomId) throws WxErrorException;
}