diff --git a/algoliasearch/src/main/java/com/algolia/api/CompositionClient.java b/algoliasearch/src/main/java/com/algolia/api/CompositionClient.java new file mode 100644 index 00000000..3915ce75 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/api/CompositionClient.java @@ -0,0 +1,307 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.api; + +import com.algolia.ApiClient; +import com.algolia.config.*; +import com.algolia.config.ClientOptions; +import com.algolia.exceptions.*; +import com.algolia.model.composition.*; +import com.algolia.utils.*; +import com.fasterxml.jackson.core.type.TypeReference; +import java.time.Duration; +import java.util.ArrayList; +import java.util.Collections; +import java.util.EnumSet; +import java.util.List; +import java.util.Random; +import java.util.concurrent.CompletableFuture; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +public class CompositionClient extends ApiClient { + + public CompositionClient(String appId, String apiKey) { + this(appId, apiKey, null); + } + + public CompositionClient(String appId, String apiKey, ClientOptions options) { + super( + appId, + apiKey, + "Composition", + options, + getDefaultHosts(appId), + Duration.ofMillis(2000L), + Duration.ofMillis(5000L), + Duration.ofMillis(30000L) + ); + } + + private static List getDefaultHosts(String appId) { + List hosts = new ArrayList<>(); + hosts.add(new Host(appId + "-dsn.algolia.net", EnumSet.of(CallType.READ))); + hosts.add(new Host(appId + ".algolia.net", EnumSet.of(CallType.WRITE))); + + List commonHosts = new ArrayList<>(); + commonHosts.add(new Host(appId + "-1.algolianet.com", EnumSet.of(CallType.READ, CallType.WRITE))); + commonHosts.add(new Host(appId + "-2.algolianet.com", EnumSet.of(CallType.READ, CallType.WRITE))); + commonHosts.add(new Host(appId + "-3.algolianet.com", EnumSet.of(CallType.READ, CallType.WRITE))); + + Collections.shuffle(commonHosts, new Random()); + + return Stream.concat(hosts.stream(), commonHosts.stream()).collect(Collectors.toList()); + } + + /** + * Runs a query on a single composition and returns matching results. + * + * @param compositionID Unique Composition ObjectID. (required) + * @param requestBody (required) + * @param innerType The class held by the index, could be your custom class or {@link Object}. + * @param requestOptions The requestOptions to send along with the query, they will be merged with + * the transporter requestOptions. + * @throws AlgoliaRuntimeException If it fails to process the API call + */ + public SearchResponse search( + @Nonnull String compositionID, + @Nonnull RequestBody requestBody, + Class innerType, + @Nullable RequestOptions requestOptions + ) throws AlgoliaRuntimeException { + return LaunderThrowable.await(searchAsync(compositionID, requestBody, innerType, requestOptions)); + } + + /** + * Runs a query on a single composition and returns matching results. + * + * @param compositionID Unique Composition ObjectID. (required) + * @param requestBody (required) + * @param innerType The class held by the index, could be your custom class or {@link Object}. + * @throws AlgoliaRuntimeException If it fails to process the API call + */ + public SearchResponse search(@Nonnull String compositionID, @Nonnull RequestBody requestBody, Class innerType) + throws AlgoliaRuntimeException { + return this.search(compositionID, requestBody, innerType, null); + } + + /** + * (asynchronously) Runs a query on a single composition and returns matching results. + * + * @param compositionID Unique Composition ObjectID. (required) + * @param requestBody (required) + * @param innerType The class held by the index, could be your custom class or {@link Object}. + * @param requestOptions The requestOptions to send along with the query, they will be merged with + * the transporter requestOptions. + * @throws AlgoliaRuntimeException If it fails to process the API call + */ + public CompletableFuture> searchAsync( + @Nonnull String compositionID, + @Nonnull RequestBody requestBody, + Class innerType, + @Nullable RequestOptions requestOptions + ) throws AlgoliaRuntimeException { + Parameters.requireNonNull(compositionID, "Parameter `compositionID` is required when calling `search`."); + + Parameters.requireNonNull(requestBody, "Parameter `requestBody` is required when calling `search`."); + + HttpRequest request = HttpRequest.builder() + .setPath("/1/compositions/{compositionID}/run", compositionID) + .setMethod("POST") + .setBody(requestBody) + .setRead(true) + .build(); + return executeAsync(request, requestOptions, SearchResponse.class, innerType); + } + + /** + * (asynchronously) Runs a query on a single composition and returns matching results. + * + * @param compositionID Unique Composition ObjectID. (required) + * @param requestBody (required) + * @param innerType The class held by the index, could be your custom class or {@link Object}. + * @throws AlgoliaRuntimeException If it fails to process the API call + */ + public CompletableFuture> searchAsync( + @Nonnull String compositionID, + @Nonnull RequestBody requestBody, + Class innerType + ) throws AlgoliaRuntimeException { + return this.searchAsync(compositionID, requestBody, innerType, null); + } + + /** + * Searches for values of a specified facet attribute on the composition's main source's index. - + * By default, facet values are sorted by decreasing count. You can adjust this with the + * `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have **more than + * 65 searchable facets and searchable attributes combined**. + * + * @param compositionID Unique Composition ObjectID. (required) + * @param facetName Facet attribute in which to search for values. This attribute must be included + * in the `attributesForFaceting` index setting with the `searchable()` modifier. (required) + * @param searchForFacetValuesRequest (optional) + * @param requestOptions The requestOptions to send along with the query, they will be merged with + * the transporter requestOptions. + * @throws AlgoliaRuntimeException If it fails to process the API call + */ + public SearchForFacetValuesResponse searchForFacetValues( + @Nonnull String compositionID, + @Nonnull String facetName, + SearchForFacetValuesRequest searchForFacetValuesRequest, + @Nullable RequestOptions requestOptions + ) throws AlgoliaRuntimeException { + return LaunderThrowable.await(searchForFacetValuesAsync(compositionID, facetName, searchForFacetValuesRequest, requestOptions)); + } + + /** + * Searches for values of a specified facet attribute on the composition's main source's index. - + * By default, facet values are sorted by decreasing count. You can adjust this with the + * `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have **more than + * 65 searchable facets and searchable attributes combined**. + * + * @param compositionID Unique Composition ObjectID. (required) + * @param facetName Facet attribute in which to search for values. This attribute must be included + * in the `attributesForFaceting` index setting with the `searchable()` modifier. (required) + * @param searchForFacetValuesRequest (optional) + * @throws AlgoliaRuntimeException If it fails to process the API call + */ + public SearchForFacetValuesResponse searchForFacetValues( + @Nonnull String compositionID, + @Nonnull String facetName, + SearchForFacetValuesRequest searchForFacetValuesRequest + ) throws AlgoliaRuntimeException { + return this.searchForFacetValues(compositionID, facetName, searchForFacetValuesRequest, null); + } + + /** + * Searches for values of a specified facet attribute on the composition's main source's index. - + * By default, facet values are sorted by decreasing count. You can adjust this with the + * `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have **more than + * 65 searchable facets and searchable attributes combined**. + * + * @param compositionID Unique Composition ObjectID. (required) + * @param facetName Facet attribute in which to search for values. This attribute must be included + * in the `attributesForFaceting` index setting with the `searchable()` modifier. (required) + * @param requestOptions The requestOptions to send along with the query, they will be merged with + * the transporter requestOptions. + * @throws AlgoliaRuntimeException If it fails to process the API call + */ + public SearchForFacetValuesResponse searchForFacetValues( + @Nonnull String compositionID, + @Nonnull String facetName, + @Nullable RequestOptions requestOptions + ) throws AlgoliaRuntimeException { + return this.searchForFacetValues(compositionID, facetName, null, requestOptions); + } + + /** + * Searches for values of a specified facet attribute on the composition's main source's index. - + * By default, facet values are sorted by decreasing count. You can adjust this with the + * `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have **more than + * 65 searchable facets and searchable attributes combined**. + * + * @param compositionID Unique Composition ObjectID. (required) + * @param facetName Facet attribute in which to search for values. This attribute must be included + * in the `attributesForFaceting` index setting with the `searchable()` modifier. (required) + * @throws AlgoliaRuntimeException If it fails to process the API call + */ + public SearchForFacetValuesResponse searchForFacetValues(@Nonnull String compositionID, @Nonnull String facetName) + throws AlgoliaRuntimeException { + return this.searchForFacetValues(compositionID, facetName, null, null); + } + + /** + * (asynchronously) Searches for values of a specified facet attribute on the composition's main + * source's index. - By default, facet values are sorted by decreasing count. You can adjust this + * with the `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have + * **more than 65 searchable facets and searchable attributes combined**. + * + * @param compositionID Unique Composition ObjectID. (required) + * @param facetName Facet attribute in which to search for values. This attribute must be included + * in the `attributesForFaceting` index setting with the `searchable()` modifier. (required) + * @param searchForFacetValuesRequest (optional) + * @param requestOptions The requestOptions to send along with the query, they will be merged with + * the transporter requestOptions. + * @throws AlgoliaRuntimeException If it fails to process the API call + */ + public CompletableFuture searchForFacetValuesAsync( + @Nonnull String compositionID, + @Nonnull String facetName, + SearchForFacetValuesRequest searchForFacetValuesRequest, + @Nullable RequestOptions requestOptions + ) throws AlgoliaRuntimeException { + Parameters.requireNonNull(compositionID, "Parameter `compositionID` is required when calling `searchForFacetValues`."); + + Parameters.requireNonNull(facetName, "Parameter `facetName` is required when calling `searchForFacetValues`."); + + HttpRequest request = HttpRequest.builder() + .setPath("/1/compositions/{compositionID}/facets/{facetName}/query", compositionID, facetName) + .setMethod("POST") + .setBody(searchForFacetValuesRequest) + .setRead(true) + .build(); + return executeAsync(request, requestOptions, new TypeReference() {}); + } + + /** + * (asynchronously) Searches for values of a specified facet attribute on the composition's main + * source's index. - By default, facet values are sorted by decreasing count. You can adjust this + * with the `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have + * **more than 65 searchable facets and searchable attributes combined**. + * + * @param compositionID Unique Composition ObjectID. (required) + * @param facetName Facet attribute in which to search for values. This attribute must be included + * in the `attributesForFaceting` index setting with the `searchable()` modifier. (required) + * @param searchForFacetValuesRequest (optional) + * @throws AlgoliaRuntimeException If it fails to process the API call + */ + public CompletableFuture searchForFacetValuesAsync( + @Nonnull String compositionID, + @Nonnull String facetName, + SearchForFacetValuesRequest searchForFacetValuesRequest + ) throws AlgoliaRuntimeException { + return this.searchForFacetValuesAsync(compositionID, facetName, searchForFacetValuesRequest, null); + } + + /** + * (asynchronously) Searches for values of a specified facet attribute on the composition's main + * source's index. - By default, facet values are sorted by decreasing count. You can adjust this + * with the `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have + * **more than 65 searchable facets and searchable attributes combined**. + * + * @param compositionID Unique Composition ObjectID. (required) + * @param facetName Facet attribute in which to search for values. This attribute must be included + * in the `attributesForFaceting` index setting with the `searchable()` modifier. (required) + * @param requestOptions The requestOptions to send along with the query, they will be merged with + * the transporter requestOptions. + * @throws AlgoliaRuntimeException If it fails to process the API call + */ + public CompletableFuture searchForFacetValuesAsync( + @Nonnull String compositionID, + @Nonnull String facetName, + @Nullable RequestOptions requestOptions + ) throws AlgoliaRuntimeException { + return this.searchForFacetValuesAsync(compositionID, facetName, null, requestOptions); + } + + /** + * (asynchronously) Searches for values of a specified facet attribute on the composition's main + * source's index. - By default, facet values are sorted by decreasing count. You can adjust this + * with the `sortFacetValueBy` parameter. - Searching for facet values doesn't work if you have + * **more than 65 searchable facets and searchable attributes combined**. + * + * @param compositionID Unique Composition ObjectID. (required) + * @param facetName Facet attribute in which to search for values. This attribute must be included + * in the `attributesForFaceting` index setting with the `searchable()` modifier. (required) + * @throws AlgoliaRuntimeException If it fails to process the API call + */ + public CompletableFuture searchForFacetValuesAsync( + @Nonnull String compositionID, + @Nonnull String facetName + ) throws AlgoliaRuntimeException { + return this.searchForFacetValuesAsync(compositionID, facetName, null, null); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/AroundPrecision.java b/algoliasearch/src/main/java/com/algolia/model/composition/AroundPrecision.java new file mode 100644 index 00000000..a51a0795 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/AroundPrecision.java @@ -0,0 +1,114 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.algolia.exceptions.AlgoliaRuntimeException; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.io.IOException; +import java.util.List; +import java.util.logging.Logger; + +/** + * Precision of a coordinate-based search in meters to group results with similar distances. The Geo + * ranking criterion considers all matches within the same range of distances to be equal. + */ +@JsonDeserialize(using = AroundPrecision.Deserializer.class) +public interface AroundPrecision { + // AroundPrecision as Integer wrapper. + static AroundPrecision of(Integer value) { + return new IntegerWrapper(value); + } + + // AroundPrecision as List wrapper. + static AroundPrecision of(List value) { + return new ListOfRangeWrapper(value); + } + + // AroundPrecision as Integer wrapper. + @JsonSerialize(using = IntegerWrapper.Serializer.class) + class IntegerWrapper implements AroundPrecision { + + private final Integer value; + + IntegerWrapper(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(IntegerWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + // AroundPrecision as List wrapper. + @JsonSerialize(using = ListOfRangeWrapper.Serializer.class) + class ListOfRangeWrapper implements AroundPrecision { + + private final List value; + + ListOfRangeWrapper(List value) { + this.value = value; + } + + public List getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(ListOfRangeWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + class Deserializer extends JsonDeserializer { + + private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName()); + + @Override + public AroundPrecision deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = jp.readValueAsTree(); + // deserialize Integer + if (tree.isInt()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + Integer value = parser.readValueAs(Integer.class); + return new AroundPrecision.IntegerWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf Integer (error: " + e.getMessage() + ") (type: Integer)"); + } + } + // deserialize List + if (tree.isArray()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + List value = parser.readValueAs(new TypeReference>() {}); + return new AroundPrecision.ListOfRangeWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf List (error: " + e.getMessage() + ") (type: List)"); + } + } + throw new AlgoliaRuntimeException(String.format("Failed to deserialize json element: %s", tree)); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public AroundPrecision getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "AroundPrecision cannot be null"); + } + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/AroundRadius.java b/algoliasearch/src/main/java/com/algolia/model/composition/AroundRadius.java new file mode 100644 index 00000000..f663dbee --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/AroundRadius.java @@ -0,0 +1,85 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.algolia.exceptions.AlgoliaRuntimeException; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.io.IOException; +import java.util.logging.Logger; + +/** + * Maximum radius for a search around a central location. This parameter works in combination with + * the `aroundLatLng` and `aroundLatLngViaIP` parameters. By default, the search radius is + * determined automatically from the density of hits around the central location. The search radius + * is small if there are many hits close to the central coordinates. + */ +@JsonDeserialize(using = AroundRadius.Deserializer.class) +public interface AroundRadius { + // AroundRadius as Integer wrapper. + static AroundRadius of(Integer value) { + return new IntegerWrapper(value); + } + + // AroundRadius as Integer wrapper. + @JsonSerialize(using = IntegerWrapper.Serializer.class) + class IntegerWrapper implements AroundRadius { + + private final Integer value; + + IntegerWrapper(Integer value) { + this.value = value; + } + + public Integer getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(IntegerWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + class Deserializer extends JsonDeserializer { + + private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName()); + + @Override + public AroundRadius deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = jp.readValueAsTree(); + // deserialize Integer + if (tree.isInt()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + Integer value = parser.readValueAs(Integer.class); + return new AroundRadius.IntegerWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf Integer (error: " + e.getMessage() + ") (type: Integer)"); + } + } + // deserialize AroundRadiusAll + if (tree.isTextual()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + return parser.readValueAs(AroundRadiusAll.class); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf AroundRadiusAll (error: " + e.getMessage() + ") (type: AroundRadiusAll)"); + } + } + throw new AlgoliaRuntimeException(String.format("Failed to deserialize json element: %s", tree)); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public AroundRadius getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "AroundRadius cannot be null"); + } + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/AroundRadiusAll.java b/algoliasearch/src/main/java/com/algolia/model/composition/AroundRadiusAll.java new file mode 100644 index 00000000..e9ed4ba1 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/AroundRadiusAll.java @@ -0,0 +1,39 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; + +/** Return all records with a valid `_geoloc` attribute. Don't filter by distance. */ +@JsonDeserialize(as = AroundRadiusAll.class) +public enum AroundRadiusAll implements AroundRadius { + ALL("all"); + + private final String value; + + AroundRadiusAll(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static AroundRadiusAll fromValue(String value) { + for (AroundRadiusAll b : AroundRadiusAll.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/Banner.java b/algoliasearch/src/main/java/com/algolia/model/composition/Banner.java new file mode 100644 index 00000000..b87e60ee --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/Banner.java @@ -0,0 +1,77 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** Banner with image and link to redirect users. */ +public class Banner { + + @JsonProperty("image") + private BannerImage image; + + @JsonProperty("link") + private BannerLink link; + + public Banner setImage(BannerImage image) { + this.image = image; + return this; + } + + /** Get image */ + @javax.annotation.Nullable + public BannerImage getImage() { + return image; + } + + public Banner setLink(BannerLink link) { + this.link = link; + return this; + } + + /** Get link */ + @javax.annotation.Nullable + public BannerLink getLink() { + return link; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Banner banner = (Banner) o; + return Objects.equals(this.image, banner.image) && Objects.equals(this.link, banner.link); + } + + @Override + public int hashCode() { + return Objects.hash(image, link); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Banner {\n"); + sb.append(" image: ").append(toIndentedString(image)).append("\n"); + sb.append(" link: ").append(toIndentedString(link)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/BannerImage.java b/algoliasearch/src/main/java/com/algolia/model/composition/BannerImage.java new file mode 100644 index 00000000..8585ecf2 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/BannerImage.java @@ -0,0 +1,87 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Image to show inside a banner. */ +public class BannerImage { + + @JsonProperty("urls") + private List urls; + + @JsonProperty("title") + private String title; + + public BannerImage setUrls(List urls) { + this.urls = urls; + return this; + } + + public BannerImage addUrls(BannerImageUrl urlsItem) { + if (this.urls == null) { + this.urls = new ArrayList<>(); + } + this.urls.add(urlsItem); + return this; + } + + /** Get urls */ + @javax.annotation.Nullable + public List getUrls() { + return urls; + } + + public BannerImage setTitle(String title) { + this.title = title; + return this; + } + + /** Get title */ + @javax.annotation.Nullable + public String getTitle() { + return title; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BannerImage bannerImage = (BannerImage) o; + return Objects.equals(this.urls, bannerImage.urls) && Objects.equals(this.title, bannerImage.title); + } + + @Override + public int hashCode() { + return Objects.hash(urls, title); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BannerImage {\n"); + sb.append(" urls: ").append(toIndentedString(urls)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/BannerImageUrl.java b/algoliasearch/src/main/java/com/algolia/model/composition/BannerImageUrl.java new file mode 100644 index 00000000..a04c148f --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/BannerImageUrl.java @@ -0,0 +1,62 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** URL for an image to show inside a banner. */ +public class BannerImageUrl { + + @JsonProperty("url") + private String url; + + public BannerImageUrl setUrl(String url) { + this.url = url; + return this; + } + + /** Get url */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BannerImageUrl bannerImageUrl = (BannerImageUrl) o; + return Objects.equals(this.url, bannerImageUrl.url); + } + + @Override + public int hashCode() { + return Objects.hash(url); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BannerImageUrl {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/BannerLink.java b/algoliasearch/src/main/java/com/algolia/model/composition/BannerLink.java new file mode 100644 index 00000000..3b8052e5 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/BannerLink.java @@ -0,0 +1,62 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** Link for a banner defined in the Merchandising Studio. */ +public class BannerLink { + + @JsonProperty("url") + private String url; + + public BannerLink setUrl(String url) { + this.url = url; + return this; + } + + /** Get url */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BannerLink bannerLink = (BannerLink) o; + return Objects.equals(this.url, bannerLink.url); + } + + @Override + public int hashCode() { + return Objects.hash(url); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BannerLink {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/CompositionIdRankingInfo.java b/algoliasearch/src/main/java/com/algolia/model/composition/CompositionIdRankingInfo.java new file mode 100644 index 00000000..80879ea2 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/CompositionIdRankingInfo.java @@ -0,0 +1,80 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** CompositionIdRankingInfo */ +public class CompositionIdRankingInfo { + + @JsonProperty("index") + private String index; + + @JsonProperty("injectedItemKey") + private String injectedItemKey; + + public CompositionIdRankingInfo setIndex(String index) { + this.index = index; + return this; + } + + /** Get index */ + @javax.annotation.Nonnull + public String getIndex() { + return index; + } + + public CompositionIdRankingInfo setInjectedItemKey(String injectedItemKey) { + this.injectedItemKey = injectedItemKey; + return this; + } + + /** Get injectedItemKey */ + @javax.annotation.Nonnull + public String getInjectedItemKey() { + return injectedItemKey; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompositionIdRankingInfo compositionIdRankingInfo = (CompositionIdRankingInfo) o; + return ( + Objects.equals(this.index, compositionIdRankingInfo.index) && + Objects.equals(this.injectedItemKey, compositionIdRankingInfo.injectedItemKey) + ); + } + + @Override + public int hashCode() { + return Objects.hash(index, injectedItemKey); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompositionIdRankingInfo {\n"); + sb.append(" index: ").append(toIndentedString(index)).append("\n"); + sb.append(" injectedItemKey: ").append(toIndentedString(injectedItemKey)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/CompositionRunAppliedRules.java b/algoliasearch/src/main/java/com/algolia/model/composition/CompositionRunAppliedRules.java new file mode 100644 index 00000000..80946bdc --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/CompositionRunAppliedRules.java @@ -0,0 +1,62 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** CompositionRunAppliedRules */ +public class CompositionRunAppliedRules { + + @JsonProperty("objectID") + private String objectID; + + public CompositionRunAppliedRules setObjectID(String objectID) { + this.objectID = objectID; + return this; + } + + /** Unique record identifier. */ + @javax.annotation.Nonnull + public String getObjectID() { + return objectID; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompositionRunAppliedRules compositionRunAppliedRules = (CompositionRunAppliedRules) o; + return Objects.equals(this.objectID, compositionRunAppliedRules.objectID); + } + + @Override + public int hashCode() { + return Objects.hash(objectID); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompositionRunAppliedRules {\n"); + sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/CompositionRunSearchResponse.java b/algoliasearch/src/main/java/com/algolia/model/composition/CompositionRunSearchResponse.java new file mode 100644 index 00000000..9f3c3853 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/CompositionRunSearchResponse.java @@ -0,0 +1,107 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** CompositionRunSearchResponse */ +public class CompositionRunSearchResponse { + + @JsonProperty("objectID") + private String objectID; + + @JsonProperty("appliedRules") + private List appliedRules; + + private Map additionalProperties = new HashMap<>(); + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public CompositionRunSearchResponse setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + return this; + } + + public CompositionRunSearchResponse setObjectID(String objectID) { + this.objectID = objectID; + return this; + } + + /** Unique record identifier. */ + @javax.annotation.Nonnull + public String getObjectID() { + return objectID; + } + + public CompositionRunSearchResponse setAppliedRules(List appliedRules) { + this.appliedRules = appliedRules; + return this; + } + + public CompositionRunSearchResponse addAppliedRules(CompositionRunAppliedRules appliedRulesItem) { + if (this.appliedRules == null) { + this.appliedRules = new ArrayList<>(); + } + this.appliedRules.add(appliedRulesItem); + return this; + } + + /** Get appliedRules */ + @javax.annotation.Nullable + public List getAppliedRules() { + return appliedRules; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompositionRunSearchResponse compositionRunSearchResponse = (CompositionRunSearchResponse) o; + return ( + Objects.equals(this.objectID, compositionRunSearchResponse.objectID) && + Objects.equals(this.appliedRules, compositionRunSearchResponse.appliedRules) && + super.equals(o) + ); + } + + @Override + public int hashCode() { + return Objects.hash(objectID, appliedRules, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompositionRunSearchResponse {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); + sb.append(" appliedRules: ").append(toIndentedString(appliedRules)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/CompositionsSearchResponse.java b/algoliasearch/src/main/java/com/algolia/model/composition/CompositionsSearchResponse.java new file mode 100644 index 00000000..56bb4965 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/CompositionsSearchResponse.java @@ -0,0 +1,85 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** CompositionsSearchResponse */ +public class CompositionsSearchResponse { + + @JsonProperty("run") + private List run = new ArrayList<>(); + + private Map additionalProperties = new HashMap<>(); + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public CompositionsSearchResponse setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + return this; + } + + public CompositionsSearchResponse setRun(List run) { + this.run = run; + return this; + } + + public CompositionsSearchResponse addRun(CompositionRunSearchResponse runItem) { + this.run.add(runItem); + return this; + } + + /** Get run */ + @javax.annotation.Nonnull + public List getRun() { + return run; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CompositionsSearchResponse compositionsSearchResponse = (CompositionsSearchResponse) o; + return Objects.equals(this.run, compositionsSearchResponse.run) && super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(run, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CompositionsSearchResponse {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" run: ").append(toIndentedString(run)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/ErrorBase.java b/algoliasearch/src/main/java/com/algolia/model/composition/ErrorBase.java new file mode 100644 index 00000000..3958fe12 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/ErrorBase.java @@ -0,0 +1,78 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Error. */ +public class ErrorBase { + + @JsonProperty("message") + private String message; + + private Map additionalProperties = new HashMap<>(); + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public ErrorBase setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + return this; + } + + public ErrorBase setMessage(String message) { + this.message = message; + return this; + } + + /** Get message */ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ErrorBase errorBase = (ErrorBase) o; + return Objects.equals(this.message, errorBase.message) && super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(message, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorBase {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/Exhaustive.java b/algoliasearch/src/main/java/com/algolia/model/composition/Exhaustive.java new file mode 100644 index 00000000..677c9d15 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/Exhaustive.java @@ -0,0 +1,150 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** + * Whether certain properties of the search response are calculated exhaustive (exact) or + * approximated. + */ +public class Exhaustive { + + @JsonProperty("facetsCount") + private Boolean facetsCount; + + @JsonProperty("facetValues") + private Boolean facetValues; + + @JsonProperty("nbHits") + private Boolean nbHits; + + @JsonProperty("rulesMatch") + private Boolean rulesMatch; + + @JsonProperty("typo") + private Boolean typo; + + public Exhaustive setFacetsCount(Boolean facetsCount) { + this.facetsCount = facetsCount; + return this; + } + + /** + * Whether the facet count is exhaustive (`true`) or approximate (`false`). See the [related + * discussion](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + */ + @javax.annotation.Nullable + public Boolean getFacetsCount() { + return facetsCount; + } + + public Exhaustive setFacetValues(Boolean facetValues) { + this.facetValues = facetValues; + return this; + } + + /** The value is `false` if not all facet values are retrieved. */ + @javax.annotation.Nullable + public Boolean getFacetValues() { + return facetValues; + } + + public Exhaustive setNbHits(Boolean nbHits) { + this.nbHits = nbHits; + return this; + } + + /** + * Whether the `nbHits` is exhaustive (`true`) or approximate (`false`). When the query takes more + * than 50ms to be processed, the engine makes an approximation. This can happen when using + * complex filters on millions of records, when typo-tolerance was not exhaustive, or when enough + * hits have been retrieved (for example, after the engine finds 10,000 exact matches). `nbHits` + * is reported as non-exhaustive whenever an approximation is made, even if the approximation + * didn’t, in the end, impact the exhaustivity of the query. + */ + @javax.annotation.Nullable + public Boolean getNbHits() { + return nbHits; + } + + public Exhaustive setRulesMatch(Boolean rulesMatch) { + this.rulesMatch = rulesMatch; + return this; + } + + /** + * Rules matching exhaustivity. The value is `false` if rules were enable for this query, and + * could not be fully processed due a timeout. This is generally caused by the number of + * alternatives (such as typos) which is too large. + */ + @javax.annotation.Nullable + public Boolean getRulesMatch() { + return rulesMatch; + } + + public Exhaustive setTypo(Boolean typo) { + this.typo = typo; + return this; + } + + /** + * Whether the typo search was exhaustive (`true`) or approximate (`false`). An approximation is + * done when the typo search query part takes more than 10% of the query budget (ie. 5ms by + * default) to be processed (this can happen when a lot of typo alternatives exist for the query). + * This field will not be included when typo-tolerance is entirely disabled. + */ + @javax.annotation.Nullable + public Boolean getTypo() { + return typo; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Exhaustive exhaustive = (Exhaustive) o; + return ( + Objects.equals(this.facetsCount, exhaustive.facetsCount) && + Objects.equals(this.facetValues, exhaustive.facetValues) && + Objects.equals(this.nbHits, exhaustive.nbHits) && + Objects.equals(this.rulesMatch, exhaustive.rulesMatch) && + Objects.equals(this.typo, exhaustive.typo) + ); + } + + @Override + public int hashCode() { + return Objects.hash(facetsCount, facetValues, nbHits, rulesMatch, typo); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Exhaustive {\n"); + sb.append(" facetsCount: ").append(toIndentedString(facetsCount)).append("\n"); + sb.append(" facetValues: ").append(toIndentedString(facetValues)).append("\n"); + sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); + sb.append(" rulesMatch: ").append(toIndentedString(rulesMatch)).append("\n"); + sb.append(" typo: ").append(toIndentedString(typo)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/FacetFilters.java b/algoliasearch/src/main/java/com/algolia/model/composition/FacetFilters.java new file mode 100644 index 00000000..f292e021 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/FacetFilters.java @@ -0,0 +1,118 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.algolia.exceptions.AlgoliaRuntimeException; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.io.IOException; +import java.util.List; +import java.util.logging.Logger; + +/** + * Filter the search by facet values, so that only records with the same facet values are retrieved. + * **Prefer using the `filters` parameter, which supports all filter types and combinations with + * boolean operators.** - `[filter1, filter2]` is interpreted as `filter1 AND filter2`. - + * `[[filter1, filter2], filter3]` is interpreted as `filter1 OR filter2 AND filter3`. - + * `facet:-value` is interpreted as `NOT facet:value`. While it's best to avoid attributes that + * start with a `-`, you can still filter them by escaping with a backslash: `facet:\\-value`. + */ +@JsonDeserialize(using = FacetFilters.Deserializer.class) +public interface FacetFilters { + // FacetFilters as List wrapper. + static FacetFilters of(List value) { + return new ListOfFacetFiltersWrapper(value); + } + + // FacetFilters as String wrapper. + static FacetFilters of(String value) { + return new StringWrapper(value); + } + + // FacetFilters as List wrapper. + @JsonSerialize(using = ListOfFacetFiltersWrapper.Serializer.class) + class ListOfFacetFiltersWrapper implements FacetFilters { + + private final List value; + + ListOfFacetFiltersWrapper(List value) { + this.value = value; + } + + public List getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(ListOfFacetFiltersWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + // FacetFilters as String wrapper. + @JsonSerialize(using = StringWrapper.Serializer.class) + class StringWrapper implements FacetFilters { + + private final String value; + + StringWrapper(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(StringWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + class Deserializer extends JsonDeserializer { + + private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName()); + + @Override + public FacetFilters deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = jp.readValueAsTree(); + // deserialize List + if (tree.isArray()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + List value = parser.readValueAs(new TypeReference>() {}); + return new FacetFilters.ListOfFacetFiltersWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf List (error: " + e.getMessage() + ") (type: List)"); + } + } + // deserialize String + if (tree.isTextual()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + String value = parser.readValueAs(String.class); + return new FacetFilters.StringWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf String (error: " + e.getMessage() + ") (type: String)"); + } + } + throw new AlgoliaRuntimeException(String.format("Failed to deserialize json element: %s", tree)); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public FacetFilters getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "FacetFilters cannot be null"); + } + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/FacetHits.java b/algoliasearch/src/main/java/com/algolia/model/composition/FacetHits.java new file mode 100644 index 00000000..1562b211 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/FacetHits.java @@ -0,0 +1,99 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** FacetHits */ +public class FacetHits { + + @JsonProperty("value") + private String value; + + @JsonProperty("highlighted") + private String highlighted; + + @JsonProperty("count") + private Integer count; + + public FacetHits setValue(String value) { + this.value = value; + return this; + } + + /** Facet value. */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public FacetHits setHighlighted(String highlighted) { + this.highlighted = highlighted; + return this; + } + + /** Highlighted attribute value, including HTML tags. */ + @javax.annotation.Nonnull + public String getHighlighted() { + return highlighted; + } + + public FacetHits setCount(Integer count) { + this.count = count; + return this; + } + + /** + * Number of records with this facet value. [The count may be + * approximated](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + */ + @javax.annotation.Nonnull + public Integer getCount() { + return count; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FacetHits facetHits = (FacetHits) o; + return ( + Objects.equals(this.value, facetHits.value) && + Objects.equals(this.highlighted, facetHits.highlighted) && + Objects.equals(this.count, facetHits.count) + ); + } + + @Override + public int hashCode() { + return Objects.hash(value, highlighted, count); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FacetHits {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" highlighted: ").append(toIndentedString(highlighted)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/FacetOrdering.java b/algoliasearch/src/main/java/com/algolia/model/composition/FacetOrdering.java new file mode 100644 index 00000000..6211765b --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/FacetOrdering.java @@ -0,0 +1,87 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** Order of facet names and facet values in your UI. */ +public class FacetOrdering { + + @JsonProperty("facets") + private Facets facets; + + @JsonProperty("values") + private Map values; + + public FacetOrdering setFacets(Facets facets) { + this.facets = facets; + return this; + } + + /** Get facets */ + @javax.annotation.Nullable + public Facets getFacets() { + return facets; + } + + public FacetOrdering setValues(Map values) { + this.values = values; + return this; + } + + public FacetOrdering putValues(String key, Value valuesItem) { + if (this.values == null) { + this.values = new HashMap<>(); + } + this.values.put(key, valuesItem); + return this; + } + + /** Order of facet values. One object for each facet. */ + @javax.annotation.Nullable + public Map getValues() { + return values; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FacetOrdering facetOrdering = (FacetOrdering) o; + return Objects.equals(this.facets, facetOrdering.facets) && Objects.equals(this.values, facetOrdering.values); + } + + @Override + public int hashCode() { + return Objects.hash(facets, values); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FacetOrdering {\n"); + sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); + sb.append(" values: ").append(toIndentedString(values)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/FacetStats.java b/algoliasearch/src/main/java/com/algolia/model/composition/FacetStats.java new file mode 100644 index 00000000..9461a295 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/FacetStats.java @@ -0,0 +1,112 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** FacetStats */ +public class FacetStats { + + @JsonProperty("min") + private Double min; + + @JsonProperty("max") + private Double max; + + @JsonProperty("avg") + private Double avg; + + @JsonProperty("sum") + private Double sum; + + public FacetStats setMin(Double min) { + this.min = min; + return this; + } + + /** Minimum value in the results. */ + @javax.annotation.Nullable + public Double getMin() { + return min; + } + + public FacetStats setMax(Double max) { + this.max = max; + return this; + } + + /** Maximum value in the results. */ + @javax.annotation.Nullable + public Double getMax() { + return max; + } + + public FacetStats setAvg(Double avg) { + this.avg = avg; + return this; + } + + /** Average facet value in the results. */ + @javax.annotation.Nullable + public Double getAvg() { + return avg; + } + + public FacetStats setSum(Double sum) { + this.sum = sum; + return this; + } + + /** Sum of all values in the results. */ + @javax.annotation.Nullable + public Double getSum() { + return sum; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FacetStats facetStats = (FacetStats) o; + return ( + Objects.equals(this.min, facetStats.min) && + Objects.equals(this.max, facetStats.max) && + Objects.equals(this.avg, facetStats.avg) && + Objects.equals(this.sum, facetStats.sum) + ); + } + + @Override + public int hashCode() { + return Objects.hash(min, max, avg, sum); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FacetStats {\n"); + sb.append(" min: ").append(toIndentedString(min)).append("\n"); + sb.append(" max: ").append(toIndentedString(max)).append("\n"); + sb.append(" avg: ").append(toIndentedString(avg)).append("\n"); + sb.append(" sum: ").append(toIndentedString(sum)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/Facets.java b/algoliasearch/src/main/java/com/algolia/model/composition/Facets.java new file mode 100644 index 00000000..97af47f8 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/Facets.java @@ -0,0 +1,75 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Order of facet names. */ +public class Facets { + + @JsonProperty("order") + private List order; + + public Facets setOrder(List order) { + this.order = order; + return this; + } + + public Facets addOrder(String orderItem) { + if (this.order == null) { + this.order = new ArrayList<>(); + } + this.order.add(orderItem); + return this; + } + + /** + * Explicit order of facets or facet values. This setting lets you always show specific facets or + * facet values at the top of the list. + */ + @javax.annotation.Nullable + public List getOrder() { + return order; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Facets facets = (Facets) o; + return Objects.equals(this.order, facets.order); + } + + @Override + public int hashCode() { + return Objects.hash(order); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Facets {\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/HighlightResult.java b/algoliasearch/src/main/java/com/algolia/model/composition/HighlightResult.java new file mode 100644 index 00000000..387d97f7 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/HighlightResult.java @@ -0,0 +1,123 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.algolia.exceptions.AlgoliaRuntimeException; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + +/** HighlightResult */ +@JsonDeserialize(using = HighlightResult.Deserializer.class) +public interface HighlightResult { + // HighlightResult as Map wrapper. + static HighlightResult of(Map value) { + return new MapOfStringHighlightResultWrapper(value); + } + + // HighlightResult as List wrapper. + static HighlightResult of(List value) { + return new ListOfHighlightResultWrapper(value); + } + + // HighlightResult as Map wrapper. + @JsonSerialize(using = MapOfStringHighlightResultWrapper.Serializer.class) + class MapOfStringHighlightResultWrapper implements HighlightResult { + + private final Map value; + + MapOfStringHighlightResultWrapper(Map value) { + this.value = value; + } + + public Map getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(MapOfStringHighlightResultWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + // HighlightResult as List wrapper. + @JsonSerialize(using = ListOfHighlightResultWrapper.Serializer.class) + class ListOfHighlightResultWrapper implements HighlightResult { + + private final List value; + + ListOfHighlightResultWrapper(List value) { + this.value = value; + } + + public List getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(ListOfHighlightResultWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + class Deserializer extends JsonDeserializer { + + private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName()); + + @Override + public HighlightResult deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = jp.readValueAsTree(); + // deserialize HighlightResultOption + if (tree.isObject() && tree.has("matchLevel") && tree.has("matchedWords")) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + return parser.readValueAs(HighlightResultOption.class); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf HighlightResultOption (error: " + e.getMessage() + ") (type: HighlightResultOption)"); + } + } + // deserialize Map + if (tree.isObject()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + Map value = parser.readValueAs(new TypeReference>() {}); + return new HighlightResult.MapOfStringHighlightResultWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest( + "Failed to deserialize oneOf Map (error: " + e.getMessage() + ") (type: Map)" + ); + } + } + // deserialize List + if (tree.isArray()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + List value = parser.readValueAs(new TypeReference>() {}); + return new HighlightResult.ListOfHighlightResultWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf List (error: " + e.getMessage() + ") (type: List)"); + } + } + throw new AlgoliaRuntimeException(String.format("Failed to deserialize json element: %s", tree)); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public HighlightResult getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "HighlightResult cannot be null"); + } + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/HighlightResultOption.java b/algoliasearch/src/main/java/com/algolia/model/composition/HighlightResultOption.java new file mode 100644 index 00000000..4bd9af4b --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/HighlightResultOption.java @@ -0,0 +1,120 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Surround words that match the query with HTML tags for highlighting. */ +@JsonDeserialize(as = HighlightResultOption.class) +public class HighlightResultOption implements HighlightResult { + + @JsonProperty("value") + private String value; + + @JsonProperty("matchLevel") + private MatchLevel matchLevel; + + @JsonProperty("matchedWords") + private List matchedWords = new ArrayList<>(); + + @JsonProperty("fullyHighlighted") + private Boolean fullyHighlighted; + + public HighlightResultOption setValue(String value) { + this.value = value; + return this; + } + + /** Highlighted attribute value, including HTML tags. */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public HighlightResultOption setMatchLevel(MatchLevel matchLevel) { + this.matchLevel = matchLevel; + return this; + } + + /** Get matchLevel */ + @javax.annotation.Nonnull + public MatchLevel getMatchLevel() { + return matchLevel; + } + + public HighlightResultOption setMatchedWords(List matchedWords) { + this.matchedWords = matchedWords; + return this; + } + + public HighlightResultOption addMatchedWords(String matchedWordsItem) { + this.matchedWords.add(matchedWordsItem); + return this; + } + + /** List of matched words from the search query. */ + @javax.annotation.Nonnull + public List getMatchedWords() { + return matchedWords; + } + + public HighlightResultOption setFullyHighlighted(Boolean fullyHighlighted) { + this.fullyHighlighted = fullyHighlighted; + return this; + } + + /** Whether the entire attribute value is highlighted. */ + @javax.annotation.Nullable + public Boolean getFullyHighlighted() { + return fullyHighlighted; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HighlightResultOption highlightResultOption = (HighlightResultOption) o; + return ( + Objects.equals(this.value, highlightResultOption.value) && + Objects.equals(this.matchLevel, highlightResultOption.matchLevel) && + Objects.equals(this.matchedWords, highlightResultOption.matchedWords) && + Objects.equals(this.fullyHighlighted, highlightResultOption.fullyHighlighted) + ); + } + + @Override + public int hashCode() { + return Objects.hash(value, matchLevel, matchedWords, fullyHighlighted); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HighlightResultOption {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" matchLevel: ").append(toIndentedString(matchLevel)).append("\n"); + sb.append(" matchedWords: ").append(toIndentedString(matchedWords)).append("\n"); + sb.append(" fullyHighlighted: ").append(toIndentedString(fullyHighlighted)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/Hit.java b/algoliasearch/src/main/java/com/algolia/model/composition/Hit.java new file mode 100644 index 00000000..c4fa00f7 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/Hit.java @@ -0,0 +1,164 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** + * Search result. A hit is a record from your index, augmented with special attributes for + * highlighting, snippeting, and ranking. + */ +public class Hit { + + @JsonProperty("objectID") + private String objectID; + + @JsonProperty("_highlightResult") + private Map highlightResult; + + @JsonProperty("_snippetResult") + private Map snippetResult; + + @JsonProperty("_rankingInfo") + private HitRankingInfo rankingInfo; + + @JsonProperty("_distinctSeqID") + private Integer distinctSeqID; + + private Map additionalProperties = new HashMap<>(); + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public Hit setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + return this; + } + + public Hit setObjectID(String objectID) { + this.objectID = objectID; + return this; + } + + /** Unique record identifier. */ + @javax.annotation.Nonnull + public String getObjectID() { + return objectID; + } + + public Hit setHighlightResult(Map highlightResult) { + this.highlightResult = highlightResult; + return this; + } + + public Hit putHighlightResult(String key, HighlightResult highlightResultItem) { + if (this.highlightResult == null) { + this.highlightResult = new HashMap<>(); + } + this.highlightResult.put(key, highlightResultItem); + return this; + } + + /** Surround words that match the query with HTML tags for highlighting. */ + @javax.annotation.Nullable + public Map getHighlightResult() { + return highlightResult; + } + + public Hit setSnippetResult(Map snippetResult) { + this.snippetResult = snippetResult; + return this; + } + + public Hit putSnippetResult(String key, SnippetResult snippetResultItem) { + if (this.snippetResult == null) { + this.snippetResult = new HashMap<>(); + } + this.snippetResult.put(key, snippetResultItem); + return this; + } + + /** Snippets that show the context around a matching search query. */ + @javax.annotation.Nullable + public Map getSnippetResult() { + return snippetResult; + } + + public Hit setRankingInfo(HitRankingInfo rankingInfo) { + this.rankingInfo = rankingInfo; + return this; + } + + /** Get rankingInfo */ + @javax.annotation.Nullable + public HitRankingInfo getRankingInfo() { + return rankingInfo; + } + + public Hit setDistinctSeqID(Integer distinctSeqID) { + this.distinctSeqID = distinctSeqID; + return this; + } + + /** Get distinctSeqID */ + @javax.annotation.Nullable + public Integer getDistinctSeqID() { + return distinctSeqID; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Hit hit = (Hit) o; + return ( + Objects.equals(this.objectID, hit.objectID) && + Objects.equals(this.highlightResult, hit.highlightResult) && + Objects.equals(this.snippetResult, hit.snippetResult) && + Objects.equals(this.rankingInfo, hit.rankingInfo) && + Objects.equals(this.distinctSeqID, hit.distinctSeqID) && + super.equals(o) + ); + } + + @Override + public int hashCode() { + return Objects.hash(objectID, highlightResult, snippetResult, rankingInfo, distinctSeqID, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Hit {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); + sb.append(" highlightResult: ").append(toIndentedString(highlightResult)).append("\n"); + sb.append(" snippetResult: ").append(toIndentedString(snippetResult)).append("\n"); + sb.append(" rankingInfo: ").append(toIndentedString(rankingInfo)).append("\n"); + sb.append(" distinctSeqID: ").append(toIndentedString(distinctSeqID)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/HitRankingInfo.java b/algoliasearch/src/main/java/com/algolia/model/composition/HitRankingInfo.java new file mode 100644 index 00000000..d8e38669 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/HitRankingInfo.java @@ -0,0 +1,303 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +/** HitRankingInfo */ +public class HitRankingInfo { + + @JsonProperty("filters") + private Integer filters; + + @JsonProperty("firstMatchedWord") + private Integer firstMatchedWord; + + @JsonProperty("geoDistance") + private Integer geoDistance; + + @JsonProperty("geoPrecision") + private Integer geoPrecision; + + @JsonProperty("matchedGeoLocation") + private MatchedGeoLocation matchedGeoLocation; + + @JsonProperty("personalization") + private Personalization personalization; + + @JsonProperty("nbExactWords") + private Integer nbExactWords; + + @JsonProperty("nbTypos") + private Integer nbTypos; + + @JsonProperty("promoted") + private Boolean promoted; + + @JsonProperty("proximityDistance") + private Integer proximityDistance; + + @JsonProperty("userScore") + private Integer userScore; + + @JsonProperty("words") + private Integer words; + + @JsonProperty("promotedByReRanking") + private Boolean promotedByReRanking; + + @JsonProperty("composed") + private Map composed; + + public HitRankingInfo setFilters(Integer filters) { + this.filters = filters; + return this; + } + + /** Whether a filter matched the query. minimum: 0 */ + @javax.annotation.Nullable + public Integer getFilters() { + return filters; + } + + public HitRankingInfo setFirstMatchedWord(Integer firstMatchedWord) { + this.firstMatchedWord = firstMatchedWord; + return this; + } + + /** Position of the first matched word in the best matching attribute of the record. minimum: 0 */ + @javax.annotation.Nonnull + public Integer getFirstMatchedWord() { + return firstMatchedWord; + } + + public HitRankingInfo setGeoDistance(Integer geoDistance) { + this.geoDistance = geoDistance; + return this; + } + + /** + * Distance between the geo location in the search query and the best matching geo location in the + * record, divided by the geo precision (in meters). minimum: 0 + */ + @javax.annotation.Nonnull + public Integer getGeoDistance() { + return geoDistance; + } + + public HitRankingInfo setGeoPrecision(Integer geoPrecision) { + this.geoPrecision = geoPrecision; + return this; + } + + /** Precision used when computing the geo distance, in meters. minimum: 1 */ + @javax.annotation.Nullable + public Integer getGeoPrecision() { + return geoPrecision; + } + + public HitRankingInfo setMatchedGeoLocation(MatchedGeoLocation matchedGeoLocation) { + this.matchedGeoLocation = matchedGeoLocation; + return this; + } + + /** Get matchedGeoLocation */ + @javax.annotation.Nullable + public MatchedGeoLocation getMatchedGeoLocation() { + return matchedGeoLocation; + } + + public HitRankingInfo setPersonalization(Personalization personalization) { + this.personalization = personalization; + return this; + } + + /** Get personalization */ + @javax.annotation.Nullable + public Personalization getPersonalization() { + return personalization; + } + + public HitRankingInfo setNbExactWords(Integer nbExactWords) { + this.nbExactWords = nbExactWords; + return this; + } + + /** Number of exactly matched words. minimum: 0 */ + @javax.annotation.Nonnull + public Integer getNbExactWords() { + return nbExactWords; + } + + public HitRankingInfo setNbTypos(Integer nbTypos) { + this.nbTypos = nbTypos; + return this; + } + + /** Number of typos encountered when matching the record. minimum: 0 */ + @javax.annotation.Nonnull + public Integer getNbTypos() { + return nbTypos; + } + + public HitRankingInfo setPromoted(Boolean promoted) { + this.promoted = promoted; + return this; + } + + /** Whether the record was promoted by a rule. */ + @javax.annotation.Nullable + public Boolean getPromoted() { + return promoted; + } + + public HitRankingInfo setProximityDistance(Integer proximityDistance) { + this.proximityDistance = proximityDistance; + return this; + } + + /** + * Number of words between multiple matches in the query plus 1. For single word queries, + * `proximityDistance` is 0. minimum: 0 + */ + @javax.annotation.Nullable + public Integer getProximityDistance() { + return proximityDistance; + } + + public HitRankingInfo setUserScore(Integer userScore) { + this.userScore = userScore; + return this; + } + + /** Overall ranking of the record, expressed as a single integer. This attribute is internal. */ + @javax.annotation.Nonnull + public Integer getUserScore() { + return userScore; + } + + public HitRankingInfo setWords(Integer words) { + this.words = words; + return this; + } + + /** Number of matched words. minimum: 1 */ + @javax.annotation.Nullable + public Integer getWords() { + return words; + } + + public HitRankingInfo setPromotedByReRanking(Boolean promotedByReRanking) { + this.promotedByReRanking = promotedByReRanking; + return this; + } + + /** Whether the record is re-ranked. */ + @javax.annotation.Nullable + public Boolean getPromotedByReRanking() { + return promotedByReRanking; + } + + public HitRankingInfo setComposed(Map composed) { + this.composed = composed; + return this; + } + + public HitRankingInfo putComposed(String key, CompositionIdRankingInfo composedItem) { + if (this.composed == null) { + this.composed = new HashMap<>(); + } + this.composed.put(key, composedItem); + return this; + } + + /** Get composed */ + @javax.annotation.Nullable + public Map getComposed() { + return composed; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HitRankingInfo hitRankingInfo = (HitRankingInfo) o; + return ( + Objects.equals(this.filters, hitRankingInfo.filters) && + Objects.equals(this.firstMatchedWord, hitRankingInfo.firstMatchedWord) && + Objects.equals(this.geoDistance, hitRankingInfo.geoDistance) && + Objects.equals(this.geoPrecision, hitRankingInfo.geoPrecision) && + Objects.equals(this.matchedGeoLocation, hitRankingInfo.matchedGeoLocation) && + Objects.equals(this.personalization, hitRankingInfo.personalization) && + Objects.equals(this.nbExactWords, hitRankingInfo.nbExactWords) && + Objects.equals(this.nbTypos, hitRankingInfo.nbTypos) && + Objects.equals(this.promoted, hitRankingInfo.promoted) && + Objects.equals(this.proximityDistance, hitRankingInfo.proximityDistance) && + Objects.equals(this.userScore, hitRankingInfo.userScore) && + Objects.equals(this.words, hitRankingInfo.words) && + Objects.equals(this.promotedByReRanking, hitRankingInfo.promotedByReRanking) && + Objects.equals(this.composed, hitRankingInfo.composed) + ); + } + + @Override + public int hashCode() { + return Objects.hash( + filters, + firstMatchedWord, + geoDistance, + geoPrecision, + matchedGeoLocation, + personalization, + nbExactWords, + nbTypos, + promoted, + proximityDistance, + userScore, + words, + promotedByReRanking, + composed + ); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HitRankingInfo {\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" firstMatchedWord: ").append(toIndentedString(firstMatchedWord)).append("\n"); + sb.append(" geoDistance: ").append(toIndentedString(geoDistance)).append("\n"); + sb.append(" geoPrecision: ").append(toIndentedString(geoPrecision)).append("\n"); + sb.append(" matchedGeoLocation: ").append(toIndentedString(matchedGeoLocation)).append("\n"); + sb.append(" personalization: ").append(toIndentedString(personalization)).append("\n"); + sb.append(" nbExactWords: ").append(toIndentedString(nbExactWords)).append("\n"); + sb.append(" nbTypos: ").append(toIndentedString(nbTypos)).append("\n"); + sb.append(" promoted: ").append(toIndentedString(promoted)).append("\n"); + sb.append(" proximityDistance: ").append(toIndentedString(proximityDistance)).append("\n"); + sb.append(" userScore: ").append(toIndentedString(userScore)).append("\n"); + sb.append(" words: ").append(toIndentedString(words)).append("\n"); + sb.append(" promotedByReRanking: ").append(toIndentedString(promotedByReRanking)).append("\n"); + sb.append(" composed: ").append(toIndentedString(composed)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/InsideBoundingBox.java b/algoliasearch/src/main/java/com/algolia/model/composition/InsideBoundingBox.java new file mode 100644 index 00000000..e6084845 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/InsideBoundingBox.java @@ -0,0 +1,111 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.algolia.exceptions.AlgoliaRuntimeException; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.io.IOException; +import java.util.List; +import java.util.logging.Logger; + +/** InsideBoundingBox */ +@JsonDeserialize(using = InsideBoundingBox.Deserializer.class) +public interface InsideBoundingBox { + // InsideBoundingBox as String wrapper. + static InsideBoundingBox of(String value) { + return new StringWrapper(value); + } + + // InsideBoundingBox as List> wrapper. + static InsideBoundingBox of(List> value) { + return new ListOfListOfDoubleWrapper(value); + } + + // InsideBoundingBox as String wrapper. + @JsonSerialize(using = StringWrapper.Serializer.class) + class StringWrapper implements InsideBoundingBox { + + private final String value; + + StringWrapper(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(StringWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + // InsideBoundingBox as List> wrapper. + @JsonSerialize(using = ListOfListOfDoubleWrapper.Serializer.class) + class ListOfListOfDoubleWrapper implements InsideBoundingBox { + + private final List> value; + + ListOfListOfDoubleWrapper(List> value) { + this.value = value; + } + + public List> getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(ListOfListOfDoubleWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + class Deserializer extends JsonDeserializer { + + private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName()); + + @Override + public InsideBoundingBox deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = jp.readValueAsTree(); + // deserialize String + if (tree.isTextual()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + String value = parser.readValueAs(String.class); + return new InsideBoundingBox.StringWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf String (error: " + e.getMessage() + ") (type: String)"); + } + } + // deserialize List> + if (tree.isArray()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + List> value = parser.readValueAs(new TypeReference>>() {}); + return new InsideBoundingBox.ListOfListOfDoubleWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf List> (error: " + e.getMessage() + ") (type: List>)"); + } + } + throw new AlgoliaRuntimeException(String.format("Failed to deserialize json element: %s", tree)); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public InsideBoundingBox getNullValue(DeserializationContext ctxt) throws JsonMappingException { + return null; + } + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/MatchLevel.java b/algoliasearch/src/main/java/com/algolia/model/composition/MatchLevel.java new file mode 100644 index 00000000..f5e5174d --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/MatchLevel.java @@ -0,0 +1,42 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; + +/** Whether the whole query string matches or only a part. */ +public enum MatchLevel { + NONE("none"), + + PARTIAL("partial"), + + FULL("full"); + + private final String value; + + MatchLevel(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static MatchLevel fromValue(String value) { + for (MatchLevel b : MatchLevel.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/MatchedGeoLocation.java b/algoliasearch/src/main/java/com/algolia/model/composition/MatchedGeoLocation.java new file mode 100644 index 00000000..90ff196e --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/MatchedGeoLocation.java @@ -0,0 +1,96 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** MatchedGeoLocation */ +public class MatchedGeoLocation { + + @JsonProperty("lat") + private Double lat; + + @JsonProperty("lng") + private Double lng; + + @JsonProperty("distance") + private Integer distance; + + public MatchedGeoLocation setLat(Double lat) { + this.lat = lat; + return this; + } + + /** Latitude of the matched location. */ + @javax.annotation.Nullable + public Double getLat() { + return lat; + } + + public MatchedGeoLocation setLng(Double lng) { + this.lng = lng; + return this; + } + + /** Longitude of the matched location. */ + @javax.annotation.Nullable + public Double getLng() { + return lng; + } + + public MatchedGeoLocation setDistance(Integer distance) { + this.distance = distance; + return this; + } + + /** Distance between the matched location and the search location (in meters). */ + @javax.annotation.Nullable + public Integer getDistance() { + return distance; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MatchedGeoLocation matchedGeoLocation = (MatchedGeoLocation) o; + return ( + Objects.equals(this.lat, matchedGeoLocation.lat) && + Objects.equals(this.lng, matchedGeoLocation.lng) && + Objects.equals(this.distance, matchedGeoLocation.distance) + ); + } + + @Override + public int hashCode() { + return Objects.hash(lat, lng, distance); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MatchedGeoLocation {\n"); + sb.append(" lat: ").append(toIndentedString(lat)).append("\n"); + sb.append(" lng: ").append(toIndentedString(lng)).append("\n"); + sb.append(" distance: ").append(toIndentedString(distance)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/NumericFilters.java b/algoliasearch/src/main/java/com/algolia/model/composition/NumericFilters.java new file mode 100644 index 00000000..f3717a27 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/NumericFilters.java @@ -0,0 +1,117 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.algolia.exceptions.AlgoliaRuntimeException; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.io.IOException; +import java.util.List; +import java.util.logging.Logger; + +/** + * Filter by numeric facets. **Prefer using the `filters` parameter, which supports all filter types + * and combinations with boolean operators.** You can use numeric comparison operators: `<`, `<=`, + * `=`, `!=`, `>`, `>=`. Comparisons are precise up to 3 decimals. You can also provide ranges: + * `facet: TO `. The range includes the lower and upper boundaries. The same + * combination rules apply as for `facetFilters`. + */ +@JsonDeserialize(using = NumericFilters.Deserializer.class) +public interface NumericFilters { + // NumericFilters as List wrapper. + static NumericFilters of(List value) { + return new ListOfNumericFiltersWrapper(value); + } + + // NumericFilters as String wrapper. + static NumericFilters of(String value) { + return new StringWrapper(value); + } + + // NumericFilters as List wrapper. + @JsonSerialize(using = ListOfNumericFiltersWrapper.Serializer.class) + class ListOfNumericFiltersWrapper implements NumericFilters { + + private final List value; + + ListOfNumericFiltersWrapper(List value) { + this.value = value; + } + + public List getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(ListOfNumericFiltersWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + // NumericFilters as String wrapper. + @JsonSerialize(using = StringWrapper.Serializer.class) + class StringWrapper implements NumericFilters { + + private final String value; + + StringWrapper(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(StringWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + class Deserializer extends JsonDeserializer { + + private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName()); + + @Override + public NumericFilters deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = jp.readValueAsTree(); + // deserialize List + if (tree.isArray()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + List value = parser.readValueAs(new TypeReference>() {}); + return new NumericFilters.ListOfNumericFiltersWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf List (error: " + e.getMessage() + ") (type: List)"); + } + } + // deserialize String + if (tree.isTextual()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + String value = parser.readValueAs(String.class); + return new NumericFilters.StringWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf String (error: " + e.getMessage() + ") (type: String)"); + } + } + throw new AlgoliaRuntimeException(String.format("Failed to deserialize json element: %s", tree)); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public NumericFilters getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "NumericFilters cannot be null"); + } + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/OptionalFilters.java b/algoliasearch/src/main/java/com/algolia/model/composition/OptionalFilters.java new file mode 100644 index 00000000..9f776871 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/OptionalFilters.java @@ -0,0 +1,120 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.algolia.exceptions.AlgoliaRuntimeException; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.io.IOException; +import java.util.List; +import java.util.logging.Logger; + +/** + * Filters to promote or demote records in the search results. Optional filters work like facet + * filters, but they don't exclude records from the search results. Records that match the optional + * filter rank before records that don't match. If you're using a negative filter `facet:-value`, + * matching records rank after records that don't match. - Optional filters don't work on virtual + * replicas. - Optional filters are applied _after_ sort-by attributes. - Optional filters are + * applied _before_ custom ranking attributes (in the default + * [ranking](https://www.algolia.com/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria/)). + * - Optional filters don't work with numeric attributes. + */ +@JsonDeserialize(using = OptionalFilters.Deserializer.class) +public interface OptionalFilters { + // OptionalFilters as List wrapper. + static OptionalFilters of(List value) { + return new ListOfOptionalFiltersWrapper(value); + } + + // OptionalFilters as String wrapper. + static OptionalFilters of(String value) { + return new StringWrapper(value); + } + + // OptionalFilters as List wrapper. + @JsonSerialize(using = ListOfOptionalFiltersWrapper.Serializer.class) + class ListOfOptionalFiltersWrapper implements OptionalFilters { + + private final List value; + + ListOfOptionalFiltersWrapper(List value) { + this.value = value; + } + + public List getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(ListOfOptionalFiltersWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + // OptionalFilters as String wrapper. + @JsonSerialize(using = StringWrapper.Serializer.class) + class StringWrapper implements OptionalFilters { + + private final String value; + + StringWrapper(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(StringWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + class Deserializer extends JsonDeserializer { + + private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName()); + + @Override + public OptionalFilters deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = jp.readValueAsTree(); + // deserialize List + if (tree.isArray()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + List value = parser.readValueAs(new TypeReference>() {}); + return new OptionalFilters.ListOfOptionalFiltersWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf List (error: " + e.getMessage() + ") (type: List)"); + } + } + // deserialize String + if (tree.isTextual()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + String value = parser.readValueAs(String.class); + return new OptionalFilters.StringWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf String (error: " + e.getMessage() + ") (type: String)"); + } + } + throw new AlgoliaRuntimeException(String.format("Failed to deserialize json element: %s", tree)); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public OptionalFilters getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "OptionalFilters cannot be null"); + } + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/Params.java b/algoliasearch/src/main/java/com/algolia/model/composition/Params.java new file mode 100644 index 00000000..c0fc6e96 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/Params.java @@ -0,0 +1,601 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Params */ +public class Params { + + @JsonProperty("query") + private String query; + + @JsonProperty("filters") + private String filters; + + @JsonProperty("page") + private Integer page; + + @JsonProperty("getRankingInfo") + private Boolean getRankingInfo; + + @JsonProperty("relevancyStrictness") + private Integer relevancyStrictness; + + @JsonProperty("facetFilters") + private FacetFilters facetFilters; + + @JsonProperty("optionalFilters") + private OptionalFilters optionalFilters; + + @JsonProperty("numericFilters") + private NumericFilters numericFilters; + + @JsonProperty("hitsPerPage") + private Integer hitsPerPage; + + @JsonProperty("aroundLatLng") + private String aroundLatLng; + + @JsonProperty("aroundLatLngViaIP") + private Boolean aroundLatLngViaIP; + + @JsonProperty("aroundRadius") + private AroundRadius aroundRadius; + + @JsonProperty("aroundPrecision") + private AroundPrecision aroundPrecision; + + @JsonProperty("minimumAroundRadius") + private Integer minimumAroundRadius; + + @JsonProperty("insideBoundingBox") + private InsideBoundingBox insideBoundingBox; + + @JsonProperty("insidePolygon") + private List> insidePolygon; + + @JsonProperty("queryLanguages") + private List queryLanguages; + + @JsonProperty("naturalLanguages") + private List naturalLanguages; + + @JsonProperty("enableRules") + private Boolean enableRules; + + @JsonProperty("ruleContexts") + private List ruleContexts; + + @JsonProperty("userToken") + private String userToken; + + @JsonProperty("clickAnalytics") + private Boolean clickAnalytics; + + @JsonProperty("analytics") + private Boolean analytics; + + @JsonProperty("analyticsTags") + private List analyticsTags; + + @JsonProperty("enableABTest") + private Boolean enableABTest; + + @JsonProperty("enableReRanking") + private Boolean enableReRanking; + + public Params setQuery(String query) { + this.query = query; + return this; + } + + /** Search query. */ + @javax.annotation.Nullable + public String getQuery() { + return query; + } + + public Params setFilters(String filters) { + this.filters = filters; + return this; + } + + /** + * Filter expression to only include items that match the filter criteria in the response. You can + * use these filter expressions: - **Numeric filters.** ` `, where `` is + * one of `<`, `<=`, `=`, `!=`, `>`, `>=`. - **Ranges.** `: TO ` where + * `` and `` are the lower and upper limits of the range (inclusive). - **Facet + * filters.** `:` where `` is a facet attribute (case-sensitive) and + * `` a facet value. - **Tag filters.** `_tags:` or just `` (case-sensitive). + * - **Boolean filters.** `: true | false`. You can combine filters with `AND`, `OR`, and + * `NOT` operators with the following restrictions: - You can only combine filters of the same + * type with `OR`. **Not supported:** `facet:value OR num > 3`. - You can't use `NOT` with + * combinations of filters. **Not supported:** `NOT(facet:value OR facet:value)` - You can't + * combine conjunctions (`AND`) with `OR`. **Not supported:** `facet:value OR (facet:value AND + * facet:value)` Use quotes around your filters, if the facet attribute name or facet value has + * spaces, keywords (`OR`, `AND`, `NOT`), or quotes. If a facet attribute is an array, the filter + * matches if it matches at least one element of the array. For more information, see + * [Filters](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering/). + */ + @javax.annotation.Nullable + public String getFilters() { + return filters; + } + + public Params setPage(Integer page) { + this.page = page; + return this; + } + + /** Page of search results to retrieve. minimum: 0 */ + @javax.annotation.Nullable + public Integer getPage() { + return page; + } + + public Params setGetRankingInfo(Boolean getRankingInfo) { + this.getRankingInfo = getRankingInfo; + return this; + } + + /** Whether the search response should include detailed ranking information. */ + @javax.annotation.Nullable + public Boolean getGetRankingInfo() { + return getRankingInfo; + } + + public Params setRelevancyStrictness(Integer relevancyStrictness) { + this.relevancyStrictness = relevancyStrictness; + return this; + } + + /** Get relevancyStrictness */ + @javax.annotation.Nullable + public Integer getRelevancyStrictness() { + return relevancyStrictness; + } + + public Params setFacetFilters(FacetFilters facetFilters) { + this.facetFilters = facetFilters; + return this; + } + + /** Get facetFilters */ + @javax.annotation.Nullable + public FacetFilters getFacetFilters() { + return facetFilters; + } + + public Params setOptionalFilters(OptionalFilters optionalFilters) { + this.optionalFilters = optionalFilters; + return this; + } + + /** Get optionalFilters */ + @javax.annotation.Nullable + public OptionalFilters getOptionalFilters() { + return optionalFilters; + } + + public Params setNumericFilters(NumericFilters numericFilters) { + this.numericFilters = numericFilters; + return this; + } + + /** Get numericFilters */ + @javax.annotation.Nullable + public NumericFilters getNumericFilters() { + return numericFilters; + } + + public Params setHitsPerPage(Integer hitsPerPage) { + this.hitsPerPage = hitsPerPage; + return this; + } + + /** Number of hits per page. minimum: 1 maximum: 1000 */ + @javax.annotation.Nullable + public Integer getHitsPerPage() { + return hitsPerPage; + } + + public Params setAroundLatLng(String aroundLatLng) { + this.aroundLatLng = aroundLatLng; + return this; + } + + /** + * Coordinates for the center of a circle, expressed as a comma-separated string of latitude and + * longitude. Only records included within a circle around this central location are included in + * the results. The radius of the circle is determined by the `aroundRadius` and + * `minimumAroundRadius` settings. This parameter is ignored if you also specify `insidePolygon` + * or `insideBoundingBox`. + */ + @javax.annotation.Nullable + public String getAroundLatLng() { + return aroundLatLng; + } + + public Params setAroundLatLngViaIP(Boolean aroundLatLngViaIP) { + this.aroundLatLngViaIP = aroundLatLngViaIP; + return this; + } + + /** Whether to obtain the coordinates from the request's IP address. */ + @javax.annotation.Nullable + public Boolean getAroundLatLngViaIP() { + return aroundLatLngViaIP; + } + + public Params setAroundRadius(AroundRadius aroundRadius) { + this.aroundRadius = aroundRadius; + return this; + } + + /** Get aroundRadius */ + @javax.annotation.Nullable + public AroundRadius getAroundRadius() { + return aroundRadius; + } + + public Params setAroundPrecision(AroundPrecision aroundPrecision) { + this.aroundPrecision = aroundPrecision; + return this; + } + + /** Get aroundPrecision */ + @javax.annotation.Nullable + public AroundPrecision getAroundPrecision() { + return aroundPrecision; + } + + public Params setMinimumAroundRadius(Integer minimumAroundRadius) { + this.minimumAroundRadius = minimumAroundRadius; + return this; + } + + /** + * Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set. + * minimum: 1 + */ + @javax.annotation.Nullable + public Integer getMinimumAroundRadius() { + return minimumAroundRadius; + } + + public Params setInsideBoundingBox(InsideBoundingBox insideBoundingBox) { + this.insideBoundingBox = insideBoundingBox; + return this; + } + + /** Get insideBoundingBox */ + @javax.annotation.Nullable + public InsideBoundingBox getInsideBoundingBox() { + return insideBoundingBox; + } + + public Params setInsidePolygon(List> insidePolygon) { + this.insidePolygon = insidePolygon; + return this; + } + + public Params addInsidePolygon(List insidePolygonItem) { + if (this.insidePolygon == null) { + this.insidePolygon = new ArrayList<>(); + } + this.insidePolygon.add(insidePolygonItem); + return this; + } + + /** + * Coordinates of a polygon in which to search. Polygons are defined by 3 to 10,000 points. Each + * point is represented by its latitude and longitude. Provide multiple polygons as nested arrays. + * For more information, see [filtering inside + * polygons](https://www.algolia.com/doc/guides/managing-results/refine-results/geolocation/#filtering-inside-rectangular-or-polygonal-areas). + * This parameter is ignored if you also specify `insideBoundingBox`. + */ + @javax.annotation.Nullable + public List> getInsidePolygon() { + return insidePolygon; + } + + public Params setQueryLanguages(List queryLanguages) { + this.queryLanguages = queryLanguages; + return this; + } + + public Params addQueryLanguages(SupportedLanguage queryLanguagesItem) { + if (this.queryLanguages == null) { + this.queryLanguages = new ArrayList<>(); + } + this.queryLanguages.add(queryLanguagesItem); + return this; + } + + /** + * Languages for language-specific query processing steps such as plurals, stop-word removal, and + * word-detection dictionaries. This setting sets a default list of languages used by the + * `removeStopWords` and `ignorePlurals` settings. This setting also sets a dictionary for word + * detection in the logogram-based + * [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) + * languages. To support this, you must place the CJK language **first**. **You should always + * specify a query language.** If you don't specify an indexing language, the search engine uses + * all [supported + * languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/), + * or the languages you specified with the `ignorePlurals` or `removeStopWords` parameters. This + * can lead to unexpected search results. For more information, see [Language-specific + * configuration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/). + */ + @javax.annotation.Nullable + public List getQueryLanguages() { + return queryLanguages; + } + + public Params setNaturalLanguages(List naturalLanguages) { + this.naturalLanguages = naturalLanguages; + return this; + } + + public Params addNaturalLanguages(SupportedLanguage naturalLanguagesItem) { + if (this.naturalLanguages == null) { + this.naturalLanguages = new ArrayList<>(); + } + this.naturalLanguages.add(naturalLanguagesItem); + return this; + } + + /** + * ISO language codes that adjust settings that are useful for processing natural language queries + * (as opposed to keyword searches): - Sets `removeStopWords` and `ignorePlurals` to the list of + * provided languages. - Sets `removeWordsIfNoResults` to `allOptional`. - Adds a + * `natural_language` attribute to `ruleContexts` and `analyticsTags`. + */ + @javax.annotation.Nullable + public List getNaturalLanguages() { + return naturalLanguages; + } + + public Params setEnableRules(Boolean enableRules) { + this.enableRules = enableRules; + return this; + } + + /** Whether to enable rules. */ + @javax.annotation.Nullable + public Boolean getEnableRules() { + return enableRules; + } + + public Params setRuleContexts(List ruleContexts) { + this.ruleContexts = ruleContexts; + return this; + } + + public Params addRuleContexts(String ruleContextsItem) { + if (this.ruleContexts == null) { + this.ruleContexts = new ArrayList<>(); + } + this.ruleContexts.add(ruleContextsItem); + return this; + } + + /** + * Assigns a rule context to the search query. [Rule + * contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) + * are strings that you can use to trigger matching rules. + */ + @javax.annotation.Nullable + public List getRuleContexts() { + return ruleContexts; + } + + public Params setUserToken(String userToken) { + this.userToken = userToken; + return this; + } + + /** + * Unique pseudonymous or anonymous user identifier. This helps with analytics and click and + * conversion events. For more information, see [user + * token](https://www.algolia.com/doc/guides/sending-events/concepts/usertoken/). + */ + @javax.annotation.Nullable + public String getUserToken() { + return userToken; + } + + public Params setClickAnalytics(Boolean clickAnalytics) { + this.clickAnalytics = clickAnalytics; + return this; + } + + /** + * Whether to include a `queryID` attribute in the response. The query ID is a unique identifier + * for a search query and is required for tracking [click and conversion + * events](https://www.algolia.com/guides/sending-events/getting-started/). + */ + @javax.annotation.Nullable + public Boolean getClickAnalytics() { + return clickAnalytics; + } + + public Params setAnalytics(Boolean analytics) { + this.analytics = analytics; + return this; + } + + /** Whether this search will be included in Analytics. */ + @javax.annotation.Nullable + public Boolean getAnalytics() { + return analytics; + } + + public Params setAnalyticsTags(List analyticsTags) { + this.analyticsTags = analyticsTags; + return this; + } + + public Params addAnalyticsTags(String analyticsTagsItem) { + if (this.analyticsTags == null) { + this.analyticsTags = new ArrayList<>(); + } + this.analyticsTags.add(analyticsTagsItem); + return this; + } + + /** + * Tags to apply to the query for [segmenting analytics + * data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/). + */ + @javax.annotation.Nullable + public List getAnalyticsTags() { + return analyticsTags; + } + + public Params setEnableABTest(Boolean enableABTest) { + this.enableABTest = enableABTest; + return this; + } + + /** Whether to enable A/B testing for this search. */ + @javax.annotation.Nullable + public Boolean getEnableABTest() { + return enableABTest; + } + + public Params setEnableReRanking(Boolean enableReRanking) { + this.enableReRanking = enableReRanking; + return this; + } + + /** + * Whether this search will use [Dynamic + * Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/). This setting only has + * an effect if you activated Dynamic Re-Ranking for this index in the Algolia dashboard. + */ + @javax.annotation.Nullable + public Boolean getEnableReRanking() { + return enableReRanking; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Params params = (Params) o; + return ( + Objects.equals(this.query, params.query) && + Objects.equals(this.filters, params.filters) && + Objects.equals(this.page, params.page) && + Objects.equals(this.getRankingInfo, params.getRankingInfo) && + Objects.equals(this.relevancyStrictness, params.relevancyStrictness) && + Objects.equals(this.facetFilters, params.facetFilters) && + Objects.equals(this.optionalFilters, params.optionalFilters) && + Objects.equals(this.numericFilters, params.numericFilters) && + Objects.equals(this.hitsPerPage, params.hitsPerPage) && + Objects.equals(this.aroundLatLng, params.aroundLatLng) && + Objects.equals(this.aroundLatLngViaIP, params.aroundLatLngViaIP) && + Objects.equals(this.aroundRadius, params.aroundRadius) && + Objects.equals(this.aroundPrecision, params.aroundPrecision) && + Objects.equals(this.minimumAroundRadius, params.minimumAroundRadius) && + Objects.equals(this.insideBoundingBox, params.insideBoundingBox) && + Objects.equals(this.insidePolygon, params.insidePolygon) && + Objects.equals(this.queryLanguages, params.queryLanguages) && + Objects.equals(this.naturalLanguages, params.naturalLanguages) && + Objects.equals(this.enableRules, params.enableRules) && + Objects.equals(this.ruleContexts, params.ruleContexts) && + Objects.equals(this.userToken, params.userToken) && + Objects.equals(this.clickAnalytics, params.clickAnalytics) && + Objects.equals(this.analytics, params.analytics) && + Objects.equals(this.analyticsTags, params.analyticsTags) && + Objects.equals(this.enableABTest, params.enableABTest) && + Objects.equals(this.enableReRanking, params.enableReRanking) + ); + } + + @Override + public int hashCode() { + return Objects.hash( + query, + filters, + page, + getRankingInfo, + relevancyStrictness, + facetFilters, + optionalFilters, + numericFilters, + hitsPerPage, + aroundLatLng, + aroundLatLngViaIP, + aroundRadius, + aroundPrecision, + minimumAroundRadius, + insideBoundingBox, + insidePolygon, + queryLanguages, + naturalLanguages, + enableRules, + ruleContexts, + userToken, + clickAnalytics, + analytics, + analyticsTags, + enableABTest, + enableReRanking + ); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Params {\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" filters: ").append(toIndentedString(filters)).append("\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" getRankingInfo: ").append(toIndentedString(getRankingInfo)).append("\n"); + sb.append(" relevancyStrictness: ").append(toIndentedString(relevancyStrictness)).append("\n"); + sb.append(" facetFilters: ").append(toIndentedString(facetFilters)).append("\n"); + sb.append(" optionalFilters: ").append(toIndentedString(optionalFilters)).append("\n"); + sb.append(" numericFilters: ").append(toIndentedString(numericFilters)).append("\n"); + sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); + sb.append(" aroundLatLng: ").append(toIndentedString(aroundLatLng)).append("\n"); + sb.append(" aroundLatLngViaIP: ").append(toIndentedString(aroundLatLngViaIP)).append("\n"); + sb.append(" aroundRadius: ").append(toIndentedString(aroundRadius)).append("\n"); + sb.append(" aroundPrecision: ").append(toIndentedString(aroundPrecision)).append("\n"); + sb.append(" minimumAroundRadius: ").append(toIndentedString(minimumAroundRadius)).append("\n"); + sb.append(" insideBoundingBox: ").append(toIndentedString(insideBoundingBox)).append("\n"); + sb.append(" insidePolygon: ").append(toIndentedString(insidePolygon)).append("\n"); + sb.append(" queryLanguages: ").append(toIndentedString(queryLanguages)).append("\n"); + sb.append(" naturalLanguages: ").append(toIndentedString(naturalLanguages)).append("\n"); + sb.append(" enableRules: ").append(toIndentedString(enableRules)).append("\n"); + sb.append(" ruleContexts: ").append(toIndentedString(ruleContexts)).append("\n"); + sb.append(" userToken: ").append(toIndentedString(userToken)).append("\n"); + sb.append(" clickAnalytics: ").append(toIndentedString(clickAnalytics)).append("\n"); + sb.append(" analytics: ").append(toIndentedString(analytics)).append("\n"); + sb.append(" analyticsTags: ").append(toIndentedString(analyticsTags)).append("\n"); + sb.append(" enableABTest: ").append(toIndentedString(enableABTest)).append("\n"); + sb.append(" enableReRanking: ").append(toIndentedString(enableReRanking)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/Personalization.java b/algoliasearch/src/main/java/com/algolia/model/composition/Personalization.java new file mode 100644 index 00000000..b8d793a2 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/Personalization.java @@ -0,0 +1,96 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** Personalization */ +public class Personalization { + + @JsonProperty("filtersScore") + private Integer filtersScore; + + @JsonProperty("rankingScore") + private Integer rankingScore; + + @JsonProperty("score") + private Integer score; + + public Personalization setFiltersScore(Integer filtersScore) { + this.filtersScore = filtersScore; + return this; + } + + /** The score of the filters. */ + @javax.annotation.Nullable + public Integer getFiltersScore() { + return filtersScore; + } + + public Personalization setRankingScore(Integer rankingScore) { + this.rankingScore = rankingScore; + return this; + } + + /** The score of the ranking. */ + @javax.annotation.Nullable + public Integer getRankingScore() { + return rankingScore; + } + + public Personalization setScore(Integer score) { + this.score = score; + return this; + } + + /** The score of the event. */ + @javax.annotation.Nullable + public Integer getScore() { + return score; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Personalization personalization = (Personalization) o; + return ( + Objects.equals(this.filtersScore, personalization.filtersScore) && + Objects.equals(this.rankingScore, personalization.rankingScore) && + Objects.equals(this.score, personalization.score) + ); + } + + @Override + public int hashCode() { + return Objects.hash(filtersScore, rankingScore, score); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Personalization {\n"); + sb.append(" filtersScore: ").append(toIndentedString(filtersScore)).append("\n"); + sb.append(" rankingScore: ").append(toIndentedString(rankingScore)).append("\n"); + sb.append(" score: ").append(toIndentedString(score)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/Range.java b/algoliasearch/src/main/java/com/algolia/model/composition/Range.java new file mode 100644 index 00000000..8a8f8e5a --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/Range.java @@ -0,0 +1,83 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** Range object with lower and upper values in meters to define custom ranges. */ +public class Range { + + @JsonProperty("from") + private Integer from; + + @JsonProperty("value") + private Integer value; + + public Range setFrom(Integer from) { + this.from = from; + return this; + } + + /** + * Lower boundary of a range in meters. The Geo ranking criterion considers all records within the + * range to be equal. + */ + @javax.annotation.Nullable + public Integer getFrom() { + return from; + } + + public Range setValue(Integer value) { + this.value = value; + return this; + } + + /** + * Upper boundary of a range in meters. The Geo ranking criterion considers all records within the + * range to be equal. + */ + @javax.annotation.Nullable + public Integer getValue() { + return value; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Range range = (Range) o; + return Objects.equals(this.from, range.from) && Objects.equals(this.value, range.value); + } + + @Override + public int hashCode() { + return Objects.hash(from, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Range {\n"); + sb.append(" from: ").append(toIndentedString(from)).append("\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/Redirect.java b/algoliasearch/src/main/java/com/algolia/model/composition/Redirect.java new file mode 100644 index 00000000..4f24ceb7 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/Redirect.java @@ -0,0 +1,76 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * [Redirect results to a + * URL](https://www.algolia.com/doc/guides/managing-results/rules/merchandising-and-promoting/how-to/redirects/), + * this this parameter is for internal use only. + */ +public class Redirect { + + @JsonProperty("index") + private List index; + + public Redirect setIndex(List index) { + this.index = index; + return this; + } + + public Redirect addIndex(RedirectRuleIndexMetadata indexItem) { + if (this.index == null) { + this.index = new ArrayList<>(); + } + this.index.add(indexItem); + return this; + } + + /** Get index */ + @javax.annotation.Nullable + public List getIndex() { + return index; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Redirect redirect = (Redirect) o; + return Objects.equals(this.index, redirect.index); + } + + @Override + public int hashCode() { + return Objects.hash(index); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Redirect {\n"); + sb.append(" index: ").append(toIndentedString(index)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/RedirectRuleIndexData.java b/algoliasearch/src/main/java/com/algolia/model/composition/RedirectRuleIndexData.java new file mode 100644 index 00000000..b9c5324e --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/RedirectRuleIndexData.java @@ -0,0 +1,62 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** Redirect rule data. */ +public class RedirectRuleIndexData { + + @JsonProperty("ruleObjectID") + private String ruleObjectID; + + public RedirectRuleIndexData setRuleObjectID(String ruleObjectID) { + this.ruleObjectID = ruleObjectID; + return this; + } + + /** Get ruleObjectID */ + @javax.annotation.Nonnull + public String getRuleObjectID() { + return ruleObjectID; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RedirectRuleIndexData redirectRuleIndexData = (RedirectRuleIndexData) o; + return Objects.equals(this.ruleObjectID, redirectRuleIndexData.ruleObjectID); + } + + @Override + public int hashCode() { + return Objects.hash(ruleObjectID); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RedirectRuleIndexData {\n"); + sb.append(" ruleObjectID: ").append(toIndentedString(ruleObjectID)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/RedirectRuleIndexMetadata.java b/algoliasearch/src/main/java/com/algolia/model/composition/RedirectRuleIndexMetadata.java new file mode 100644 index 00000000..c121ecf4 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/RedirectRuleIndexMetadata.java @@ -0,0 +1,128 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** RedirectRuleIndexMetadata */ +public class RedirectRuleIndexMetadata { + + @JsonProperty("source") + private String source; + + @JsonProperty("dest") + private String dest; + + @JsonProperty("reason") + private String reason; + + @JsonProperty("succeed") + private Boolean succeed; + + @JsonProperty("data") + private RedirectRuleIndexData data; + + public RedirectRuleIndexMetadata setSource(String source) { + this.source = source; + return this; + } + + /** Source index for the redirect rule. */ + @javax.annotation.Nonnull + public String getSource() { + return source; + } + + public RedirectRuleIndexMetadata setDest(String dest) { + this.dest = dest; + return this; + } + + /** Destination index for the redirect rule. */ + @javax.annotation.Nonnull + public String getDest() { + return dest; + } + + public RedirectRuleIndexMetadata setReason(String reason) { + this.reason = reason; + return this; + } + + /** Reason for the redirect rule. */ + @javax.annotation.Nonnull + public String getReason() { + return reason; + } + + public RedirectRuleIndexMetadata setSucceed(Boolean succeed) { + this.succeed = succeed; + return this; + } + + /** Redirect rule status. */ + @javax.annotation.Nonnull + public Boolean getSucceed() { + return succeed; + } + + public RedirectRuleIndexMetadata setData(RedirectRuleIndexData data) { + this.data = data; + return this; + } + + /** Get data */ + @javax.annotation.Nonnull + public RedirectRuleIndexData getData() { + return data; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RedirectRuleIndexMetadata redirectRuleIndexMetadata = (RedirectRuleIndexMetadata) o; + return ( + Objects.equals(this.source, redirectRuleIndexMetadata.source) && + Objects.equals(this.dest, redirectRuleIndexMetadata.dest) && + Objects.equals(this.reason, redirectRuleIndexMetadata.reason) && + Objects.equals(this.succeed, redirectRuleIndexMetadata.succeed) && + Objects.equals(this.data, redirectRuleIndexMetadata.data) + ); + } + + @Override + public int hashCode() { + return Objects.hash(source, dest, reason, succeed, data); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RedirectRuleIndexMetadata {\n"); + sb.append(" source: ").append(toIndentedString(source)).append("\n"); + sb.append(" dest: ").append(toIndentedString(dest)).append("\n"); + sb.append(" reason: ").append(toIndentedString(reason)).append("\n"); + sb.append(" succeed: ").append(toIndentedString(succeed)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/RedirectURL.java b/algoliasearch/src/main/java/com/algolia/model/composition/RedirectURL.java new file mode 100644 index 00000000..ac46871b --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/RedirectURL.java @@ -0,0 +1,62 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** The redirect rule container. */ +public class RedirectURL { + + @JsonProperty("url") + private String url; + + public RedirectURL setUrl(String url) { + this.url = url; + return this; + } + + /** Get url */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RedirectURL redirectURL = (RedirectURL) o; + return Objects.equals(this.url, redirectURL.url); + } + + @Override + public int hashCode() { + return Objects.hash(url); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RedirectURL {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/RenderingContent.java b/algoliasearch/src/main/java/com/algolia/model/composition/RenderingContent.java new file mode 100644 index 00000000..99fb8213 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/RenderingContent.java @@ -0,0 +1,99 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** + * Extra data that can be used in the search UI. You can use this to control aspects of your search + * UI, such as the order of facet names and values without changing your frontend code. + */ +public class RenderingContent { + + @JsonProperty("facetOrdering") + private FacetOrdering facetOrdering; + + @JsonProperty("redirect") + private RedirectURL redirect; + + @JsonProperty("widgets") + private Widgets widgets; + + public RenderingContent setFacetOrdering(FacetOrdering facetOrdering) { + this.facetOrdering = facetOrdering; + return this; + } + + /** Get facetOrdering */ + @javax.annotation.Nullable + public FacetOrdering getFacetOrdering() { + return facetOrdering; + } + + public RenderingContent setRedirect(RedirectURL redirect) { + this.redirect = redirect; + return this; + } + + /** Get redirect */ + @javax.annotation.Nullable + public RedirectURL getRedirect() { + return redirect; + } + + public RenderingContent setWidgets(Widgets widgets) { + this.widgets = widgets; + return this; + } + + /** Get widgets */ + @javax.annotation.Nullable + public Widgets getWidgets() { + return widgets; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RenderingContent renderingContent = (RenderingContent) o; + return ( + Objects.equals(this.facetOrdering, renderingContent.facetOrdering) && + Objects.equals(this.redirect, renderingContent.redirect) && + Objects.equals(this.widgets, renderingContent.widgets) + ); + } + + @Override + public int hashCode() { + return Objects.hash(facetOrdering, redirect, widgets); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RenderingContent {\n"); + sb.append(" facetOrdering: ").append(toIndentedString(facetOrdering)).append("\n"); + sb.append(" redirect: ").append(toIndentedString(redirect)).append("\n"); + sb.append(" widgets: ").append(toIndentedString(widgets)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/RequestBody.java b/algoliasearch/src/main/java/com/algolia/model/composition/RequestBody.java new file mode 100644 index 00000000..e9a06ad5 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/RequestBody.java @@ -0,0 +1,62 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** RequestBody */ +public class RequestBody { + + @JsonProperty("params") + private Params params; + + public RequestBody setParams(Params params) { + this.params = params; + return this; + } + + /** Get params */ + @javax.annotation.Nullable + public Params getParams() { + return params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RequestBody requestBody = (RequestBody) o; + return Objects.equals(this.params, requestBody.params); + } + + @Override + public int hashCode() { + return Objects.hash(params); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RequestBody {\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/ResultsCompositionInfoResponse.java b/algoliasearch/src/main/java/com/algolia/model/composition/ResultsCompositionInfoResponse.java new file mode 100644 index 00000000..e4249f24 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/ResultsCompositionInfoResponse.java @@ -0,0 +1,69 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** ResultsCompositionInfoResponse */ +public class ResultsCompositionInfoResponse { + + @JsonProperty("injectedItems") + private List injectedItems = new ArrayList<>(); + + public ResultsCompositionInfoResponse setInjectedItems(List injectedItems) { + this.injectedItems = injectedItems; + return this; + } + + public ResultsCompositionInfoResponse addInjectedItems(ResultsInjectedItemInfoResponse injectedItemsItem) { + this.injectedItems.add(injectedItemsItem); + return this; + } + + /** Get injectedItems */ + @javax.annotation.Nonnull + public List getInjectedItems() { + return injectedItems; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResultsCompositionInfoResponse resultsCompositionInfoResponse = (ResultsCompositionInfoResponse) o; + return Objects.equals(this.injectedItems, resultsCompositionInfoResponse.injectedItems); + } + + @Override + public int hashCode() { + return Objects.hash(injectedItems); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResultsCompositionInfoResponse {\n"); + sb.append(" injectedItems: ").append(toIndentedString(injectedItems)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/ResultsInjectedItemAppliedRulesInfoResponse.java b/algoliasearch/src/main/java/com/algolia/model/composition/ResultsInjectedItemAppliedRulesInfoResponse.java new file mode 100644 index 00000000..81b443d3 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/ResultsInjectedItemAppliedRulesInfoResponse.java @@ -0,0 +1,63 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** ResultsInjectedItemAppliedRulesInfoResponse */ +public class ResultsInjectedItemAppliedRulesInfoResponse { + + @JsonProperty("objectID") + private String objectID; + + public ResultsInjectedItemAppliedRulesInfoResponse setObjectID(String objectID) { + this.objectID = objectID; + return this; + } + + /** Unique record identifier. */ + @javax.annotation.Nonnull + public String getObjectID() { + return objectID; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResultsInjectedItemAppliedRulesInfoResponse resultsInjectedItemAppliedRulesInfoResponse = + (ResultsInjectedItemAppliedRulesInfoResponse) o; + return Objects.equals(this.objectID, resultsInjectedItemAppliedRulesInfoResponse.objectID); + } + + @Override + public int hashCode() { + return Objects.hash(objectID); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResultsInjectedItemAppliedRulesInfoResponse {\n"); + sb.append(" objectID: ").append(toIndentedString(objectID)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/ResultsInjectedItemInfoResponse.java b/algoliasearch/src/main/java/com/algolia/model/composition/ResultsInjectedItemInfoResponse.java new file mode 100644 index 00000000..b092ae16 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/ResultsInjectedItemInfoResponse.java @@ -0,0 +1,107 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** ResultsInjectedItemInfoResponse */ +public class ResultsInjectedItemInfoResponse { + + @JsonProperty("key") + private String key; + + @JsonProperty("appliedRules") + private List appliedRules; + + private Map additionalProperties = new HashMap<>(); + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public ResultsInjectedItemInfoResponse setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + return this; + } + + public ResultsInjectedItemInfoResponse setKey(String key) { + this.key = key; + return this; + } + + /** Get key */ + @javax.annotation.Nonnull + public String getKey() { + return key; + } + + public ResultsInjectedItemInfoResponse setAppliedRules(List appliedRules) { + this.appliedRules = appliedRules; + return this; + } + + public ResultsInjectedItemInfoResponse addAppliedRules(ResultsInjectedItemAppliedRulesInfoResponse appliedRulesItem) { + if (this.appliedRules == null) { + this.appliedRules = new ArrayList<>(); + } + this.appliedRules.add(appliedRulesItem); + return this; + } + + /** Get appliedRules */ + @javax.annotation.Nullable + public List getAppliedRules() { + return appliedRules; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ResultsInjectedItemInfoResponse resultsInjectedItemInfoResponse = (ResultsInjectedItemInfoResponse) o; + return ( + Objects.equals(this.key, resultsInjectedItemInfoResponse.key) && + Objects.equals(this.appliedRules, resultsInjectedItemInfoResponse.appliedRules) && + super.equals(o) + ); + } + + @Override + public int hashCode() { + return Objects.hash(key, appliedRules, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResultsInjectedItemInfoResponse {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" key: ").append(toIndentedString(key)).append("\n"); + sb.append(" appliedRules: ").append(toIndentedString(appliedRules)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/SearchForFacetValuesParams.java b/algoliasearch/src/main/java/com/algolia/model/composition/SearchForFacetValuesParams.java new file mode 100644 index 00000000..fbcd5e71 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/SearchForFacetValuesParams.java @@ -0,0 +1,100 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** SearchForFacetValuesParams */ +public class SearchForFacetValuesParams { + + @JsonProperty("query") + private String query; + + @JsonProperty("maxFacetHits") + private Integer maxFacetHits; + + @JsonProperty("searchQuery") + private Params searchQuery; + + public SearchForFacetValuesParams setQuery(String query) { + this.query = query; + return this; + } + + /** Search query. */ + @javax.annotation.Nullable + public String getQuery() { + return query; + } + + public SearchForFacetValuesParams setMaxFacetHits(Integer maxFacetHits) { + this.maxFacetHits = maxFacetHits; + return this; + } + + /** + * Maximum number of facet values to return when [searching for facet + * values](https://www.algolia.com/doc/guides/managing-results/refine-results/faceting/#search-for-facet-values). + * maximum: 100 + */ + @javax.annotation.Nullable + public Integer getMaxFacetHits() { + return maxFacetHits; + } + + public SearchForFacetValuesParams setSearchQuery(Params searchQuery) { + this.searchQuery = searchQuery; + return this; + } + + /** Get searchQuery */ + @javax.annotation.Nullable + public Params getSearchQuery() { + return searchQuery; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchForFacetValuesParams searchForFacetValuesParams = (SearchForFacetValuesParams) o; + return ( + Objects.equals(this.query, searchForFacetValuesParams.query) && + Objects.equals(this.maxFacetHits, searchForFacetValuesParams.maxFacetHits) && + Objects.equals(this.searchQuery, searchForFacetValuesParams.searchQuery) + ); + } + + @Override + public int hashCode() { + return Objects.hash(query, maxFacetHits, searchQuery); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchForFacetValuesParams {\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" maxFacetHits: ").append(toIndentedString(maxFacetHits)).append("\n"); + sb.append(" searchQuery: ").append(toIndentedString(searchQuery)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/SearchForFacetValuesRequest.java b/algoliasearch/src/main/java/com/algolia/model/composition/SearchForFacetValuesRequest.java new file mode 100644 index 00000000..64c1dd06 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/SearchForFacetValuesRequest.java @@ -0,0 +1,62 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** SearchForFacetValuesRequest */ +public class SearchForFacetValuesRequest { + + @JsonProperty("params") + private SearchForFacetValuesParams params; + + public SearchForFacetValuesRequest setParams(SearchForFacetValuesParams params) { + this.params = params; + return this; + } + + /** Get params */ + @javax.annotation.Nullable + public SearchForFacetValuesParams getParams() { + return params; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchForFacetValuesRequest searchForFacetValuesRequest = (SearchForFacetValuesRequest) o; + return Objects.equals(this.params, searchForFacetValuesRequest.params); + } + + @Override + public int hashCode() { + return Objects.hash(params); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchForFacetValuesRequest {\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/SearchForFacetValuesResponse.java b/algoliasearch/src/main/java/com/algolia/model/composition/SearchForFacetValuesResponse.java new file mode 100644 index 00000000..735be7e0 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/SearchForFacetValuesResponse.java @@ -0,0 +1,72 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** SearchForFacetValuesResponse */ +public class SearchForFacetValuesResponse { + + @JsonProperty("results") + private List results; + + public SearchForFacetValuesResponse setResults(List results) { + this.results = results; + return this; + } + + public SearchForFacetValuesResponse addResults(SearchForFacetValuesResults resultsItem) { + if (this.results == null) { + this.results = new ArrayList<>(); + } + this.results.add(resultsItem); + return this; + } + + /** Search for facet values results. */ + @javax.annotation.Nullable + public List getResults() { + return results; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchForFacetValuesResponse searchForFacetValuesResponse = (SearchForFacetValuesResponse) o; + return Objects.equals(this.results, searchForFacetValuesResponse.results); + } + + @Override + public int hashCode() { + return Objects.hash(results); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchForFacetValuesResponse {\n"); + sb.append(" results: ").append(toIndentedString(results)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/SearchForFacetValuesResults.java b/algoliasearch/src/main/java/com/algolia/model/composition/SearchForFacetValuesResults.java new file mode 100644 index 00000000..50e3820d --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/SearchForFacetValuesResults.java @@ -0,0 +1,123 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** SearchForFacetValuesResults */ +public class SearchForFacetValuesResults { + + @JsonProperty("indexName") + private String indexName; + + @JsonProperty("facetHits") + private List facetHits = new ArrayList<>(); + + @JsonProperty("exhaustiveFacetsCount") + private Boolean exhaustiveFacetsCount; + + @JsonProperty("processingTimeMS") + private Integer processingTimeMS; + + public SearchForFacetValuesResults setIndexName(String indexName) { + this.indexName = indexName; + return this; + } + + /** Get indexName */ + @javax.annotation.Nonnull + public String getIndexName() { + return indexName; + } + + public SearchForFacetValuesResults setFacetHits(List facetHits) { + this.facetHits = facetHits; + return this; + } + + public SearchForFacetValuesResults addFacetHits(FacetHits facetHitsItem) { + this.facetHits.add(facetHitsItem); + return this; + } + + /** Matching facet values. */ + @javax.annotation.Nonnull + public List getFacetHits() { + return facetHits; + } + + public SearchForFacetValuesResults setExhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { + this.exhaustiveFacetsCount = exhaustiveFacetsCount; + return this; + } + + /** + * Whether the facet count is exhaustive (true) or approximate (false). For more information, see + * [Why are my facet and hit counts not + * accurate](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-). + */ + @javax.annotation.Nonnull + public Boolean getExhaustiveFacetsCount() { + return exhaustiveFacetsCount; + } + + public SearchForFacetValuesResults setProcessingTimeMS(Integer processingTimeMS) { + this.processingTimeMS = processingTimeMS; + return this; + } + + /** Time the server took to process the request, in milliseconds. */ + @javax.annotation.Nullable + public Integer getProcessingTimeMS() { + return processingTimeMS; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchForFacetValuesResults searchForFacetValuesResults = (SearchForFacetValuesResults) o; + return ( + Objects.equals(this.indexName, searchForFacetValuesResults.indexName) && + Objects.equals(this.facetHits, searchForFacetValuesResults.facetHits) && + Objects.equals(this.exhaustiveFacetsCount, searchForFacetValuesResults.exhaustiveFacetsCount) && + Objects.equals(this.processingTimeMS, searchForFacetValuesResults.processingTimeMS) + ); + } + + @Override + public int hashCode() { + return Objects.hash(indexName, facetHits, exhaustiveFacetsCount, processingTimeMS); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchForFacetValuesResults {\n"); + sb.append(" indexName: ").append(toIndentedString(indexName)).append("\n"); + sb.append(" facetHits: ").append(toIndentedString(facetHits)).append("\n"); + sb.append(" exhaustiveFacetsCount: ").append(toIndentedString(exhaustiveFacetsCount)).append("\n"); + sb.append(" processingTimeMS: ").append(toIndentedString(processingTimeMS)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/SearchResponse.java b/algoliasearch/src/main/java/com/algolia/model/composition/SearchResponse.java new file mode 100644 index 00000000..16daf7cf --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/SearchResponse.java @@ -0,0 +1,104 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** SearchResponse */ +public class SearchResponse { + + @JsonProperty("compositions") + private CompositionsSearchResponse compositions; + + @JsonProperty("results") + private List> results = new ArrayList<>(); + + private Map additionalProperties = new HashMap<>(); + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public SearchResponse setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + return this; + } + + public SearchResponse setCompositions(CompositionsSearchResponse compositions) { + this.compositions = compositions; + return this; + } + + /** Get compositions */ + @javax.annotation.Nullable + public CompositionsSearchResponse getCompositions() { + return compositions; + } + + public SearchResponse setResults(List> results) { + this.results = results; + return this; + } + + public SearchResponse addResults(SearchResultsItem resultsItem) { + this.results.add(resultsItem); + return this; + } + + /** Search results. */ + @javax.annotation.Nonnull + public List> getResults() { + return results; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchResponse searchResponse = (SearchResponse) o; + return ( + Objects.equals(this.compositions, searchResponse.compositions) && + Objects.equals(this.results, searchResponse.results) && + super.equals(o) + ); + } + + @Override + public int hashCode() { + return Objects.hash(compositions, results, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchResponse {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" compositions: ").append(toIndentedString(compositions)).append("\n"); + sb.append(" results: ").append(toIndentedString(results)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/SearchResultsItem.java b/algoliasearch/src/main/java/com/algolia/model/composition/SearchResultsItem.java new file mode 100644 index 00000000..32be59a9 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/SearchResultsItem.java @@ -0,0 +1,703 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** SearchResultsItem */ +public class SearchResultsItem { + + @JsonProperty("abTestID") + private Integer abTestID; + + @JsonProperty("abTestVariantID") + private Integer abTestVariantID; + + @JsonProperty("aroundLatLng") + private String aroundLatLng; + + @JsonProperty("automaticRadius") + private String automaticRadius; + + @JsonProperty("exhaustive") + private Exhaustive exhaustive; + + @JsonProperty("appliedRules") + private List appliedRules; + + @JsonProperty("exhaustiveFacetsCount") + private Boolean exhaustiveFacetsCount; + + @JsonProperty("exhaustiveNbHits") + private Boolean exhaustiveNbHits; + + @JsonProperty("exhaustiveTypo") + private Boolean exhaustiveTypo; + + @JsonProperty("facets") + private Map> facets; + + @JsonProperty("facets_stats") + private Map facetsStats; + + @JsonProperty("index") + private String index; + + @JsonProperty("indexUsed") + private String indexUsed; + + @JsonProperty("message") + private String message; + + @JsonProperty("nbSortedHits") + private Integer nbSortedHits; + + @JsonProperty("parsedQuery") + private String parsedQuery; + + @JsonProperty("processingTimeMS") + private Integer processingTimeMS; + + @JsonProperty("processingTimingsMS") + private Object processingTimingsMS; + + @JsonProperty("queryAfterRemoval") + private String queryAfterRemoval; + + @JsonProperty("redirect") + private Redirect redirect; + + @JsonProperty("renderingContent") + private RenderingContent renderingContent; + + @JsonProperty("serverTimeMS") + private Integer serverTimeMS; + + @JsonProperty("serverUsed") + private String serverUsed; + + @JsonProperty("userData") + private Object userData; + + @JsonProperty("queryID") + private String queryID; + + @JsonProperty("_automaticInsights") + private Boolean automaticInsights; + + @JsonProperty("page") + private Integer page; + + @JsonProperty("nbHits") + private Integer nbHits; + + @JsonProperty("nbPages") + private Integer nbPages; + + @JsonProperty("hitsPerPage") + private Integer hitsPerPage; + + @JsonProperty("hits") + private List hits = new ArrayList<>(); + + @JsonProperty("query") + private String query; + + @JsonProperty("params") + private String params; + + @JsonProperty("compositions") + private Map compositions = new HashMap<>(); + + public SearchResultsItem setAbTestID(Integer abTestID) { + this.abTestID = abTestID; + return this; + } + + /** + * A/B test ID. This is only included in the response for indices that are part of an A/B test. + */ + @javax.annotation.Nullable + public Integer getAbTestID() { + return abTestID; + } + + public SearchResultsItem setAbTestVariantID(Integer abTestVariantID) { + this.abTestVariantID = abTestVariantID; + return this; + } + + /** + * Variant ID. This is only included in the response for indices that are part of an A/B test. + * minimum: 1 + */ + @javax.annotation.Nullable + public Integer getAbTestVariantID() { + return abTestVariantID; + } + + public SearchResultsItem setAroundLatLng(String aroundLatLng) { + this.aroundLatLng = aroundLatLng; + return this; + } + + /** Computed geographical location. */ + @javax.annotation.Nullable + public String getAroundLatLng() { + return aroundLatLng; + } + + public SearchResultsItem setAutomaticRadius(String automaticRadius) { + this.automaticRadius = automaticRadius; + return this; + } + + /** Distance from a central coordinate provided by `aroundLatLng`. */ + @javax.annotation.Nullable + public String getAutomaticRadius() { + return automaticRadius; + } + + public SearchResultsItem setExhaustive(Exhaustive exhaustive) { + this.exhaustive = exhaustive; + return this; + } + + /** Get exhaustive */ + @javax.annotation.Nullable + public Exhaustive getExhaustive() { + return exhaustive; + } + + public SearchResultsItem setAppliedRules(List appliedRules) { + this.appliedRules = appliedRules; + return this; + } + + public SearchResultsItem addAppliedRules(Object appliedRulesItem) { + if (this.appliedRules == null) { + this.appliedRules = new ArrayList<>(); + } + this.appliedRules.add(appliedRulesItem); + return this; + } + + /** Rules applied to the query. */ + @javax.annotation.Nullable + public List getAppliedRules() { + return appliedRules; + } + + public SearchResultsItem setExhaustiveFacetsCount(Boolean exhaustiveFacetsCount) { + this.exhaustiveFacetsCount = exhaustiveFacetsCount; + return this; + } + + /** + * See the `facetsCount` field of the `exhaustive` object in the response. + * + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public Boolean getExhaustiveFacetsCount() { + return exhaustiveFacetsCount; + } + + public SearchResultsItem setExhaustiveNbHits(Boolean exhaustiveNbHits) { + this.exhaustiveNbHits = exhaustiveNbHits; + return this; + } + + /** + * See the `nbHits` field of the `exhaustive` object in the response. + * + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public Boolean getExhaustiveNbHits() { + return exhaustiveNbHits; + } + + public SearchResultsItem setExhaustiveTypo(Boolean exhaustiveTypo) { + this.exhaustiveTypo = exhaustiveTypo; + return this; + } + + /** + * See the `typo` field of the `exhaustive` object in the response. + * + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public Boolean getExhaustiveTypo() { + return exhaustiveTypo; + } + + public SearchResultsItem setFacets(Map> facets) { + this.facets = facets; + return this; + } + + public SearchResultsItem putFacets(String key, Map facetsItem) { + if (this.facets == null) { + this.facets = new HashMap<>(); + } + this.facets.put(key, facetsItem); + return this; + } + + /** Facet counts. */ + @javax.annotation.Nullable + public Map> getFacets() { + return facets; + } + + public SearchResultsItem setFacetsStats(Map facetsStats) { + this.facetsStats = facetsStats; + return this; + } + + public SearchResultsItem putFacetsStats(String key, FacetStats facetsStatsItem) { + if (this.facetsStats == null) { + this.facetsStats = new HashMap<>(); + } + this.facetsStats.put(key, facetsStatsItem); + return this; + } + + /** Statistics for numerical facets. */ + @javax.annotation.Nullable + public Map getFacetsStats() { + return facetsStats; + } + + public SearchResultsItem setIndex(String index) { + this.index = index; + return this; + } + + /** Index name used for the query. */ + @javax.annotation.Nullable + public String getIndex() { + return index; + } + + public SearchResultsItem setIndexUsed(String indexUsed) { + this.indexUsed = indexUsed; + return this; + } + + /** + * Index name used for the query. During A/B testing, the targeted index isn't always the index + * used by the query. + */ + @javax.annotation.Nullable + public String getIndexUsed() { + return indexUsed; + } + + public SearchResultsItem setMessage(String message) { + this.message = message; + return this; + } + + /** Warnings about the query. */ + @javax.annotation.Nullable + public String getMessage() { + return message; + } + + public SearchResultsItem setNbSortedHits(Integer nbSortedHits) { + this.nbSortedHits = nbSortedHits; + return this; + } + + /** Number of hits selected and sorted by the relevant sort algorithm. */ + @javax.annotation.Nullable + public Integer getNbSortedHits() { + return nbSortedHits; + } + + public SearchResultsItem setParsedQuery(String parsedQuery) { + this.parsedQuery = parsedQuery; + return this; + } + + /** + * Post-[normalization](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/#what-does-normalization-mean) + * query string that will be searched. + */ + @javax.annotation.Nullable + public String getParsedQuery() { + return parsedQuery; + } + + public SearchResultsItem setProcessingTimeMS(Integer processingTimeMS) { + this.processingTimeMS = processingTimeMS; + return this; + } + + /** Time the server took to process the request, in milliseconds. */ + @javax.annotation.Nonnull + public Integer getProcessingTimeMS() { + return processingTimeMS; + } + + public SearchResultsItem setProcessingTimingsMS(Object processingTimingsMS) { + this.processingTimingsMS = processingTimingsMS; + return this; + } + + /** + * Experimental. List of processing steps and their times, in milliseconds. You can use this list + * to investigate performance issues. + */ + @javax.annotation.Nullable + public Object getProcessingTimingsMS() { + return processingTimingsMS; + } + + public SearchResultsItem setQueryAfterRemoval(String queryAfterRemoval) { + this.queryAfterRemoval = queryAfterRemoval; + return this; + } + + /** + * Markup text indicating which parts of the original query have been removed to retrieve a + * non-empty result set. + */ + @javax.annotation.Nullable + public String getQueryAfterRemoval() { + return queryAfterRemoval; + } + + public SearchResultsItem setRedirect(Redirect redirect) { + this.redirect = redirect; + return this; + } + + /** Get redirect */ + @javax.annotation.Nullable + public Redirect getRedirect() { + return redirect; + } + + public SearchResultsItem setRenderingContent(RenderingContent renderingContent) { + this.renderingContent = renderingContent; + return this; + } + + /** Get renderingContent */ + @javax.annotation.Nullable + public RenderingContent getRenderingContent() { + return renderingContent; + } + + public SearchResultsItem setServerTimeMS(Integer serverTimeMS) { + this.serverTimeMS = serverTimeMS; + return this; + } + + /** Time the server took to process the request, in milliseconds. */ + @javax.annotation.Nullable + public Integer getServerTimeMS() { + return serverTimeMS; + } + + public SearchResultsItem setServerUsed(String serverUsed) { + this.serverUsed = serverUsed; + return this; + } + + /** Host name of the server that processed the request. */ + @javax.annotation.Nullable + public String getServerUsed() { + return serverUsed; + } + + public SearchResultsItem setUserData(Object userData) { + this.userData = userData; + return this; + } + + /** An object with custom data. You can store up to 32kB as custom data. */ + @javax.annotation.Nullable + public Object getUserData() { + return userData; + } + + public SearchResultsItem setQueryID(String queryID) { + this.queryID = queryID; + return this; + } + + /** + * Unique identifier for the query. This is used for [click + * analytics](https://www.algolia.com/doc/guides/analytics/click-analytics/). + */ + @javax.annotation.Nullable + public String getQueryID() { + return queryID; + } + + public SearchResultsItem setAutomaticInsights(Boolean automaticInsights) { + this.automaticInsights = automaticInsights; + return this; + } + + /** Whether automatic events collection is enabled for the application. */ + @javax.annotation.Nullable + public Boolean getAutomaticInsights() { + return automaticInsights; + } + + public SearchResultsItem setPage(Integer page) { + this.page = page; + return this; + } + + /** Page of search results to retrieve. minimum: 0 */ + @javax.annotation.Nonnull + public Integer getPage() { + return page; + } + + public SearchResultsItem setNbHits(Integer nbHits) { + this.nbHits = nbHits; + return this; + } + + /** Number of results (hits). */ + @javax.annotation.Nonnull + public Integer getNbHits() { + return nbHits; + } + + public SearchResultsItem setNbPages(Integer nbPages) { + this.nbPages = nbPages; + return this; + } + + /** Number of pages of results. */ + @javax.annotation.Nonnull + public Integer getNbPages() { + return nbPages; + } + + public SearchResultsItem setHitsPerPage(Integer hitsPerPage) { + this.hitsPerPage = hitsPerPage; + return this; + } + + /** Number of hits per page. minimum: 1 maximum: 1000 */ + @javax.annotation.Nonnull + public Integer getHitsPerPage() { + return hitsPerPage; + } + + public SearchResultsItem setHits(List hits) { + this.hits = hits; + return this; + } + + public SearchResultsItem addHits(T hitsItem) { + this.hits.add(hitsItem); + return this; + } + + /** + * Search results (hits). Hits are records from your index that match the search criteria, + * augmented with additional attributes, such as, for highlighting. + */ + @javax.annotation.Nonnull + public List getHits() { + return hits; + } + + public SearchResultsItem setQuery(String query) { + this.query = query; + return this; + } + + /** Search query. */ + @javax.annotation.Nonnull + public String getQuery() { + return query; + } + + public SearchResultsItem setParams(String params) { + this.params = params; + return this; + } + + /** URL-encoded string of all search parameters. */ + @javax.annotation.Nonnull + public String getParams() { + return params; + } + + public SearchResultsItem setCompositions(Map compositions) { + this.compositions = compositions; + return this; + } + + public SearchResultsItem putCompositions(String key, ResultsCompositionInfoResponse compositionsItem) { + this.compositions.put(key, compositionsItem); + return this; + } + + /** Get compositions */ + @javax.annotation.Nonnull + public Map getCompositions() { + return compositions; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchResultsItem searchResultsItem = (SearchResultsItem) o; + return ( + Objects.equals(this.abTestID, searchResultsItem.abTestID) && + Objects.equals(this.abTestVariantID, searchResultsItem.abTestVariantID) && + Objects.equals(this.aroundLatLng, searchResultsItem.aroundLatLng) && + Objects.equals(this.automaticRadius, searchResultsItem.automaticRadius) && + Objects.equals(this.exhaustive, searchResultsItem.exhaustive) && + Objects.equals(this.appliedRules, searchResultsItem.appliedRules) && + Objects.equals(this.exhaustiveFacetsCount, searchResultsItem.exhaustiveFacetsCount) && + Objects.equals(this.exhaustiveNbHits, searchResultsItem.exhaustiveNbHits) && + Objects.equals(this.exhaustiveTypo, searchResultsItem.exhaustiveTypo) && + Objects.equals(this.facets, searchResultsItem.facets) && + Objects.equals(this.facetsStats, searchResultsItem.facetsStats) && + Objects.equals(this.index, searchResultsItem.index) && + Objects.equals(this.indexUsed, searchResultsItem.indexUsed) && + Objects.equals(this.message, searchResultsItem.message) && + Objects.equals(this.nbSortedHits, searchResultsItem.nbSortedHits) && + Objects.equals(this.parsedQuery, searchResultsItem.parsedQuery) && + Objects.equals(this.processingTimeMS, searchResultsItem.processingTimeMS) && + Objects.equals(this.processingTimingsMS, searchResultsItem.processingTimingsMS) && + Objects.equals(this.queryAfterRemoval, searchResultsItem.queryAfterRemoval) && + Objects.equals(this.redirect, searchResultsItem.redirect) && + Objects.equals(this.renderingContent, searchResultsItem.renderingContent) && + Objects.equals(this.serverTimeMS, searchResultsItem.serverTimeMS) && + Objects.equals(this.serverUsed, searchResultsItem.serverUsed) && + Objects.equals(this.userData, searchResultsItem.userData) && + Objects.equals(this.queryID, searchResultsItem.queryID) && + Objects.equals(this.automaticInsights, searchResultsItem.automaticInsights) && + Objects.equals(this.page, searchResultsItem.page) && + Objects.equals(this.nbHits, searchResultsItem.nbHits) && + Objects.equals(this.nbPages, searchResultsItem.nbPages) && + Objects.equals(this.hitsPerPage, searchResultsItem.hitsPerPage) && + Objects.equals(this.hits, searchResultsItem.hits) && + Objects.equals(this.query, searchResultsItem.query) && + Objects.equals(this.params, searchResultsItem.params) && + Objects.equals(this.compositions, searchResultsItem.compositions) + ); + } + + @Override + public int hashCode() { + return Objects.hash( + abTestID, + abTestVariantID, + aroundLatLng, + automaticRadius, + exhaustive, + appliedRules, + exhaustiveFacetsCount, + exhaustiveNbHits, + exhaustiveTypo, + facets, + facetsStats, + index, + indexUsed, + message, + nbSortedHits, + parsedQuery, + processingTimeMS, + processingTimingsMS, + queryAfterRemoval, + redirect, + renderingContent, + serverTimeMS, + serverUsed, + userData, + queryID, + automaticInsights, + page, + nbHits, + nbPages, + hitsPerPage, + hits, + query, + params, + compositions + ); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchResultsItem {\n"); + sb.append(" abTestID: ").append(toIndentedString(abTestID)).append("\n"); + sb.append(" abTestVariantID: ").append(toIndentedString(abTestVariantID)).append("\n"); + sb.append(" aroundLatLng: ").append(toIndentedString(aroundLatLng)).append("\n"); + sb.append(" automaticRadius: ").append(toIndentedString(automaticRadius)).append("\n"); + sb.append(" exhaustive: ").append(toIndentedString(exhaustive)).append("\n"); + sb.append(" appliedRules: ").append(toIndentedString(appliedRules)).append("\n"); + sb.append(" exhaustiveFacetsCount: ").append(toIndentedString(exhaustiveFacetsCount)).append("\n"); + sb.append(" exhaustiveNbHits: ").append(toIndentedString(exhaustiveNbHits)).append("\n"); + sb.append(" exhaustiveTypo: ").append(toIndentedString(exhaustiveTypo)).append("\n"); + sb.append(" facets: ").append(toIndentedString(facets)).append("\n"); + sb.append(" facetsStats: ").append(toIndentedString(facetsStats)).append("\n"); + sb.append(" index: ").append(toIndentedString(index)).append("\n"); + sb.append(" indexUsed: ").append(toIndentedString(indexUsed)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" nbSortedHits: ").append(toIndentedString(nbSortedHits)).append("\n"); + sb.append(" parsedQuery: ").append(toIndentedString(parsedQuery)).append("\n"); + sb.append(" processingTimeMS: ").append(toIndentedString(processingTimeMS)).append("\n"); + sb.append(" processingTimingsMS: ").append(toIndentedString(processingTimingsMS)).append("\n"); + sb.append(" queryAfterRemoval: ").append(toIndentedString(queryAfterRemoval)).append("\n"); + sb.append(" redirect: ").append(toIndentedString(redirect)).append("\n"); + sb.append(" renderingContent: ").append(toIndentedString(renderingContent)).append("\n"); + sb.append(" serverTimeMS: ").append(toIndentedString(serverTimeMS)).append("\n"); + sb.append(" serverUsed: ").append(toIndentedString(serverUsed)).append("\n"); + sb.append(" userData: ").append(toIndentedString(userData)).append("\n"); + sb.append(" queryID: ").append(toIndentedString(queryID)).append("\n"); + sb.append(" automaticInsights: ").append(toIndentedString(automaticInsights)).append("\n"); + sb.append(" page: ").append(toIndentedString(page)).append("\n"); + sb.append(" nbHits: ").append(toIndentedString(nbHits)).append("\n"); + sb.append(" nbPages: ").append(toIndentedString(nbPages)).append("\n"); + sb.append(" hitsPerPage: ").append(toIndentedString(hitsPerPage)).append("\n"); + sb.append(" hits: ").append(toIndentedString(hits)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" params: ").append(toIndentedString(params)).append("\n"); + sb.append(" compositions: ").append(toIndentedString(compositions)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/SnippetResult.java b/algoliasearch/src/main/java/com/algolia/model/composition/SnippetResult.java new file mode 100644 index 00000000..31f8e4ec --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/SnippetResult.java @@ -0,0 +1,123 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.algolia.exceptions.AlgoliaRuntimeException; +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.core.*; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.logging.Logger; + +/** SnippetResult */ +@JsonDeserialize(using = SnippetResult.Deserializer.class) +public interface SnippetResult { + // SnippetResult as Map wrapper. + static SnippetResult of(Map value) { + return new MapOfStringSnippetResultWrapper(value); + } + + // SnippetResult as List wrapper. + static SnippetResult of(List value) { + return new ListOfSnippetResultWrapper(value); + } + + // SnippetResult as Map wrapper. + @JsonSerialize(using = MapOfStringSnippetResultWrapper.Serializer.class) + class MapOfStringSnippetResultWrapper implements SnippetResult { + + private final Map value; + + MapOfStringSnippetResultWrapper(Map value) { + this.value = value; + } + + public Map getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(MapOfStringSnippetResultWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + // SnippetResult as List wrapper. + @JsonSerialize(using = ListOfSnippetResultWrapper.Serializer.class) + class ListOfSnippetResultWrapper implements SnippetResult { + + private final List value; + + ListOfSnippetResultWrapper(List value) { + this.value = value; + } + + public List getValue() { + return value; + } + + static class Serializer extends JsonSerializer { + + @Override + public void serialize(ListOfSnippetResultWrapper value, JsonGenerator gen, SerializerProvider provider) throws IOException { + gen.writeObject(value.getValue()); + } + } + } + + class Deserializer extends JsonDeserializer { + + private static final Logger LOGGER = Logger.getLogger(Deserializer.class.getName()); + + @Override + public SnippetResult deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode tree = jp.readValueAsTree(); + // deserialize SnippetResultOption + if (tree.isObject() && tree.has("matchLevel")) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + return parser.readValueAs(SnippetResultOption.class); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf SnippetResultOption (error: " + e.getMessage() + ") (type: SnippetResultOption)"); + } + } + // deserialize Map + if (tree.isObject()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + Map value = parser.readValueAs(new TypeReference>() {}); + return new SnippetResult.MapOfStringSnippetResultWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest( + "Failed to deserialize oneOf Map (error: " + e.getMessage() + ") (type: Map)" + ); + } + } + // deserialize List + if (tree.isArray()) { + try (JsonParser parser = tree.traverse(jp.getCodec())) { + List value = parser.readValueAs(new TypeReference>() {}); + return new SnippetResult.ListOfSnippetResultWrapper(value); + } catch (Exception e) { + // deserialization failed, continue + LOGGER.finest("Failed to deserialize oneOf List (error: " + e.getMessage() + ") (type: List)"); + } + } + throw new AlgoliaRuntimeException(String.format("Failed to deserialize json element: %s", tree)); + } + + /** Handle deserialization of the 'null' value. */ + @Override + public SnippetResult getNullValue(DeserializationContext ctxt) throws JsonMappingException { + throw new JsonMappingException(ctxt.getParser(), "SnippetResult cannot be null"); + } + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/SnippetResultOption.java b/algoliasearch/src/main/java/com/algolia/model/composition/SnippetResultOption.java new file mode 100644 index 00000000..13e4a046 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/SnippetResultOption.java @@ -0,0 +1,78 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.Objects; + +/** Snippets that show the context around a matching search query. */ +@JsonDeserialize(as = SnippetResultOption.class) +public class SnippetResultOption implements SnippetResult { + + @JsonProperty("value") + private String value; + + @JsonProperty("matchLevel") + private MatchLevel matchLevel; + + public SnippetResultOption setValue(String value) { + this.value = value; + return this; + } + + /** Highlighted attribute value, including HTML tags. */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public SnippetResultOption setMatchLevel(MatchLevel matchLevel) { + this.matchLevel = matchLevel; + return this; + } + + /** Get matchLevel */ + @javax.annotation.Nonnull + public MatchLevel getMatchLevel() { + return matchLevel; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SnippetResultOption snippetResultOption = (SnippetResultOption) o; + return Objects.equals(this.value, snippetResultOption.value) && Objects.equals(this.matchLevel, snippetResultOption.matchLevel); + } + + @Override + public int hashCode() { + return Objects.hash(value, matchLevel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SnippetResultOption {\n"); + sb.append(" value: ").append(toIndentedString(value)).append("\n"); + sb.append(" matchLevel: ").append(toIndentedString(matchLevel)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/SortRemainingBy.java b/algoliasearch/src/main/java/com/algolia/model/composition/SortRemainingBy.java new file mode 100644 index 00000000..8de1e96f --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/SortRemainingBy.java @@ -0,0 +1,47 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; + +/** + * Order of facet values that aren't explicitly positioned with the `order` setting. - `count`. + * Order remaining facet values by decreasing count. The count is the number of matching records + * containing this facet value. - `alpha`. Sort facet values alphabetically. - `hidden`. Don't show + * facet values that aren't explicitly positioned. + */ +public enum SortRemainingBy { + COUNT("count"), + + ALPHA("alpha"), + + HIDDEN("hidden"); + + private final String value; + + SortRemainingBy(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static SortRemainingBy fromValue(String value) { + for (SortRemainingBy b : SortRemainingBy.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/SupportedLanguage.java b/algoliasearch/src/main/java/com/algolia/model/composition/SupportedLanguage.java new file mode 100644 index 00000000..4860bda1 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/SupportedLanguage.java @@ -0,0 +1,172 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; + +/** ISO code for a supported language. */ +public enum SupportedLanguage { + AF("af"), + + AR("ar"), + + AZ("az"), + + BG("bg"), + + BN("bn"), + + CA("ca"), + + CS("cs"), + + CY("cy"), + + DA("da"), + + DE("de"), + + EL("el"), + + EN("en"), + + EO("eo"), + + ES("es"), + + ET("et"), + + EU("eu"), + + FA("fa"), + + FI("fi"), + + FO("fo"), + + FR("fr"), + + GA("ga"), + + GL("gl"), + + HE("he"), + + HI("hi"), + + HU("hu"), + + HY("hy"), + + ID("id"), + + IS("is"), + + IT("it"), + + JA("ja"), + + KA("ka"), + + KK("kk"), + + KO("ko"), + + KU("ku"), + + KY("ky"), + + LT("lt"), + + LV("lv"), + + MI("mi"), + + MN("mn"), + + MR("mr"), + + MS("ms"), + + MT("mt"), + + NB("nb"), + + NL("nl"), + + NO("no"), + + NS("ns"), + + PL("pl"), + + PS("ps"), + + PT("pt"), + + PT_BR("pt-br"), + + QU("qu"), + + RO("ro"), + + RU("ru"), + + SK("sk"), + + SQ("sq"), + + SV("sv"), + + SW("sw"), + + TA("ta"), + + TE("te"), + + TH("th"), + + TL("tl"), + + TN("tn"), + + TR("tr"), + + TT("tt"), + + UK("uk"), + + UR("ur"), + + UZ("uz"), + + ZH("zh"); + + private final String value; + + SupportedLanguage(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static SupportedLanguage fromValue(String value) { + for (SupportedLanguage b : SupportedLanguage.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/Value.java b/algoliasearch/src/main/java/com/algolia/model/composition/Value.java new file mode 100644 index 00000000..3bc5a270 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/Value.java @@ -0,0 +1,117 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Value */ +public class Value { + + @JsonProperty("order") + private List order; + + @JsonProperty("sortRemainingBy") + private SortRemainingBy sortRemainingBy; + + @JsonProperty("hide") + private List hide; + + public Value setOrder(List order) { + this.order = order; + return this; + } + + public Value addOrder(String orderItem) { + if (this.order == null) { + this.order = new ArrayList<>(); + } + this.order.add(orderItem); + return this; + } + + /** + * Explicit order of facets or facet values. This setting lets you always show specific facets or + * facet values at the top of the list. + */ + @javax.annotation.Nullable + public List getOrder() { + return order; + } + + public Value setSortRemainingBy(SortRemainingBy sortRemainingBy) { + this.sortRemainingBy = sortRemainingBy; + return this; + } + + /** Get sortRemainingBy */ + @javax.annotation.Nullable + public SortRemainingBy getSortRemainingBy() { + return sortRemainingBy; + } + + public Value setHide(List hide) { + this.hide = hide; + return this; + } + + public Value addHide(String hideItem) { + if (this.hide == null) { + this.hide = new ArrayList<>(); + } + this.hide.add(hideItem); + return this; + } + + /** Hide facet values. */ + @javax.annotation.Nullable + public List getHide() { + return hide; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Value value = (Value) o; + return ( + Objects.equals(this.order, value.order) && + Objects.equals(this.sortRemainingBy, value.sortRemainingBy) && + Objects.equals(this.hide, value.hide) + ); + } + + @Override + public int hashCode() { + return Objects.hash(order, sortRemainingBy, hide); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Value {\n"); + sb.append(" order: ").append(toIndentedString(order)).append("\n"); + sb.append(" sortRemainingBy: ").append(toIndentedString(sortRemainingBy)).append("\n"); + sb.append(" hide: ").append(toIndentedString(hide)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/algoliasearch/src/main/java/com/algolia/model/composition/Widgets.java b/algoliasearch/src/main/java/com/algolia/model/composition/Widgets.java new file mode 100644 index 00000000..19d3b824 --- /dev/null +++ b/algoliasearch/src/main/java/com/algolia/model/composition/Widgets.java @@ -0,0 +1,72 @@ +// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost +// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. + +package com.algolia.model.composition; + +import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.databind.annotation.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Widgets returned from any rules that are applied to the current search. */ +public class Widgets { + + @JsonProperty("banners") + private List banners; + + public Widgets setBanners(List banners) { + this.banners = banners; + return this; + } + + public Widgets addBanners(Banner bannersItem) { + if (this.banners == null) { + this.banners = new ArrayList<>(); + } + this.banners.add(bannersItem); + return this; + } + + /** Banners defined in the Merchandising Studio for a given search. */ + @javax.annotation.Nullable + public List getBanners() { + return banners; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Widgets widgets = (Widgets) o; + return Objects.equals(this.banners, widgets.banners); + } + + @Override + public int hashCode() { + return Objects.hash(banners); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Widgets {\n"); + sb.append(" banners: ").append(toIndentedString(banners)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +}