AgencyClients::add()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 7
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author Dmitry Gladyshev <[email protected]>
4
 * @date 30.03.17 11:39
5
 */
6
7
namespace Yandex\Direct\Service;
8
9
use Yandex\Direct\Exception\Exception;
10
use Yandex\Direct\Service;
11
use Throwable;
12
use function Yandex\Direct\filter_params;
13
use function Yandex\Direct\get_param_names;
14
15
final class AgencyClients extends Service
16
{
17
    /**
18
     * Возвращает список рекламодателей — клиентов агентства,
19
     * их параметры и настройки главных представителей рекламодателя.
20
     *
21
     * @param $SelectionCriteria
22
     * @param $FieldNames
23
     * @param $Page
24
     * @return array
25
     * @throws Throwable
26
     *
27
     * @see https://tech.yandex.ru/direct/doc/ref-v5/agencyclients/get-docpage
28
     */
29
    public function get($SelectionCriteria, $FieldNames, $Page = null)
30
    {
31
        return $this->request([
32
            'method' => 'get',
33
            'params' => array_filter(compact(get_param_names(__METHOD__)))
34
        ]);
35
    }
36
37
    /**
38
     * Регистрирует новых рекламодателей — клиентов агентства,
39
     * а также пользователей — главных представителей рекламодателя.
40
     *
41
     * @param $Login
42
     * @param $FirstName
43
     * @param $LastName
44
     * @param $Currency
45
     * @param $Grants
46
     * @param $Notification
47
     * @param $Settings
48
     * @return array
49
     * @throws Exception
50
     * @throws Throwable
51
     *
52
     * @see https://tech.yandex.ru/direct/doc/ref-v5/agencyclients/add-docpage/
53
     */
54
    public function add($Login, $FirstName, $LastName, $Currency, $Notification, $Grants = null, $Settings = null)
55
    {
56
        $params = compact(get_param_names(__METHOD__));
57
58
        return $this->request([
59
            'method' => 'add',
60
            'params' => $params
61
        ]);
62
    }
63
64
    /**
65
     * Изменяет параметры рекламодателей — клиентов агентства, а также настройки пользователей —
66
     * главных представителей рекламодателя.
67
     *
68
     * @inheritDoc
69
     * @param $Clients
70
     * @throws Throwable
71
     *
72
     * @see https://yandex.ru/dev/direct/doc/ref-v5/agencyclients/update-docpage/
73
     */
74
    public function update($Clients)
75
    {
76
        return $this->request([
77
            'method' => 'update',
78
            'params' => [
79
                'Clients' => $Clients
80
            ]
81
        ]);
82
    }
83
}
84