| @@ 184-205 (lines=22) @@ | ||
| 181 | } |
|
| 182 | break; |
|
| 183 | ||
| 184 | case 'deleteCounter': |
|
| 185 | if (isset($_POST['counterId']) && $_POST['counterId']) { |
|
| 186 | //DELETE /counter/{id} |
|
| 187 | /** |
|
| 188 | * @see http://api.yandex.ru/metrika/doc/ref/reference/delete-counter.xml |
|
| 189 | */ |
|
| 190 | $response = $managementClient |
|
| 191 | ->counters() |
|
| 192 | ->deleteCounter($_POST['counterId']); |
|
| 193 | ||
| 194 | ||
| 195 | if (isset($response['errors']) && $response['errors']) { |
|
| 196 | $status = 'error'; |
|
| 197 | $errorMessage = $response['errors'][0]['text']; |
|
| 198 | ||
| 199 | } else { |
|
| 200 | $result = array( |
|
| 201 | 'id' => $_POST['counterId'] |
|
| 202 | ); |
|
| 203 | } |
|
| 204 | } |
|
| 205 | break; |
|
| 206 | ||
| 207 | case 'addDelegate': |
|
| 208 | if (isset($_POST['userLogin'], $_POST['createAt'], $_POST['comment']) && $_POST['userLogin']) { |
|
| @@ 243-263 (lines=21) @@ | ||
| 240 | } |
|
| 241 | break; |
|
| 242 | ||
| 243 | case 'deleteDelegate': |
|
| 244 | if (isset($_POST['userLogin']) && $_POST['userLogin']) { |
|
| 245 | //DELETE /management/v1/delegate/{userLogin} |
|
| 246 | /** |
|
| 247 | * @see http://api.yandex.ru/metrika/doc/beta/management/delegates/deletedelegateold.xml |
|
| 248 | */ |
|
| 249 | $response = $managementClient |
|
| 250 | ->delegates() |
|
| 251 | ->deleteDelegate($_POST['userLogin']); |
|
| 252 | ||
| 253 | if (isset($response['errors']) && $response['errors']) { |
|
| 254 | $status = 'error'; |
|
| 255 | $errorMessage = $response['errors'][0]['text']; |
|
| 256 | ||
| 257 | } else { |
|
| 258 | $result = array( |
|
| 259 | 'id' => $_POST['userLogin'] |
|
| 260 | ); |
|
| 261 | } |
|
| 262 | } |
|
| 263 | break; |
|
| 264 | ||
| 265 | case 'deleteAccount': |
|
| 266 | if (isset($_POST['userLogin']) && $_POST['userLogin']) { |
|
| @@ 265-285 (lines=21) @@ | ||
| 262 | } |
|
| 263 | break; |
|
| 264 | ||
| 265 | case 'deleteAccount': |
|
| 266 | if (isset($_POST['userLogin']) && $_POST['userLogin']) { |
|
| 267 | //DELETE /management/v1/account/{userLogin} |
|
| 268 | /** |
|
| 269 | * @see http://api.yandex.ru/metrika/doc/beta/management/accounts/deleteaccountold.xml |
|
| 270 | */ |
|
| 271 | $response = $managementClient |
|
| 272 | ->accounts() |
|
| 273 | ->deleteAccount($_POST['userLogin']); |
|
| 274 | ||
| 275 | if (isset($response['errors']) && $response['errors']) { |
|
| 276 | $status = 'error'; |
|
| 277 | $errorMessage = $response['errors'][0]['text']; |
|
| 278 | ||
| 279 | } else { |
|
| 280 | $result = array( |
|
| 281 | 'id' => $_POST['userLogin'] |
|
| 282 | ); |
|
| 283 | } |
|
| 284 | } |
|
| 285 | break; |
|
| 286 | ||
| 287 | case 'addFilter': |
|
| 288 | if (isset($_POST['params'], $_POST['counterId']) && $_POST['params'] && $_POST['counterId']) { |
|