1: <?php
2:
3: declare(strict_types=1);
4:
5: /**
6: * SPDX-License-Identifier: Apache-2.0
7: *
8: * The OpenSearch Contributors require contributions made to
9: * this file be licensed under the Apache-2.0 license or a
10: * compatible open source license.
11: *
12: * Modifications Copyright OpenSearch Contributors. See
13: * GitHub history for details.
14: */
15:
16: namespace OpenSearch\Endpoints\Ltr;
17:
18: use OpenSearch\Exception\RuntimeException;
19: use OpenSearch\Endpoints\AbstractEndpoint;
20:
21: /**
22: * NOTE: This file is autogenerated using util/GenerateEndpoints.php
23: */
24: class AddFeaturesToSetByQuery extends AbstractEndpoint
25: {
26: protected $name;
27: protected $query;
28: protected $store;
29:
30: public function getURI(): string
31: {
32: if (!isset($this->name) || $this->name === '') {
33: throw new RuntimeException('name is required for add_features_to_set_by_query');
34: }
35: $name = $this->name;
36: if (!isset($this->query) || $this->query === '') {
37: throw new RuntimeException('query is required for add_features_to_set_by_query');
38: }
39: $query = $this->query;
40: $store = $this->store ?? null;
41: if (isset($store)) {
42: return '/_ltr/' . rawurlencode($store) . '/_featureset/' . rawurlencode($name) . '/_addfeatures/' . rawurlencode($query);
43: }
44: return '/_ltr/_featureset/' . rawurlencode($name) . '/_addfeatures/' . rawurlencode($query);
45: }
46:
47: public function getParamWhitelist(): array
48: {
49: return [
50: 'merge',
51: 'routing',
52: 'version',
53: 'pretty',
54: 'human',
55: 'error_trace',
56: 'source',
57: 'filter_path'
58: ];
59: }
60:
61: public function getMethod(): string
62: {
63: return 'POST';
64: }
65:
66: public function setName($name): static
67: {
68: if (is_null($name)) {
69: return $this;
70: }
71: $this->name = $name;
72:
73: return $this;
74: }
75:
76: public function setQuery($query): static
77: {
78: if (is_null($query)) {
79: return $this;
80: }
81: $this->query = $query;
82:
83: return $this;
84: }
85:
86: public function setStore($store): static
87: {
88: if (is_null($store)) {
89: return $this;
90: }
91: $this->store = $store;
92:
93: return $this;
94: }
95: }
96: