Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generated SDKs #344

Merged
merged 19 commits into from Aug 31, 2022
  •  
  •  
  •  
Expand Up @@ -18,7 +18,7 @@

/**
* <p>Either the scope <code>manage_products:{projectKey}</code> or <code>manage_categories:{projectKey}</code> is required.</p>
* <p>Creating a Category produces the CategoryCreatedMessage.</p>
* <p>Creating a Category produces the CategoryCreated Message.</p>
*
* <hr>
* <div class=code-example>
Expand Down
Expand Up @@ -17,7 +17,7 @@
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
* <p>Produces the InventoryEntryDeletedMessage.</p>
* <p>Produces the InventoryEntryDeleted Message.</p>
*
* <hr>
* <div class=code-example>
Expand Down
Expand Up @@ -17,7 +17,7 @@
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
* <p>Produces the InventoryEntryDeletedMessage.</p>
* <p>Produces the InventoryEntryDeleted Message.</p>
*
* <hr>
* <div class=code-example>
Expand Down
Expand Up @@ -17,7 +17,7 @@
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
* <p>Produces the InventoryEntryCreatedMessage.</p>
* <p>Produces the InventoryEntryCreated Message.</p>
*
* <hr>
* <div class=code-example>
Expand Down
Expand Up @@ -6,6 +6,9 @@
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;
Expand All @@ -31,7 +34,8 @@
@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.ErrorableTrait<ByProjectKeyMeActiveCartGet>,
implements com.commercetools.api.client.ExpandableTrait<ByProjectKeyMeActiveCartGet>,
com.commercetools.api.client.ErrorableTrait<ByProjectKeyMeActiveCartGet>,
com.commercetools.api.client.Deprecatable200Trait<ByProjectKeyMeActiveCartGet> {

private String projectKey;
Expand Down Expand Up @@ -72,10 +76,73 @@ 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)
Expand Down
Expand Up @@ -17,7 +17,7 @@
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
*
* <p>Deprecated scope: <code>view_orders:{projectKey}</code></p>
*
* <hr>
* <div class=code-example>
Expand Down
Expand Up @@ -17,7 +17,7 @@
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
*
* <p>Deprecated scope: <code>view_orders:{projectKey}</code></p>
*
* <hr>
* <div class=code-example>
Expand Down
@@ -0,0 +1,121 @@

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 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>Create an Order from a Quote</p>
*
* <hr>
* <div class=code-example>
* <pre><code class='java'>{@code
* CompletableFuture<ApiHttpResponse<com.commercetools.api.models.order.Order>> result = apiRoot
* .withProjectKey("{projectKey}")
* .orders()
* .orderQuote()
* .post(null)
* .execute()
* }</code></pre>
* </div>
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class ByProjectKeyOrdersQuotesPost extends
BodyApiMethod<ByProjectKeyOrdersQuotesPost, com.commercetools.api.models.order.Order, com.commercetools.api.models.order.OrderFromQuoteDraft>
implements com.commercetools.api.client.ErrorableTrait<ByProjectKeyOrdersQuotesPost> {

private String projectKey;

private com.commercetools.api.models.order.OrderFromQuoteDraft orderFromQuoteDraft;

public ByProjectKeyOrdersQuotesPost(final ApiHttpClient apiHttpClient, String projectKey,
com.commercetools.api.models.order.OrderFromQuoteDraft orderFromQuoteDraft) {
super(apiHttpClient);
this.projectKey = projectKey;
this.orderFromQuoteDraft = orderFromQuoteDraft;
}

public ByProjectKeyOrdersQuotesPost(ByProjectKeyOrdersQuotesPost t) {
super(t);
this.projectKey = t.projectKey;
this.orderFromQuoteDraft = t.orderFromQuoteDraft;
}

@Override
protected ApiHttpRequest buildHttpRequest() {
List<String> params = new ArrayList<>(getQueryParamUriStrings());
String httpRequestPath = String.format("/%s/orders/quotes", 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(orderFromQuoteDraft)));

}

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

@Override
public CompletableFuture<ApiHttpResponse<com.commercetools.api.models.order.Order>> execute(
final ApiHttpClient client) {
return execute(client, com.commercetools.api.models.order.Order.class);
}

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

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

public com.commercetools.api.models.order.OrderFromQuoteDraft getBody() {
return orderFromQuoteDraft;
}

public ByProjectKeyOrdersQuotesPost withBody(
com.commercetools.api.models.order.OrderFromQuoteDraft orderFromQuoteDraft) {
ByProjectKeyOrdersQuotesPost t = copy();
t.orderFromQuoteDraft = orderFromQuoteDraft;
return t;
}

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

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

ByProjectKeyOrdersQuotesPost that = (ByProjectKeyOrdersQuotesPost) o;

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

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

@Override
protected ByProjectKeyOrdersQuotesPost copy() {
return new ByProjectKeyOrdersQuotesPost(this);
}
}
@@ -0,0 +1,23 @@

package com.commercetools.api.client;

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 ByProjectKeyOrdersQuotesRequestBuilder {

private final ApiHttpClient apiHttpClient;
private final String projectKey;

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

public ByProjectKeyOrdersQuotesPost post(
com.commercetools.api.models.order.OrderFromQuoteDraft orderFromQuoteDraft) {
return new ByProjectKeyOrdersQuotesPost(apiHttpClient, projectKey, orderFromQuoteDraft);
}

}
Expand Up @@ -27,6 +27,10 @@ public ByProjectKeyOrdersImportRequestBuilder importOrder() {
return new ByProjectKeyOrdersImportRequestBuilder(apiHttpClient, projectKey);
}

public ByProjectKeyOrdersQuotesRequestBuilder orderQuote() {
return new ByProjectKeyOrdersQuotesRequestBuilder(apiHttpClient, projectKey);
}

public ByProjectKeyOrdersOrderNumberByOrderNumberRequestBuilder withOrderNumber(String orderNumber) {
return new ByProjectKeyOrdersOrderNumberByOrderNumberRequestBuilder(apiHttpClient, projectKey, orderNumber);
}
Expand Down
Expand Up @@ -17,7 +17,7 @@
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
*
* <p>If Price selection query parameters are provided, the selected Prices are added to the response. Produces the ProductDeleted Message.</p>
*
* <hr>
* <div class=code-example>
Expand Down
Expand Up @@ -17,7 +17,7 @@
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
* <p>Gets the full representation of a product by ID.</p>
* <p>If Price selection query parameters are provided, the selected Prices are added to the response.</p>
*
* <hr>
* <div class=code-example>
Expand Down
Expand Up @@ -14,7 +14,7 @@
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
* <p>Checks if product with given ID exists.</p>
* <p>Check if a Product exists with a specified <code>id</code>. Responds with a <code>200 OK</code> status if the Product exists or <code>404 Not Found</code> otherwise.</p>
*
* <hr>
* <div class=code-example>
Expand Down
Expand Up @@ -20,7 +20,7 @@
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
* <p>Uploads a binary image file to a given product variant. The supported image formats are JPEG, PNG and GIF.</p>
* <p>Upload a JPEG, PNG and GIF file to a ProductVariant. The maximum file size of the image is 10MB. <code>variant</code> or <code>sku</code> is required to update a specific ProductVariant. The image is uploaded to the Master Variant if <code>variant</code> or <code>sku</code> are not included. Produces the ProductImageAdded Message when the <code>Small</code> version of the image has been uploaded to the CDN.</p>
*
* <hr>
* <div class=code-example>
Expand Down
Expand Up @@ -17,7 +17,7 @@
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
*
* <p>If Price selection query parameters are provided, the selected Prices are added to the response.</p>
*
* <hr>
* <div class=code-example>
Expand Down