@@ 29-89 (lines=61) @@ | ||
26 | * @package Elastification\Client\Request\Shared |
|
27 | * @author Daniel Wendlandt |
|
28 | */ |
|
29 | abstract class AbstractAliasesRequest extends AbstractBaseRequest |
|
30 | { |
|
31 | const REQUEST_ACTION = '_aliases'; |
|
32 | ||
33 | /** |
|
34 | * @var null|string |
|
35 | */ |
|
36 | private $body = null; |
|
37 | ||
38 | /** |
|
39 | * @inheritdoc |
|
40 | */ |
|
41 | public function getIndex() |
|
42 | { |
|
43 | return null; |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * @inheritdoc |
|
48 | */ |
|
49 | public function getType() |
|
50 | { |
|
51 | return null; |
|
52 | } |
|
53 | ||
54 | /** |
|
55 | * @inheritdoc |
|
56 | */ |
|
57 | public function getMethod() |
|
58 | { |
|
59 | return RequestMethods::POST; |
|
60 | } |
|
61 | ||
62 | /** |
|
63 | * @inheritdoc |
|
64 | */ |
|
65 | public function getAction() |
|
66 | { |
|
67 | return self::REQUEST_ACTION; |
|
68 | } |
|
69 | ||
70 | /** |
|
71 | * @inheritdoc |
|
72 | */ |
|
73 | public function getBody() |
|
74 | { |
|
75 | return $this->body; |
|
76 | } |
|
77 | ||
78 | /** |
|
79 | * @inheritdoc |
|
80 | */ |
|
81 | public function setBody($body) |
|
82 | { |
|
83 | if (empty($body)) { |
|
84 | throw new RequestException('Body can not be empty'); |
|
85 | } |
|
86 | ||
87 | $this->body = $this->serializer->serialize($body, $this->serializerParams); |
|
88 | } |
|
89 | } |
|
90 |
@@ 23-80 (lines=58) @@ | ||
20 | use Elastification\Client\Request\RequestMethods; |
|
21 | use Elastification\Client\Request\Shared\AbstractBaseRequest; |
|
22 | ||
23 | abstract class AbstractUpdateAliasesRequest extends AbstractBaseRequest |
|
24 | { |
|
25 | ||
26 | const REQUEST_ACTION = '_aliases'; |
|
27 | ||
28 | /** |
|
29 | * @var null|mixed |
|
30 | */ |
|
31 | private $body = null; |
|
32 | ||
33 | /** |
|
34 | * @inheritdoc |
|
35 | */ |
|
36 | public function getIndex() |
|
37 | { |
|
38 | return null; |
|
39 | } |
|
40 | ||
41 | /** |
|
42 | * @inheritdoc |
|
43 | */ |
|
44 | public function getType() |
|
45 | { |
|
46 | return null; |
|
47 | } |
|
48 | ||
49 | /** |
|
50 | * @inheritdoc |
|
51 | */ |
|
52 | public function getMethod() |
|
53 | { |
|
54 | return RequestMethods::POST; |
|
55 | } |
|
56 | ||
57 | /** |
|
58 | * @inheritdoc |
|
59 | */ |
|
60 | public function getAction() |
|
61 | { |
|
62 | return self::REQUEST_ACTION; |
|
63 | } |
|
64 | ||
65 | /** |
|
66 | * @inheritdoc |
|
67 | */ |
|
68 | public function getBody() |
|
69 | { |
|
70 | return $this->body; |
|
71 | } |
|
72 | ||
73 | /** |
|
74 | * @inheritdoc |
|
75 | */ |
|
76 | public function setBody($body) |
|
77 | { |
|
78 | $this->body = $this->serializer->serialize($body, $this->serializerParams); |
|
79 | } |
|
80 | } |
|
81 |