Client::delete()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 10
cc 1
nc 1
nop 2
crap 1
1
<?php
2
/*
3
 * This file is part of the wannanbigpig/alipay-sdk-php.
4
 *
5
 * (c) wannanbigpig <[email protected]>
6
 *
7
 * This source file is subject to the MIT license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace EasyAlipay\MiniProgram\Members;
12
13
use EasyAlipay\Kernel\Support\Support;
14
15
class Client extends Support
16
{
17
    /**
18
     * alipay.open.app.members.create(应用添加成员).
19
     *
20
     * @param string $logonId
21
     * @param string $role
22
     *
23
     * @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response
24
     *
25
     * @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException
26
     * @throws \GuzzleHttp\Exception\GuzzleException
27
     * @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException
28
     */
29 2
    public function create(string $logonId, string $role = 'EXPERIENCER')
30
    {
31 2
        $method = 'alipay.open.app.members.create';
32
        $params = [
33 2
            'logon_id' => $logonId,
34 2
            'role' => $role,
35
        ];
36
37 2
        return $this->request($method, [
38 2
            'biz_content' => $params,
39
        ]);
40
    }
41
42
43
    /**
44
     * alipay.open.app.members.query(应用查询成员列表).
45
     *
46
     * @param string $role
47
     *
48
     * @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response
49
     *
50
     * @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException
51
     * @throws \GuzzleHttp\Exception\GuzzleException
52
     * @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException
53
     */
54 2
    public function query(string $role = 'EXPERIENCER')
55
    {
56 2
        $method = 'alipay.open.app.members.query';
57
        $params = [
58 2
            'role' => $role,
59
        ];
60
61 2
        return $this->request($method, [
62 2
            'biz_content' => $params,
63
        ]);
64
    }
65
66
    /**
67
     * alipay.open.app.members.delete(应用删除成员).
68
     *
69
     * @param string $userId
70
     * @param string $role
71
     *
72
     * @return array|object|\Psr\Http\Message\ResponseInterface|\WannanBigPig\Supports\Collection|\WannanBigPig\Supports\Http\Response
73
     *
74
     * @throws \EasyAlipay\Kernel\Exceptions\InvalidSignException
75
     * @throws \GuzzleHttp\Exception\GuzzleException
76
     * @throws \WannanBigPig\Supports\Exceptions\InvalidArgumentException
77
     */
78 2
    public function delete(string $userId, string $role = 'EXPERIENCER')
79
    {
80 2
        $method = 'alipay.open.app.members.delete';
81
        $params = [
82 2
            'user_id' => $userId,
83 2
            'role' => $role,
84
        ];
85
86 2
        return $this->request($method, [
87 2
            'biz_content' => $params,
88
        ]);
89
    }
90
}
91