forked from silenceper/wechat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
follow_user.go
35 lines (30 loc) · 997 Bytes
/
follow_user.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
package externalcontact
import (
"fmt"
"github.com/bbang94/wechat/v2/util"
)
const (
// fetchFollowUserListURL 获取配置了客户联系功能的成员列表
fetchFollowUserListURL = "https://qyapi.weixin.qq.com/cgi-bin/externalcontact/get_follow_user_list"
)
// followerUserResponse 客户联系功能的成员列表响应
type followerUserResponse struct {
util.CommonError
FollowUser []string `json:"follow_user"`
}
// GetFollowUserList 获取配置了客户联系功能的成员列表
// @see https://developer.work.weixin.qq.com/document/path/92571
func (r *Client) GetFollowUserList() ([]string, error) {
accessToken, err := r.GetAccessToken()
if err != nil {
return nil, err
}
var response []byte
response, err = util.HTTPGet(fmt.Sprintf("%s?access_token=%s", fetchFollowUserListURL, accessToken))
if err != nil {
return nil, err
}
var result followerUserResponse
err = util.DecodeWithError(response, &result, "GetFollowUserList")
return result.FollowUser, err
}