-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #448 from commercetools/gen-sdk-updates
- Loading branch information
Showing
86 changed files
with
5,491 additions
and
324 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
159 changes: 159 additions & 0 deletions
159
...ojectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePost.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
|
||
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>Creates a new Cart by replicating an existing Cart or Order. Can be useful in cases where a customer wants to cancel a recent order to make some changes or reorder a previous order.</p> | ||
* <p>The replicated Cart preserves Customer information, Line Items and Custom Line Items, Custom Fields, Discount Codes, and other settings of the Cart or Order. If the Line Items become invalid, for example, due to removed Products or Prices, they are removed from the new Cart. If the Customer switches to another Customer Group, the new Cart is updated with the new value. It has up-to-date Tax Rates, Prices, and Line Item product data and is in <code>Active</code> CartState.</p> | ||
* <p>The new Cart does not contain Payments or Deliveries. The State of Line Items and Custom Line Items is reset to <code>initial</code>.</p> | ||
* <p>If the Cart exists in the Project but does not reference the requested BusinessUnit, this method returns an InvalidOperation error.</p> | ||
* | ||
* <hr> | ||
* <div class=code-example> | ||
* <pre><code class='java'>{@code | ||
* CompletableFuture<ApiHttpResponse<com.commercetools.api.models.cart.Cart>> result = apiRoot | ||
* .withProjectKey("{projectKey}") | ||
* .asAssociate() | ||
* .withAssociateIdValue("{associateId}") | ||
* .inBusinessUnitKeyWithBusinessUnitKeyValue("{businessUnitKey}") | ||
* .carts() | ||
* .replicate() | ||
* .post(null) | ||
* .execute() | ||
* }</code></pre> | ||
* </div> | ||
*/ | ||
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") | ||
public class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePost extends | ||
BodyApiMethod<ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePost, com.commercetools.api.models.cart.Cart, com.commercetools.api.models.cart.ReplicaCartDraft> | ||
implements | ||
com.commercetools.api.client.ErrorableTrait<ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePost> { | ||
|
||
private String projectKey; | ||
private String associateId; | ||
private String businessUnitKey; | ||
|
||
private com.commercetools.api.models.cart.ReplicaCartDraft replicaCartDraft; | ||
|
||
public ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePost( | ||
final ApiHttpClient apiHttpClient, String projectKey, String associateId, String businessUnitKey, | ||
com.commercetools.api.models.cart.ReplicaCartDraft replicaCartDraft) { | ||
super(apiHttpClient); | ||
this.projectKey = projectKey; | ||
this.associateId = associateId; | ||
this.businessUnitKey = businessUnitKey; | ||
this.replicaCartDraft = replicaCartDraft; | ||
} | ||
|
||
public ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePost( | ||
ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePost t) { | ||
super(t); | ||
this.projectKey = t.projectKey; | ||
this.associateId = t.associateId; | ||
this.businessUnitKey = t.businessUnitKey; | ||
this.replicaCartDraft = t.replicaCartDraft; | ||
} | ||
|
||
@Override | ||
protected ApiHttpRequest buildHttpRequest() { | ||
List<String> params = new ArrayList<>(getQueryParamUriStrings()); | ||
String httpRequestPath = String.format("%s/as-associate/%s/in-business-unit/key=%s/carts/replicate", | ||
this.projectKey, this.associateId, this.businessUnitKey); | ||
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(replicaCartDraft))); | ||
|
||
} | ||
|
||
@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 String getAssociateId() { | ||
return this.associateId; | ||
} | ||
|
||
public String getBusinessUnitKey() { | ||
return this.businessUnitKey; | ||
} | ||
|
||
public void setProjectKey(final String projectKey) { | ||
this.projectKey = projectKey; | ||
} | ||
|
||
public void setAssociateId(final String associateId) { | ||
this.associateId = associateId; | ||
} | ||
|
||
public void setBusinessUnitKey(final String businessUnitKey) { | ||
this.businessUnitKey = businessUnitKey; | ||
} | ||
|
||
public com.commercetools.api.models.cart.ReplicaCartDraft getBody() { | ||
return replicaCartDraft; | ||
} | ||
|
||
public ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePost withBody( | ||
com.commercetools.api.models.cart.ReplicaCartDraft replicaCartDraft) { | ||
ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePost t = copy(); | ||
t.replicaCartDraft = replicaCartDraft; | ||
return t; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) | ||
return true; | ||
|
||
if (o == null || getClass() != o.getClass()) | ||
return false; | ||
|
||
ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePost that = (ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePost) o; | ||
|
||
return new EqualsBuilder().append(projectKey, that.projectKey) | ||
.append(associateId, that.associateId) | ||
.append(businessUnitKey, that.businessUnitKey) | ||
.append(replicaCartDraft, that.replicaCartDraft) | ||
.isEquals(); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return new HashCodeBuilder(17, 37).append(projectKey) | ||
.append(associateId) | ||
.append(businessUnitKey) | ||
.append(replicaCartDraft) | ||
.toHashCode(); | ||
} | ||
|
||
@Override | ||
protected ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePost copy() { | ||
return new ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePost(this); | ||
} | ||
} |
159 changes: 159 additions & 0 deletions
159
...eyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePostString.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
|
||
package com.commercetools.api.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 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>Creates a new Cart by replicating an existing Cart or Order. Can be useful in cases where a customer wants to cancel a recent order to make some changes or reorder a previous order.</p> | ||
* <p>The replicated Cart preserves Customer information, Line Items and Custom Line Items, Custom Fields, Discount Codes, and other settings of the Cart or Order. If the Line Items become invalid, for example, due to removed Products or Prices, they are removed from the new Cart. If the Customer switches to another Customer Group, the new Cart is updated with the new value. It has up-to-date Tax Rates, Prices, and Line Item product data and is in <code>Active</code> CartState.</p> | ||
* <p>The new Cart does not contain Payments or Deliveries. The State of Line Items and Custom Line Items is reset to <code>initial</code>.</p> | ||
* <p>If the Cart exists in the Project but does not reference the requested BusinessUnit, this method returns an InvalidOperation error.</p> | ||
* | ||
* <hr> | ||
* <div class=code-example> | ||
* <pre><code class='java'>{@code | ||
* CompletableFuture<ApiHttpResponse<com.commercetools.api.models.cart.Cart>> result = apiRoot | ||
* .withProjectKey("{projectKey}") | ||
* .asAssociate() | ||
* .withAssociateIdValue("{associateId}") | ||
* .inBusinessUnitKeyWithBusinessUnitKeyValue("{businessUnitKey}") | ||
* .carts() | ||
* .replicate() | ||
* .post("") | ||
* .execute() | ||
* }</code></pre> | ||
* </div> | ||
*/ | ||
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") | ||
public class ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePostString extends | ||
StringBodyApiMethod<ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePostString, com.commercetools.api.models.cart.Cart> | ||
implements | ||
com.commercetools.api.client.ErrorableTrait<ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePostString> { | ||
|
||
private String projectKey; | ||
private String associateId; | ||
private String businessUnitKey; | ||
|
||
private String replicaCartDraft; | ||
|
||
public ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePostString( | ||
final ApiHttpClient apiHttpClient, String projectKey, String associateId, String businessUnitKey, | ||
String replicaCartDraft) { | ||
super(apiHttpClient); | ||
this.projectKey = projectKey; | ||
this.associateId = associateId; | ||
this.businessUnitKey = businessUnitKey; | ||
this.replicaCartDraft = replicaCartDraft; | ||
} | ||
|
||
public ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePostString( | ||
ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePostString t) { | ||
super(t); | ||
this.projectKey = t.projectKey; | ||
this.associateId = t.associateId; | ||
this.businessUnitKey = t.businessUnitKey; | ||
this.replicaCartDraft = t.replicaCartDraft; | ||
} | ||
|
||
@Override | ||
protected ApiHttpRequest buildHttpRequest() { | ||
List<String> params = new ArrayList<>(getQueryParamUriStrings()); | ||
String httpRequestPath = String.format("%s/as-associate/%s/in-business-unit/key=%s/carts/replicate", | ||
this.projectKey, this.associateId, this.businessUnitKey); | ||
if (!params.isEmpty()) { | ||
httpRequestPath += "?" + String.join("&", params); | ||
} | ||
return new ApiHttpRequest(ApiHttpMethod.POST, URI.create(httpRequestPath), getHeaders(), | ||
replicaCartDraft.getBytes(StandardCharsets.UTF_8)); | ||
|
||
} | ||
|
||
@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 String getAssociateId() { | ||
return this.associateId; | ||
} | ||
|
||
public String getBusinessUnitKey() { | ||
return this.businessUnitKey; | ||
} | ||
|
||
public void setProjectKey(final String projectKey) { | ||
this.projectKey = projectKey; | ||
} | ||
|
||
public void setAssociateId(final String associateId) { | ||
this.associateId = associateId; | ||
} | ||
|
||
public void setBusinessUnitKey(final String businessUnitKey) { | ||
this.businessUnitKey = businessUnitKey; | ||
} | ||
|
||
public String getBody() { | ||
return replicaCartDraft; | ||
} | ||
|
||
public ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePostString withBody( | ||
String replicaCartDraft) { | ||
ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePostString t = copy(); | ||
t.replicaCartDraft = replicaCartDraft; | ||
return t; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) | ||
return true; | ||
|
||
if (o == null || getClass() != o.getClass()) | ||
return false; | ||
|
||
ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePostString that = (ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePostString) o; | ||
|
||
return new EqualsBuilder().append(projectKey, that.projectKey) | ||
.append(associateId, that.associateId) | ||
.append(businessUnitKey, that.businessUnitKey) | ||
.append(replicaCartDraft, that.replicaCartDraft) | ||
.isEquals(); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return new HashCodeBuilder(17, 37).append(projectKey) | ||
.append(associateId) | ||
.append(businessUnitKey) | ||
.append(replicaCartDraft) | ||
.toHashCode(); | ||
} | ||
|
||
@Override | ||
protected ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePostString copy() { | ||
return new ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePostString(this); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
...AssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicateRequestBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
package com.commercetools.api.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 ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicateRequestBuilder { | ||
|
||
private final ApiHttpClient apiHttpClient; | ||
private final String projectKey; | ||
private final String associateId; | ||
private final String businessUnitKey; | ||
|
||
public ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicateRequestBuilder( | ||
final ApiHttpClient apiHttpClient, final String projectKey, final String associateId, | ||
final String businessUnitKey) { | ||
this.apiHttpClient = apiHttpClient; | ||
this.projectKey = projectKey; | ||
this.associateId = associateId; | ||
this.businessUnitKey = businessUnitKey; | ||
} | ||
|
||
public ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePost post( | ||
com.commercetools.api.models.cart.ReplicaCartDraft replicaCartDraft) { | ||
return new ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePost( | ||
apiHttpClient, projectKey, associateId, businessUnitKey, replicaCartDraft); | ||
} | ||
|
||
public ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePostString post( | ||
final String replicaCartDraft) { | ||
return new ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePostString( | ||
apiHttpClient, projectKey, associateId, businessUnitKey, replicaCartDraft); | ||
} | ||
|
||
public ByProjectKeyAsAssociateByAssociateIdInBusinessUnitKeyByBusinessUnitKeyCartsReplicatePost post( | ||
UnaryOperator<com.commercetools.api.models.cart.ReplicaCartDraftBuilder> op) { | ||
return post(op.apply(com.commercetools.api.models.cart.ReplicaCartDraftBuilder.of()).build()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.