1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | |
12: | |
13: | |
14: | |
15: | |
16: | namespace OpenSearch\Endpoints\Ltr; |
17: | |
18: | use OpenSearch\Exception\RuntimeException; |
19: | use OpenSearch\Endpoints\AbstractEndpoint; |
20: | |
21: | |
22: | |
23: | |
24: | class AddFeaturesToSet extends AbstractEndpoint |
25: | { |
26: | protected $name; |
27: | protected $store; |
28: | |
29: | public function getURI(): string |
30: | { |
31: | if (!isset($this->name) || $this->name === '') { |
32: | throw new RuntimeException('name is required for add_features_to_set'); |
33: | } |
34: | $name = $this->name; |
35: | $store = $this->store ?? null; |
36: | if (isset($store)) { |
37: | return '/_ltr/' . rawurlencode($store) . '/_featureset/' . rawurlencode($name) . '/_addfeatures'; |
38: | } |
39: | return '/_ltr/_featureset/' . rawurlencode($name) . '/_addfeatures'; |
40: | } |
41: | |
42: | public function getParamWhitelist(): array |
43: | { |
44: | return [ |
45: | 'merge', |
46: | 'routing', |
47: | 'version', |
48: | 'pretty', |
49: | 'human', |
50: | 'error_trace', |
51: | 'source', |
52: | 'filter_path' |
53: | ]; |
54: | } |
55: | |
56: | public function getMethod(): string |
57: | { |
58: | return 'POST'; |
59: | } |
60: | |
61: | public function setBody($body): static |
62: | { |
63: | if (is_null($body)) { |
64: | return $this; |
65: | } |
66: | $this->body = $body; |
67: | |
68: | return $this; |
69: | } |
70: | |
71: | public function setName($name): static |
72: | { |
73: | if (is_null($name)) { |
74: | return $this; |
75: | } |
76: | $this->name = $name; |
77: | |
78: | return $this; |
79: | } |
80: | |
81: | public function setStore($store): static |
82: | { |
83: | if (is_null($store)) { |
84: | return $this; |
85: | } |
86: | $this->store = $store; |
87: | |
88: | return $this; |
89: | } |
90: | } |
91: | |