Completed
Pull Request — master (#1565)
by milkmeowo
03:58
created

DimissionClient   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 44
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getUnassignedList() 0 5 1
A transfer() 0 9 1
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\ExternalContact;
13
14
use EasyWeChat\Kernel\BaseClient;
15
16
/**
17
 * Class DimissionClient.
18
 *
19
 * @author milkmeowo <[email protected]>
20
 */
21
class DimissionClient extends BaseClient
22
{
23
    /**
24
     * 获取离职成员的客户列表.
25
     *
26
     * @see https://work.weixin.qq.com/api/doc#90000/90135/91563
27
     *
28
     * @param int $pageId
29
     * @param int $pageSize
30
     *
31
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
32
     *
33
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
34
     */
35 1
    public function getUnassignedList(int $pageId = 0, int $pageSize = 1000)
36
    {
37 1
        return $this->httpPostJson('cgi-bin/externalcontact/get_unassigned_list', [
38 1
            'page_id' => $pageId,
39 1
            'page_size' => $pageSize,
40
        ]);
41
    }
42
43
    /**
44
     * 离职成员的外部联系人再分配.
45
     *
46
     * @see https://work.weixin.qq.com/api/doc#90000/90135/91564
47
     *
48
     * @param string $externalUserId
49
     * @param string $handoverUserId
50
     * @param string $takeoverUserId
51
     *
52
     * @return array|\EasyWeChat\Kernel\Support\Collection|object|\Psr\Http\Message\ResponseInterface|string
53
     *
54
     * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException
55
     */
56 1
    public function transfer(string $externalUserId, string $handoverUserId, string $takeoverUserId)
57
    {
58
        $params = [
59 1
            'external_userid' => $externalUserId,
60 1
            'handover_userid' => $handoverUserId,
61 1
            'takeover_userid' => $takeoverUserId,
62
        ];
63
64 1
        return $this->httpPostJson('cgi-bin/externalcontact/transfer', $params);
65
    }
66
}
67