Completed
Pull Request — master (#1227)
by
unknown
02:52 queued 26s
created

Client::revertGrayRelease()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
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
    public function commit(int $templateId, string $extJson, string $version, string $description)
32
    {
33
        return $this->httpPostJson('wxa/commit', [
34
            'template_id' => $templateId,
35
            'ext_json' => $extJson,
36
            'user_version' => $version,
37
            'user_desc' => $description,
38
        ]);
39
    }
40
41
    /**
42
     * @param string|null $path
43
     *
44
     * @return \EasyWeChat\Kernel\Http\Response
45
     */
46
    public function getQrCode(string $path = null)
47
    {
48
        return $this->requestRaw('wxa/get_qrcode', 'GET', [
49
            'query' => ['path' => $path],
50
        ]);
51
    }
52
53
    /**
54
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
55
     */
56
    public function getCategory()
57
    {
58
        return $this->httpGet('wxa/get_category');
59
    }
60
61
    /**
62
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
63
     */
64
    public function getPage()
65
    {
66
        return $this->httpGet('wxa/get_page');
67
    }
68
69
    /**
70
     * @param array $itemList
71
     *
72
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
73
     */
74
    public function submitAudit(array $itemList)
75
    {
76
        return $this->httpPostJson('wxa/submit_audit', [
77
            'item_list' => $itemList,
78
        ]);
79
    }
80
81
    /**
82
     * @param int $auditId
83
     *
84
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
85
     */
86
    public function getAuditStatus(int $auditId)
87
    {
88
        return $this->httpPostJson('wxa/get_auditstatus', [
89
            'auditid' => $auditId,
90
        ]);
91
    }
92
93
    /**
94
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
95
     */
96
    public function getLatestAuditStatus()
97
    {
98
        return $this->httpGet('wxa/get_latest_auditstatus');
99
    }
100
101
    /**
102
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
103
     */
104
    public function release()
105
    {
106
        return $this->httpPostJson('wxa/release');
107
    }
108
109
    /**
110
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
111
     */
112
    public function withdrawAudit()
113
    {
114
        return $this->httpGet('wxa/undocodeaudit');
115
    }
116
117
    /**
118
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
119
     */
120
    public function rollbackRelease()
121
    {
122
        return $this->httpGet('wxa/revertcoderelease');
123
    }
124
125
    /**
126
     * @param string $action
127
     *
128
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
129
     */
130
    public function changeVisitStatus(string $action)
131
    {
132
        return $this->httpPostJson('wxa/change_visitstatus', [
133
            'action' => $action,
134
        ]);
135
    }
136
137
    /**
138
     * 分阶段发布.
139
     *
140
     * @param int $grayPercentage
141
     *
142
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
143
     */
144
    public function grayRelease(int $grayPercentage)
145
    {
146
        return $this->httpPostJson('wxa/grayrelease', [
147
            'gray_percentage' => $grayPercentage,
148
        ]);
149
    }
150
151
    /**
152
     * 取消分阶段发布.
153
     *
154
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
155
     */
156
    public function revertGrayRelease()
157
    {
158
        return $this->httpGet('wxa/revertgrayrelease');
159
    }
160
161
    /**
162
     * 查询当前分阶段发布详情.
163
     *
164
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
165
     */
166
    public function getGrayReleasePlan()
167
    {
168
        return $this->httpGet('wxa/getgrayreleaseplan');
169
    }
170
}
171