/
client_contacts_export.go
152 lines (135 loc) · 5.13 KB
/
client_contacts_export.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
package wecom
import (
"github.com/wenerme/go-req"
)
// ExportSimpleUser 导出成员
//
// see https://work.weixin.qq.com/api/doc/90000/90135/94849
func (c *Client) ExportSimpleUser(r *ExportSimpleUserRequest, opts ...interface{}) (out ExportSimpleUserResponse, err error) {
err = c.Request.With(req.Request{
Method: "POST",
URL: "/cgi-bin/export/simple_user",
Body: r,
Options: opts,
}).Fetch(&out)
return
}
// ExportUser 导出成员详情
//
// see https://work.weixin.qq.com/api/doc/90000/90135/94851
func (c *Client) ExportUser(r *ExportUserRequest, opts ...interface{}) (out ExportUserResponse, err error) {
err = c.Request.With(req.Request{
Method: "POST",
URL: "/cgi-bin/export/user",
Body: r,
Options: opts,
}).Fetch(&out)
return
}
// ExportDepartment 导出部门
//
// see https://work.weixin.qq.com/api/doc/90000/90135/94852
func (c *Client) ExportDepartment(r *ExportDepartmentRequest, opts ...interface{}) (out ExportDepartmentResponse, err error) {
err = c.Request.With(req.Request{
Method: "POST",
URL: "/cgi-bin/export/department",
Body: r,
Options: opts,
}).Fetch(&out)
return
}
// ExportTagUser 导出标签成员
//
// see https://work.weixin.qq.com/api/doc/90000/90135/94853
func (c *Client) ExportTagUser(r *ExportTagUserRequest, opts ...interface{}) (out ExportTagUserResponse, err error) {
err = c.Request.With(req.Request{
Method: "POST",
URL: "/cgi-bin/export/taguser",
Body: r,
Options: opts,
}).Fetch(&out)
return
}
// ExportGetResult 接口定义
//
// see https://work.weixin.qq.com/api/doc/90000/90135/94854
func (c *Client) ExportGetResult(r *ExportGetResultRequest, opts ...interface{}) (out ExportGetResultResponse, err error) {
err = c.Request.With(req.Request{
Method: "GET",
URL: "/cgi-bin/export/get_result",
Query: r,
Options: opts,
}).Fetch(&out)
return
}
// ExportSimpleUserRequest is request of Client.ExportSimpleUser
type ExportSimpleUserRequest struct {
// EncodingAesKey base64encode的加密密钥,长度固定为43,加密方式采用aes-256-cbc方式
EncodingAesKey string `json:"encoding_aeskey" validate:"required"`
// BlockSize 每块数据的人员数,支持范围[10^4,10^6],默认值为10^6
BlockSize int `json:"block_size" `
}
// ExportSimpleUserResponse is response of Client.ExportSimpleUser
type ExportSimpleUserResponse struct {
// JobID 任务ID,可通过获取导出结果接口查询任务结果
JobID string `json:"jobid" `
}
// ExportUserRequest is request of Client.ExportUser
type ExportUserRequest struct {
// EncodingAesKey base64encode的加密密钥,长度固定为43,加密方式采用aes-256-cbc方式
EncodingAesKey string `json:"encoding_aeskey" validate:"required"`
// BlockSize 每块数据的人员数,支持范围[10^4,10^6],默认值为10^6
BlockSize int `json:"block_size" `
}
// ExportUserResponse is response of Client.ExportUser
type ExportUserResponse struct {
// JobID 任务ID,可通过获取导出结果接口查询任务结果
JobID string `json:"jobid" `
}
// ExportDepartmentRequest is request of Client.ExportDepartment
type ExportDepartmentRequest struct {
// EncodingAesKey base64encode的加密密钥,长度固定为43,加密方式采用aes-256-cbc方式
EncodingAesKey string `json:"encoding_aeskey" validate:"required"`
// BlockSize 每块数据的部门数,支持范围[10^4,10^6],默认值为10^6
BlockSize int `json:"block_size" `
}
// ExportDepartmentResponse is response of Client.ExportDepartment
type ExportDepartmentResponse struct {
// JobID 任务ID,可通过获取导出结果接口查询任务结果
JobID string `json:"jobid" `
}
// ExportTagUserRequest is request of Client.ExportTagUser
type ExportTagUserRequest struct {
// TagID 需要导出的标签
TagID int `json:"tagid" validate:"required"`
// EncodingAesKey base64encode的加密密钥,长度固定为43,加密方式采用aes-256-cbc方式
EncodingAesKey string `json:"encoding_aeskey" validate:"required"`
// BlockSize 每块数据的人员数和部门数之和,支持范围[10^4,10^6],默认值为10^6
BlockSize int `json:"block_size" `
}
// ExportTagUserResponse is response of Client.ExportTagUser
type ExportTagUserResponse struct {
// JobID 任务ID,可通过获取导出结果接口查询任务结果
JobID string `json:"jobid" `
}
// ExportGetResultRequest is request of Client.ExportGetResult
type ExportGetResultRequest struct {
// JobID 导出任务接口成功后返回
JobID string `json:"jobid" validate:"required"`
}
// ExportGetResultResponse is response of Client.ExportGetResult
type ExportGetResultResponse struct {
// Status 任务状态:0-未处理,1-处理中,2-完成,3-异常失败
Status string `json:"status" `
// DataList 数据文件列表
DataList ExportGetResultResponseDataList `json:"data_list" `
}
// ExportGetResultResponseDataList is model of ExportGetResultResponse.DataList
type ExportGetResultResponseDataList struct {
// URL 数据下载链接,支持指定Range头部分段下载。有效期2个小时
URL string `json:"url" `
// Size 密文数据大小
Size int `json:"size" `
// Md5 密文数据md5
Md5 string `json:"md5" `
}