1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Gladyshev\Yandex\Direct\Service; |
4
|
|
|
|
5
|
|
|
use Gladyshev\Yandex\Direct\Exception\ErrorResponseException; |
6
|
|
|
|
7
|
|
|
|
8
|
|
|
use function Gladyshev\Yandex\Direct\get_param_names; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* Class BidModifiers |
12
|
|
|
* @package Gladyshev\Yandex\Direct\Service |
13
|
|
|
*/ |
14
|
|
|
final class BidModifiers extends \Gladyshev\Yandex\Direct\AbstractService |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* Создает корректировки ставок. |
18
|
|
|
* |
19
|
|
|
* @param $BidModifiers |
20
|
|
|
* @return array |
21
|
|
|
* @throws \Throwable |
22
|
|
|
* |
23
|
|
|
* @see https://tech.yandex.ru/direct/doc/ref-v5/bidmodifiers/add-docpage/ |
24
|
|
|
*/ |
25
|
|
|
public function add($BidModifiers) |
26
|
|
|
{ |
27
|
|
|
return $this->call([ |
28
|
|
|
'method' => 'add', |
29
|
|
|
'params' => [ |
30
|
|
|
'BidModifiers' => $BidModifiers |
31
|
|
|
] |
32
|
|
|
]); |
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Удаляет корректировки ставок. |
37
|
|
|
* |
38
|
|
|
* @param $SelectionCriteria |
39
|
|
|
* @return array |
40
|
|
|
* @throws \Throwable |
41
|
|
|
* |
42
|
|
|
* @see https://tech.yandex.ru/direct/doc/ref-v5/bidmodifiers/delete-docpage/ |
43
|
|
|
*/ |
44
|
|
|
public function delete($SelectionCriteria) |
45
|
|
|
{ |
46
|
|
|
return $this->call([ |
47
|
|
|
'method' => 'delete', |
48
|
|
|
'params' => [ |
49
|
|
|
'SelectionCriteria' => $SelectionCriteria |
50
|
|
|
] |
51
|
|
|
]); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Возвращает параметры корректировок, отвечающих заданным критериям. |
56
|
|
|
* |
57
|
|
|
* @param array $SelectionCriteria |
58
|
|
|
* @param array $FieldNames |
59
|
|
|
* @param array $MobileAdjustmentFieldNames |
60
|
|
|
* @param array $DemographicsAdjustmentFieldNames |
61
|
|
|
* @param array $RetargetingAdjustmentFieldNames |
62
|
|
|
* @param array $RegionalAdjustmentFieldNames |
63
|
|
|
* @param array $VideoAdjustmentFieldNames |
64
|
|
|
* @param array $SmartAdAdjustmentFieldNames |
65
|
|
|
* @param array $Page |
66
|
|
|
* |
67
|
|
|
* @return array |
68
|
|
|
* |
69
|
|
|
* @throws \Throwable |
70
|
|
|
* @throws \ReflectionException |
71
|
|
|
* @throws ErrorResponseException |
72
|
|
|
* |
73
|
|
|
* @see https://tech.yandex.ru/direct/doc/ref-v5/bidmodifiers/get-docpage/ |
74
|
|
|
*/ |
75
|
|
|
public function get( |
76
|
|
|
$SelectionCriteria, |
77
|
|
|
$FieldNames, |
78
|
|
|
$MobileAdjustmentFieldNames = null, |
79
|
|
|
$DemographicsAdjustmentFieldNames = null, |
80
|
|
|
$RetargetingAdjustmentFieldNames = null, |
81
|
|
|
$RegionalAdjustmentFieldNames = null, |
82
|
|
|
$VideoAdjustmentFieldNames = null, |
83
|
|
|
$SmartAdAdjustmentFieldNames = null, |
84
|
|
|
$Page = null |
85
|
|
|
) { |
86
|
|
|
$params = compact(get_param_names(__METHOD__)); |
87
|
|
|
|
88
|
|
|
return $this->call([ |
89
|
|
|
'method' => 'get', |
90
|
|
|
'params' => $params |
91
|
|
|
]); |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* Изменяет значения коэффициентов в корректировках ставок. |
96
|
|
|
* |
97
|
|
|
* @param $BidModifiers |
98
|
|
|
* @return array |
99
|
|
|
* @throws \Throwable |
100
|
|
|
* |
101
|
|
|
* @see https://tech.yandex.ru/direct/doc/ref-v5/bidmodifiers/set-docpage/ |
102
|
|
|
*/ |
103
|
|
|
public function setAuto($BidModifiers) |
104
|
|
|
{ |
105
|
|
|
return $this->call([ |
106
|
|
|
'method' => 'setAuto', |
107
|
|
|
'params' => [ |
108
|
|
|
'BidModifiers' => $BidModifiers |
109
|
|
|
] |
110
|
|
|
]); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Включает/выключает набор корректировок. |
115
|
|
|
* |
116
|
|
|
* @param $BidModifierToggleItems |
117
|
|
|
* @return array |
118
|
|
|
* @throws \Throwable |
119
|
|
|
* |
120
|
|
|
* @see https://tech.yandex.ru/direct/doc/ref-v5/bidmodifiers/toggle-docpage/ |
121
|
|
|
*/ |
122
|
|
|
public function toggle($BidModifierToggleItems) |
123
|
|
|
{ |
124
|
|
|
return $this->call([ |
125
|
|
|
'method' => 'toggle', |
126
|
|
|
'params' => [ |
127
|
|
|
'BidModifierToggleItems' => $BidModifierToggleItems |
128
|
|
|
] |
129
|
|
|
]); |
130
|
|
|
} |
131
|
|
|
} |
132
|
|
|
|