Skip to content

Commit 40f6d0a

Browse files
authored
Handle text endpoints (#1135)
* correctly handling text endpoints * handle new text endnpoint in transport, tests
1 parent 01fead7 commit 40f6d0a

13 files changed

Lines changed: 190 additions & 167 deletions

File tree

java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatAsyncClient.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@
2222
import co.elastic.clients.ApiClient;
2323
import co.elastic.clients.elasticsearch._types.ErrorResponse;
2424
import co.elastic.clients.transport.ElasticsearchTransport;
25-
import co.elastic.clients.transport.Endpoint;
2625
import co.elastic.clients.transport.JsonEndpoint;
27-
import co.elastic.clients.transport.Transport;
2826
import co.elastic.clients.transport.TransportOptions;
27+
import co.elastic.clients.transport.endpoints.TextResponse;
2928
import co.elastic.clients.util.ObjectBuilder;
3029
import java.util.concurrent.CompletableFuture;
3130
import java.util.function.Function;
@@ -495,7 +494,7 @@ public CompletableFuture<HealthResponse> health() {
495494
* "https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-cat">Documentation
496495
* on elastic.co</a>
497496
*/
498-
public CompletableFuture<HelpResponse> help() {
497+
public CompletableFuture<TextResponse> help() {
499498
return this.transport.performRequestAsync(HelpRequest._INSTANCE, HelpRequest._ENDPOINT, this.transportOptions);
500499
}
501500

java-client/src/main/java/co/elastic/clients/elasticsearch/cat/ElasticsearchCatClient.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@
2323
import co.elastic.clients.elasticsearch._types.ElasticsearchException;
2424
import co.elastic.clients.elasticsearch._types.ErrorResponse;
2525
import co.elastic.clients.transport.ElasticsearchTransport;
26-
import co.elastic.clients.transport.Endpoint;
2726
import co.elastic.clients.transport.JsonEndpoint;
28-
import co.elastic.clients.transport.Transport;
2927
import co.elastic.clients.transport.TransportOptions;
28+
import co.elastic.clients.transport.endpoints.TextResponse;
3029
import co.elastic.clients.util.ObjectBuilder;
3130
import java.io.IOException;
3231
import java.util.function.Function;
@@ -498,7 +497,7 @@ public HealthResponse health() throws IOException, ElasticsearchException {
498497
* "https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-cat">Documentation
499498
* on elastic.co</a>
500499
*/
501-
public HelpResponse help() throws IOException, ElasticsearchException {
500+
public TextResponse help() throws IOException, ElasticsearchException {
502501
return this.transport.performRequest(HelpRequest._INSTANCE, HelpRequest._ENDPOINT, this.transportOptions);
503502
}
504503

java-client/src/main/java/co/elastic/clients/elasticsearch/cat/HelpRequest.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,12 @@
2020
package co.elastic.clients.elasticsearch.cat;
2121

2222
import co.elastic.clients.elasticsearch._types.ErrorResponse;
23-
import co.elastic.clients.json.JsonpDeserializable;
24-
import co.elastic.clients.json.JsonpDeserializer;
25-
import co.elastic.clients.json.ObjectBuilderDeserializer;
26-
import co.elastic.clients.json.ObjectDeserializer;
2723
import co.elastic.clients.transport.Endpoint;
2824
import co.elastic.clients.transport.endpoints.SimpleEndpoint;
29-
import co.elastic.clients.util.ObjectBuilder;
30-
import jakarta.json.stream.JsonGenerator;
25+
import co.elastic.clients.transport.endpoints.TextResponse;
26+
import co.elastic.clients.transport.endpoints.TextEndpoint;
27+
3128
import java.util.Collections;
32-
import java.util.Objects;
3329

3430
//----------------------------------------------------------------
3531
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
@@ -71,7 +67,7 @@ public HelpRequest() {
7167
/**
7268
* Endpoint "{@code cat.help}".
7369
*/
74-
public static final Endpoint<HelpRequest, HelpResponse, ErrorResponse> _ENDPOINT = new SimpleEndpoint<>(
70+
public static final Endpoint<HelpRequest, TextResponse, ErrorResponse> _ENDPOINT = new TextEndpoint<>(
7571
"es/cat.help",
7672

7773
// Request method
@@ -95,5 +91,5 @@ public HelpRequest() {
9591
request -> {
9692
return Collections.emptyMap();
9793

98-
}, SimpleEndpoint.emptyMap(), false, HelpResponse._DESERIALIZER);
94+
}, SimpleEndpoint.emptyMap(), false, null);
9995
}

java-client/src/main/java/co/elastic/clients/elasticsearch/cat/HelpResponse.java

Lines changed: 0 additions & 65 deletions
This file was deleted.

java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,6 @@
11411141
'cat.health.Request': 'cat/health/CatHealthRequest.ts#L23-L66',
11421142
'cat.health.Response': 'cat/health/CatHealthResponse.ts#L22-L25',
11431143
'cat.help.Request': 'cat/help/CatHelpRequest.ts#L22-L39',
1144-
'cat.help.Response': 'cat/help/CatHelpResponse.ts#L20-L25',
11451144
'cat.indices.IndicesRecord': 'cat/indices/types.ts#L20-L812',
11461145
'cat.indices.Request': 'cat/indices/CatIndicesRequest.ts#L30-L107',
11471146
'cat.indices.Response': 'cat/indices/CatIndicesResponse.ts#L22-L25',
@@ -2703,7 +2702,6 @@
27032702
'nodes.get_repositories_metering_info.Response': 'nodes/get_repositories_metering_info/GetRepositoriesMeteringInfoResponse.ts#L36-L39',
27042703
'nodes.get_repositories_metering_info.ResponseBase': 'nodes/get_repositories_metering_info/GetRepositoriesMeteringInfoResponse.ts#L25-L34',
27052704
'nodes.hot_threads.Request': 'nodes/hot_threads/NodesHotThreadsRequest.ts#L25-L94',
2706-
'nodes.hot_threads.Response': 'nodes/hot_threads/NodesHotThreadsResponse.ts#L20-L22',
27072705
'nodes.info.DeprecationIndexing': 'nodes/info/types.ts#L154-L157',
27082706
'nodes.info.NodeInfo': 'nodes/info/types.ts#L32-L72',
27092707
'nodes.info.NodeInfoAction': 'nodes/info/types.ts#L195-L197',

java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/ElasticsearchNodesAsyncClient.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
import co.elastic.clients.transport.ElasticsearchTransport;
2525
import co.elastic.clients.transport.Endpoint;
2626
import co.elastic.clients.transport.JsonEndpoint;
27-
import co.elastic.clients.transport.Transport;
2827
import co.elastic.clients.transport.TransportOptions;
28+
import co.elastic.clients.transport.endpoints.TextResponse;
2929
import co.elastic.clients.util.ObjectBuilder;
3030
import java.util.concurrent.CompletableFuture;
3131
import java.util.function.Function;
@@ -163,9 +163,9 @@ public final CompletableFuture<GetRepositoriesMeteringInfoResponse> getRepositor
163163
* on elastic.co</a>
164164
*/
165165

166-
public CompletableFuture<HotThreadsResponse> hotThreads(HotThreadsRequest request) {
166+
public CompletableFuture<TextResponse> hotThreads(HotThreadsRequest request) {
167167
@SuppressWarnings("unchecked")
168-
JsonEndpoint<HotThreadsRequest, HotThreadsResponse, ErrorResponse> endpoint = (JsonEndpoint<HotThreadsRequest, HotThreadsResponse, ErrorResponse>) HotThreadsRequest._ENDPOINT;
168+
Endpoint<HotThreadsRequest, TextResponse, ErrorResponse> endpoint = (Endpoint<HotThreadsRequest, TextResponse, ErrorResponse>) HotThreadsRequest._ENDPOINT;
169169

170170
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
171171
}
@@ -184,7 +184,7 @@ public CompletableFuture<HotThreadsResponse> hotThreads(HotThreadsRequest reques
184184
* on elastic.co</a>
185185
*/
186186

187-
public final CompletableFuture<HotThreadsResponse> hotThreads(
187+
public final CompletableFuture<TextResponse> hotThreads(
188188
Function<HotThreadsRequest.Builder, ObjectBuilder<HotThreadsRequest>> fn) {
189189
return hotThreads(fn.apply(new HotThreadsRequest.Builder()).build());
190190
}
@@ -200,7 +200,7 @@ public final CompletableFuture<HotThreadsResponse> hotThreads(
200200
* on elastic.co</a>
201201
*/
202202

203-
public CompletableFuture<HotThreadsResponse> hotThreads() {
203+
public CompletableFuture<TextResponse> hotThreads() {
204204
return this.transport.performRequestAsync(new HotThreadsRequest.Builder().build(), HotThreadsRequest._ENDPOINT,
205205
this.transportOptions);
206206
}

java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/ElasticsearchNodesClient.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
import co.elastic.clients.transport.ElasticsearchTransport;
2626
import co.elastic.clients.transport.Endpoint;
2727
import co.elastic.clients.transport.JsonEndpoint;
28-
import co.elastic.clients.transport.Transport;
2928
import co.elastic.clients.transport.TransportOptions;
29+
import co.elastic.clients.transport.endpoints.TextResponse;
3030
import co.elastic.clients.util.ObjectBuilder;
3131
import java.io.IOException;
3232
import java.util.function.Function;
@@ -165,9 +165,9 @@ public final GetRepositoriesMeteringInfoResponse getRepositoriesMeteringInfo(
165165
* on elastic.co</a>
166166
*/
167167

168-
public HotThreadsResponse hotThreads(HotThreadsRequest request) throws IOException, ElasticsearchException {
168+
public TextResponse hotThreads(HotThreadsRequest request) throws IOException, ElasticsearchException {
169169
@SuppressWarnings("unchecked")
170-
JsonEndpoint<HotThreadsRequest, HotThreadsResponse, ErrorResponse> endpoint = (JsonEndpoint<HotThreadsRequest, HotThreadsResponse, ErrorResponse>) HotThreadsRequest._ENDPOINT;
170+
Endpoint<HotThreadsRequest, TextResponse, ErrorResponse> endpoint = (Endpoint<HotThreadsRequest, TextResponse, ErrorResponse>) HotThreadsRequest._ENDPOINT;
171171

172172
return this.transport.performRequest(request, endpoint, this.transportOptions);
173173
}
@@ -186,7 +186,7 @@ public HotThreadsResponse hotThreads(HotThreadsRequest request) throws IOExcepti
186186
* on elastic.co</a>
187187
*/
188188

189-
public final HotThreadsResponse hotThreads(Function<HotThreadsRequest.Builder, ObjectBuilder<HotThreadsRequest>> fn)
189+
public final TextResponse hotThreads(Function<HotThreadsRequest.Builder, ObjectBuilder<HotThreadsRequest>> fn)
190190
throws IOException, ElasticsearchException {
191191
return hotThreads(fn.apply(new HotThreadsRequest.Builder()).build());
192192
}
@@ -202,7 +202,7 @@ public final HotThreadsResponse hotThreads(Function<HotThreadsRequest.Builder, O
202202
* on elastic.co</a>
203203
*/
204204

205-
public HotThreadsResponse hotThreads() throws IOException, ElasticsearchException {
205+
public TextResponse hotThreads() throws IOException, ElasticsearchException {
206206
return this.transport.performRequest(new HotThreadsRequest.Builder().build(), HotThreadsRequest._ENDPOINT,
207207
this.transportOptions);
208208
}

java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HotThreadsRequest.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,19 @@
2323
import co.elastic.clients.elasticsearch._types.RequestBase;
2424
import co.elastic.clients.elasticsearch._types.ThreadType;
2525
import co.elastic.clients.elasticsearch._types.Time;
26-
import co.elastic.clients.json.JsonpDeserializable;
27-
import co.elastic.clients.json.JsonpDeserializer;
28-
import co.elastic.clients.json.ObjectBuilderDeserializer;
29-
import co.elastic.clients.json.ObjectDeserializer;
3026
import co.elastic.clients.transport.Endpoint;
3127
import co.elastic.clients.transport.endpoints.SimpleEndpoint;
28+
import co.elastic.clients.transport.endpoints.TextResponse;
29+
import co.elastic.clients.transport.endpoints.TextEndpoint;
3230
import co.elastic.clients.util.ApiTypeHelper;
3331
import co.elastic.clients.util.ObjectBuilder;
34-
import jakarta.json.stream.JsonGenerator;
32+
3533
import java.lang.Boolean;
3634
import java.lang.Long;
3735
import java.lang.String;
3836
import java.util.HashMap;
3937
import java.util.List;
4038
import java.util.Map;
41-
import java.util.Objects;
4239
import java.util.function.Function;
4340
import java.util.stream.Collectors;
4441
import javax.annotation.Nullable;
@@ -365,7 +362,7 @@ public HotThreadsRequest build() {
365362
/**
366363
* Endpoint "{@code nodes.hot_threads}".
367364
*/
368-
public static final Endpoint<HotThreadsRequest, HotThreadsResponse, ErrorResponse> _ENDPOINT = new SimpleEndpoint<>(
365+
public static final Endpoint<HotThreadsRequest, TextResponse, ErrorResponse> _ENDPOINT = new TextEndpoint<>(
369366
"es/nodes.hot_threads",
370367

371368
// Request method
@@ -446,5 +443,5 @@ public HotThreadsRequest build() {
446443
}
447444
return params;
448445

449-
}, SimpleEndpoint.emptyMap(), false, HotThreadsResponse._DESERIALIZER);
446+
}, SimpleEndpoint.emptyMap(), false, null);
450447
}

java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HotThreadsResponse.java

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)