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 Jul 16, 2024
1 parent 879e5cb commit b60610d
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ public class RrfRank extends RankBase implements RankVariant, JsonpSerializable
private final Long rankConstant;

@Nullable
private final Long windowSize;
private final Long rankWindowSize;

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

private RrfRank(Builder builder) {

this.rankConstant = builder.rankConstant;
this.windowSize = builder.windowSize;
this.rankWindowSize = builder.rankWindowSize;

}

Expand Down Expand Up @@ -98,11 +98,11 @@ public final Long rankConstant() {
/**
* Size of the individual result sets per query
* <p>
* API name: {@code window_size}
* API name: {@code rank_window_size}
*/
@Nullable
public final Long windowSize() {
return this.windowSize;
public final Long rankWindowSize() {
return this.rankWindowSize;
}

/**
Expand All @@ -121,9 +121,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.write(this.rankConstant);

}
if (this.windowSize != null) {
generator.writeKey("window_size");
generator.write(this.windowSize);
if (this.rankWindowSize != null) {
generator.writeKey("rank_window_size");
generator.write(this.rankWindowSize);

}

Expand All @@ -145,7 +145,7 @@ public static class Builder extends RankBase.AbstractBuilder<Builder> implements
private Long rankConstant;

@Nullable
private Long windowSize;
private Long rankWindowSize;

/**
* How much influence documents in individual result sets per query have over
Expand All @@ -161,10 +161,10 @@ public final Builder rankConstant(@Nullable Long value) {
/**
* Size of the individual result sets per query
* <p>
* API name: {@code window_size}
* API name: {@code rank_window_size}
*/
public final Builder windowSize(@Nullable Long value) {
this.windowSize = value;
public final Builder rankWindowSize(@Nullable Long value) {
this.rankWindowSize = value;
return this;
}

Expand Down Expand Up @@ -197,7 +197,7 @@ public RrfRank build() {
protected static void setupRrfRankDeserializer(ObjectDeserializer<RrfRank.Builder> op) {

op.add(Builder::rankConstant, JsonpDeserializer.longDeserializer(), "rank_constant");
op.add(Builder::windowSize, JsonpDeserializer.longDeserializer(), "window_size");
op.add(Builder::rankWindowSize, JsonpDeserializer.longDeserializer(), "rank_window_size");

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import co.elastic.clients.util.ObjectBuilder;
import co.elastic.clients.util.WithJsonObjectBuilderBase;
import jakarta.json.stream.JsonGenerator;
import java.lang.Float;
import java.lang.Integer;
import java.lang.String;
import java.util.Objects;
Expand Down Expand Up @@ -63,17 +64,23 @@
public class DenseVectorIndexOptions implements JsonpSerializable {
private final String type;

private final int m;
@Nullable
private final Integer m;

private final int efConstruction;
@Nullable
private final Integer efConstruction;

@Nullable
private final Float confidenceInterval;

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

private DenseVectorIndexOptions(Builder builder) {

this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type");
this.m = ApiTypeHelper.requireNonNull(builder.m, this, "m");
this.efConstruction = ApiTypeHelper.requireNonNull(builder.efConstruction, this, "efConstruction");
this.m = builder.m;
this.efConstruction = builder.efConstruction;
this.confidenceInterval = builder.confidenceInterval;

}

Expand All @@ -89,19 +96,29 @@ public final String type() {
}

/**
* Required - API name: {@code m}
* API name: {@code m}
*/
public final int m() {
@Nullable
public final Integer m() {
return this.m;
}

/**
* Required - API name: {@code ef_construction}
* API name: {@code ef_construction}
*/
public final int efConstruction() {
@Nullable
public final Integer efConstruction() {
return this.efConstruction;
}

/**
* API name: {@code confidence_interval}
*/
@Nullable
public final Float confidenceInterval() {
return this.confidenceInterval;
}

/**
* Serialize this object to JSON.
*/
Expand All @@ -116,11 +133,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("type");
generator.write(this.type);

generator.writeKey("m");
generator.write(this.m);
if (this.m != null) {
generator.writeKey("m");
generator.write(this.m);

}
if (this.efConstruction != null) {
generator.writeKey("ef_construction");
generator.write(this.efConstruction);

}
if (this.confidenceInterval != null) {
generator.writeKey("confidence_interval");
generator.write(this.confidenceInterval);

generator.writeKey("ef_construction");
generator.write(this.efConstruction);
}

}

Expand All @@ -140,10 +167,15 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder>
ObjectBuilder<DenseVectorIndexOptions> {
private String type;

@Nullable
private Integer m;

@Nullable
private Integer efConstruction;

@Nullable
private Float confidenceInterval;

/**
* Required - API name: {@code type}
*/
Expand All @@ -153,21 +185,29 @@ public final Builder type(String value) {
}

/**
* Required - API name: {@code m}
* API name: {@code m}
*/
public final Builder m(int value) {
public final Builder m(@Nullable Integer value) {
this.m = value;
return this;
}

/**
* Required - API name: {@code ef_construction}
* API name: {@code ef_construction}
*/
public final Builder efConstruction(int value) {
public final Builder efConstruction(@Nullable Integer value) {
this.efConstruction = value;
return this;
}

/**
* API name: {@code confidence_interval}
*/
public final Builder confidenceInterval(@Nullable Float value) {
this.confidenceInterval = value;
return this;
}

@Override
protected Builder self() {
return this;
Expand Down Expand Up @@ -200,6 +240,7 @@ protected static void setupDenseVectorIndexOptionsDeserializer(
op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type");
op.add(Builder::m, JsonpDeserializer.integerDeserializer(), "m");
op.add(Builder::efConstruction, JsonpDeserializer.integerDeserializer(), "ef_construction");
op.add(Builder::confidenceInterval, JsonpDeserializer.floatDeserializer(), "confidence_interval");

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
public class TermvectorsResponse implements JsonpSerializable {
private final boolean found;

@Nullable
private final String id;

private final String index;
Expand All @@ -80,7 +81,7 @@ public class TermvectorsResponse implements JsonpSerializable {
private TermvectorsResponse(Builder builder) {

this.found = ApiTypeHelper.requireNonNull(builder.found, this, "found");
this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id");
this.id = builder.id;
this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index");
this.termVectors = ApiTypeHelper.unmodifiable(builder.termVectors);
this.took = ApiTypeHelper.requireNonNull(builder.took, this, "took");
Expand All @@ -100,8 +101,9 @@ public final boolean found() {
}

/**
* Required - API name: {@code _id}
* API name: {@code _id}
*/
@Nullable
public final String id() {
return this.id;
}
Expand Down Expand Up @@ -148,9 +150,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("found");
generator.write(this.found);

generator.writeKey("_id");
generator.write(this.id);
if (this.id != null) {
generator.writeKey("_id");
generator.write(this.id);

}
generator.writeKey("_index");
generator.write(this.index);

Expand Down Expand Up @@ -189,6 +193,7 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder>
ObjectBuilder<TermvectorsResponse> {
private Boolean found;

@Nullable
private String id;

private String index;
Expand All @@ -209,9 +214,9 @@ public final Builder found(boolean value) {
}

/**
* Required - API name: {@code _id}
* API name: {@code _id}
*/
public final Builder id(String value) {
public final Builder id(@Nullable String value) {
this.id = value;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
*/
@JsonpDeserializable
public class MultiTermVectorsResult implements JsonpSerializable {
@Nullable
private final String id;

private final String index;
Expand All @@ -87,7 +88,7 @@ public class MultiTermVectorsResult implements JsonpSerializable {

private MultiTermVectorsResult(Builder builder) {

this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id");
this.id = builder.id;
this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index");
this.version = builder.version;
this.took = builder.took;
Expand All @@ -102,8 +103,9 @@ public static MultiTermVectorsResult of(Function<Builder, ObjectBuilder<MultiTer
}

/**
* Required - API name: {@code _id}
* API name: {@code _id}
*/
@Nullable
public final String id() {
return this.id;
}
Expand Down Expand Up @@ -165,9 +167,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {

protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.writeKey("_id");
generator.write(this.id);
if (this.id != null) {
generator.writeKey("_id");
generator.write(this.id);

}
generator.writeKey("_index");
generator.write(this.index);

Expand Down Expand Up @@ -219,6 +223,7 @@ public String toString() {
public static class Builder extends WithJsonObjectBuilderBase<Builder>
implements
ObjectBuilder<MultiTermVectorsResult> {
@Nullable
private String id;

private String index;
Expand All @@ -239,9 +244,9 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder>
private ErrorCause error;

/**
* Required - API name: {@code _id}
* API name: {@code _id}
*/
public final Builder id(String value) {
public final Builder id(@Nullable String value) {
this.id = value;
return this;
}
Expand Down
Loading

0 comments on commit b60610d

Please sign in to comment.