Client::getRoom()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 7
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\Work\MsgAudit;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * Class Client.
18
 *
19
 * @author ZengJJ <[email protected] >
20
 */
21
class Client extends BaseClient
22
{
23
    /**
24
     * @param string|null $type
25
     *
26
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
27
     *
28
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException|\GuzzleHttp\Exception\GuzzleException
29
     */
30
    public function getPermitUsers(string $type = null)
31
    {
32
        return $this->httpPostJson('cgi-bin/msgaudit/get_permit_user_list', (empty($type) ? [] : ['type' => $type]));
33
    }
34
35
    /**
36
     * @param array $info 数组,格式: [[userid, exteranalopenid], [userid, exteranalopenid]]
37
     *
38
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
39
     *
40
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
41
     * @throws \GuzzleHttp\Exception\GuzzleException
42
     */
43
    public function getSingleAgreeStatus(array $info)
44
    {
45
        $params = [
46
            'info' => $info
47
        ];
48
49
        return $this->httpPostJson('cgi-bin/msgaudit/check_single_agree', $params);
50
    }
51
52
    /**
53
     * @param  string  $roomId
54
     *
55
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
56
     *
57
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
58
     * @throws \GuzzleHttp\Exception\GuzzleException
59
     */
60
    public function getRoomAgreeStatus(string $roomId)
61
    {
62
        $params = [
63
            'roomid' => $roomId
64
        ];
65
66
        return $this->httpPostJson('cgi-bin/msgaudit/check_room_agree', $params);
67
    }
68
69
    /**
70
     * @param  string  $roomId
71
     *
72
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
73
     *
74
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
75
     * @throws \GuzzleHttp\Exception\GuzzleException
76
     */
77
    public function getRoom(string $roomId)
78
    {
79
        $params = [
80
            'roomid' => $roomId
81
        ];
82
83
        return $this->httpPostJson('cgi-bin/msgaudit/groupchat/get', $params);
84
    }
85
}
86