|
| 1 | + |
| 2 | +package com.commercetools.api.client; |
| 3 | + |
| 4 | +import java.net.URI; |
| 5 | +import java.time.Duration; |
| 6 | +import java.util.ArrayList; |
| 7 | +import java.util.List; |
| 8 | +import java.util.concurrent.CompletableFuture; |
| 9 | +import java.util.function.Function; |
| 10 | +import java.util.function.Supplier; |
| 11 | +import java.util.stream.Collectors; |
| 12 | + |
| 13 | +import io.vrap.rmf.base.client.*; |
| 14 | +import io.vrap.rmf.base.client.utils.Generated; |
| 15 | + |
| 16 | +import org.apache.commons.lang3.builder.EqualsBuilder; |
| 17 | +import org.apache.commons.lang3.builder.HashCodeBuilder; |
| 18 | + |
| 19 | +/** |
| 20 | + * |
| 21 | + * |
| 22 | + * <hr> |
| 23 | + * <div class=code-example> |
| 24 | + * <pre><code class='java'>{@code |
| 25 | + * CompletableFuture<ApiHttpResponse<com.commercetools.api.models.business_unit.BusinessUnit>> result = apiRoot |
| 26 | + * .withProjectKey("{projectKey}") |
| 27 | + * .businessUnits() |
| 28 | + * .withId("{ID}") |
| 29 | + * .delete() |
| 30 | + * .withVersion(version) |
| 31 | + * .execute() |
| 32 | + * }</code></pre> |
| 33 | + * </div> |
| 34 | + */ |
| 35 | +@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") |
| 36 | +public class ByProjectKeyBusinessUnitsByIDDelete |
| 37 | + extends ApiMethod<ByProjectKeyBusinessUnitsByIDDelete, com.commercetools.api.models.business_unit.BusinessUnit> |
| 38 | + implements com.commercetools.api.client.VersionedTrait<ByProjectKeyBusinessUnitsByIDDelete>, |
| 39 | + com.commercetools.api.client.ConflictingTrait<ByProjectKeyBusinessUnitsByIDDelete>, |
| 40 | + com.commercetools.api.client.ExpandableTrait<ByProjectKeyBusinessUnitsByIDDelete>, |
| 41 | + com.commercetools.api.client.ErrorableTrait<ByProjectKeyBusinessUnitsByIDDelete>, |
| 42 | + com.commercetools.api.client.Deprecatable200Trait<ByProjectKeyBusinessUnitsByIDDelete> { |
| 43 | + |
| 44 | + private String projectKey; |
| 45 | + private String ID; |
| 46 | + |
| 47 | + public ByProjectKeyBusinessUnitsByIDDelete(final ApiHttpClient apiHttpClient, String projectKey, String ID) { |
| 48 | + super(apiHttpClient); |
| 49 | + this.projectKey = projectKey; |
| 50 | + this.ID = ID; |
| 51 | + } |
| 52 | + |
| 53 | + public ByProjectKeyBusinessUnitsByIDDelete(ByProjectKeyBusinessUnitsByIDDelete t) { |
| 54 | + super(t); |
| 55 | + this.projectKey = t.projectKey; |
| 56 | + this.ID = t.ID; |
| 57 | + } |
| 58 | + |
| 59 | + @Override |
| 60 | + protected ApiHttpRequest buildHttpRequest() { |
| 61 | + List<String> params = new ArrayList<>(getQueryParamUriStrings()); |
| 62 | + String httpRequestPath = String.format("/%s/business-units/%s", this.projectKey, this.ID); |
| 63 | + if (!params.isEmpty()) { |
| 64 | + httpRequestPath += "?" + String.join("&", params); |
| 65 | + } |
| 66 | + return new ApiHttpRequest(ApiHttpMethod.DELETE, URI.create(httpRequestPath), getHeaders(), null); |
| 67 | + } |
| 68 | + |
| 69 | + @Override |
| 70 | + public ApiHttpResponse<com.commercetools.api.models.business_unit.BusinessUnit> executeBlocking( |
| 71 | + final ApiHttpClient client, final Duration timeout) { |
| 72 | + return executeBlocking(client, timeout, com.commercetools.api.models.business_unit.BusinessUnit.class); |
| 73 | + } |
| 74 | + |
| 75 | + @Override |
| 76 | + public CompletableFuture<ApiHttpResponse<com.commercetools.api.models.business_unit.BusinessUnit>> execute( |
| 77 | + final ApiHttpClient client) { |
| 78 | + return execute(client, com.commercetools.api.models.business_unit.BusinessUnit.class); |
| 79 | + } |
| 80 | + |
| 81 | + public String getProjectKey() { |
| 82 | + return this.projectKey; |
| 83 | + } |
| 84 | + |
| 85 | + public String getID() { |
| 86 | + return this.ID; |
| 87 | + } |
| 88 | + |
| 89 | + public List<String> getVersion() { |
| 90 | + return this.getQueryParam("version"); |
| 91 | + } |
| 92 | + |
| 93 | + public List<String> getExpand() { |
| 94 | + return this.getQueryParam("expand"); |
| 95 | + } |
| 96 | + |
| 97 | + public void setProjectKey(final String projectKey) { |
| 98 | + this.projectKey = projectKey; |
| 99 | + } |
| 100 | + |
| 101 | + public void setID(final String ID) { |
| 102 | + this.ID = ID; |
| 103 | + } |
| 104 | + |
| 105 | + /** |
| 106 | + * set version with the specified value |
| 107 | + */ |
| 108 | + public <TValue> ByProjectKeyBusinessUnitsByIDDelete withVersion(final TValue version) { |
| 109 | + return copy().withQueryParam("version", version); |
| 110 | + } |
| 111 | + |
| 112 | + /** |
| 113 | + * add additional version query parameter |
| 114 | + */ |
| 115 | + public <TValue> ByProjectKeyBusinessUnitsByIDDelete addVersion(final TValue version) { |
| 116 | + return copy().addQueryParam("version", version); |
| 117 | + } |
| 118 | + |
| 119 | + /** |
| 120 | + * set version with the specified value |
| 121 | + */ |
| 122 | + public ByProjectKeyBusinessUnitsByIDDelete withVersion(final Supplier<Long> supplier) { |
| 123 | + return copy().withQueryParam("version", supplier.get()); |
| 124 | + } |
| 125 | + |
| 126 | + /** |
| 127 | + * add additional version query parameter |
| 128 | + */ |
| 129 | + public ByProjectKeyBusinessUnitsByIDDelete addVersion(final Supplier<Long> supplier) { |
| 130 | + return copy().addQueryParam("version", supplier.get()); |
| 131 | + } |
| 132 | + |
| 133 | + /** |
| 134 | + * set version with the specified value |
| 135 | + */ |
| 136 | + public ByProjectKeyBusinessUnitsByIDDelete withVersion(final Function<StringBuilder, StringBuilder> op) { |
| 137 | + return copy().withQueryParam("version", op.apply(new StringBuilder())); |
| 138 | + } |
| 139 | + |
| 140 | + /** |
| 141 | + * add additional version query parameter |
| 142 | + */ |
| 143 | + public ByProjectKeyBusinessUnitsByIDDelete addVersion(final Function<StringBuilder, StringBuilder> op) { |
| 144 | + return copy().addQueryParam("version", op.apply(new StringBuilder())); |
| 145 | + } |
| 146 | + |
| 147 | + /** |
| 148 | + * set version with the specified values |
| 149 | + */ |
| 150 | + public <TValue> ByProjectKeyBusinessUnitsByIDDelete withVersion(final List<TValue> version) { |
| 151 | + return copy().withoutQueryParam("version") |
| 152 | + .addQueryParams( |
| 153 | + version.stream().map(s -> new ParamEntry<>("version", s.toString())).collect(Collectors.toList())); |
| 154 | + } |
| 155 | + |
| 156 | + /** |
| 157 | + * add additional version query parameters |
| 158 | + */ |
| 159 | + public <TValue> ByProjectKeyBusinessUnitsByIDDelete addVersion(final List<TValue> version) { |
| 160 | + return copy().addQueryParams( |
| 161 | + version.stream().map(s -> new ParamEntry<>("version", s.toString())).collect(Collectors.toList())); |
| 162 | + } |
| 163 | + |
| 164 | + /** |
| 165 | + * set expand with the specified value |
| 166 | + */ |
| 167 | + public <TValue> ByProjectKeyBusinessUnitsByIDDelete withExpand(final TValue expand) { |
| 168 | + return copy().withQueryParam("expand", expand); |
| 169 | + } |
| 170 | + |
| 171 | + /** |
| 172 | + * add additional expand query parameter |
| 173 | + */ |
| 174 | + public <TValue> ByProjectKeyBusinessUnitsByIDDelete addExpand(final TValue expand) { |
| 175 | + return copy().addQueryParam("expand", expand); |
| 176 | + } |
| 177 | + |
| 178 | + /** |
| 179 | + * set expand with the specified value |
| 180 | + */ |
| 181 | + public ByProjectKeyBusinessUnitsByIDDelete withExpand(final Supplier<String> supplier) { |
| 182 | + return copy().withQueryParam("expand", supplier.get()); |
| 183 | + } |
| 184 | + |
| 185 | + /** |
| 186 | + * add additional expand query parameter |
| 187 | + */ |
| 188 | + public ByProjectKeyBusinessUnitsByIDDelete addExpand(final Supplier<String> supplier) { |
| 189 | + return copy().addQueryParam("expand", supplier.get()); |
| 190 | + } |
| 191 | + |
| 192 | + /** |
| 193 | + * set expand with the specified value |
| 194 | + */ |
| 195 | + public ByProjectKeyBusinessUnitsByIDDelete withExpand(final Function<StringBuilder, StringBuilder> op) { |
| 196 | + return copy().withQueryParam("expand", op.apply(new StringBuilder())); |
| 197 | + } |
| 198 | + |
| 199 | + /** |
| 200 | + * add additional expand query parameter |
| 201 | + */ |
| 202 | + public ByProjectKeyBusinessUnitsByIDDelete addExpand(final Function<StringBuilder, StringBuilder> op) { |
| 203 | + return copy().addQueryParam("expand", op.apply(new StringBuilder())); |
| 204 | + } |
| 205 | + |
| 206 | + /** |
| 207 | + * set expand with the specified values |
| 208 | + */ |
| 209 | + public <TValue> ByProjectKeyBusinessUnitsByIDDelete withExpand(final List<TValue> expand) { |
| 210 | + return copy().withoutQueryParam("expand") |
| 211 | + .addQueryParams( |
| 212 | + expand.stream().map(s -> new ParamEntry<>("expand", s.toString())).collect(Collectors.toList())); |
| 213 | + } |
| 214 | + |
| 215 | + /** |
| 216 | + * add additional expand query parameters |
| 217 | + */ |
| 218 | + public <TValue> ByProjectKeyBusinessUnitsByIDDelete addExpand(final List<TValue> expand) { |
| 219 | + return copy().addQueryParams( |
| 220 | + expand.stream().map(s -> new ParamEntry<>("expand", s.toString())).collect(Collectors.toList())); |
| 221 | + } |
| 222 | + |
| 223 | + @Override |
| 224 | + public boolean equals(Object o) { |
| 225 | + if (this == o) |
| 226 | + return true; |
| 227 | + |
| 228 | + if (o == null || getClass() != o.getClass()) |
| 229 | + return false; |
| 230 | + |
| 231 | + ByProjectKeyBusinessUnitsByIDDelete that = (ByProjectKeyBusinessUnitsByIDDelete) o; |
| 232 | + |
| 233 | + return new EqualsBuilder().append(projectKey, that.projectKey).append(ID, that.ID).isEquals(); |
| 234 | + } |
| 235 | + |
| 236 | + @Override |
| 237 | + public int hashCode() { |
| 238 | + return new HashCodeBuilder(17, 37).append(projectKey).append(ID).toHashCode(); |
| 239 | + } |
| 240 | + |
| 241 | + @Override |
| 242 | + protected ByProjectKeyBusinessUnitsByIDDelete copy() { |
| 243 | + return new ByProjectKeyBusinessUnitsByIDDelete(this); |
| 244 | + } |
| 245 | +} |
0 commit comments