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
|
|
|
|
13
|
|
|
final class AgencyClients extends Service |
14
|
|
|
{ |
15
|
|
|
/** |
16
|
|
|
* Возвращает список рекламодателей — клиентов агентства, |
17
|
|
|
* их параметры и настройки главных представителей рекламодателя. |
18
|
|
|
* |
19
|
|
|
* @param $SelectionCriteria |
20
|
|
|
* @param $FieldNames |
21
|
|
|
* @param $Page |
22
|
|
|
* @return array |
23
|
|
|
* @throws Throwable |
24
|
|
|
* |
25
|
|
|
* @see https://tech.yandex.ru/direct/doc/ref-v5/agencyclients/get-docpage |
26
|
|
|
*/ |
27
|
|
|
public function get($SelectionCriteria, $FieldNames, $Page = null) |
28
|
|
|
{ |
29
|
|
|
return $this->request([ |
30
|
|
|
'method' => 'get', |
31
|
|
|
'params' => array_filter([ |
32
|
|
|
'SelectionCriteria' => $SelectionCriteria, |
33
|
|
|
'FieldNames' => $FieldNames, |
34
|
|
|
'Page' => $Page |
35
|
|
|
]) |
36
|
|
|
]); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Регистрирует новых рекламодателей — клиентов агентства, |
41
|
|
|
* а также пользователей — главных представителей рекламодателя. |
42
|
|
|
* |
43
|
|
|
* @param $Login |
44
|
|
|
* @param $FirstName |
45
|
|
|
* @param $LastName |
46
|
|
|
* @param $Currency |
47
|
|
|
* @param $Grants |
48
|
|
|
* @param $Notification |
49
|
|
|
* @param $Settings |
50
|
|
|
* @return array |
51
|
|
|
* @throws Exception |
52
|
|
|
* @throws Throwable |
53
|
|
|
* |
54
|
|
|
* @see https://tech.yandex.ru/direct/doc/ref-v5/agencyclients/add-docpage/ |
55
|
|
|
*/ |
56
|
|
|
public function add($Login, $FirstName, $LastName, $Currency, $Notification, $Grants = null, $Settings = null) |
57
|
|
|
{ |
58
|
|
|
return $this->request([ |
59
|
|
|
'method' => 'add', |
60
|
|
|
'params' => array_filter([ |
61
|
|
|
'Login' => $Login, |
62
|
|
|
'FirstName' => $FirstName, |
63
|
|
|
'LastName' => $LastName, |
64
|
|
|
'Currency' => $Currency, |
65
|
|
|
'Grants' => $Grants, |
66
|
|
|
'Notification' => $Notification, |
67
|
|
|
'Setting' => $Settings |
68
|
|
|
]) |
69
|
|
|
]); |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* Изменяет параметры рекламодателей — клиентов агентства, а также настройки пользователей — |
74
|
|
|
* главных представителей рекламодателя. |
75
|
|
|
* |
76
|
|
|
* @inheritDoc |
77
|
|
|
* @param $Clients |
78
|
|
|
* @throws Throwable |
79
|
|
|
* |
80
|
|
|
* @see https://yandex.ru/dev/direct/doc/ref-v5/agencyclients/update-docpage/ |
81
|
|
|
*/ |
82
|
|
|
public function update($Clients) |
83
|
|
|
{ |
84
|
|
|
return $this->request([ |
85
|
|
|
'method' => 'update', |
86
|
|
|
'params' => [ |
87
|
|
|
'Clients' => $Clients |
88
|
|
|
] |
89
|
|
|
]); |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
|