Completed
Pull Request — master (#1615)
by
unknown
03:47
created

DevClient::delete()   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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
ccs 3
cts 3
cp 1
crap 1
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\MiniProgram\Plugin;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * Class DevClient.
18
 *
19
 * @author her-cat <[email protected]>
20
 */
21
class DevClient extends BaseClient
22
{
23
    /**
24
     * Get users.
25
     *
26
     * @param int $page
27
     * @param int $size
28
     *
29
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
30
     *
31
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
32
     */
33 1
    public function getUsers(int $page = 1, int $size = 10)
34
    {
35 1
        return $this->httpPostJson('wxa/devplugin', [
36 1
            'action' => 'dev_apply_list',
37 1
            'page' => $page,
38 1
            'num' => $size,
39
        ]);
40
    }
41
42
    /**
43
     * Agree to use plugin.
44
     *
45
     * @param string $appId
46
     *
47
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
48
     *
49
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
50
     */
51 1
    public function agree(string $appId)
52
    {
53 1
        return $this->httpPostJson('wxa/devplugin', [
54 1
            'action' => 'dev_agree',
55 1
            'appid' => $appId,
56
        ]);
57
    }
58
59
    /**
60
     * Refuse to use plugin.
61
     *
62
     * @param string $reason
63
     *
64
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
65
     *
66
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
67
     */
68 1
    public function refuse(string $reason)
69
    {
70 1
        return $this->httpPostJson('wxa/devplugin', [
71 1
            'action' => 'dev_refuse',
72 1
            'reason' => $reason,
73
        ]);
74
    }
75
76
    /**
77
     * Delete rejected applications.
78
     *
79
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
80
     *
81
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
82
     */
83 1
    public function delete()
84
    {
85 1
        return $this->httpPostJson('wxa/devplugin', [
86 1
            'action' => 'dev_delete',
87
        ]);
88
    }
89
}
90