-
Notifications
You must be signed in to change notification settings - Fork 14
/
获客助手-获客链接管理.go
executable file
·316 lines (274 loc) · 10.4 KB
/
获客助手-获客链接管理.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
package apis
import (
"encoding/json"
"net/url"
)
// 自动生成的文件, 生成方式: make api doc=微信文档地址url
// 可自行修改生成的文件,以满足开发需求
// ReqListLinkCustomerAcquisition 获取获客链接列表请求
// 文档:https://developer.work.weixin.qq.com/document/path/97297#获取获客链接列表
type ReqListLinkCustomerAcquisition struct {
// Cursor 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
Cursor string `json:"cursor,omitempty"`
// Limit 返回的最大记录数,整型,最大值100
Limit int `json:"limit,omitempty"`
}
var _ urlValuer = ReqListLinkCustomerAcquisition{}
func (x ReqListLinkCustomerAcquisition) intoURLValues() url.Values {
var vals map[string]interface{}
jsonBytes, _ := json.Marshal(x)
_ = json.Unmarshal(jsonBytes, &vals)
var ret url.Values = make(map[string][]string)
for k, v := range vals {
ret.Add(k, StrVal(v))
}
return ret
}
// RespListLinkCustomerAcquisition 获取获客链接列表响应
// 文档:https://developer.work.weixin.qq.com/document/path/97297#获取获客链接列表
type RespListLinkCustomerAcquisition struct {
CommonResp
// LinkIDList link_id列表
LinkIDList []string `json:"link_id_list"`
// NextCursor 分页游标,在下次请求时填写以获取之后分页的记录
NextCursor string `json:"next_cursor"`
}
var _ bodyer = RespListLinkCustomerAcquisition{}
func (x RespListLinkCustomerAcquisition) intoBody() ([]byte, error) {
result, err := json.Marshal(x)
if err != nil {
return nil, err
}
return result, nil
}
// ExecListLinkCustomerAcquisition 获取获客链接列表
// 文档:https://developer.work.weixin.qq.com/document/path/97297#获取获客链接列表
func (c *ApiClient) ExecListLinkCustomerAcquisition(req ReqListLinkCustomerAcquisition) (RespListLinkCustomerAcquisition, error) {
var resp RespListLinkCustomerAcquisition
err := c.executeWXApiGet("/cgi-bin/externalcontact/customer_acquisition/list_link", req, &resp, true)
if err != nil {
return RespListLinkCustomerAcquisition{}, err
}
if bizErr := resp.TryIntoErr(); bizErr != nil {
return RespListLinkCustomerAcquisition{}, bizErr
}
return resp, nil
}
// ReqGetCustomerAcquisition 获取获客链接详情请求
// 文档:https://developer.work.weixin.qq.com/document/path/97297#获取获客链接详情
type ReqGetCustomerAcquisition struct {
// LinkID 获客链接id,必填
LinkID string `json:"link_id"`
}
var _ urlValuer = ReqGetCustomerAcquisition{}
func (x ReqGetCustomerAcquisition) intoURLValues() url.Values {
var vals map[string]interface{}
jsonBytes, _ := json.Marshal(x)
_ = json.Unmarshal(jsonBytes, &vals)
var ret url.Values = make(map[string][]string)
for k, v := range vals {
ret.Add(k, StrVal(v))
}
return ret
}
// RespGetCustomerAcquisition 获取获客链接详情响应
// 文档:https://developer.work.weixin.qq.com/document/path/97297#获取获客链接详情
type RespGetCustomerAcquisition struct {
CommonResp
Link struct {
// CreateTime 创建时间
CreateTime int `json:"create_time"`
// LinkID 获客链接的id
LinkID string `json:"link_id"`
// LinkName 获客链接的名称
LinkName string `json:"link_name"`
// URL 获客链接实际的url
URL string `json:"url"`
} `json:"link"`
Range struct {
// DepartmentList 该获客链接使用范围的部门列表
DepartmentList []int `json:"department_list"`
// UserList 该获客链接使用范围成员列表
UserList []string `json:"user_list"`
} `json:"range"`
// SkipVerify 是否无需验证,默认为true
SkipVerify bool `json:"skip_verify"`
}
var _ bodyer = RespGetCustomerAcquisition{}
func (x RespGetCustomerAcquisition) intoBody() ([]byte, error) {
result, err := json.Marshal(x)
if err != nil {
return nil, err
}
return result, nil
}
// ExecGetCustomerAcquisition 获取获客链接详情
// 文档:https://developer.work.weixin.qq.com/document/path/97297#获取获客链接详情
func (c *ApiClient) ExecGetCustomerAcquisition(req ReqGetCustomerAcquisition) (RespGetCustomerAcquisition, error) {
var resp RespGetCustomerAcquisition
err := c.executeWXApiGet("/cgi-bin/externalcontact/customer_acquisition/get", req, &resp, true)
if err != nil {
return RespGetCustomerAcquisition{}, err
}
if bizErr := resp.TryIntoErr(); bizErr != nil {
return RespGetCustomerAcquisition{}, bizErr
}
return resp, nil
}
// ReqCreateLinkCustomerAcquisition 创建获客链接请求
// 文档:https://developer.work.weixin.qq.com/document/path/97297#创建获客链接
type ReqCreateLinkCustomerAcquisition struct {
// LinkName 链接名称,必填
LinkName string `json:"link_name"`
Range struct {
// DepartmentList 此获客链接关联的部门id列表,部门覆盖总人数最多100个
DepartmentList []int `json:"department_list,omitempty"`
// UserList 此获客链接关联的userid列表,最多可关联100个
UserList []string `json:"user_list,omitempty"`
} `json:"range"`
// SkipVerify 是否无需验证,默认为true
SkipVerify bool `json:"skip_verify,omitempty"`
}
var _ urlValuer = ReqCreateLinkCustomerAcquisition{}
func (x ReqCreateLinkCustomerAcquisition) intoURLValues() url.Values {
var vals map[string]interface{}
jsonBytes, _ := json.Marshal(x)
_ = json.Unmarshal(jsonBytes, &vals)
var ret url.Values = make(map[string][]string)
for k, v := range vals {
ret.Add(k, StrVal(v))
}
return ret
}
// RespCreateLinkCustomerAcquisition 创建获客链接响应
// 文档:https://developer.work.weixin.qq.com/document/path/97297#创建获客链接
type RespCreateLinkCustomerAcquisition struct {
CommonResp
Link struct {
// CreateTime 获客链接创建时间
CreateTime int `json:"create_time"`
// LinkID 获客链接的id
LinkID string `json:"link_id"`
// LinkName 获客链接名称
LinkName string `json:"link_name"`
// URL 获客链接
URL string `json:"url"`
} `json:"link"`
}
var _ bodyer = RespCreateLinkCustomerAcquisition{}
func (x RespCreateLinkCustomerAcquisition) intoBody() ([]byte, error) {
result, err := json.Marshal(x)
if err != nil {
return nil, err
}
return result, nil
}
// ExecCreateLinkCustomerAcquisition 创建获客链接
// 文档:https://developer.work.weixin.qq.com/document/path/97297#创建获客链接
func (c *ApiClient) ExecCreateLinkCustomerAcquisition(req ReqCreateLinkCustomerAcquisition) (RespCreateLinkCustomerAcquisition, error) {
var resp RespCreateLinkCustomerAcquisition
err := c.executeWXApiGet("/cgi-bin/externalcontact/customer_acquisition/create_link", req, &resp, true)
if err != nil {
return RespCreateLinkCustomerAcquisition{}, err
}
if bizErr := resp.TryIntoErr(); bizErr != nil {
return RespCreateLinkCustomerAcquisition{}, bizErr
}
return resp, nil
}
// ReqUpdateLinkCustomerAcquisition 编辑获客链接请求
// 文档:https://developer.work.weixin.qq.com/document/path/97297#编辑获客链接
type ReqUpdateLinkCustomerAcquisition struct {
// LinkID 获客链接的id,必填
LinkID string `json:"link_id"`
// LinkName 更新的链接名称
LinkName string `json:"link_name,omitempty"`
Range struct {
// DepartmentList 此获客链接关联的部门id列表,部门覆盖总人数最多100个
DepartmentList []int `json:"department_list,omitempty"`
// UserList 此获客链接关联的userid列表,最多可关联100个
UserList []string `json:"user_list,omitempty"`
} `json:"range"`
// SkipVerify 是否无需验证,默认为true
SkipVerify bool `json:"skip_verify,omitempty"`
}
var _ urlValuer = ReqUpdateLinkCustomerAcquisition{}
func (x ReqUpdateLinkCustomerAcquisition) intoURLValues() url.Values {
var vals map[string]interface{}
jsonBytes, _ := json.Marshal(x)
_ = json.Unmarshal(jsonBytes, &vals)
var ret url.Values = make(map[string][]string)
for k, v := range vals {
ret.Add(k, StrVal(v))
}
return ret
}
// RespUpdateLinkCustomerAcquisition 编辑获客链接响应
// 文档:https://developer.work.weixin.qq.com/document/path/97297#编辑获客链接
type RespUpdateLinkCustomerAcquisition struct {
CommonResp
}
var _ bodyer = RespUpdateLinkCustomerAcquisition{}
func (x RespUpdateLinkCustomerAcquisition) intoBody() ([]byte, error) {
result, err := json.Marshal(x)
if err != nil {
return nil, err
}
return result, nil
}
// ExecUpdateLinkCustomerAcquisition 编辑获客链接
// 文档:https://developer.work.weixin.qq.com/document/path/97297#编辑获客链接
func (c *ApiClient) ExecUpdateLinkCustomerAcquisition(req ReqUpdateLinkCustomerAcquisition) (RespUpdateLinkCustomerAcquisition, error) {
var resp RespUpdateLinkCustomerAcquisition
err := c.executeWXApiGet("/cgi-bin/externalcontact/customer_acquisition/update_link", req, &resp, true)
if err != nil {
return RespUpdateLinkCustomerAcquisition{}, err
}
if bizErr := resp.TryIntoErr(); bizErr != nil {
return RespUpdateLinkCustomerAcquisition{}, bizErr
}
return resp, nil
}
// ReqDeleteLinkCustomerAcquisition 删除获客链接请求
// 文档:https://developer.work.weixin.qq.com/document/path/97297#删除获客链接
type ReqDeleteLinkCustomerAcquisition struct {
// LinkID 获客链接的id,必填
LinkID string `json:"link_id"`
}
var _ urlValuer = ReqDeleteLinkCustomerAcquisition{}
func (x ReqDeleteLinkCustomerAcquisition) intoURLValues() url.Values {
var vals map[string]interface{}
jsonBytes, _ := json.Marshal(x)
_ = json.Unmarshal(jsonBytes, &vals)
var ret url.Values = make(map[string][]string)
for k, v := range vals {
ret.Add(k, StrVal(v))
}
return ret
}
// RespDeleteLinkCustomerAcquisition 删除获客链接响应
// 文档:https://developer.work.weixin.qq.com/document/path/97297#删除获客链接
type RespDeleteLinkCustomerAcquisition struct {
CommonResp
}
var _ bodyer = RespDeleteLinkCustomerAcquisition{}
func (x RespDeleteLinkCustomerAcquisition) intoBody() ([]byte, error) {
result, err := json.Marshal(x)
if err != nil {
return nil, err
}
return result, nil
}
// ExecDeleteLinkCustomerAcquisition 删除获客链接
// 文档:https://developer.work.weixin.qq.com/document/path/97297#删除获客链接
func (c *ApiClient) ExecDeleteLinkCustomerAcquisition(req ReqDeleteLinkCustomerAcquisition) (RespDeleteLinkCustomerAcquisition, error) {
var resp RespDeleteLinkCustomerAcquisition
err := c.executeWXApiGet("/cgi-bin/externalcontact/customer_acquisition/delete_link", req, &resp, true)
if err != nil {
return RespDeleteLinkCustomerAcquisition{}, err
}
if bizErr := resp.TryIntoErr(); bizErr != nil {
return RespDeleteLinkCustomerAcquisition{}, bizErr
}
return resp, nil
}