-
Notifications
You must be signed in to change notification settings - Fork 147
/
client.go
102 lines (75 loc) · 3.02 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package moment
import (
"github.com/ArtisanCloud/PowerLibs/v2/object"
"github.com/ArtisanCloud/PowerWeChat/v2/src/kernel"
"github.com/ArtisanCloud/PowerWeChat/v2/src/work/externalContact/moment/request"
"github.com/ArtisanCloud/PowerWeChat/v2/src/work/externalContact/moment/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/93333
func (comp *Client) GetMomentList(params *request.RequestGetMomentList) (*response.ResponseGetMomentList, error) {
result := &response.ResponseGetMomentList{}
_, err := comp.HttpPostJson("cgi-bin/externalcontact/get_moment_list", params, nil, nil, result)
return result, err
}
// 获取客户朋友圈企业发表的列表
// https://developer.work.weixin.qq.com/document/path/93333
func (comp *Client) GetMomentTask(momentID string, cursor string, limit int) (*response.ResponseMomentGetMomentTask, error) {
result := &response.ResponseMomentGetMomentTask{}
options := &object.HashMap{
"moment_id": momentID,
"cursor": cursor,
"limit": limit,
}
_, err := comp.HttpPostJson("cgi-bin/externalcontact/get_moment_task", options, nil, nil, result)
return result, err
}
// 获取客户朋友圈发表时选择的可见范围
// https://developer.work.weixin.qq.com/document/path/93333
func (comp *Client) GetMomentCustomerList(momentID string, userID string, cursor string, limit int) (*response.ResponseMomentGetMomentCustomerList, error) {
result := &response.ResponseMomentGetMomentCustomerList{}
options := &object.HashMap{
"moment_id": momentID,
"userid": userID,
"cursor": cursor,
"limit": limit,
}
_, err := comp.HttpPostJson("cgi-bin/externalcontact/get_moment_customer_list", options, nil, nil, result)
return result, err
}
// 获取客户朋友圈发表后的可见客户列表
// https://developer.work.weixin.qq.com/document/path/93333
func (comp *Client) GetMomentSendResult(momentID string, userID string, cursor string, limit int) (*response.ResponseMomentGetMomentSendResult, error) {
result := &response.ResponseMomentGetMomentSendResult{}
options := &object.HashMap{
"moment_id": momentID,
"userid": userID,
"cursor": cursor,
"limit": limit,
}
_, err := comp.HttpPostJson("cgi-bin/externalcontact/get_moment_send_result", options, nil, nil, result)
return result, err
}
// 获取客户朋友圈的互动数据
// https://developer.work.weixin.qq.com/document/path/93333
func (comp *Client) GetMomentComments(momentID string, userID string) (*response.ResponseMomentGetMomentComments, error) {
result := &response.ResponseMomentGetMomentComments{}
options := &object.HashMap{
"moment_id": momentID,
"userid": userID,
}
_, err := comp.HttpPostJson("cgi-bin/externalcontact/get_moment_comments", options, nil, nil, result)
return result, err
}