Passed
Push — master ( b57922...9e7e75 )
by Carlos
03:10
created

Client::speedupAudit()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 4
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
3
/*
4
 * This file is part of the overtrue/wechat.
5
 *
6
 * (c) overtrue <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace EasyWeChat\OpenPlatform\Authorizer\MiniProgram\Code;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * Class Client.
18
 *
19
 * @author mingyoung <[email protected]>
20
 */
21
class Client extends BaseClient
22
{
23
    /**
24
     * @param int    $templateId
25
     * @param string $extJson
26
     * @param string $version
27
     * @param string $description
28
     *
29
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
30
     *
31
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
32
     * @throws \GuzzleHttp\Exception\GuzzleException
33
     */
34 1
    public function commit(int $templateId, string $extJson, string $version, string $description)
35
    {
36 1
        return $this->httpPostJson('wxa/commit', [
37 1
            'template_id' => $templateId,
38 1
            'ext_json' => $extJson,
39 1
            'user_version' => $version,
40 1
            'user_desc' => $description,
41
        ]);
42
    }
43
44
    /**
45
     * @param string|null $path
46
     *
47
     * @return \EasyWeChat\Kernel\Http\Response
48
     *
49
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
50
     * @throws \GuzzleHttp\Exception\GuzzleException
51
     */
52 2
    public function getQrCode(string $path = null)
53
    {
54 2
        return $this->requestRaw('wxa/get_qrcode', 'GET', [
55 2
            'query' => ['path' => $path],
56
        ]);
57
    }
58
59
    /**
60
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
61
     *
62
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
63
     */
64 1
    public function getCategory()
65
    {
66 1
        return $this->httpGet('wxa/get_category');
67
    }
68
69
    /**
70
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
71
     *
72
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
73
     */
74 1
    public function getPage()
75
    {
76 1
        return $this->httpGet('wxa/get_page');
77
    }
78
79
    /**
80
     * @param array       $itemList
81
     * @param string|null $feedbackInfo
82
     * @param string|null $feedbackStuff
83
     *
84
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
85
     *
86
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
87
     * @throws \GuzzleHttp\Exception\GuzzleException
88
     */
89 1
    public function submitAudit(array $itemList, string $feedbackInfo = null, string $feedbackStuff = null)
90
    {
91 1
        return $this->httpPostJson('wxa/submit_audit', [
92 1
            'item_list' => $itemList,
93 1
            'feedback_info' => $feedbackInfo,
94 1
            'feedback_stuff' => $feedbackStuff,
95
        ]);
96
    }
97
98
    /**
99
     * @param int $auditId
100
     *
101
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
102
     *
103
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
104
     * @throws \GuzzleHttp\Exception\GuzzleException
105
     */
106 1
    public function getAuditStatus(int $auditId)
107
    {
108 1
        return $this->httpPostJson('wxa/get_auditstatus', [
109 1
            'auditid' => $auditId,
110
        ]);
111
    }
112
113
    /**
114
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
115
     *
116
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
117
     */
118 1
    public function getLatestAuditStatus()
119
    {
120 1
        return $this->httpGet('wxa/get_latest_auditstatus');
121
    }
122
123
    /**
124
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
125
     *
126
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
127
     * @throws \GuzzleHttp\Exception\GuzzleException
128
     */
129 1
    public function release()
130
    {
131 1
        return $this->httpPostJson('wxa/release');
132
    }
133
134
    /**
135
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
136
     *
137
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
138
     */
139 1
    public function withdrawAudit()
140
    {
141 1
        return $this->httpGet('wxa/undocodeaudit');
142
    }
143
144
    /**
145
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
146
     *
147
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
148
     */
149 1
    public function rollbackRelease()
150
    {
151 1
        return $this->httpGet('wxa/revertcoderelease');
152
    }
153
154
    /**
155
     * @param string $action
156
     *
157
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
158
     *
159
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
160
     * @throws \GuzzleHttp\Exception\GuzzleException
161
     */
162 1
    public function changeVisitStatus(string $action)
163
    {
164 1
        return $this->httpPostJson('wxa/change_visitstatus', [
165 1
            'action' => $action,
166
        ]);
167
    }
168
169
    /**
170
     * 分阶段发布.
171
     *
172
     * @param int $grayPercentage
173
     *
174
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
175
     *
176
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
177
     * @throws \GuzzleHttp\Exception\GuzzleException
178
     */
179 1
    public function grayRelease(int $grayPercentage)
180
    {
181 1
        return $this->httpPostJson('wxa/grayrelease', [
182 1
            'gray_percentage' => $grayPercentage,
183
        ]);
184
    }
185
186
    /**
187
     * 取消分阶段发布.
188
     *
189
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
190
     *
191
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
192
     */
193 1
    public function revertGrayRelease()
194
    {
195 1
        return $this->httpGet('wxa/revertgrayrelease');
196
    }
197
198
    /**
199
     * 查询当前分阶段发布详情.
200
     *
201
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
202
     *
203
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
204
     */
205 1
    public function getGrayRelease()
206
    {
207 1
        return $this->httpGet('wxa/getgrayreleaseplan');
208
    }
209
210
    /**
211
     * 查询当前设置的最低基础库版本及各版本用户占比.
212
     *
213
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
214
     *
215
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
216
     * @throws \GuzzleHttp\Exception\GuzzleException
217
     */
218
    public function getSupportVersion()
219
    {
220
        return $this->httpPostJson('cgi-bin/wxopen/getweappsupportversion');
221
    }
222
223
    /**
224
     * 设置最低基础库版本.
225
     *
226
     * @param string $version
227
     *
228
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
229
     *
230
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
231
     * @throws \GuzzleHttp\Exception\GuzzleException
232
     */
233
    public function setSupportVersion(string $version)
234
    {
235
        return $this->httpPostJson('cgi-bin/wxopen/setweappsupportversion', [
236
            'version' => $version,
237
        ]);
238
    }
239
240
    /**
241
     * 查询服务商的当月提审限额(quota)和加急次数
242
     *
243
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
244
     *
245
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
246
     */
247
    public function queryQuota()
248
    {
249
        return $this->httpGet('wxa/queryquota');
250
    }
251
252
    /**
253
     * 加急审核申请
254
     *
255
     * @param int $auditId 审核单ID
256
     *
257
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
258
     *
259
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
260
     */
261
    public function speedupAudit(int $auditId)
262
    {
263
        return $this->httpPostJson('wxa/speedupaudit', [
264
            'auditid' => $auditId,
265
        ]);
266
    }
267
}
268