|
| 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.Collection; |
| 8 | +import java.util.List; |
| 9 | +import java.util.concurrent.CompletableFuture; |
| 10 | +import java.util.function.Function; |
| 11 | +import java.util.function.Supplier; |
| 12 | +import java.util.stream.Collectors; |
| 13 | + |
| 14 | +import com.fasterxml.jackson.core.type.TypeReference; |
| 15 | + |
| 16 | +import io.vrap.rmf.base.client.*; |
| 17 | +import io.vrap.rmf.base.client.utils.Generated; |
| 18 | + |
| 19 | +import org.apache.commons.lang3.builder.EqualsBuilder; |
| 20 | +import org.apache.commons.lang3.builder.HashCodeBuilder; |
| 21 | + |
| 22 | +/** |
| 23 | + * <p>Returns a ReferenceExists error if other resources reference the Channel to be deleted.</p> |
| 24 | + * |
| 25 | + * <hr> |
| 26 | + * <div class=code-example> |
| 27 | + * <pre><code class='java'>{@code |
| 28 | + * CompletableFuture<ApiHttpResponse<com.commercetools.api.models.channel.Channel>> result = apiRoot |
| 29 | + * .withProjectKey("{projectKey}") |
| 30 | + * .channels() |
| 31 | + * .withKey("{key}") |
| 32 | + * .delete() |
| 33 | + * .withVersion(version) |
| 34 | + * .execute() |
| 35 | + * }</code></pre> |
| 36 | + * </div> |
| 37 | + */ |
| 38 | +@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") |
| 39 | +public class ByProjectKeyChannelsKeyByKeyDelete |
| 40 | + extends TypeApiMethod<ByProjectKeyChannelsKeyByKeyDelete, com.commercetools.api.models.channel.Channel> |
| 41 | + implements com.commercetools.api.client.VersionedTrait<ByProjectKeyChannelsKeyByKeyDelete>, |
| 42 | + com.commercetools.api.client.ConflictingTrait<ByProjectKeyChannelsKeyByKeyDelete>, |
| 43 | + com.commercetools.api.client.ExpandableTrait<ByProjectKeyChannelsKeyByKeyDelete>, |
| 44 | + com.commercetools.api.client.ErrorableTrait<ByProjectKeyChannelsKeyByKeyDelete>, |
| 45 | + com.commercetools.api.client.Deprecatable200Trait<ByProjectKeyChannelsKeyByKeyDelete> { |
| 46 | + |
| 47 | + @Override |
| 48 | + public TypeReference<com.commercetools.api.models.channel.Channel> resultType() { |
| 49 | + return new TypeReference<com.commercetools.api.models.channel.Channel>() { |
| 50 | + }; |
| 51 | + } |
| 52 | + |
| 53 | + private String projectKey; |
| 54 | + private String key; |
| 55 | + |
| 56 | + public ByProjectKeyChannelsKeyByKeyDelete(final ApiHttpClient apiHttpClient, String projectKey, String key) { |
| 57 | + super(apiHttpClient); |
| 58 | + this.projectKey = projectKey; |
| 59 | + this.key = key; |
| 60 | + } |
| 61 | + |
| 62 | + public ByProjectKeyChannelsKeyByKeyDelete(ByProjectKeyChannelsKeyByKeyDelete t) { |
| 63 | + super(t); |
| 64 | + this.projectKey = t.projectKey; |
| 65 | + this.key = t.key; |
| 66 | + } |
| 67 | + |
| 68 | + @Override |
| 69 | + protected ApiHttpRequest buildHttpRequest() { |
| 70 | + List<String> params = new ArrayList<>(getQueryParamUriStrings()); |
| 71 | + String httpRequestPath = String.format("%s/channels/key=%s", encodePathParam(this.projectKey), |
| 72 | + encodePathParam(this.key)); |
| 73 | + if (!params.isEmpty()) { |
| 74 | + httpRequestPath += "?" + String.join("&", params); |
| 75 | + } |
| 76 | + return new ApiHttpRequest(ApiHttpMethod.DELETE, URI.create(httpRequestPath), getHeaders(), null); |
| 77 | + } |
| 78 | + |
| 79 | + @Override |
| 80 | + public ApiHttpResponse<com.commercetools.api.models.channel.Channel> executeBlocking(final ApiHttpClient client, |
| 81 | + final Duration timeout) { |
| 82 | + return executeBlocking(client, timeout, com.commercetools.api.models.channel.Channel.class); |
| 83 | + } |
| 84 | + |
| 85 | + @Override |
| 86 | + public CompletableFuture<ApiHttpResponse<com.commercetools.api.models.channel.Channel>> execute( |
| 87 | + final ApiHttpClient client) { |
| 88 | + return execute(client, com.commercetools.api.models.channel.Channel.class); |
| 89 | + } |
| 90 | + |
| 91 | + public String getProjectKey() { |
| 92 | + return this.projectKey; |
| 93 | + } |
| 94 | + |
| 95 | + public String getKey() { |
| 96 | + return this.key; |
| 97 | + } |
| 98 | + |
| 99 | + public List<String> getVersion() { |
| 100 | + return this.getQueryParam("version"); |
| 101 | + } |
| 102 | + |
| 103 | + public List<String> getExpand() { |
| 104 | + return this.getQueryParam("expand"); |
| 105 | + } |
| 106 | + |
| 107 | + public void setProjectKey(final String projectKey) { |
| 108 | + this.projectKey = projectKey; |
| 109 | + } |
| 110 | + |
| 111 | + public void setKey(final String key) { |
| 112 | + this.key = key; |
| 113 | + } |
| 114 | + |
| 115 | + /** |
| 116 | + * set version with the specified value |
| 117 | + * @param version value to be set |
| 118 | + * @param <TValue> value type |
| 119 | + * @return ByProjectKeyChannelsKeyByKeyDelete |
| 120 | + */ |
| 121 | + public <TValue> ByProjectKeyChannelsKeyByKeyDelete withVersion(final TValue version) { |
| 122 | + return copy().withQueryParam("version", version); |
| 123 | + } |
| 124 | + |
| 125 | + /** |
| 126 | + * add additional version query parameter |
| 127 | + * @param version value to be added |
| 128 | + * @param <TValue> value type |
| 129 | + * @return ByProjectKeyChannelsKeyByKeyDelete |
| 130 | + */ |
| 131 | + public <TValue> ByProjectKeyChannelsKeyByKeyDelete addVersion(final TValue version) { |
| 132 | + return copy().addQueryParam("version", version); |
| 133 | + } |
| 134 | + |
| 135 | + /** |
| 136 | + * set version with the specified value |
| 137 | + * @param supplier supplier for the value to be set |
| 138 | + * @return ByProjectKeyChannelsKeyByKeyDelete |
| 139 | + */ |
| 140 | + public ByProjectKeyChannelsKeyByKeyDelete withVersion(final Supplier<Long> supplier) { |
| 141 | + return copy().withQueryParam("version", supplier.get()); |
| 142 | + } |
| 143 | + |
| 144 | + /** |
| 145 | + * add additional version query parameter |
| 146 | + * @param supplier supplier for the value to be added |
| 147 | + * @return ByProjectKeyChannelsKeyByKeyDelete |
| 148 | + */ |
| 149 | + public ByProjectKeyChannelsKeyByKeyDelete addVersion(final Supplier<Long> supplier) { |
| 150 | + return copy().addQueryParam("version", supplier.get()); |
| 151 | + } |
| 152 | + |
| 153 | + /** |
| 154 | + * set version with the specified value |
| 155 | + * @param op builder for the value to be set |
| 156 | + * @return ByProjectKeyChannelsKeyByKeyDelete |
| 157 | + */ |
| 158 | + public ByProjectKeyChannelsKeyByKeyDelete withVersion(final Function<StringBuilder, StringBuilder> op) { |
| 159 | + return copy().withQueryParam("version", op.apply(new StringBuilder())); |
| 160 | + } |
| 161 | + |
| 162 | + /** |
| 163 | + * add additional version query parameter |
| 164 | + * @param op builder for the value to be added |
| 165 | + * @return ByProjectKeyChannelsKeyByKeyDelete |
| 166 | + */ |
| 167 | + public ByProjectKeyChannelsKeyByKeyDelete addVersion(final Function<StringBuilder, StringBuilder> op) { |
| 168 | + return copy().addQueryParam("version", op.apply(new StringBuilder())); |
| 169 | + } |
| 170 | + |
| 171 | + /** |
| 172 | + * set version with the specified values |
| 173 | + * @param version values to be set |
| 174 | + * @param <TValue> value type |
| 175 | + * @return ByProjectKeyChannelsKeyByKeyDelete |
| 176 | + */ |
| 177 | + public <TValue> ByProjectKeyChannelsKeyByKeyDelete withVersion(final Collection<TValue> version) { |
| 178 | + return copy().withoutQueryParam("version") |
| 179 | + .addQueryParams( |
| 180 | + version.stream().map(s -> new ParamEntry<>("version", s.toString())).collect(Collectors.toList())); |
| 181 | + } |
| 182 | + |
| 183 | + /** |
| 184 | + * add additional version query parameters |
| 185 | + * @param version values to be added |
| 186 | + * @param <TValue> value type |
| 187 | + * @return ByProjectKeyChannelsKeyByKeyDelete |
| 188 | + */ |
| 189 | + public <TValue> ByProjectKeyChannelsKeyByKeyDelete addVersion(final Collection<TValue> version) { |
| 190 | + return copy().addQueryParams( |
| 191 | + version.stream().map(s -> new ParamEntry<>("version", s.toString())).collect(Collectors.toList())); |
| 192 | + } |
| 193 | + |
| 194 | + /** |
| 195 | + * set expand with the specified value |
| 196 | + * @param expand value to be set |
| 197 | + * @param <TValue> value type |
| 198 | + * @return ByProjectKeyChannelsKeyByKeyDelete |
| 199 | + */ |
| 200 | + public <TValue> ByProjectKeyChannelsKeyByKeyDelete withExpand(final TValue expand) { |
| 201 | + return copy().withQueryParam("expand", expand); |
| 202 | + } |
| 203 | + |
| 204 | + /** |
| 205 | + * add additional expand query parameter |
| 206 | + * @param expand value to be added |
| 207 | + * @param <TValue> value type |
| 208 | + * @return ByProjectKeyChannelsKeyByKeyDelete |
| 209 | + */ |
| 210 | + public <TValue> ByProjectKeyChannelsKeyByKeyDelete addExpand(final TValue expand) { |
| 211 | + return copy().addQueryParam("expand", expand); |
| 212 | + } |
| 213 | + |
| 214 | + /** |
| 215 | + * set expand with the specified value |
| 216 | + * @param supplier supplier for the value to be set |
| 217 | + * @return ByProjectKeyChannelsKeyByKeyDelete |
| 218 | + */ |
| 219 | + public ByProjectKeyChannelsKeyByKeyDelete withExpand(final Supplier<String> supplier) { |
| 220 | + return copy().withQueryParam("expand", supplier.get()); |
| 221 | + } |
| 222 | + |
| 223 | + /** |
| 224 | + * add additional expand query parameter |
| 225 | + * @param supplier supplier for the value to be added |
| 226 | + * @return ByProjectKeyChannelsKeyByKeyDelete |
| 227 | + */ |
| 228 | + public ByProjectKeyChannelsKeyByKeyDelete addExpand(final Supplier<String> supplier) { |
| 229 | + return copy().addQueryParam("expand", supplier.get()); |
| 230 | + } |
| 231 | + |
| 232 | + /** |
| 233 | + * set expand with the specified value |
| 234 | + * @param op builder for the value to be set |
| 235 | + * @return ByProjectKeyChannelsKeyByKeyDelete |
| 236 | + */ |
| 237 | + public ByProjectKeyChannelsKeyByKeyDelete withExpand(final Function<StringBuilder, StringBuilder> op) { |
| 238 | + return copy().withQueryParam("expand", op.apply(new StringBuilder())); |
| 239 | + } |
| 240 | + |
| 241 | + /** |
| 242 | + * add additional expand query parameter |
| 243 | + * @param op builder for the value to be added |
| 244 | + * @return ByProjectKeyChannelsKeyByKeyDelete |
| 245 | + */ |
| 246 | + public ByProjectKeyChannelsKeyByKeyDelete addExpand(final Function<StringBuilder, StringBuilder> op) { |
| 247 | + return copy().addQueryParam("expand", op.apply(new StringBuilder())); |
| 248 | + } |
| 249 | + |
| 250 | + /** |
| 251 | + * set expand with the specified values |
| 252 | + * @param expand values to be set |
| 253 | + * @param <TValue> value type |
| 254 | + * @return ByProjectKeyChannelsKeyByKeyDelete |
| 255 | + */ |
| 256 | + public <TValue> ByProjectKeyChannelsKeyByKeyDelete withExpand(final Collection<TValue> expand) { |
| 257 | + return copy().withoutQueryParam("expand") |
| 258 | + .addQueryParams( |
| 259 | + expand.stream().map(s -> new ParamEntry<>("expand", s.toString())).collect(Collectors.toList())); |
| 260 | + } |
| 261 | + |
| 262 | + /** |
| 263 | + * add additional expand query parameters |
| 264 | + * @param expand values to be added |
| 265 | + * @param <TValue> value type |
| 266 | + * @return ByProjectKeyChannelsKeyByKeyDelete |
| 267 | + */ |
| 268 | + public <TValue> ByProjectKeyChannelsKeyByKeyDelete addExpand(final Collection<TValue> expand) { |
| 269 | + return copy().addQueryParams( |
| 270 | + expand.stream().map(s -> new ParamEntry<>("expand", s.toString())).collect(Collectors.toList())); |
| 271 | + } |
| 272 | + |
| 273 | + @Override |
| 274 | + public boolean equals(Object o) { |
| 275 | + if (this == o) |
| 276 | + return true; |
| 277 | + |
| 278 | + if (o == null || getClass() != o.getClass()) |
| 279 | + return false; |
| 280 | + |
| 281 | + ByProjectKeyChannelsKeyByKeyDelete that = (ByProjectKeyChannelsKeyByKeyDelete) o; |
| 282 | + |
| 283 | + return new EqualsBuilder().append(projectKey, that.projectKey).append(key, that.key).isEquals(); |
| 284 | + } |
| 285 | + |
| 286 | + @Override |
| 287 | + public int hashCode() { |
| 288 | + return new HashCodeBuilder(17, 37).append(projectKey).append(key).toHashCode(); |
| 289 | + } |
| 290 | + |
| 291 | + @Override |
| 292 | + protected ByProjectKeyChannelsKeyByKeyDelete copy() { |
| 293 | + return new ByProjectKeyChannelsKeyByKeyDelete(this); |
| 294 | + } |
| 295 | +} |
0 commit comments