Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>() {

Check warning on line 39 in commercetools/commercetools-sdk-java-history/src/main/java-generated/com/commercetools/history/client/ByProjectKeyGraphqlPostString.java

View check run for this annotation

Codecov / codecov/patch

commercetools/commercetools-sdk-java-history/src/main/java-generated/com/commercetools/history/client/ByProjectKeyGraphqlPostString.java#L39

Added line #L39 was not covered by tests
};
}

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
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
public interface ModifiedBy {

/**
* <p><code>true</code> if the change was made using the Merchant Center or ImpEx.</p>
* <p><code>true</code> if the change was made using the Merchant Center.</p>
* @return isPlatformClient
*/
@NotNull
Expand Down Expand Up @@ -99,7 +99,7 @@ public interface ModifiedBy {
public Reference getAssociate();

/**
* <p><code>true</code> if the change was made using the Merchant Center or ImpEx.</p>
* <p><code>true</code> if the change was made using the Merchant Center.</p>
* @param isPlatformClient value to be set
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class ModifiedByBuilder implements Builder<ModifiedBy> {
private com.commercetools.history.models.common.Reference associate;

/**
* <p><code>true</code> if the change was made using the Merchant Center or ImpEx.</p>
* <p><code>true</code> if the change was made using the Merchant Center.</p>
* @param isPlatformClient value to be set
* @return Builder
*/
Expand Down Expand Up @@ -180,7 +180,7 @@ public ModifiedByBuilder associate(@Nullable final com.commercetools.history.mod
}

/**
* <p><code>true</code> if the change was made using the Merchant Center or ImpEx.</p>
* <p><code>true</code> if the change was made using the Merchant Center.</p>
* @return isPlatformClient
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public ModifiedByImpl() {
}

/**
* <p><code>true</code> if the change was made using the Merchant Center or ImpEx.</p>
* <p><code>true</code> if the change was made using the Merchant Center.</p>
*/

public Boolean getIsPlatformClient() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public interface Source extends JsonEnum {
<p>The change was made through the Merchant Center.</p> */
Source MERCHANT_CENTER = SourceEnum.MERCHANT_CENTER;
/**
<p>The change was made through ImpEx.</p> */
<p>The change was made through the now-decommissioned ImpEx tool.</p> */
Source IMP_EX = SourceEnum.IMP_EX;
/**
<p>The change was made through an API Client.</p> */
Expand Down
Loading
Loading