Skip to content

Commit

Permalink
[codegen] update to latest api spec
Browse files Browse the repository at this point in the history
  • Loading branch information
l-trotta committed May 8, 2024
1 parent 07bfeda commit 767ee11
Show file tree
Hide file tree
Showing 12 changed files with 264 additions and 255 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1509,22 +1509,22 @@
'indices.validate_query.Request': 'indices/validate_query/IndicesValidateQueryRequest.ts#L25-L111',
'indices.validate_query.Response': 'indices/validate_query/IndicesValidateQueryResponse.ts#L23-L30',
'inference._types.CompletionResult': 'inference/_types/Results.ts#L59-L64',
'inference._types.InferenceEndpoint': 'inference/_types/Services.ts#L23-L39',
'inference._types.InferenceEndpointInfo': 'inference/_types/Services.ts#L41-L53',
'inference._types.InferenceResult': 'inference/_types/Results.ts#L77-L87',
'inference._types.ModelConfig': 'inference/_types/Services.ts#L23-L39',
'inference._types.ModelConfigContainer': 'inference/_types/Services.ts#L41-L53',
'inference._types.RankedDocument': 'inference/_types/Results.ts#L66-L76',
'inference._types.SparseEmbeddingResult': 'inference/_types/Results.ts#L35-L37',
'inference._types.TaskType': 'inference/_types/TaskType.ts#L20-L28',
'inference._types.TextEmbeddingByteResult': 'inference/_types/Results.ts#L45-L50',
'inference._types.TextEmbeddingResult': 'inference/_types/Results.ts#L52-L57',
'inference.delete_model.Request': 'inference/delete_model/DeleteModelRequest.ts#L24-L41',
'inference.delete_model.Response': 'inference/delete_model/DeleteModelResponse.ts#L22-L24',
'inference.get_model.Request': 'inference/get_model/GetModelRequest.ts#L24-L41',
'inference.get_model.Response': 'inference/get_model/GetModelResponse.ts#L22-L26',
'inference.delete.Request': 'inference/delete/DeleteRequest.ts#L24-L41',
'inference.delete.Response': 'inference/delete/DeleteResponse.ts#L22-L24',
'inference.get.Request': 'inference/get/GetRequest.ts#L24-L41',
'inference.get.Response': 'inference/get/GetResponse.ts#L22-L26',
'inference.inference.Request': 'inference/inference/InferenceRequest.ts#L26-L66',
'inference.inference.Response': 'inference/inference/InferenceResponse.ts#L22-L24',
'inference.put_model.Request': 'inference/put_model/PutModelRequest.ts#L25-L44',
'inference.put_model.Response': 'inference/put_model/PutModelResponse.ts#L22-L24',
'inference.put.Request': 'inference/put/PutRequest.ts#L25-L44',
'inference.put.Response': 'inference/put/PutResponse.ts#L22-L24',
'ingest._types.AppendProcessor': 'ingest/_types/Processors.ts#L279-L294',
'ingest._types.AttachmentProcessor': 'ingest/_types/Processors.ts#L296-L337',
'ingest._types.BytesProcessor': 'ingest/_types/Processors.ts#L392-L408',
Expand Down Expand Up @@ -2714,10 +2714,10 @@
if (hash.length > 1) {
hash = hash.substring(1);
}
window.location = "https://github.com/elastic/elasticsearch-specification/tree/0bdc82a1d8e22d0479d280a2e0e9ba1ffeb86d05/specification/" + (paths[hash] || "");
window.location = "https://github.com/elastic/elasticsearch-specification/tree/8d0b9be127b5ca759345e10ea9d571a7ea352b6f/specification/" + (paths[hash] || "");
</script>
</head>
<body>
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/0bdc82a1d8e22d0479d280a2e0e9ba1ffeb86d05/specification/">Elasticsearch API specification</a>.
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/8d0b9be127b5ca759345e10ea9d571a7ea352b6f/specification/">Elasticsearch API specification</a>.
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -53,31 +53,31 @@
//
//----------------------------------------------------------------

