Skip to content

Commit

Permalink
build(codegen): updating SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
ct-sdks[bot] committed Jan 2, 2025
1 parent 61424ec commit 3b9ffb6
Show file tree
Hide file tree
Showing 30 changed files with 2,983 additions and 0 deletions.
27 changes: 27 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,30 @@
- added type `SearchExactValue`
</details>

**History changes**

<details>
<summary>Added Resource(s)</summary>

- added resource `/{projectKey}/graphql`
</details>


<details>
<summary>Added Method(s)</summary>

- added method `apiRoot.withProjectKeyValue().graphql().post()`
</details>


<details>
<summary>Added Type(s)</summary>

- added type `GraphQLRequest`
- added type `GraphQLResponse`
- added type `GraphQLError`
- added type `GraphQLErrorLocation`
- added type `GraphQLVariablesMap`
- added type `GraphQLErrorObject`
</details>

Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@

package com.commercetools.history.client;

import java.net.URI;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;

import com.fasterxml.jackson.core.type.TypeReference;

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;

/**
* <p>Execute a GraphQL request.</p>
*
* <hr>
* <div class=code-example>
* <pre><code class='java'>{@code
* CompletableFuture<ApiHttpResponse<com.commercetools.history.models.graph_ql.GraphQLResponse>> result = apiRoot
* .withProjectKeyValue("{projectKey}")
* .graphql()
* .post(null)
* .execute()
* }</code></pre>
* </div>
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class ByProjectKeyGraphqlPost extends
TypeBodyApiMethod<ByProjectKeyGraphqlPost, com.commercetools.history.models.graph_ql.GraphQLResponse, com.commercetools.history.models.graph_ql.GraphQLRequest> {

@Override
public TypeReference<com.commercetools.history.models.graph_ql.GraphQLResponse> resultType() {
return new TypeReference<com.commercetools.history.models.graph_ql.GraphQLResponse>() {
};
}

private String projectKey;

private com.commercetools.history.models.graph_ql.GraphQLRequest graphQLRequest;

public ByProjectKeyGraphqlPost(final ApiHttpClient apiHttpClient, String projectKey,
com.commercetools.history.models.graph_ql.GraphQLRequest graphQLRequest) {
super(apiHttpClient);
this.projectKey = projectKey;
this.graphQLRequest = graphQLRequest;
}

public ByProjectKeyGraphqlPost(ByProjectKeyGraphqlPost t) {
super(t);
this.projectKey = t.projectKey;
this.graphQLRequest = t.graphQLRequest;
}

@Override
protected ApiHttpRequest buildHttpRequest() {
List<String> params = new ArrayList<>(getQueryParamUriStrings());
String httpRequestPath = String.format("%s/graphql", encodePathParam(this.projectKey));
if (!params.isEmpty()) {
httpRequestPath += "?" + String.join("&", params);
}
return new ApiHttpRequest(ApiHttpMethod.POST, URI.create(httpRequestPath), getHeaders(),
io.vrap.rmf.base.client.utils.json.JsonUtils
.executing(() -> apiHttpClient().getSerializerService().toJsonByteArray(graphQLRequest)));

}

@Override
public ApiHttpResponse<com.commercetools.history.models.graph_ql.GraphQLResponse> executeBlocking(
final ApiHttpClient client, final Duration timeout) {
return executeBlocking(client, timeout, com.commercetools.history.models.graph_ql.GraphQLResponse.class);
}

@Override
public CompletableFuture<ApiHttpResponse<com.commercetools.history.models.graph_ql.GraphQLResponse>> execute(
final ApiHttpClient client) {
return execute(client, com.commercetools.history.models.graph_ql.GraphQLResponse.class);
}

public String getProjectKey() {
return this.projectKey;
}

public void setProjectKey(final String projectKey) {
this.projectKey = projectKey;
}

public com.commercetools.history.models.graph_ql.GraphQLRequest getBody() {
return graphQLRequest;
}

public ByProjectKeyGraphqlPost withBody(com.commercetools.history.models.graph_ql.GraphQLRequest graphQLRequest) {
ByProjectKeyGraphqlPost t = copy();
t.graphQLRequest = graphQLRequest;
return t;
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;

if (o == null || getClass() != o.getClass())
return false;

ByProjectKeyGraphqlPost that = (ByProjectKeyGraphqlPost) o;

return new EqualsBuilder().append(projectKey, that.projectKey)
.append(graphQLRequest, that.graphQLRequest)
.isEquals();
}

@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).append(projectKey).append(graphQLRequest).toHashCode();
}

@Override
protected ByProjectKeyGraphqlPost copy() {
return new ByProjectKeyGraphqlPost(this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@

package com.commercetools.history.client;

import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CompletableFuture;

import com.fasterxml.jackson.core.type.TypeReference;

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;

/**
* <p>Execute a GraphQL request.</p>
*
* <hr>
* <div class=code-example>
* <pre><code class='java'>{@code
* CompletableFuture<ApiHttpResponse<com.commercetools.history.models.graph_ql.GraphQLResponse>> result = apiRoot
* .withProjectKeyValue("{projectKey}")
* .graphql()
* .post("")
* .execute()
* }</code></pre>
* </div>
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class ByProjectKeyGraphqlPostString extends
StringBodyApiMethod<ByProjectKeyGraphqlPostString, com.commercetools.history.models.graph_ql.GraphQLResponse> {

@Override
public TypeReference<com.commercetools.history.models.graph_ql.GraphQLResponse> resultType() {
return new TypeReference<com.commercetools.history.models.graph_ql.GraphQLResponse>() {
};
}

private String projectKey;

private String graphQLRequest;

public ByProjectKeyGraphqlPostString(final ApiHttpClient apiHttpClient, String projectKey, String graphQLRequest) {
super(apiHttpClient);
this.projectKey = projectKey;
this.graphQLRequest = graphQLRequest;
}

public ByProjectKeyGraphqlPostString(ByProjectKeyGraphqlPostString t) {
super(t);
this.projectKey = t.projectKey;
this.graphQLRequest = t.graphQLRequest;
}

@Override
protected ApiHttpRequest buildHttpRequest() {
List<String> params = new ArrayList<>(getQueryParamUriStrings());
String httpRequestPath = String.format("%s/graphql", this.projectKey);
if (!params.isEmpty()) {
httpRequestPath += "?" + String.join("&", params);
}
return new ApiHttpRequest(ApiHttpMethod.POST, URI.create(httpRequestPath), getHeaders(),
graphQLRequest.getBytes(StandardCharsets.UTF_8));

}

@Override
public ApiHttpResponse<com.commercetools.history.models.graph_ql.GraphQLResponse> executeBlocking(
final ApiHttpClient client, final Duration timeout) {
return executeBlocking(client, timeout, com.commercetools.history.models.graph_ql.GraphQLResponse.class);
}

@Override
public CompletableFuture<ApiHttpResponse<com.commercetools.history.models.graph_ql.GraphQLResponse>> execute(
final ApiHttpClient client) {
return execute(client, com.commercetools.history.models.graph_ql.GraphQLResponse.class);
}

public String getProjectKey() {
return this.projectKey;
}

public void setProjectKey(final String projectKey) {
this.projectKey = projectKey;
}

public String getBody() {
return graphQLRequest;
}

public ByProjectKeyGraphqlPostString withBody(String graphQLRequest) {
ByProjectKeyGraphqlPostString t = copy();
t.graphQLRequest = graphQLRequest;
return t;
}

@Override
public boolean equals(Object o) {
if (this == o)
return true;

if (o == null || getClass() != o.getClass())
return false;

ByProjectKeyGraphqlPostString that = (ByProjectKeyGraphqlPostString) o;

return new EqualsBuilder().append(projectKey, that.projectKey)
.append(graphQLRequest, that.graphQLRequest)
.isEquals();
}

@Override
public int hashCode() {
return new HashCodeBuilder(17, 37).append(projectKey).append(graphQLRequest).toHashCode();
}

@Override
protected ByProjectKeyGraphqlPostString copy() {
return new ByProjectKeyGraphqlPostString(this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

package com.commercetools.history.client;

import java.util.function.UnaryOperator;

import io.vrap.rmf.base.client.ApiHttpClient;
import io.vrap.rmf.base.client.utils.Generated;

@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class ByProjectKeyGraphqlRequestBuilder {

private final ApiHttpClient apiHttpClient;
private final String projectKey;

public ByProjectKeyGraphqlRequestBuilder(final ApiHttpClient apiHttpClient, final String projectKey) {
this.apiHttpClient = apiHttpClient;
this.projectKey = projectKey;
}

public ByProjectKeyGraphqlPost post(com.commercetools.history.models.graph_ql.GraphQLRequest graphQLRequest) {
return new ByProjectKeyGraphqlPost(apiHttpClient, projectKey, graphQLRequest);
}

public ByProjectKeyGraphqlPostString post(final String graphQLRequest) {
return new ByProjectKeyGraphqlPostString(apiHttpClient, projectKey, graphQLRequest);
}

public ByProjectKeyGraphqlPost post(
UnaryOperator<com.commercetools.history.models.graph_ql.GraphQLRequestBuilder> op) {
return post(op.apply(com.commercetools.history.models.graph_ql.GraphQLRequestBuilder.of()).build());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ public ByProjectKeyGet get() {
return new ByProjectKeyGet(apiHttpClient, projectKey);
}

public ByProjectKeyGraphqlRequestBuilder graphql() {
return new ByProjectKeyGraphqlRequestBuilder(apiHttpClient, projectKey);
}

public ByProjectKeyByResourceTypeRequestBuilder withResourceTypeValue(String resourceType) {
return new ByProjectKeyByResourceTypeRequestBuilder(apiHttpClient, projectKey, resourceType);
}
Expand Down
Loading

0 comments on commit 3b9ffb6

Please sign in to comment.