Skip to content

Commit 3b9ffb6

Browse files
committed
build(codegen): updating SDK
1 parent 61424ec commit 3b9ffb6

30 files changed

+2983
-0
lines changed

changes.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,30 @@
4545
- added type `SearchExactValue`
4646
</details>
4747

48+
**History changes**
49+
50+
<details>
51+
<summary>Added Resource(s)</summary>
52+
53+
- added resource `/{projectKey}/graphql`
54+
</details>
55+
56+
57+
<details>
58+
<summary>Added Method(s)</summary>
59+
60+
- added method `apiRoot.withProjectKeyValue().graphql().post()`
61+
</details>
62+
63+
64+
<details>
65+
<summary>Added Type(s)</summary>
66+
67+
- added type `GraphQLRequest`
68+
- added type `GraphQLResponse`
69+
- added type `GraphQLError`
70+
- added type `GraphQLErrorLocation`
71+
- added type `GraphQLVariablesMap`
72+
- added type `GraphQLErrorObject`
73+
</details>
74+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
2+
package com.commercetools.history.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+
10+
import com.fasterxml.jackson.core.type.TypeReference;
11+
12+
import io.vrap.rmf.base.client.*;
13+
import io.vrap.rmf.base.client.utils.Generated;
14+
15+
import org.apache.commons.lang3.builder.EqualsBuilder;
16+
import org.apache.commons.lang3.builder.HashCodeBuilder;
17+
18+
/**
19+
* <p>Execute a GraphQL request.</p>
20+
*
21+
* <hr>
22+
* <div class=code-example>
23+
* <pre><code class='java'>{@code
24+
* CompletableFuture<ApiHttpResponse<com.commercetools.history.models.graph_ql.GraphQLResponse>> result = apiRoot
25+
* .withProjectKeyValue("{projectKey}")
26+
* .graphql()
27+
* .post(null)
28+
* .execute()
29+
* }</code></pre>
30+
* </div>
31+
*/
32+
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
33+
public class ByProjectKeyGraphqlPost extends
34+
TypeBodyApiMethod<ByProjectKeyGraphqlPost, com.commercetools.history.models.graph_ql.GraphQLResponse, com.commercetools.history.models.graph_ql.GraphQLRequest> {
35+
36+
@Override
37+
public TypeReference<com.commercetools.history.models.graph_ql.GraphQLResponse> resultType() {
38+
return new TypeReference<com.commercetools.history.models.graph_ql.GraphQLResponse>() {
39+
};
40+
}
41+
42+
private String projectKey;
43+
44+
private com.commercetools.history.models.graph_ql.GraphQLRequest graphQLRequest;
45+
46+
public ByProjectKeyGraphqlPost(final ApiHttpClient apiHttpClient, String projectKey,
47+
com.commercetools.history.models.graph_ql.GraphQLRequest graphQLRequest) {
48+
super(apiHttpClient);
49+
this.projectKey = projectKey;
50+
this.graphQLRequest = graphQLRequest;
51+
}
52+
53+
public ByProjectKeyGraphqlPost(ByProjectKeyGraphqlPost t) {
54+
super(t);
55+
this.projectKey = t.projectKey;
56+
this.graphQLRequest = t.graphQLRequest;
57+
}
58+
59+
@Override
60+
protected ApiHttpRequest buildHttpRequest() {
61+
List<String> params = new ArrayList<>(getQueryParamUriStrings());
62+
String httpRequestPath = String.format("%s/graphql", encodePathParam(this.projectKey));
63+
if (!params.isEmpty()) {
64+
httpRequestPath += "?" + String.join("&", params);
65+
}
66+
return new ApiHttpRequest(ApiHttpMethod.POST, URI.create(httpRequestPath), getHeaders(),
67+
io.vrap.rmf.base.client.utils.json.JsonUtils
68+
.executing(() -> apiHttpClient().getSerializerService().toJsonByteArray(graphQLRequest)));
69+
70+
}
71+
72+
@Override
73+
public ApiHttpResponse<com.commercetools.history.models.graph_ql.GraphQLResponse> executeBlocking(
74+
final ApiHttpClient client, final Duration timeout) {
75+
return executeBlocking(client, timeout, com.commercetools.history.models.graph_ql.GraphQLResponse.class);
76+
}
77+
78+
@Override
79+
public CompletableFuture<ApiHttpResponse<com.commercetools.history.models.graph_ql.GraphQLResponse>> execute(
80+
final ApiHttpClient client) {
81+
return execute(client, com.commercetools.history.models.graph_ql.GraphQLResponse.class);
82+
}
83+
84+
public String getProjectKey() {
85+
return this.projectKey;
86+
}
87+
88+
public void setProjectKey(final String projectKey) {
89+
this.projectKey = projectKey;
90+
}
91+
92+
public com.commercetools.history.models.graph_ql.GraphQLRequest getBody() {
93+
return graphQLRequest;
94+
}
95+
96+
public ByProjectKeyGraphqlPost withBody(com.commercetools.history.models.graph_ql.GraphQLRequest graphQLRequest) {
97+
ByProjectKeyGraphqlPost t = copy();
98+
t.graphQLRequest = graphQLRequest;
99+
return t;
100+
}
101+
102+
@Override
103+
public boolean equals(Object o) {
104+
if (this == o)
105+
return true;
106+
107+
if (o == null || getClass() != o.getClass())
108+
return false;
109+
110+
ByProjectKeyGraphqlPost that = (ByProjectKeyGraphqlPost) o;
111+
112+
return new EqualsBuilder().append(projectKey, that.projectKey)
113+
.append(graphQLRequest, that.graphQLRequest)
114+
.isEquals();
115+
}
116+
117+
@Override
118+
public int hashCode() {
119+
return new HashCodeBuilder(17, 37).append(projectKey).append(graphQLRequest).toHashCode();
120+
}
121+
122+
@Override
123+
protected ByProjectKeyGraphqlPost copy() {
124+
return new ByProjectKeyGraphqlPost(this);
125+
}
126+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
2+
package com.commercetools.history.client;
3+
4+
import java.net.URI;
5+
import java.nio.charset.StandardCharsets;
6+
import java.time.Duration;
7+
import java.util.ArrayList;
8+
import java.util.List;
9+
import java.util.concurrent.CompletableFuture;
10+
11+
import com.fasterxml.jackson.core.type.TypeReference;
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+
* <p>Execute a GraphQL request.</p>
21+
*
22+
* <hr>
23+
* <div class=code-example>
24+
* <pre><code class='java'>{@code
25+
* CompletableFuture<ApiHttpResponse<com.commercetools.history.models.graph_ql.GraphQLResponse>> result = apiRoot
26+
* .withProjectKeyValue("{projectKey}")
27+
* .graphql()
28+
* .post("")
29+
* .execute()
30+
* }</code></pre>
31+
* </div>
32+
*/
33+
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
34+
public class ByProjectKeyGraphqlPostString extends
35+
StringBodyApiMethod<ByProjectKeyGraphqlPostString, com.commercetools.history.models.graph_ql.GraphQLResponse> {
36+
37+
@Override
38+
public TypeReference<com.commercetools.history.models.graph_ql.GraphQLResponse> resultType() {
39+
return new TypeReference<com.commercetools.history.models.graph_ql.GraphQLResponse>() {
40+
};
41+
}
42+
43+
private String projectKey;
44+
45+
private String graphQLRequest;
46+
47+
public ByProjectKeyGraphqlPostString(final ApiHttpClient apiHttpClient, String projectKey, String graphQLRequest) {
48+
super(apiHttpClient);
49+
this.projectKey = projectKey;
50+
this.graphQLRequest = graphQLRequest;
51+
}
52+
53+
public ByProjectKeyGraphqlPostString(ByProjectKeyGraphqlPostString t) {
54+
super(t);
55+
this.projectKey = t.projectKey;
56+
this.graphQLRequest = t.graphQLRequest;
57+
}
58+
59+
@Override
60+
protected ApiHttpRequest buildHttpRequest() {
61+
List<String> params = new ArrayList<>(getQueryParamUriStrings());
62+
String httpRequestPath = String.format("%s/graphql", this.projectKey);
63+
if (!params.isEmpty()) {
64+
httpRequestPath += "?" + String.join("&", params);
65+
}
66+
return new ApiHttpRequest(ApiHttpMethod.POST, URI.create(httpRequestPath), getHeaders(),
67+
graphQLRequest.getBytes(StandardCharsets.UTF_8));
68+
69+
}
70+
71+
@Override
72+
public ApiHttpResponse<com.commercetools.history.models.graph_ql.GraphQLResponse> executeBlocking(
73+
final ApiHttpClient client, final Duration timeout) {
74+
return executeBlocking(client, timeout, com.commercetools.history.models.graph_ql.GraphQLResponse.class);
75+
}
76+
77+
@Override
78+
public CompletableFuture<ApiHttpResponse<com.commercetools.history.models.graph_ql.GraphQLResponse>> execute(
79+
final ApiHttpClient client) {
80+
return execute(client, com.commercetools.history.models.graph_ql.GraphQLResponse.class);
81+
}
82+
83+
public String getProjectKey() {
84+
return this.projectKey;
85+
}
86+
87+
public void setProjectKey(final String projectKey) {
88+
this.projectKey = projectKey;
89+
}
90+
91+
public String getBody() {
92+
return graphQLRequest;
93+
}
94+
95+
public ByProjectKeyGraphqlPostString withBody(String graphQLRequest) {
96+
ByProjectKeyGraphqlPostString t = copy();
97+
t.graphQLRequest = graphQLRequest;
98+
return t;
99+
}
100+
101+
@Override
102+
public boolean equals(Object o) {
103+
if (this == o)
104+
return true;
105+
106+
if (o == null || getClass() != o.getClass())
107+
return false;
108+
109+
ByProjectKeyGraphqlPostString that = (ByProjectKeyGraphqlPostString) o;
110+
111+
return new EqualsBuilder().append(projectKey, that.projectKey)
112+
.append(graphQLRequest, that.graphQLRequest)
113+
.isEquals();
114+
}
115+
116+
@Override
117+
public int hashCode() {
118+
return new HashCodeBuilder(17, 37).append(projectKey).append(graphQLRequest).toHashCode();
119+
}
120+
121+
@Override
122+
protected ByProjectKeyGraphqlPostString copy() {
123+
return new ByProjectKeyGraphqlPostString(this);
124+
}
125+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
package com.commercetools.history.client;
3+
4+
import java.util.function.UnaryOperator;
5+
6+
import io.vrap.rmf.base.client.ApiHttpClient;
7+
import io.vrap.rmf.base.client.utils.Generated;
8+
9+
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
10+
public class ByProjectKeyGraphqlRequestBuilder {
11+
12+
private final ApiHttpClient apiHttpClient;
13+
private final String projectKey;
14+
15+
public ByProjectKeyGraphqlRequestBuilder(final ApiHttpClient apiHttpClient, final String projectKey) {
16+
this.apiHttpClient = apiHttpClient;
17+
this.projectKey = projectKey;
18+
}
19+
20+
public ByProjectKeyGraphqlPost post(com.commercetools.history.models.graph_ql.GraphQLRequest graphQLRequest) {
21+
return new ByProjectKeyGraphqlPost(apiHttpClient, projectKey, graphQLRequest);
22+
}
23+
24+
public ByProjectKeyGraphqlPostString post(final String graphQLRequest) {
25+
return new ByProjectKeyGraphqlPostString(apiHttpClient, projectKey, graphQLRequest);
26+
}
27+
28+
public ByProjectKeyGraphqlPost post(
29+
UnaryOperator<com.commercetools.history.models.graph_ql.GraphQLRequestBuilder> op) {
30+
return post(op.apply(com.commercetools.history.models.graph_ql.GraphQLRequestBuilder.of()).build());
31+
}
32+
33+
}

commercetools/commercetools-sdk-java-history/src/main/java-generated/com/commercetools/history/client/ByProjectKeyRequestBuilder.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ public ByProjectKeyGet get() {
1919
return new ByProjectKeyGet(apiHttpClient, projectKey);
2020
}
2121

22+
public ByProjectKeyGraphqlRequestBuilder graphql() {
23+
return new ByProjectKeyGraphqlRequestBuilder(apiHttpClient, projectKey);
24+
}
25+
2226
public ByProjectKeyByResourceTypeRequestBuilder withResourceTypeValue(String resourceType) {
2327
return new ByProjectKeyByResourceTypeRequestBuilder(apiHttpClient, projectKey, resourceType);
2428
}

0 commit comments

Comments
 (0)