// typedef: inference.delete_model.Request
// typedef: inference.delete.Request

/**
* Delete an inference service model
* Delete an inference endpoint
*
* @see <a href="../doc-files/api-spec.html#inference.delete_model.Request">API
* @see <a href="../doc-files/api-spec.html#inference.delete.Request">API
* specification</a>
*/

public class DeleteModelRequest extends RequestBase {
public class DeleteInferenceRequest extends RequestBase {
private final String inferenceId;

@Nullable
private final TaskType taskType;

// ---------------------------------------------------------------------------------------------

private DeleteModelRequest(Builder builder) {
private DeleteInferenceRequest(Builder builder) {

this.inferenceId = ApiTypeHelper.requireNonNull(builder.inferenceId, this, "inferenceId");
this.taskType = builder.taskType;

}

public static DeleteModelRequest of(Function<Builder, ObjectBuilder<DeleteModelRequest>> fn) {
public static DeleteInferenceRequest of(Function<Builder, ObjectBuilder<DeleteInferenceRequest>> fn) {
return fn.apply(new Builder()).build();
}

Expand All @@ -103,12 +103,12 @@ public final TaskType taskType() {
// ---------------------------------------------------------------------------------------------

/**
* Builder for {@link DeleteModelRequest}.
* Builder for {@link DeleteInferenceRequest}.
*/

public static class Builder extends RequestBase.AbstractBuilder<Builder>
implements
ObjectBuilder<DeleteModelRequest> {
ObjectBuilder<DeleteInferenceRequest> {
private String inferenceId;

@Nullable
Expand Down Expand Up @@ -140,25 +140,25 @@ protected Builder self() {
}

/**
* Builds a {@link DeleteModelRequest}.
* Builds a {@link DeleteInferenceRequest}.
*
* @throws NullPointerException
* if some of the required fields are null.
*/
public DeleteModelRequest build() {
public DeleteInferenceRequest build() {
_checkSingleUse();

return new DeleteModelRequest(this);
return new DeleteInferenceRequest(this);
}
}

// ---------------------------------------------------------------------------------------------

/**
* Endpoint "{@code inference.delete_model}".
* Endpoint "{@code inference.delete}".
*/
public static final Endpoint<DeleteModelRequest, DeleteModelResponse, ErrorResponse> _ENDPOINT = new SimpleEndpoint<>(
"es/inference.delete_model",
public static final Endpoint<DeleteInferenceRequest, DeleteInferenceResponse, ErrorResponse> _ENDPOINT = new SimpleEndpoint<>(
"es/inference.delete",

// Request method
request -> {
Expand Down Expand Up @@ -223,5 +223,5 @@ public DeleteModelRequest build() {
request -> {
return Collections.emptyMap();

}, SimpleEndpoint.emptyMap(), false, DeleteModelResponse._DESERIALIZER);
}, SimpleEndpoint.emptyMap(), false, DeleteInferenceResponse._DESERIALIZER);
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,62 +44,63 @@
//
//----------------------------------------------------------------

// typedef: inference.delete_model.Response
// typedef: inference.delete.Response

/**
*
* @see <a href="../doc-files/api-spec.html#inference.delete_model.Response">API
* @see <a href="../doc-files/api-spec.html#inference.delete.Response">API
* specification</a>
*/
@JsonpDeserializable
public class DeleteModelResponse extends AcknowledgedResponseBase {
public class DeleteInferenceResponse extends AcknowledgedResponseBase {
// ---------------------------------------------------------------------------------------------

private DeleteModelResponse(Builder builder) {
private DeleteInferenceResponse(Builder builder) {
super(builder);

}

public static DeleteModelResponse of(Function<Builder, ObjectBuilder<DeleteModelResponse>> fn) {
public static DeleteInferenceResponse of(Function<Builder, ObjectBuilder<DeleteInferenceResponse>> fn) {
return fn.apply(new Builder()).build();
}

// ---------------------------------------------------------------------------------------------

/**
* Builder for {@link DeleteModelResponse}.
* Builder for {@link DeleteInferenceResponse}.
*/

public static class Builder extends AcknowledgedResponseBase.AbstractBuilder<Builder>
implements
ObjectBuilder<DeleteModelResponse> {
ObjectBuilder<DeleteInferenceResponse> {
@Override
protected Builder self() {
return this;
}

/**
* Builds a {@link DeleteModelResponse}.
* Builds a {@link DeleteInferenceResponse}.
*
* @throws NullPointerException
* if some of the required fields are null.
*/
public DeleteModelResponse build() {
public DeleteInferenceResponse build() {
_checkSingleUse();

return new DeleteModelResponse(this);
return new DeleteInferenceResponse(this);
}
}

// ---------------------------------------------------------------------------------------------

/**
* Json deserializer for {@link DeleteModelResponse}
* Json deserializer for {@link DeleteInferenceResponse}
*/
public static final JsonpDeserializer<DeleteModelResponse> _DESERIALIZER = ObjectBuilderDeserializer
.lazy(Builder::new, DeleteModelResponse::setupDeleteModelResponseDeserializer);
public static final JsonpDeserializer<DeleteInferenceResponse> _DESERIALIZER = ObjectBuilderDeserializer
.lazy(Builder::new, DeleteInferenceResponse::setupDeleteInferenceResponseDeserializer);

protected static void setupDeleteModelResponseDeserializer(ObjectDeserializer<DeleteModelResponse.Builder> op) {
protected static void setupDeleteInferenceResponseDeserializer(
ObjectDeserializer<DeleteInferenceResponse.Builder> op) {
AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,89 +67,89 @@ public ElasticsearchInferenceAsyncClient withTransportOptions(@Nullable Transpor
return new ElasticsearchInferenceAsyncClient(this.transport, transportOptions);
}

// ----- Endpoint: inference.delete_model
// ----- Endpoint: inference.delete

/**
* Delete model in the Inference API
* Delete an inference endpoint
*
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-inference-api.html">Documentation
* on elastic.co</a>
*/

public CompletableFuture<DeleteModelResponse> deleteModel(DeleteModelRequest request) {
public CompletableFuture<DeleteInferenceResponse> delete(DeleteInferenceRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint<DeleteModelRequest, DeleteModelResponse, ErrorResponse> endpoint = (JsonEndpoint<DeleteModelRequest, DeleteModelResponse, ErrorResponse>) DeleteModelRequest._ENDPOINT;
JsonEndpoint<DeleteInferenceRequest, DeleteInferenceResponse, ErrorResponse> endpoint = (JsonEndpoint<DeleteInferenceRequest, DeleteInferenceResponse, ErrorResponse>) DeleteInferenceRequest._ENDPOINT;

return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}

/**
* Delete model in the Inference API
* Delete an inference endpoint
*
* @param fn
* a function that initializes a builder to create the
* {@link DeleteModelRequest}
* {@link DeleteInferenceRequest}
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-inference-api.html">Documentation
* on elastic.co</a>
*/

public final CompletableFuture<DeleteModelResponse> deleteModel(
Function<DeleteModelRequest.Builder, ObjectBuilder<DeleteModelRequest>> fn) {
return deleteModel(fn.apply(new DeleteModelRequest.Builder()).build());
public final CompletableFuture<DeleteInferenceResponse> delete(
Function<DeleteInferenceRequest.Builder, ObjectBuilder<DeleteInferenceRequest>> fn) {
return delete(fn.apply(new DeleteInferenceRequest.Builder()).build());
}

// ----- Endpoint: inference.get_model
// ----- Endpoint: inference.get

/**
* Get a model in the Inference API
* Get an inference endpoint
*
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/master/get-inference-api.html">Documentation
* on elastic.co</a>
*/

public CompletableFuture<GetModelResponse> getModel(GetModelRequest request) {
public CompletableFuture<GetInferenceResponse> get(GetInferenceRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint<GetModelRequest, GetModelResponse, ErrorResponse> endpoint = (JsonEndpoint<GetModelRequest, GetModelResponse, ErrorResponse>) GetModelRequest._ENDPOINT;
JsonEndpoint<GetInferenceRequest, GetInferenceResponse, ErrorResponse> endpoint = (JsonEndpoint<GetInferenceRequest, GetInferenceResponse, ErrorResponse>) GetInferenceRequest._ENDPOINT;

return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}

/**
* Get a model in the Inference API
* Get an inference endpoint
*
* @param fn
* a function that initializes a builder to create the
* {@link GetModelRequest}
* {@link GetInferenceRequest}
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/master/get-inference-api.html">Documentation
* on elastic.co</a>
*/

public final CompletableFuture<GetModelResponse> getModel(
Function<GetModelRequest.Builder, ObjectBuilder<GetModelRequest>> fn) {
return getModel(fn.apply(new GetModelRequest.Builder()).build());
public final CompletableFuture<GetInferenceResponse> get(
Function<GetInferenceRequest.Builder, ObjectBuilder<GetInferenceRequest>> fn) {
return get(fn.apply(new GetInferenceRequest.Builder()).build());
}

/**
* Get a model in the Inference API
* Get an inference endpoint
*
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/master/get-inference-api.html">Documentation
* on elastic.co</a>
*/

public CompletableFuture<GetModelResponse> getModel() {
return this.transport.performRequestAsync(new GetModelRequest.Builder().build(), GetModelRequest._ENDPOINT,
this.transportOptions);
public CompletableFuture<GetInferenceResponse> get() {
return this.transport.performRequestAsync(new GetInferenceRequest.Builder().build(),
GetInferenceRequest._ENDPOINT, this.transportOptions);
}

// ----- Endpoint: inference.inference

/**
* Perform inference on a model
* Perform inference
*
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/master/post-inference-api.html">Documentation
Expand All @@ -164,7 +164,7 @@ public CompletableFuture<InferenceResponse> inference(InferenceRequest request)
}

/**
* Perform inference on a model
* Perform inference
*
* @param fn
* a function that initializes a builder to create the
Expand All @@ -179,37 +179,36 @@ public final CompletableFuture<InferenceResponse> inference(
return inference(fn.apply(new InferenceRequest.Builder()).build());
}

// ----- Endpoint: inference.put_model
// ----- Endpoint: inference.put

/**
* Configure a model for use in the Inference API
* Configure an inference endpoint for use in the Inference API
*
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/master/put-inference-api.html">Documentation
* on elastic.co</a>
*/

public CompletableFuture<PutModelResponse> putModel(PutModelRequest request) {
public CompletableFuture<PutResponse> put(PutRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint<PutModelRequest, PutModelResponse, ErrorResponse> endpoint = (JsonEndpoint<PutModelRequest, PutModelResponse, ErrorResponse>) PutModelRequest._ENDPOINT;
JsonEndpoint<PutRequest, PutResponse, ErrorResponse> endpoint = (JsonEndpoint<PutRequest, PutResponse, ErrorResponse>) PutRequest._ENDPOINT;

return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}

/**
* Configure a model for use in the Inference API
* Configure an inference endpoint for use in the Inference API
*
* @param fn
* a function that initializes a builder to create the
* {@link PutModelRequest}
* {@link PutRequest}
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/master/put-inference-api.html">Documentation
* on elastic.co</a>
*/

public final CompletableFuture<PutModelResponse> putModel(
Function<PutModelRequest.Builder, ObjectBuilder<PutModelRequest>> fn) {
return putModel(fn.apply(new PutModelRequest.Builder()).build());
public final CompletableFuture<PutResponse> put(Function<PutRequest.Builder, ObjectBuilder<PutRequest>> fn) {
return put(fn.apply(new PutRequest.Builder()).build());
}

}
Loading

0 comments on commit 767ee11

Please sign in to comment.