Passed
Push — master ( 78b346...e9f486 )
by Carlos
02:47
created

Client::getAuditStatus()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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 $data
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 $data, string $feedbackInfo = null, string $feedbackStuff = null)
90
    {
91 1
        if (isset($data['item_list'])) {
92 1
            return $this->httpPostJson('wxa/submit_audit', $data);
93
        }
94
95 1
        return $this->httpPostJson('wxa/submit_audit', [
96 1
            'item_list' => $data,
97 1
            'feedback_info' => $feedbackInfo,
98 1
            'feedback_stuff' => $feedbackStuff,
99
        ]);
100
    }
101
102
    /**
103
     * @param int $auditId
104
     *
105
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
106
     *
107
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
108
     * @throws \GuzzleHttp\Exception\GuzzleException
109
     */
110 1
    public function getAuditStatus(int $auditId)
111
    {
112 1
        return $this->httpPostJson('wxa/get_auditstatus', [
113 1
            'auditid' => $auditId,
114
        ]);
115
    }
116
117
    /**
118
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
119
     *
120
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
121
     */
122 1
    public function getLatestAuditStatus()
123
    {
124 1
        return $this->httpGet('wxa/get_latest_auditstatus');
125
    }
126
127
    /**
128
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
129
     *
130
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
131
     * @throws \GuzzleHttp\Exception\GuzzleException
132
     */
133 1
    public function release()
134
    {
135 1
        return $this->httpPostJson('wxa/release');
136
    }
137
138
    /**
139
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
140
     *
141
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
142
     */
143 1
    public function withdrawAudit()
144
    {
145 1
        return $this->httpGet('wxa/undocodeaudit');
146
    }
147
148
    /**
149
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
150
     *
151
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
152
     */
153 1
    public function rollbackRelease()
154
    {
155 1
        return $this->httpGet('wxa/revertcoderelease');
156
    }
157
158
    /**
159
     * @param string $action
160
     *
161
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
162
     *
163
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
164
     * @throws \GuzzleHttp\Exception\GuzzleException
165
     */
166 1
    public function changeVisitStatus(string $action)
167
    {
168 1
        return $this->httpPostJson('wxa/change_visitstatus', [
169 1
            'action' => $action,
170
        ]);
171
    }
172
173
    /**
174
     * 分阶段发布.
175
     *
176
     * @param int $grayPercentage
177
     *
178
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
179
     *
180
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
181
     * @throws \GuzzleHttp\Exception\GuzzleException
182
     */
183 1
    public function grayRelease(int $grayPercentage)
184
    {
185 1
        return $this->httpPostJson('wxa/grayrelease', [
186 1
            'gray_percentage' => $grayPercentage,
187
        ]);
188
    }
189
190
    /**
191
     * 取消分阶段发布.
192
     *
193
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
194
     *
195
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
196
     */
197 1
    public function revertGrayRelease()
198
    {
199 1
        return $this->httpGet('wxa/revertgrayrelease');
200
    }
201
202
    /**
203
     * 查询当前分阶段发布详情.
204
     *
205
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
206
     *
207
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
208
     */
209 1
    public function getGrayRelease()
210
    {
211 1
        return $this->httpGet('wxa/getgrayreleaseplan');
212
    }
213
214
    /**
215
     * 查询当前设置的最低基础库版本及各版本用户占比.
216
     *
217
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
218
     *
219
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
220
     * @throws \GuzzleHttp\Exception\GuzzleException
221
     */
222
    public function getSupportVersion()
223
    {
224
        return $this->httpPostJson('cgi-bin/wxopen/getweappsupportversion');
225
    }
226
227
    /**
228
     * 设置最低基础库版本.
229
     *
230
     * @param string $version
231
     *
232
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
233
     *
234
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
235
     * @throws \GuzzleHttp\Exception\GuzzleException
236
     */
237
    public function setSupportVersion(string $version)
238
    {
239
        return $this->httpPostJson('cgi-bin/wxopen/setweappsupportversion', [
240
            'version' => $version,
241
        ]);
242
    }
243
244
    /**
245
     * 查询服务商的当月提审限额(quota)和加急次数.
246
     *
247
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
248
     *
249
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
250
     */
251
    public function queryQuota()
252
    {
253
        return $this->httpGet('wxa/queryquota');
254
    }
255
256
    /**
257
     * 加急审核申请.
258
     *
259
     * @param int $auditId 审核单ID
260
     *
261
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
262
     *
263
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
264
     */
265
    public function speedupAudit(int $auditId)
266
    {
267
        return $this->httpPostJson('wxa/speedupaudit', [
268
            'auditid' => $auditId,
269
        ]);
270
    }
271
}
272