001
002package com.commercetools.ml.models.image_search;
003
004import java.time.*;
005import java.util.*;
006import java.util.function.Function;
007
008import javax.validation.Valid;
009import javax.validation.constraints.NotNull;
010
011import com.fasterxml.jackson.annotation.*;
012import com.fasterxml.jackson.databind.annotation.*;
013
014import io.vrap.rmf.base.client.utils.Generated;
015
016/**
017 *  <p>Response format from image search endpoint.</p>
018 *
019 * <hr>
020 * Example to create an instance using the builder pattern
021 * <div class=code-example>
022 * <pre><code class='java'>
023 *     ImageSearchResponse imageSearchResponse = ImageSearchResponse.builder()
024 *             .count(0.3)
025 *             .offset(0.3)
026 *             .total(0.3)
027 *             .plusResults(resultsBuilder -> resultsBuilder)
028 *             .build()
029 * </code></pre>
030 * </div>
031 */
032@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
033@JsonDeserialize(as = ImageSearchResponseImpl.class)
034public interface ImageSearchResponse {
035
036    /**
037     *  <p>The maximum number of results to return from a query.</p>
038     */
039    @NotNull
040    @JsonProperty("count")
041    public Integer getCount();
042
043    /**
044     *  <p>Number of elements skipped.</p>
045     */
046    @NotNull
047    @JsonProperty("offset")
048    public Double getOffset();
049
050    /**
051     *  <p>The total number of product images that were have been analyzed.</p>
052     */
053    @NotNull
054    @JsonProperty("total")
055    public Integer getTotal();
056
057    /**
058     *  <p>An array of image URLs of images that are similar to the query image. If no matching images are found, results is empty.</p>
059     */
060    @NotNull
061    @Valid
062    @JsonProperty("results")
063    public List<ResultItem> getResults();
064
065    public void setCount(final Integer count);
066
067    public void setOffset(final Double offset);
068
069    public void setTotal(final Integer total);
070
071    @JsonIgnore
072    public void setResults(final ResultItem... results);
073
074    public void setResults(final List<ResultItem> results);
075
076    public static ImageSearchResponse of() {
077        return new ImageSearchResponseImpl();
078    }
079
080    public static ImageSearchResponse of(final ImageSearchResponse template) {
081        ImageSearchResponseImpl instance = new ImageSearchResponseImpl();
082        instance.setCount(template.getCount());
083        instance.setOffset(template.getOffset());
084        instance.setTotal(template.getTotal());
085        instance.setResults(template.getResults());
086        return instance;
087    }
088
089    public static ImageSearchResponseBuilder builder() {
090        return ImageSearchResponseBuilder.of();
091    }
092
093    public static ImageSearchResponseBuilder builder(final ImageSearchResponse template) {
094        return ImageSearchResponseBuilder.of(template);
095    }
096
097    default <T> T withImageSearchResponse(Function<ImageSearchResponse, T> helper) {
098        return helper.apply(this);
099    }
100
101    public static com.fasterxml.jackson.core.type.TypeReference<ImageSearchResponse> typeReference() {
102        return new com.fasterxml.jackson.core.type.TypeReference<ImageSearchResponse>() {
103            @Override
104            public String toString() {
105                return "TypeReference<ImageSearchResponse>";
106            }
107        };
108    }
109}