Completed
Pull Request — master (#1564)
by milkmeowo
07:34 queued 01:26
created

Client::list()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 0
cts 0
cp 0
crap 2
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\Crm;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * Class Client.
18
 *
19
 * @author mingyoung <[email protected]>
20
 */
21
class Client extends BaseClient
22
{
23
    /**
24
     * 获取配置了客户联系功能的成员列表.
25
     *
26
     * @see https://work.weixin.qq.com/api/doc#90000/90135/91554
27
     *
28 1
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
29
     *
30 1
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
31 1
     */
32
    public function followUsers()
33
    {
34
        return $this->httpGet('cgi-bin/externalcontact/get_follow_user_list');
35
    }
36
37
    /**
38
     * 获取外部联系人列表.
39
     *
40
     * @see https://work.weixin.qq.com/api/doc#90000/90135/91555
41
     *
42
     * @param $userId
43
     *
44
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
45
     *
46
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
47
     */
48
    public function list($userId)
49
    {
50
        return $this->httpGet('cgi-bin/externalcontact/list', [
51
            'userid' => $userId,
52
        ]);
53
    }
54
55
    /**
56
     * 获取外部联系人详情.
57
     *
58
     * @see https://work.weixin.qq.com/api/doc#90000/90135/91556
59
     *
60
     * @param $externalUserId
61
     *
62
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
63
     *
64
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
65
     */
66
    public function get($externalUserId)
67
    {
68
        return $this->httpGet('cgi-bin/externalcontact/get', [
69
            'external_userid' => $externalUserId,
70
        ]);
71
    }
72
}
73