1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
4
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
5
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
6
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
7
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
8
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
9
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
10
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
11
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
12
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
13
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
14
|
|
|
* |
15
|
|
|
* This software consists of voluntary contributions made by many individuals |
16
|
|
|
* and is licensed under the MIT license. |
17
|
|
|
*/ |
18
|
|
|
namespace Elastification\Client\Request\V2x\Cat; |
19
|
|
|
|
20
|
|
|
use Elastification\Client\Request\RequestMethods; |
21
|
|
|
use Elastification\Client\Request\Shared\AbstractBaseRequest; |
22
|
|
|
use Elastification\Client\Response\Response; |
23
|
|
|
use Elastification\Client\Serializer\SerializerInterface; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Class NodeAttrsCatRequest |
27
|
|
|
* @package Elastification\Client\Request\V2x\Cat |
28
|
|
|
*/ |
29
|
|
|
class NodeAttrsCatRequest extends AbstractBaseRequest |
30
|
|
|
{ |
31
|
|
|
const REQUEST_ACTION = '_cat'; |
32
|
|
|
const CAT_TYPE = 'nodeattrs'; |
33
|
|
|
|
34
|
|
|
|
35
|
11 |
|
public function __construct($index, $type, SerializerInterface $serializer, array $serializerParams = array()) |
36
|
|
|
{ |
37
|
11 |
|
parent::__construct($index, $type, $serializer, $serializerParams); |
38
|
|
|
|
39
|
11 |
|
$this->setParameter('format', 'json'); |
40
|
11 |
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @param string $rawData |
44
|
|
|
* @param \Elastification\Client\Serializer\SerializerInterface $serializer |
45
|
|
|
* @param array $serializerParams |
46
|
|
|
* |
47
|
|
|
* @return Response |
48
|
|
|
* @author Daniel Wendlandt |
49
|
|
|
*/ |
50
|
1 |
|
public function createResponse( |
51
|
|
|
$rawData, |
52
|
|
|
SerializerInterface $serializer, |
53
|
|
|
array $serializerParams = array() |
54
|
|
|
) { |
55
|
1 |
|
return new Response($rawData, $serializer, $serializerParams); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* gets a response class name that is supported by this class |
60
|
|
|
* |
61
|
|
|
* @return string |
62
|
|
|
* @author Daniel Wendlandt |
63
|
|
|
*/ |
64
|
1 |
|
public function getSupportedClass() |
65
|
|
|
{ |
66
|
1 |
|
return 'Elastification\Client\Response\Response'; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
/** |
70
|
|
|
* @inheritdoc |
71
|
|
|
*/ |
72
|
1 |
|
public function getMethod() |
73
|
|
|
{ |
74
|
1 |
|
return RequestMethods::GET; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* @inheritdoc |
79
|
|
|
*/ |
80
|
1 |
|
public function getAction() |
81
|
|
|
{ |
82
|
1 |
|
return self::CAT_TYPE; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @inheritdoc |
87
|
|
|
*/ |
88
|
1 |
|
public function getIndex() |
89
|
|
|
{ |
90
|
1 |
|
return self::REQUEST_ACTION; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* @inheritdoc |
95
|
|
|
*/ |
96
|
1 |
|
public function getType() |
97
|
|
|
{ |
98
|
1 |
|
return null; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @inheritdoc |
103
|
|
|
*/ |
104
|
1 |
|
public function getBody() |
105
|
|
|
{ |
106
|
1 |
|
return null; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @inheritdoc |
111
|
|
|
*/ |
112
|
1 |
|
public function setBody($body) |
113
|
|
|
{ |
114
|
|
|
//do nothing |
115
|
1 |
|
} |
116
|
|
|
|
117
|
|
|
|
118
|
|
|
} |
119
|
|
|
|