-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeleteCallFlows.php
62 lines (52 loc) · 2.48 KB
/
DeleteCallFlows.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
declare(strict_types=1);
namespace Yproximite\IovoxBundle\Api\Calling\CallFlow;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Yproximite\IovoxBundle\Api\ErrorResult\InternalErrorResult;
use Yproximite\IovoxBundle\Api\ErrorResult\RequestMethodInvalidErrorResult;
use Yproximite\IovoxBundle\Api\ErrorResult\VersionEmptyErrorResult;
use Yproximite\IovoxBundle\Api\ErrorResult\VersionInvalidErrorResult;
use Yproximite\IovoxBundle\Api\QueryParameter\GenericQueryParameter;
use Yproximite\IovoxBundle\Api\QueryParameter\MethodQueryParameter;
use Yproximite\IovoxBundle\Api\QueryParameter\VersionQueryParameter;
use Yproximite\IovoxBundle\Exception\Api\BadResponseReturnException;
/**
* @see https://docs.iovox.com/display/RA/deleteCallFlows
*/
class DeleteCallFlows extends AbstractCallFlow implements DeleteCallFlowsInterface
{
public function executeQuery(array $queryParameters = []): bool
{
$query = $this->createQuery($queryParameters);
$response = $this->client->executeQuery($query);
if (Response::HTTP_NO_CONTENT === $response->getStatusCode()) {
return true;
}
throw new BadResponseReturnException($response, $this->errorResults);
}
protected function setMethod(): void
{
$this->method = Request::METHOD_DELETE;
}
protected function setQueryParameters(): void
{
$this->editableQueryParameters = [
self::QUERY_PARAMETER_CALL_FLOWS => new GenericQueryParameter(self::QUERY_PARAMETER_CALL_FLOWS, GenericQueryParameter::TYPE_STRING, 'A pipe delimited list of all Call Flows to be deleted', true),
self::QUERY_PARAMETER_DETACH_FROM_LINKS => new GenericQueryParameter(self::QUERY_PARAMETER_DETACH_FROM_LINKS, GenericQueryParameter::TYPE_BOOLEAN, 'Detaches the Call Flow from links. If FALSE, only Call Flows not attached to links can be deleted.'),
];
$this->allQueryParameters = array_merge([
VersionQueryParameter::getParameterName() => new VersionQueryParameter(),
MethodQueryParameter::getParameterName() => new MethodQueryParameter('deleteCallFlows'),
], $this->editableQueryParameters);
}
protected function setErrorResults(): void
{
$this->errorResults = [
new VersionEmptyErrorResult(),
new VersionInvalidErrorResult(),
new RequestMethodInvalidErrorResult($this->method),
new InternalErrorResult(),
];
}
}