-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathWechat.proto
More file actions
355 lines (311 loc) · 8.13 KB
/
Copy pathWechat.proto
File metadata and controls
355 lines (311 loc) · 8.13 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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
syntax = "proto3";
package Grpcs.Gateway.Wechat;
service Component {
//获取授权链接
rpc GetBindUrl(GetBindUrlRequest) returns (GetBindUrlResponse) {}
//获取公众号/小程序信息(本接口可以重建refreshToken)
rpc GetInfo(GetInfoRequest) returns (GetInfoResponse) {}
//使用CODE获取授权的AppId
rpc GetAppId(GetAppIdRequest) returns (GetAppIdResponse) {}
}
service Message {
//获取Event信息
rpc GetEvent(Empty) returns (stream MessageResponse) {}
//获取用户发送的信息
rpc GetUser(Empty) returns (stream MessageResponse) {}
//获取消息详情
rpc GetStatus(MessageStatusRequest) returns (MessageStatusResponse) {}
//发送文本消息
rpc SendText(SendTextRequest) returns (SendMessageResponse) {}
//发送图片消息
rpc SendImage(SendImageRequest) returns (SendMessageResponse) {}
//发送图文消息(小程序为Link消息)
rpc SendNews(SendNewsRequest) returns (SendMessageResponse) {}
//发送小程序卡片消息
rpc SendWxAppCard(SendWxAppCardRequest) returns (SendMessageResponse) {}
//获取模版列表
rpc GetTemplate(GetInfoRequest) returns (GetTemplateResponse) {}
//发送模版消息
rpc SendTemplate(SendTemplateRequest) returns (SendMessageResponse) {}
//取消消息(只有定时未开始的任务可以取消)
rpc Cancel(MessageStatusRequest) returns (Error) {}
}
service WxApp {
//获取小程序用户openId
rpc GetOpenId(GetOpenIdByCodeRequest) returns (GetOpenIdByCodeResponse) {}
//设置小程序服务域名
rpc SetServiceDomain(SetServiceDomainRequest) returns (Error) {}
//部署小程序
rpc Deploy(DeployRequest) returns (Error) {}
//生成参数二维码(临时)
rpc GetQrCode (GetQrCodeRequest) returns (GetQrCodeResponse) {}
}
service WxWeb {
//用户code链接获取
rpc GetAuthCodeUrl(GetAuthCodeUrlRequest) returns (GetAuthCodeUrlResponse) {}
//获取浏览器用户openId
rpc GetOpenId(GetOpenIdByCodeRequest) returns (GetOpenIdByCodeResponse) {}
//获取用户信息
rpc GetUserInfo(GetUserInfoRequest) returns (GetUserInfoResponse) {}
//获取Js-Ticket
rpc GetJsTicket(GetJsTicketRequest) returns (GetJsTicketResponse) {}
//生成参数二维码(临时)
rpc GetQrCode (GetQrCodeRequest) returns (GetQrCodeResponse) {}
//设置菜单
rpc CreateMenu(CreateMenuRequest) returns (Error) {}
//删除菜单
rpc DeleteMenu(GetInfoRequest) returns (Error) {}
//获取模版列表
rpc GetImageList (GetImageListRequest) returns (GetImageListResponse) {}
//上传图片素材
rpc UploadImage (UploadImageRequest) returns (UploadImageResponse) {}
//删除图片素材
rpc DeleteImage (DeleteImageRequest) returns (Error) {}
}
//公共
message Empty {}
message Error {
int32 err_code = 1;
string err_msg = 2;
}
//平台部分
message GetBindUrlRequest {
string redirect_url = 1;
bool use_mobile = 2;
}
message GetBindUrlResponse {
Error error = 1;
string url = 2;
}
message GetInfoRequest {
string app_id = 1;
}
message GetInfoResponse {
Error error = 1;
string user_name = 2;
string nick_name = 3;
string head_img = 4;
string principal_name = 5;
string alias = 6;
int32 service_type_info = 7;
int32 verify_type_info = 8;
string qrcode_url = 9;
repeated int32 permissions = 10;
string app_id = 11;
string type = 12;
}
message GetAppIdRequest {
string code = 1;
}
message GetAppIdResponse {
Error error = 1;
string app_id = 2;
}
//消息部分
message MessageResponse {
Error error = 1;
string type = 2;
string app_id = 3;
string open_id = 4;
int32 time = 5;
string content = 6;
}
message MessageStatusRequest {
string message_id = 1;
bool detail = 2;
}
message MessageStatusResponse {
enum Status {
PENDING = 0;
PROCESSING = 1;
FINISHED = 2;
}
Error error = 1;
Status status = 2;
int32 total_num = 3;
int32 success_num = 4;
int32 user_block_num = 5;
int32 system_failed_num = 6;
int32 send_error_num = 7;
int32 send_time = 8;
repeated string success_list = 9;
repeated string user_block_list = 10;
repeated string system_failed_list = 11;
repeated string send_error_list = 12;
}
message GetTemplateResponse {
message ListItem {
string template_id = 1;
string title = 2;
string primary_industry = 3;
string deputy_industry = 4;
string content = 5;
string example = 6;
}
Error error = 1;
repeated ListItem template_list = 2;
}
message TargetItem {
message Replacer {
string key = 1;
string value = 2;
}
string open_id = 1;
repeated Replacer data = 2;
}
message SendTemplateRequest {
message DataItem {
string key = 1;
string value = 2;
string color = 3;
}
string app_id = 1;
repeated TargetItem targets = 2;
string template_id = 3;
string form_id = 4;
string url = 5;
repeated DataItem data = 6;
int32 time = 7;
bool no_status = 8;
bool high_priority = 9;
}
message SendTextRequest {
string app_id = 1;
repeated TargetItem targets = 2;
string content = 3;
int32 time = 4;
bool no_status = 5;
bool high_priority = 6;
}
message SendImageRequest {
string app_id = 1;
repeated TargetItem targets = 2;
string image_id = 3;
int32 time = 4;
bool no_status = 5;
bool high_priority = 6;
}
message SendNewsRequest {
string app_id = 1;
repeated TargetItem targets = 2;
string image = 3;
string title = 4;
string description = 5;
string link = 6;
int32 time = 7;
bool no_status = 8;
bool high_priority = 9;
}
message SendWxAppCardRequest {
string app_id = 1;
repeated TargetItem targets = 2;
string title = 3;
string wx_app_id = 4;
string page_path = 5;
string image_id = 6;
int32 time = 7;
bool no_status = 8;
bool high_priority = 9;
}
message SendMessageResponse {
Error error = 1;
string message_id = 2;
int32 send_time = 3;
}
//WxApp部分
message SetServiceDomainRequest {
string app_id = 1;
repeated string request_domain = 2;
repeated string ws_request_domain = 3;
repeated string upload_domain = 4;
repeated string downloaddomain_domain = 5;
repeated string webview_domain = 6;
}
message DeployRequest {
string app_id = 1;
int32 template_id = 2;
string user_version = 3;
string user_desc = 4;
}
//WxWeb部分
message GetOpenIdByCodeRequest {
string app_id = 1;
string code = 2;
}
message GetOpenIdByCodeResponse {
Error error = 1;
string open_id = 2;
string secret_key = 3;
}
message GetUserInfoRequest {
string app_id = 1;
string open_id = 2;
}
message GetUserInfoResponse {
Error error = 1;
int32 subscribe_time = 2;
string open_id = 3;
string nick_name = 4;
int32 sex = 5;
string country = 6;
string province = 7;
string city = 8;
string photo = 9;
string union_id = 10;
}
message CreateMenuRequest {
string app_id = 1;
string config = 2;
}
message GetAuthCodeUrlRequest {
string app_id = 1;
string redirect_url = 2;
}
message GetAuthCodeUrlResponse {
Error error = 1;
string url = 2;
}
message GetJsTicketRequest {
string app_id = 1;
}
message GetJsTicketResponse {
Error error = 1;
string js_ticket = 2;
}
message UploadImageRequest {
string app_id = 1;
bytes file = 2;
}
message UploadImageResponse {
Error error = 1;
string image_id = 2;
string url = 3;
}
message DeleteImageRequest {
string app_id = 1;
string image_id = 2;
}
message GetImageListRequest {
string app_id = 1;
int32 page = 2;
}
message ImageItem {
string image_id = 1;
int32 update_time = 2;
string url = 3;
}
message GetImageListResponse {
Error error = 1;
int32 total = 2;
repeated ImageItem list = 3;
}
message GetQrCodeRequest {
string app_id = 1;
string data = 2;
}
message GetQrCodeResponse {
Error error = 1;
string image_url = 2;
string qrcode_url = 3;
int32 expired = 4;
}