33
33
package org .opensearch .client .opensearch .cat ;
34
34
35
35
import java .util .HashMap ;
36
- import java .util .List ;
37
36
import java .util .Map ;
38
37
import javax .annotation .Nonnull ;
39
38
import javax .annotation .Nullable ;
40
39
import org .opensearch .client .opensearch ._types .RequestBase ;
41
- import org .opensearch .client .util .ApiTypeHelper ;
42
40
import org .opensearch .client .util .ObjectBuilder ;
43
41
44
42
// typedef: cat._types.CatRequestBase
45
43
46
44
public abstract class CatRequestBase extends RequestBase {
47
- @ Nonnull
48
- private final List < String > headers ;
49
- @ Nonnull
50
- private final List < String > sort ;
45
+ @ Nullable
46
+ private final String headers ;
47
+ @ Nullable
48
+ private final String sort ;
51
49
52
50
public CatRequestBase () {
53
- this .headers = ApiTypeHelper . undefinedList () ;
54
- this .sort = ApiTypeHelper . undefinedList () ;
51
+ this .headers = null ;
52
+ this .sort = null ;
55
53
}
56
54
57
55
protected CatRequestBase (AbstractBuilder <?> builder ) {
58
56
super (builder );
59
- this .headers = ApiTypeHelper . unmodifiable ( builder .headers ) ;
60
- this .sort = ApiTypeHelper . unmodifiable ( builder .sort ) ;
57
+ this .headers = builder .headers ;
58
+ this .sort = builder .sort ;
61
59
}
62
60
63
61
/**
64
62
* A comma-separated list of headers to limit the returned information
65
63
* <p>
66
64
* API name: {@code h}
67
65
*/
68
- @ Nonnull
66
+ @ Nullable
69
67
public final String headers () {
70
- return String . join ( "," , this .headers ) ;
68
+ return this .headers ;
71
69
}
72
70
73
71
/**
@@ -76,9 +74,9 @@ public final String headers() {
76
74
* API name: {@code s}
77
75
* <p>
78
76
*/
79
- @ Nonnull
77
+ @ Nullable
80
78
public final String sort () {
81
- return String . join ( "," , this .sort ) ;
79
+ return this .sort ;
82
80
}
83
81
84
82
protected abstract static class CatRequestBaseBuilder <BuilderT extends CatRequestBaseBuilder <BuilderT >> extends AbstractBuilder <
@@ -89,22 +87,22 @@ protected abstract static class CatRequestBaseBuilder<BuilderT extends CatReques
89
87
protected abstract static class AbstractBuilder <BuilderT extends AbstractBuilder <BuilderT >> extends RequestBase .AbstractBuilder <
90
88
BuilderT > {
91
89
@ Nullable
92
- protected List < String > headers ;
90
+ protected String headers ;
93
91
@ Nullable
94
- protected List < String > sort ;
92
+ protected String sort ;
95
93
96
94
protected AbstractBuilder () {}
97
95
98
96
protected AbstractBuilder (CatRequestBase o ) {
99
97
super (o );
100
- this .headers = _listCopy ( o .headers ) ;
101
- this .sort = _listCopy ( o .sort ) ;
98
+ this .headers = o .headers ;
99
+ this .sort = o .sort ;
102
100
}
103
101
104
102
protected AbstractBuilder (AbstractBuilder <BuilderT > o ) {
105
103
super (o );
106
- this .headers = _listCopy ( o .headers ) ;
107
- this .sort = _listCopy ( o .sort ) ;
104
+ this .headers = o .headers ;
105
+ this .sort = o .sort ;
108
106
}
109
107
110
108
/**
@@ -114,32 +112,8 @@ protected AbstractBuilder(AbstractBuilder<BuilderT> o) {
114
112
* <p>
115
113
*/
116
114
@ Nonnull
117
- public final BuilderT headers (List <String > values ) {
118
- this .headers = _listAddAll (this .headers , values );
119
- return self ();
120
- }
121
-
122
- /**
123
- * A comma-separated list of specific headers to limits the output
124
- * <p>
125
- * API name: {@code h}
126
- * <p>
127
- */
128
- @ Nonnull
129
- public final BuilderT headers (String value , String ... values ) {
130
- this .headers = _listAdd (this .headers , value , values );
131
- return self ();
132
- }
133
-
134
- /**
135
- * A comma-separated list of headers to sort the returned information
136
- * <p>
137
- * API name: {@code s}
138
- * <p>
139
- */
140
- @ Nonnull
141
- public final BuilderT sort (List <String > values ) {
142
- this .sort = _listAddAll (this .sort , values );
115
+ public final BuilderT headers (@ Nullable String headers ) {
116
+ this .headers = headers ;
143
117
return self ();
144
118
}
145
119
@@ -150,20 +124,20 @@ public final BuilderT sort(List<String> values) {
150
124
* <p>
151
125
*/
152
126
@ Nonnull
153
- public final BuilderT sort (String value , String ... values ) {
154
- this .sort = _listAdd ( this . sort , value , values ) ;
127
+ public final BuilderT sort (@ Nullable String sort ) {
128
+ this .sort = sort ;
155
129
return self ();
156
130
}
157
131
}
158
132
159
133
@ Override
160
134
protected void applyQueryParameters (@ Nonnull Map <String , String > params ) {
161
135
super .applyQueryParameters (params );
162
- if (ApiTypeHelper . isDefined ( headers )) {
163
- params .put ("h" , String . join ( "," , headers ) );
136
+ if (headers != null && ! headers . trim (). isEmpty ( )) {
137
+ params .put ("h" , headers );
164
138
}
165
- if (ApiTypeHelper . isDefined ( sort )) {
166
- params .put ("s" , String . join ( "," , sort ) );
139
+ if (sort != null && ! sort . trim (). isEmpty ( )) {
140
+ params .put ("s" , sort );
167
141
}
168
142
params .put ("format" , "json" );
169
143
}
0 commit comments