|
| 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.quote.Quote>> result = apiRoot |
| 26 | + * .withProjectKey("{projectKey}") |
| 27 | + * .me() |
| 28 | + * .quotes() |
| 29 | + * .withId("{ID}") |
| 30 | + * .post(null) |
| 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 ByProjectKeyMeQuotesByIDPost extends |
| 37 | + BodyApiMethod<ByProjectKeyMeQuotesByIDPost, com.commercetools.api.models.quote.Quote, com.commercetools.api.models.me.MyQuoteUpdate> |
| 38 | + implements com.commercetools.api.client.ConflictingTrait<ByProjectKeyMeQuotesByIDPost>, |
| 39 | + com.commercetools.api.client.ExpandableTrait<ByProjectKeyMeQuotesByIDPost>, |
| 40 | + com.commercetools.api.client.Deprecatable200Trait<ByProjectKeyMeQuotesByIDPost>, |
| 41 | + com.commercetools.api.client.ErrorableTrait<ByProjectKeyMeQuotesByIDPost> { |
| 42 | + |
| 43 | + private String projectKey; |
| 44 | + private String ID; |
| 45 | + |
| 46 | + private com.commercetools.api.models.me.MyQuoteUpdate myQuoteUpdate; |
| 47 | + |
| 48 | + public ByProjectKeyMeQuotesByIDPost(final ApiHttpClient apiHttpClient, String projectKey, String ID, |
| 49 | + com.commercetools.api.models.me.MyQuoteUpdate myQuoteUpdate) { |
| 50 | + super(apiHttpClient); |
| 51 | + this.projectKey = projectKey; |
| 52 | + this.ID = ID; |
| 53 | + this.myQuoteUpdate = myQuoteUpdate; |
| 54 | + } |
| 55 | + |
| 56 | + public ByProjectKeyMeQuotesByIDPost(ByProjectKeyMeQuotesByIDPost t) { |
| 57 | + super(t); |
| 58 | + this.projectKey = t.projectKey; |
| 59 | + this.ID = t.ID; |
| 60 | + this.myQuoteUpdate = t.myQuoteUpdate; |
| 61 | + } |
| 62 | + |
| 63 | + @Override |
| 64 | + protected ApiHttpRequest buildHttpRequest() { |
| 65 | + List<String> params = new ArrayList<>(getQueryParamUriStrings()); |
| 66 | + String httpRequestPath = String.format("/%s/me/quotes/%s", this.projectKey, this.ID); |
| 67 | + if (!params.isEmpty()) { |
| 68 | + httpRequestPath += "?" + String.join("&", params); |
| 69 | + } |
| 70 | + return new ApiHttpRequest(ApiHttpMethod.POST, URI.create(httpRequestPath), getHeaders(), |
| 71 | + io.vrap.rmf.base.client.utils.json.JsonUtils |
| 72 | + .executing(() -> apiHttpClient().getSerializerService().toJsonByteArray(myQuoteUpdate))); |
| 73 | + |
| 74 | + } |
| 75 | + |
| 76 | + @Override |
| 77 | + public ApiHttpResponse<com.commercetools.api.models.quote.Quote> executeBlocking(final ApiHttpClient client, |
| 78 | + final Duration timeout) { |
| 79 | + return executeBlocking(client, timeout, com.commercetools.api.models.quote.Quote.class); |
| 80 | + } |
| 81 | + |
| 82 | + @Override |
| 83 | + public CompletableFuture<ApiHttpResponse<com.commercetools.api.models.quote.Quote>> execute( |
| 84 | + final ApiHttpClient client) { |
| 85 | + return execute(client, com.commercetools.api.models.quote.Quote.class); |
| 86 | + } |
| 87 | + |
| 88 | + public String getProjectKey() { |
| 89 | + return this.projectKey; |
| 90 | + } |
| 91 | + |
| 92 | + public String getID() { |
| 93 | + return this.ID; |
| 94 | + } |
| 95 | + |
| 96 | + public List<String> getExpand() { |
| 97 | + return this.getQueryParam("expand"); |
| 98 | + } |
| 99 | + |
| 100 | + public void setProjectKey(final String projectKey) { |
| 101 | + this.projectKey = projectKey; |
| 102 | + } |
| 103 | + |
| 104 | + public void setID(final String ID) { |
| 105 | + this.ID = ID; |
| 106 | + } |
| 107 | + |
| 108 | + /** |
| 109 | + * set expand with the specified value |
| 110 | + */ |
| 111 | + public <TValue> ByProjectKeyMeQuotesByIDPost withExpand(final TValue expand) { |
| 112 | + return copy().withQueryParam("expand", expand); |
| 113 | + } |
| 114 | + |
| 115 | + /** |
| 116 | + * add additional expand query parameter |
| 117 | + */ |
| 118 | + public <TValue> ByProjectKeyMeQuotesByIDPost addExpand(final TValue expand) { |
| 119 | + return copy().addQueryParam("expand", expand); |
| 120 | + } |
| 121 | + |
| 122 | + /** |
| 123 | + * set expand with the specified value |
| 124 | + */ |
| 125 | + public ByProjectKeyMeQuotesByIDPost withExpand(final Supplier<String> supplier) { |
| 126 | + return copy().withQueryParam("expand", supplier.get()); |
| 127 | + } |
| 128 | + |
| 129 | + /** |
| 130 | + * add additional expand query parameter |
| 131 | + */ |
| 132 | + public ByProjectKeyMeQuotesByIDPost addExpand(final Supplier<String> supplier) { |
| 133 | + return copy().addQueryParam("expand", supplier.get()); |
| 134 | + } |
| 135 | + |
| 136 | + /** |
| 137 | + * set expand with the specified value |
| 138 | + */ |
| 139 | + public ByProjectKeyMeQuotesByIDPost withExpand(final Function<StringBuilder, StringBuilder> op) { |
| 140 | + return copy().withQueryParam("expand", op.apply(new StringBuilder())); |
| 141 | + } |
| 142 | + |
| 143 | + /** |
| 144 | + * add additional expand query parameter |
| 145 | + */ |
| 146 | + public ByProjectKeyMeQuotesByIDPost addExpand(final Function<StringBuilder, StringBuilder> op) { |
| 147 | + return copy().addQueryParam("expand", op.apply(new StringBuilder())); |
| 148 | + } |
| 149 | + |
| 150 | + /** |
| 151 | + * set expand with the specified values |
| 152 | + */ |
| 153 | + public <TValue> ByProjectKeyMeQuotesByIDPost withExpand(final List<TValue> expand) { |
| 154 | + return copy().withoutQueryParam("expand") |
| 155 | + .addQueryParams( |
| 156 | + expand.stream().map(s -> new ParamEntry<>("expand", s.toString())).collect(Collectors.toList())); |
| 157 | + } |
| 158 | + |
| 159 | + /** |
| 160 | + * add additional expand query parameters |
| 161 | + */ |
| 162 | + public <TValue> ByProjectKeyMeQuotesByIDPost addExpand(final List<TValue> expand) { |
| 163 | + return copy().addQueryParams( |
| 164 | + expand.stream().map(s -> new ParamEntry<>("expand", s.toString())).collect(Collectors.toList())); |
| 165 | + } |
| 166 | + |
| 167 | + public com.commercetools.api.models.me.MyQuoteUpdate getBody() { |
| 168 | + return myQuoteUpdate; |
| 169 | + } |
| 170 | + |
| 171 | + public ByProjectKeyMeQuotesByIDPost withBody(com.commercetools.api.models.me.MyQuoteUpdate myQuoteUpdate) { |
| 172 | + ByProjectKeyMeQuotesByIDPost t = copy(); |
| 173 | + t.myQuoteUpdate = myQuoteUpdate; |
| 174 | + return t; |
| 175 | + } |
| 176 | + |
| 177 | + @Override |
| 178 | + public boolean equals(Object o) { |
| 179 | + if (this == o) |
| 180 | + return true; |
| 181 | + |
| 182 | + if (o == null || getClass() != o.getClass()) |
| 183 | + return false; |
| 184 | + |
| 185 | + ByProjectKeyMeQuotesByIDPost that = (ByProjectKeyMeQuotesByIDPost) o; |
| 186 | + |
| 187 | + return new EqualsBuilder().append(projectKey, that.projectKey) |
| 188 | + .append(ID, that.ID) |
| 189 | + .append(myQuoteUpdate, that.myQuoteUpdate) |
| 190 | + .isEquals(); |
| 191 | + } |
| 192 | + |
| 193 | + @Override |
| 194 | + public int hashCode() { |
| 195 | + return new HashCodeBuilder(17, 37).append(projectKey).append(ID).append(myQuoteUpdate).toHashCode(); |
| 196 | + } |
| 197 | + |
| 198 | + @Override |
| 199 | + protected ByProjectKeyMeQuotesByIDPost copy() { |
| 200 | + return new ByProjectKeyMeQuotesByIDPost(this); |
| 201 | + } |
| 202 | +} |
0 commit comments