OperateClient::changeOwner()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 8
ccs 0
cts 7
cp 0
crap 2
rs 10
1
<?php
2
3
namespace EasyIM\TencentIM\Group;
4
5
use EasyIM\Kernel\BaseClient;
6
use EasyIM\Kernel\Exceptions\InvalidConfigException;
7
use EasyIM\Kernel\Support\Collection;
8
use GuzzleHttp\Exception\GuzzleException;
9
use Psr\Http\Message\ResponseInterface;
10
11
/**
12
 * Class OperateClient
13
 *
14
 * @package EasyIM\TencentIM\Group
15
 * @author  yingzhan <[email protected]>
16
 */
17
class OperateClient extends BaseClient
18
{
19
    /**
20
     * Mass prohibitions and cancellations chat.
21
     *
22
     * @param string $groupId
23
     * @param array  $membersAccount
24
     * @param int    $shutUpTime
25
     *
26
     * @return array|Collection|object|ResponseInterface|string
27
     * @throws InvalidConfigException
28
     * @throws GuzzleException
29
     */
30
    public function forbidMsg(string $groupId, array $membersAccount, int $shutUpTime)
31
    {
32
        $params = [
33
            'GroupId' => $groupId,
34
            'Members_Account' => $membersAccount,
35
            'ShutUpTime' => $shutUpTime
36
        ];
37
38
        return $this->httpPostJson('group_open_http_svc/forbid_send_msg', $params);
39
    }
40
41
    /**
42
     * Get forbidden group member list.
43
     *
44
     * @param string $groupId
45
     *
46
     * @return array|Collection|object|ResponseInterface|string
47
     * @throws InvalidConfigException|GuzzleException
48
     */
49
    public function getGroupShut(string $groupId)
50
    {
51
        $params = [
52
            'GroupId' => $groupId
53
        ];
54
55
        return $this->httpPostJson('group_open_http_svc/get_group_shutted_uin', $params);
56
    }
57
58
    /**
59
     * Transfer group owner.
60
     *
61
     * @param string $groupId
62
     * @param string $newOwnerAccount
63
     *
64
     * @return array|Collection|object|ResponseInterface|string
65
     * @throws InvalidConfigException
66
     * @throws GuzzleException
67
     */
68
    public function changeOwner(string $groupId, string $newOwnerAccount)
69
    {
70
        $params = [
71
            'GroupId' => $groupId,
72
            'NewOwner_Account' => $newOwnerAccount
73
        ];
74
75
        return $this->httpPostJson('group_open_http_svc/change_group_owner', $params);
76
    }
77
78
    /**
79
     * Set member unread message count.
80
     *
81
     * @param string $groupId
82
     * @param string $memberAccount
83
     * @param int    $unreadMsgNum
84
     *
85
     * @return array|Collection|object|ResponseInterface|string
86
     * @throws InvalidConfigException
87
     * @throws GuzzleException
88
     */
89
    public function setUnreadMsgNum(string $groupId, string $memberAccount, int $unreadMsgNum)
90
    {
91
        $params = [
92
            'GroupId' => $groupId,
93
            'Member_Account' => $memberAccount,
94
            'UnreadMsgNum' => $unreadMsgNum
95
        ];
96
97
        return $this->httpPostJson('group_open_http_svc/set_unread_msg_num', $params);
98
    }
99
}
100