001
002package com.commercetools.api.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 *
018 *
019 * <hr>
020 * <div class=code-example>
021 * <pre><code class='java'>{@code
022 *   CompletableFuture<ApiHttpResponse<com.commercetools.api.models.api_client.ApiClient>> result = apiRoot
023 *            .withProjectKey("{projectKey}")
024 *            .apiClients()
025 *            .withId("{ID}")
026 *            .delete()
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 ByProjectKeyApiClientsByIDDelete
033        extends ApiMethod<ByProjectKeyApiClientsByIDDelete, com.commercetools.api.models.api_client.ApiClient>
034        implements com.commercetools.api.client.ErrorableTrait<ByProjectKeyApiClientsByIDDelete>,
035        com.commercetools.api.client.Deprecatable200Trait<ByProjectKeyApiClientsByIDDelete> {
036
037    private String projectKey;
038    private String ID;
039
040    public ByProjectKeyApiClientsByIDDelete(final ApiHttpClient apiHttpClient, String projectKey, String ID) {
041        super(apiHttpClient);
042        this.projectKey = projectKey;
043        this.ID = ID;
044    }
045
046    public ByProjectKeyApiClientsByIDDelete(ByProjectKeyApiClientsByIDDelete t) {
047        super(t);
048        this.projectKey = t.projectKey;
049        this.ID = t.ID;
050    }
051
052    @Override
053    protected ApiHttpRequest buildHttpRequest() {
054        List<String> params = new ArrayList<>(getQueryParamUriStrings());
055        String httpRequestPath = String.format("%s/api-clients/%s", this.projectKey, this.ID);
056        if (!params.isEmpty()) {
057            httpRequestPath += "?" + String.join("&", params);
058        }
059        return new ApiHttpRequest(ApiHttpMethod.DELETE, URI.create(httpRequestPath), getHeaders(), null);
060    }
061
062    @Override
063    public ApiHttpResponse<com.commercetools.api.models.api_client.ApiClient> executeBlocking(
064            final ApiHttpClient client, final Duration timeout) {
065        return executeBlocking(client, timeout, com.commercetools.api.models.api_client.ApiClient.class);
066    }
067
068    @Override
069    public CompletableFuture<ApiHttpResponse<com.commercetools.api.models.api_client.ApiClient>> execute(
070            final ApiHttpClient client) {
071        return execute(client, com.commercetools.api.models.api_client.ApiClient.class);
072    }
073
074    public String getProjectKey() {
075        return this.projectKey;
076    }
077
078    public String getID() {
079        return this.ID;
080    }
081
082    public void setProjectKey(final String projectKey) {
083        this.projectKey = projectKey;
084    }
085
086    public void setID(final String ID) {
087        this.ID = ID;
088    }
089
090    @Override
091    public boolean equals(Object o) {
092        if (this == o)
093            return true;
094
095        if (o == null || getClass() != o.getClass())
096            return false;
097
098        ByProjectKeyApiClientsByIDDelete that = (ByProjectKeyApiClientsByIDDelete) o;
099
100        return new EqualsBuilder().append(projectKey, that.projectKey).append(ID, that.ID).isEquals();
101    }
102
103    @Override
104    public int hashCode() {
105        return new HashCodeBuilder(17, 37).append(projectKey).append(ID).toHashCode();
106    }
107
108    @Override
109    protected ByProjectKeyApiClientsByIDDelete copy() {
110        return new ByProjectKeyApiClientsByIDDelete(this);
111    }
112}