1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | |
6: | |
7: | |
8: | |
9: | |
10: | |
11: | |
12: | |
13: | |
14: | |
15: | |
16: | namespace OpenSearch\Endpoints\Ml; |
17: | |
18: | use OpenSearch\Exception\RuntimeException; |
19: | use OpenSearch\Endpoints\AbstractEndpoint; |
20: | |
21: | |
22: | |
23: | |
24: | class GetAllMessages extends AbstractEndpoint |
25: | { |
26: | protected $memory_id; |
27: | |
28: | public function getURI(): string |
29: | { |
30: | $memory_id = $this->memory_id ?? null; |
31: | if (isset($memory_id)) { |
32: | return "/_plugins/_ml/memory/$memory_id/messages"; |
33: | } |
34: | throw new RuntimeException('Missing parameter for the endpoint ml.get_all_messages'); |
35: | } |
36: | |
37: | public function getParamWhitelist(): array |
38: | { |
39: | return [ |
40: | 'max_results', |
41: | 'next_token', |
42: | 'pretty', |
43: | 'human', |
44: | 'error_trace', |
45: | 'source', |
46: | 'filter_path' |
47: | ]; |
48: | } |
49: | |
50: | public function getMethod(): string |
51: | { |
52: | return 'GET'; |
53: | } |
54: | |
55: | public function setMemoryId($memory_id): static |
56: | { |
57: | if (is_null($memory_id)) { |
58: | return $this; |
59: | } |
60: | $this->memory_id = $memory_id; |
61: | |
62: | return $this; |
63: | } |
64: | } |
65: | |