Completed
Push — master ( 0648f6...5a6f61 )
by mingyoung
14s queued 10s
created

Client::setVisibleScopes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 4
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\Microapp;
13
14
use EasyDingTalk\Kernel\BaseClient;
15
16
class Client extends BaseClient
17
{
18
    /**
19
     * 获取应用列表
20
     *
21
22
     *
23
     * @return mixed
24
     */
25
    public function list()
26
    {
27
        return $this->client->postJson('microapp/list');
28
    }
29
30
    /**
31
     * 获取员工可见的应用列表
32
     *
33
     * @param string $userId
34
     *
35
     * @return mixed
36
     */
37
    public function listByUserId($userId)
38
    {
39
        return $this->client->get('microapp/list_by_userid', compact('userId'));
40
    }
41
42
    /**
43
     * 获取应用的可见范围
44
     *
45
     * @param int $agentId
46
     *
47
     * @return mixed
48
     */
49
    public function visibleScopes($agentId)
50
    {
51
        return $this->client->get('microapp/visible_scopes', compact('agentId'));
52
    }
53
54
    /**
55
     * 设置应用的可见范围
56
     *
57
     * @param int   $agentId
58
     * @param bool  $isHidden
59
     * @param array $userIds
60
     * @param array $departmentIds
61
     *
62
     * @return mixed
63
     */
64
    public function setVisibleScopes($agentId, $isHidden, $userIds, $departmentIds)
65
    {
66
        return $this->client->postJson('microapp/set_visible_scopes', compact('agentId', 'isHidden') + ['userVisibleScopes' => $userIds, 'deptVisibleScopes' => $departmentIds]);
67
    }
68
}
69