Completed
Push — master ( 09c178...97031f )
by mingyoung
03:36
created

Client::readUsers()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
3
/*
4
 * This file is part of the mingyoung/dingtalk.
5
 *
6
 * (c) 张铭阳 <[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 EasyDingTalk\Chat;
13
14
use EasyDingTalk\Kernel\BaseClient;
15
16
class Client extends BaseClient
17
{
18
    /**
19
     * 发送群消息
20
     *
21
     * @param string $chatId
22
     * @param string $message
23
     *
24
     * @return mixed
25
     */
26
    public function send($chatId, $message)
27
    {
28
        return $this->client->postJson('chat/send', [
29
            'chatid' => $chatId, 'msg' => $message,
30
        ]);
31
    }
32
33
    /**
34
     * 查询群消息已读人员列表
35
     *
36
     * @param string $messageId
37
     * @param int    $cursor
38
     * @param int    $size
39
     *
40
     * @return mixed
41
     */
42
    public function result($messageId, $cursor, $size)
43
    {
44
        return $this->client->get('chat/getReadList', [
45
            'messageId' => $messageId, 'cursor' => $cursor, 'size' => $size,
46
        ]);
47
    }
48
49
    /**
50
     * 创建会话
51
     *
52
     * @param array $params
53
     *
54
     * @return mixed
55
     */
56
    public function create($params)
57
    {
58
        return $this->client->postJson('chat/create', $params);
59
    }
60
61
    /**
62
     * 修改会话
63
     *
64
     * @param string $chatId
65
     * @param array  $params
66
     *
67
     * @return mixed
68
     */
69
    public function update($chatId, $params)
70
    {
71
        return $this->client->postJson('chat/update', ['chatid' => $chatId] + $params);
72
    }
73
74
    /**
75
     * 获取会话
76
     *
77
     * @param string $chatId
78
     *
79
     * @return mixed
80
     */
81
    public function get($chatId)
82
    {
83
        return $this->client->get('chat/get', ['chatid' => $chatId]);
84
    }
85
}
86