-
Notifications
You must be signed in to change notification settings - Fork 15
/
ByProjectKeyMeActiveCartGet.java
168 lines (140 loc) · 5.38 KB
/
ByProjectKeyMeActiveCartGet.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
package com.commercetools.api.client;
import java.net.URI;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import io.vrap.rmf.base.client.*;
import io.vrap.rmf.base.client.utils.Generated;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
/**
*
*
* <hr>
* <div class=code-example>
* <pre><code class='java'>{@code
* CompletableFuture<ApiHttpResponse<com.commercetools.api.models.cart.Cart>> result = apiRoot
* .withProjectKey("{projectKey}")
* .me()
* .activeCart()
* .get()
* .execute()
* }</code></pre>
* </div>
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class ByProjectKeyMeActiveCartGet
extends ApiMethod<ByProjectKeyMeActiveCartGet, com.commercetools.api.models.cart.Cart>
implements com.commercetools.api.client.ExpandableTrait<ByProjectKeyMeActiveCartGet>,
com.commercetools.api.client.ErrorableTrait<ByProjectKeyMeActiveCartGet>,
com.commercetools.api.client.Deprecatable200Trait<ByProjectKeyMeActiveCartGet> {
private String projectKey;
public ByProjectKeyMeActiveCartGet(final ApiHttpClient apiHttpClient, String projectKey) {
super(apiHttpClient);
this.projectKey = projectKey;
}
public ByProjectKeyMeActiveCartGet(ByProjectKeyMeActiveCartGet t) {
super(t);
this.projectKey = t.projectKey;
}
@Override
protected ApiHttpRequest buildHttpRequest() {
List<String> params = new ArrayList<>(getQueryParamUriStrings());
String httpRequestPath = String.format("/%s/me/active-cart", this.projectKey);
if (!params.isEmpty()) {
httpRequestPath += "?" + String.join("&", params);
}
return new ApiHttpRequest(ApiHttpMethod.GET, URI.create(httpRequestPath), getHeaders(), null);
}
@Override
public ApiHttpResponse<com.commercetools.api.models.cart.Cart> executeBlocking(final ApiHttpClient client,
final Duration timeout) {
return executeBlocking(client, timeout, com.commercetools.api.models.cart.Cart.class);
}
@Override
public CompletableFuture<ApiHttpResponse<com.commercetools.api.models.cart.Cart>> execute(
final ApiHttpClient client) {
return execute(client, com.commercetools.api.models.cart.Cart.class);
}
public String getProjectKey() {
return this.projectKey;
}
public List<String> getExpand() {
return this.getQueryParam("expand");
}
public void setProjectKey(final String projectKey) {
this.projectKey = projectKey;
}
/**
* set expand with the specified value
*/
public <TValue> ByProjectKeyMeActiveCartGet withExpand(final TValue expand) {
return copy().withQueryParam("expand", expand);
}
/**
* add additional expand query parameter
*/
public <TValue> ByProjectKeyMeActiveCartGet addExpand(final TValue expand) {
return copy().addQueryParam("expand", expand);
}
/**
* set expand with the specified value
*/
public ByProjectKeyMeActiveCartGet withExpand(final Supplier<String> supplier) {
return copy().withQueryParam("expand", supplier.get());
}
/**
* add additional expand query parameter
*/
public ByProjectKeyMeActiveCartGet addExpand(final Supplier<String> supplier) {
return copy().addQueryParam("expand", supplier.get());
}
/**
* set expand with the specified value
*/
public ByProjectKeyMeActiveCartGet withExpand(final Function<StringBuilder, StringBuilder> op) {
return copy().withQueryParam("expand", op.apply(new StringBuilder()));
}
/**
* add additional expand query parameter
*/
public ByProjectKeyMeActiveCartGet addExpand(final Function<StringBuilder, StringBuilder> op) {
return copy().addQueryParam("expand", op.apply(new StringBuilder()));
}
/**
* set expand with the specified values
*/
public <TValue> ByProjectKeyMeActiveCartGet withExpand(final List<TValue> expand) {
return copy().withoutQueryParam("expand")
.addQueryParams(
expand.stream().map(s -> new ParamEntry<>("expand", s.toString())).collect(Collectors.toList()));
}
/**
* add additional expand query parameters
*/
public <TValue> ByProjectKeyMeActiveCartGet addExpand(final List<TValue> expand) {
return copy().addQueryParams(
expand.stream().map(s -> new ParamEntry<>("expand", s.toString())).collect(Collectors.toList()));
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
ByProjectKeyMeActiveCartGet that = (ByProjectKeyMeActiveCartGet) o;
return new EqualsBuilder().append(projectKey, that.projectKey).isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).append(projectKey).toHashCode();
}
@Override
protected ByProjectKeyMeActiveCartGet copy() {
return new ByProjectKeyMeActiveCartGet(this);
}
}