001
002package com.commercetools.ml.client;
003
004import java.net.URI;
005import java.time.Duration;
006import java.util.ArrayList;
007import java.util.List;
008import java.util.concurrent.CompletableFuture;
009
010import io.vrap.rmf.base.client.*;
011import io.vrap.rmf.base.client.utils.Generated;
012
013import org.apache.commons.lang3.builder.EqualsBuilder;
014import org.apache.commons.lang3.builder.HashCodeBuilder;
015
016/**
017 *  <p>Get the current image search config.</p>
018 *
019 * <hr>
020 * <div class=code-example>
021 * <pre><code class='java'>{@code
022 *   CompletableFuture<ApiHttpResponse<com.commercetools.ml.models.image_search_config.ImageSearchConfigResponse>> result = apiRoot
023 *            .withProjectKey("{projectKey}")
024 *            .imageSearch()
025 *            .config()
026 *            .get()
027 *            .execute()
028 * }</code></pre>
029 * </div>
030 */
031@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
032public class ByProjectKeyImageSearchConfigGet extends
033        ApiMethod<ByProjectKeyImageSearchConfigGet, com.commercetools.ml.models.image_search_config.ImageSearchConfigResponse> {
034
035    private String projectKey;
036
037    public ByProjectKeyImageSearchConfigGet(final ApiHttpClient apiHttpClient, String projectKey) {
038        super(apiHttpClient);
039        this.projectKey = projectKey;
040    }
041
042    public ByProjectKeyImageSearchConfigGet(ByProjectKeyImageSearchConfigGet t) {
043        super(t);
044        this.projectKey = t.projectKey;
045    }
046
047    @Override
048    protected ApiHttpRequest buildHttpRequest() {
049        List<String> params = new ArrayList<>(getQueryParamUriStrings());
050        String httpRequestPath = String.format("/%s/image-search/config", this.projectKey);
051        if (!params.isEmpty()) {
052            httpRequestPath += "?" + String.join("&", params);
053        }
054        return new ApiHttpRequest(ApiHttpMethod.GET, URI.create(httpRequestPath), getHeaders(), null);
055    }
056
057    @Override
058    public ApiHttpResponse<com.commercetools.ml.models.image_search_config.ImageSearchConfigResponse> executeBlocking(
059            final ApiHttpClient client, final Duration timeout) {
060        return executeBlocking(client, timeout,
061            com.commercetools.ml.models.image_search_config.ImageSearchConfigResponse.class);
062    }
063
064    @Override
065    public CompletableFuture<ApiHttpResponse<com.commercetools.ml.models.image_search_config.ImageSearchConfigResponse>> execute(
066            final ApiHttpClient client) {
067        return execute(client, com.commercetools.ml.models.image_search_config.ImageSearchConfigResponse.class);
068    }
069
070    public String getProjectKey() {
071        return this.projectKey;
072    }
073
074    public void setProjectKey(final String projectKey) {
075        this.projectKey = projectKey;
076    }
077
078    @Override
079    public boolean equals(Object o) {
080        if (this == o)
081            return true;
082
083        if (o == null || getClass() != o.getClass())
084            return false;
085
086        ByProjectKeyImageSearchConfigGet that = (ByProjectKeyImageSearchConfigGet) o;
087
088        return new EqualsBuilder().append(projectKey, that.projectKey).isEquals();
089    }
090
091    @Override
092    public int hashCode() {
093        return new HashCodeBuilder(17, 37).append(projectKey).toHashCode();
094    }
095
096    @Override
097    protected ByProjectKeyImageSearchConfigGet copy() {
098        return new ByProjectKeyImageSearchConfigGet(this);
099    }
100}