-
Notifications
You must be signed in to change notification settings - Fork 171
/
client.go
68 lines (50 loc) · 1.65 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
package servicer
import (
"github.com/ArtisanCloud/PowerLibs/v2/object"
"github.com/ArtisanCloud/PowerWeChat/v2/src/kernel"
"github.com/ArtisanCloud/PowerWeChat/v2/src/work/accountService/servicer/response"
)
type Client struct {
*kernel.BaseClient
}
func NewClient(app kernel.ApplicationInterface) (*Client, error) {
baseClient, err := kernel.NewBaseClient(&app, nil)
if err != nil {
return nil, err
}
return &Client{
baseClient,
}, nil
}
// 添加接待人员
// https://developer.work.weixin.qq.com/document/path/94646
func (comp *Client) Add(openKFID string, userIDList []string) (*response.ResponseServicerAdd, error) {
result := &response.ResponseServicerAdd{}
options := &object.HashMap{
"open_kfid": openKFID,
"userid_list": userIDList,
}
_, err := comp.HttpPostJson("cgi-bin/kf/servicer/add", options, nil, nil, result)
return result, err
}
// 删除接待人员
// https://developer.work.weixin.qq.com/document/path/94647
func (comp *Client) Del(openKFID string, userIDList []string) (*response.ResponseServicerDel, error) {
result := &response.ResponseServicerDel{}
options := &object.HashMap{
"open_kfid": openKFID,
"userid_list": userIDList,
}
_, err := comp.HttpPostJson("cgi-bin/kf/servicer/del", options, nil, nil, result)
return result, err
}
// 获取接待人员列表
// https://developer.work.weixin.qq.com/document/path/94645
func (comp *Client) List(openKFID string) (*response.ResponseServicerList, error) {
result := &response.ResponseServicerList{}
params := &object.StringMap{
"open_kfid": openKFID,
}
_, err := comp.HttpPostJson("cgi-bin/kf/servicer/list", nil, params, nil, result)
return result, err
}