-
Notifications
You must be signed in to change notification settings - Fork 174
/
client.go
88 lines (62 loc) · 2.56 KB
/
client.go
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
package msgaudit
import (
"context"
"github.com/ArtisanCloud/PowerLibs/v3/object"
"github.com/ArtisanCloud/PowerWeChat/v3/src/kernel"
"github.com/ArtisanCloud/PowerWeChat/v3/src/kernel/power"
"github.com/ArtisanCloud/PowerWeChat/v3/src/work/msgAudit/response"
)
type Client struct {
BaseClient *kernel.BaseClient
}
// 获取会话内容存档开启成员列表
// https://developer.work.weixin.qq.com/document/path/91614
func (comp *Client) GetPermitUsersList(ctx context.Context, msgType string) (*response.ResponseMsgAuditGetPermitUsers, error) {
result := &response.ResponseMsgAuditGetPermitUsers{}
params := &object.StringMap{}
if msgType != "" {
(*params)["type"] = msgType
}
_, err := comp.BaseClient.HttpPostJson(ctx, "cgi-bin/msgaudit/get_permit_user_list", params, nil, nil, result)
return result, err
}
// 获取会话同意情况
// https://developer.work.weixin.qq.com/document/path/91782
func (comp *Client) CheckSingleAgree(ctx context.Context, info []*power.StringMap) (*response.ResponseMsgAuditGetAgreeInfo, error) {
result := &response.ResponseMsgAuditGetAgreeInfo{}
params := &object.HashMap{
"info": info,
}
_, err := comp.BaseClient.HttpPostJson(ctx, "cgi-bin/msgaudit/check_single_agree", params, nil, nil, result)
return result, err
}
// 获取会话同意情况
// https://developer.work.weixin.qq.com/document/path/91782
func (comp *Client) CheckRoomAgree(ctx context.Context, roomID string) (*response.ResponseMsgAuditGetAgreeInfo, error) {
result := &response.ResponseMsgAuditGetAgreeInfo{}
params := &object.HashMap{
"roomid": roomID,
}
_, err := comp.BaseClient.HttpPostJson(ctx, "cgi-bin/msgaudit/check_room_agree?", params, nil, nil, result)
return result, err
}
// 获取会话内容存档内部群信息
// https://developer.work.weixin.qq.com/document/path/92951
func (comp *Client) GroupChatGet(ctx context.Context, roomID string) (*response.ResponseMsgAuditGetRoom, error) {
result := &response.ResponseMsgAuditGetRoom{}
params := &object.HashMap{
"roomid": roomID,
}
_, err := comp.BaseClient.HttpPostJson(ctx, "cgi-bin/msgaudit/groupchat/get?", params, nil, nil, result)
return result, err
}
// 获取机器人信息
// https://developer.work.weixin.qq.com/document/path/91774
func (comp *Client) GetRobotInfo(ctx context.Context, robotID string) (*response.ResponseMsgAuditGetRobotInfo, error) {
result := &response.ResponseMsgAuditGetRobotInfo{}
params := &object.StringMap{
"robot_id": robotID,
}
_, err := comp.BaseClient.HttpGet(ctx, "cgi-bin/msgaudit/get_robot_info?", params, nil, result)
return result, err
}