work/wedrive/vip.pm untested

filter: Statementstmt 0.0% 0 / 51 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 18 MC/DCmcdc 0.0% 0 / 9 Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 102 CC 7 SCAR 20.8
CC
7
Cov
0%
batch_add
12.0
batch_del
12.0
list
12.0
CRAP 8.0
1 package QQ::weixin::work::wedrive::vip;
2
3 =encoding utf8
4
5 =head1 Name
6
7 QQ::weixin::work::wedrive::vip
8
9 =head1 DESCRIPTION
10
11 微盘
12
13 =cut
14
15 use strict;
16 use base qw(QQ::weixin::work::wedrive);
17 use Encode;
18 use LWP::UserAgent;
19 use JSON;
20 use utf8;
21
22 our $VERSION = '0.10';
23 our @EXPORT = qw/ batch_add batch_del list /;
24
25 =head1 FUNCTION
26
27 高级功能账号管理
28
29 =head2 batch_add(access_token, hash);
30
31 分配高级功能账号
32 最后更新:2023/12/07
33
34 =head2 SYNOPSIS
35
36 L<https://developer.work.weixin.qq.com/document/path/99512>
37
38 =head3 请求说明:
39
40 该接口用于分配应用可见范围内企业成员的高级功能。
41
42 =head4 请求包结构体为:
43
44 {
45 "userid_list": ["zhangsan","lisi","wangwu"]
46 }
47
48 =head4 参数说明:
49
50 参数 类型 是否必须 说明
51 access_token 是 调用接口凭证
52 userid_list 是 要分配高级功能的企业成员userid列表,单次操作最大限制100个
53
54 =head4 权限说明:
55
56 应用类型 权限要求
57 自建应用 配置到「协作 - 微盘 - 可调用接口的应用」中
58 代开发应用 暂不支持
59 第三方应用 暂不支持
60
61 =head3 RETURN 返回结果:
62
63 {
64 "errcode": 0,
65 "errmsg": "ok",
66 "succ_userid_list":["zhangsan","lisi"],
67 "fail_userid_list":["wangwu"]
68 }
69
70 =head4 RETURN 参数说明:
71
72 参数 类型 说明
73 errcode 返回码
74 errmsg 对返回码的文本描述内容
75 succ_userid_list 分配成功的userid列表,包括已经是高级功能账号的userid
76 fail_userid_list 分配失败的userid列表
77
78 =cut
79
80 sub batch_add {
81 if ( @_ && $_[0] && ref $_[1] eq 'HASH' ) {
82 my $access_token = $_[0];
83 my $json = $_[1];
84 my $ua = LWP::UserAgent->new;
85 $ua->timeout(30);
86 $ua->env_proxy;
87
88 my $response = $ua->post("https://qyapi.weixin.qq.com/cgi-bin/wedrive/vip/batch_add?access_token=$access_token",Content => to_json($json,{allow_nonref=>1}),Content_type =>'application/json');
89 if ($response->is_success) {
90 return from_json($response->decoded_content,{utf8 => 1, allow_nonref => 1});
91 }
92
93 }
94 return 0;
95 }
96
97 =head2 batch_del(access_token, hash);
98
99 取消高级功能账号
100 最后更新:2023/12/07
101
102 =head2 SYNOPSIS
103
104 L<https://developer.work.weixin.qq.com/document/path/99513>
105
106 =head3 请求说明:
107
108 该接口用于撤销分配应用可见范围企业成员的高级功能。
109
110 =head4 请求包结构体为:
111
112 {
113 "userid_list": ["zhangsan","lisi","wangwu"]
114 }
115
116 =head4 参数说明:
117
118 参数 类型 是否必须 说明
119 access_token 是 调用接口凭证
120 userid_list 是 要撤销分配高级功能的企业成员userid列表,单次操作最多限制100个
121
122 =head4 权限说明:
123
124 应用类型 权限要求
125 自建应用 配置到「协作 - 微盘 - 可调用接口的应用」中
126 代开发应用 暂不支持
127 第三方应用 暂不支持
128
129 =head3 RETURN 返回结果:
130
131 {
132 "errcode": 0,
133 "errmsg": "ok",
134 "succ_userid_list":["zhangsan","lisi"],
135 "fail_userid_list":["wangwu"]
136 }
137
138 =head4 RETURN 参数说明:
139
140 参数 类型 说明
141 errcode 返回码
142 errmsg 对返回码的文本描述内容
143 succ_userid_list 撤销分配成功的userid列表
144 fail_userid_list 撤销分配失败的userid列表
145
146 =cut
147
148 sub batch_del {
149 if ( @_ && $_[0] && ref $_[1] eq 'HASH' ) {
150 my $access_token = $_[0];
151 my $json = $_[1];
152 my $ua = LWP::UserAgent->new;
153 $ua->timeout(30);
154 $ua->env_proxy;
155
156 my $response = $ua->post("https://qyapi.weixin.qq.com/cgi-bin/wedrive/vip/batch_del?access_token=$access_token",Content => to_json($json,{allow_nonref=>1}),Content_type =>'application/json');
157 if ($response->is_success) {
158 return from_json($response->decoded_content,{utf8 => 1, allow_nonref => 1});
159 }
160
161 }
162 return 0;
163 }
164
165 =head2 list(access_token, hash);
166
167 获取高级功能账号列表
168 最后更新:2023/12/07
169
170 =head2 SYNOPSIS
171
172 L<https://developer.work.weixin.qq.com/document/path/99514>
173
174 =head3 请求说明:
175
176 该接口用于查询企业已分配高级功能且在应用可见范围的账号列表。
177
178 =head4 请求包结构体为:
179
180 {
181 "cursor":"CURSOR",
182 "limit":2
183 }
184
185 =head4 参数说明:
186
187 参数 类型 是否必须 说明
188 access_token 是 调用接口凭证
189 cursor 否 用于分页查询的游标,字符串类型,由上一次调用返回,首次调用可不填
190 limit 否 用于分页查询,每次请求返回的数据上限。默认100,最大200
191 注意:不保证每次返回的数据刚好为指定limit,必须用返回的has_more判断是否继续请求
192
193 =head4 权限说明:
194
195 应用类型 权限要求
196 自建应用 配置到「协作 - 微盘 - 可调用接口的应用」中
197 代开发应用 暂不支持
198 第三方应用 暂不支持
199
200 =head3 RETURN 返回结果:
201
202 {
203 "errcode": 0,
204 "errmsg": "ok",
205 "has_more":true,
206 "next_cursor":"GNIJIGEO",
207 "userid_list":["zhangsan","lisi"]
208 }
209
210 =head4 RETURN 参数说明:
211
212 参数 类型 说明
213 errcode 返回码
214 errmsg 对返回码的文本描述内容
215 has_more 是否还有更多数据未获取
216 next_cursor 下一次请求的cursor值
217 userid_list 符合条件的企业成员userid列表
218
219 =cut
220
221 sub list {
222 if ( @_ && $_[0] && ref $_[1] eq 'HASH' ) {
223 my $access_token = $_[0];
224 my $json = $_[1];
225 my $ua = LWP::UserAgent->new;
226 $ua->timeout(30);
227 $ua->env_proxy;
228
229 my $response = $ua->post("https://qyapi.weixin.qq.com/cgi-bin/wedrive/vip/list?access_token=$access_token",Content => to_json($json,{allow_nonref=>1}),Content_type =>'application/json');
230 if ($response->is_success) {
231 return from_json($response->decoded_content,{utf8 => 1, allow_nonref => 1});
232 }
233
234 }
235 return 0;
236 }
237
238 1;
239 __END__