-
Notifications
You must be signed in to change notification settings - Fork 147
/
client.go
58 lines (42 loc) · 1.62 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
package corpgroup
import (
"fmt"
"github.com/ArtisanCloud/PowerLibs/v2/object"
"github.com/ArtisanCloud/PowerWeChat/v2/src/kernel"
"github.com/ArtisanCloud/PowerWeChat/v2/src/work/corpgroup/response"
)
type Client struct {
*kernel.BaseClient
}
// 获取应用共享信息
// https://open.work.weixin.qq.com/api/doc/90000/90135/93403
func (comp *Client) GetAppShareInfo(agentID int) (*response.ResponseCorpGroupListAPPShareInfo, error) {
result := &response.ResponseCorpGroupListAPPShareInfo{}
params := &object.StringMap{
"agentid": fmt.Sprintf("%d", agentID),
}
_, err := comp.HttpPostJson("cgi-bin/corpgroup/corp/list_app_share_info", nil, params, nil, result)
return result, err
}
// 获取下级企业的access_token
// https://open.work.weixin.qq.com/api/doc/90000/90135/93359
func (comp *Client) GetToken(corpID string, agentID string) (*response.ResponseCorpGroupGetToken, error) {
result := &response.ResponseCorpGroupGetToken{}
params := &object.HashMap{
"corpid": corpID,
"agentid": agentID,
}
_, err := comp.HttpPostJson("cgi-bin/corpgroup/corp/gettoken", params, nil, nil, result)
return result, err
}
// 获取下级企业的小程序session
// https://open.work.weixin.qq.com/api/doc/90000/90135/93355
func (comp *Client) GetMiniProgramTransferSession(userID string, sessionKey string) (*response.ResponseCorpGroupTransferSession, error) {
result := &response.ResponseCorpGroupTransferSession{}
params := &object.HashMap{
"userid": userID,
"session_key": sessionKey,
}
_, err := comp.HttpPostJson("cgi-bin/corpgroup/miniprogram/transfer_session?", params, nil, nil, result)
return result, err
}