Skip to content

Commit

Permalink
Merge branch 'main' into SUPPORT-28804_add_deserializer_for_import_api
Browse files Browse the repository at this point in the history
  • Loading branch information
lojzatran authored Nov 3, 2024
2 parents 8c7e225 + 19d82fc commit 32cf601
Show file tree
Hide file tree
Showing 75 changed files with 2,033 additions and 161 deletions.
41 changes: 41 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,49 @@
**Api changes**

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

- added type `ApprovalRuleSetCustomFieldAction`
- added type `ApprovalRuleSetCustomTypeAction`
</details>


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

- added property `custom` to type `ApprovalRule`
- added property `source` to type `EventBridgeDestination`
</details>


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

- added enum `approval-rule` to type `CustomFieldReferenceValue`
- added enum `approval-rule` to type `ResourceTypeId`
</details>


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

- added method `apiRoot.withProjectKey().productTailoring().head()`
</details>

**Import changes**

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

- added type `InvalidFieldsUpdateError`
- added type `NewMasterVariantAdditionNotAllowedError`
</details>

**History changes**

<details>
<summary>Required Property(s)</summary>

- changed property `id` of type `ModifiedBy` to be optional
</details>

Original file line number Diff line number Diff line change
Expand Up @@ -778,6 +778,7 @@ type ApprovalRule implements Versioned {
requesters: [RuleRequester!]!
businessUnitRef: KeyReference!
businessUnit: BusinessUnit!
custom: CustomFieldsType
id: String!
version: Long!
createdAt: DateTime!
Expand Down Expand Up @@ -864,6 +865,8 @@ input ApprovalRuleUpdateAction {
setRequesters: SetApprovalRuleRequesters
setStatus: SetApprovalRuleStatus
setApprovers: SetApprovalRuleApprovers
setCustomField: SetApprovalRuleCustomField
setCustomType: SetApprovalRuleCustomType
}

input ApproveApprovalFlow {
Expand Down Expand Up @@ -10532,6 +10535,18 @@ input SetApprovalRuleStatus {
status: ApprovalRuleStatus!
}

input SetApprovalRuleCustomField {
name: String!
value: String
}

input SetApprovalRuleCustomType {
fields: [CustomFieldInput!]
type: ResourceIdentifierInput
typeKey: String
typeId: String
}

input SetAssociateRoleCustomField {
name: String!
value: String
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@

package com.commercetools.api.client;

import java.net.URI;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collection;
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 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>Checks if a ProductTailoring exists for a given Query Predicate. Returns a <code>200 OK</code> status if any ProductTailoring match the Query Predicate or a <code>404 Not Found</code> otherwise.</p>
*
* <hr>
* <div class=code-example>
* <pre><code class='java'>{@code
* CompletableFuture<ApiHttpResponse<com.fasterxml.jackson.databind.JsonNode>> result = apiRoot
* .withProjectKey("{projectKey}")
* .productTailoring()
* .head()
* .execute()
* }</code></pre>
* </div>
*/
@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen")
public class ByProjectKeyProductTailoringHead
extends TypeApiMethod<ByProjectKeyProductTailoringHead, com.fasterxml.jackson.databind.JsonNode>
implements com.commercetools.api.client.ErrorableTrait<ByProjectKeyProductTailoringHead>,
com.commercetools.api.client.Deprecatable200Trait<ByProjectKeyProductTailoringHead> {

@Override
public TypeReference<com.fasterxml.jackson.databind.JsonNode> resultType() {
return new TypeReference<com.fasterxml.jackson.databind.JsonNode>() {
};
}

private String projectKey;

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

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

@Override
protected ApiHttpRequest buildHttpRequest() {
List<String> params = new ArrayList<>(getQueryParamUriStrings());
String httpRequestPath = String.format("%s/product-tailoring", encodePathParam(this.projectKey));
if (!params.isEmpty()) {
httpRequestPath += "?" + String.join("&", params);
}
return new ApiHttpRequest(ApiHttpMethod.HEAD, URI.create(httpRequestPath), getHeaders(), null);
}

@Override
public ApiHttpResponse<com.fasterxml.jackson.databind.JsonNode> executeBlocking(final ApiHttpClient client,
final Duration timeout) {
return executeBlocking(client, timeout, com.fasterxml.jackson.databind.JsonNode.class);
}

@Override
public CompletableFuture<ApiHttpResponse<com.fasterxml.jackson.databind.JsonNode>> execute(
final ApiHttpClient client) {
return execute(client, com.fasterxml.jackson.databind.JsonNode.class);
}

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

public List<String> getWhere() {
return this.getQueryParam("where");
}

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

/**
* set where with the specified value
* @param where value to be set
* @param <TValue> value type
* @return ByProjectKeyProductTailoringHead
*/
public <TValue> ByProjectKeyProductTailoringHead withWhere(final TValue where) {
return copy().withQueryParam("where", where);
}

/**
* add additional where query parameter
* @param where value to be added
* @param <TValue> value type
* @return ByProjectKeyProductTailoringHead
*/
public <TValue> ByProjectKeyProductTailoringHead addWhere(final TValue where) {
return copy().addQueryParam("where", where);
}

/**
* set where with the specified value
* @param supplier supplier for the value to be set
* @return ByProjectKeyProductTailoringHead
*/
public ByProjectKeyProductTailoringHead withWhere(final Supplier<String> supplier) {
return copy().withQueryParam("where", supplier.get());
}

/**
* add additional where query parameter
* @param supplier supplier for the value to be added
* @return ByProjectKeyProductTailoringHead
*/
public ByProjectKeyProductTailoringHead addWhere(final Supplier<String> supplier) {
return copy().addQueryParam("where", supplier.get());
}

/**
* set where with the specified value
* @param op builder for the value to be set
* @return ByProjectKeyProductTailoringHead
*/
public ByProjectKeyProductTailoringHead withWhere(final Function<StringBuilder, StringBuilder> op) {
return copy().withQueryParam("where", op.apply(new StringBuilder()));
}

/**
* add additional where query parameter
* @param op builder for the value to be added
* @return ByProjectKeyProductTailoringHead
*/
public ByProjectKeyProductTailoringHead addWhere(final Function<StringBuilder, StringBuilder> op) {
return copy().addQueryParam("where", op.apply(new StringBuilder()));
}

/**
* set where with the specified values
* @param where values to be set
* @param <TValue> value type
* @return ByProjectKeyProductTailoringHead
*/
public <TValue> ByProjectKeyProductTailoringHead withWhere(final Collection<TValue> where) {
return copy().withoutQueryParam("where")
.addQueryParams(
where.stream().map(s -> new ParamEntry<>("where", s.toString())).collect(Collectors.toList()));
}

/**
* add additional where query parameters
* @param where values to be added
* @param <TValue> value type
* @return ByProjectKeyProductTailoringHead
*/
public <TValue> ByProjectKeyProductTailoringHead addWhere(final Collection<TValue> where) {
return copy().addQueryParams(
where.stream().map(s -> new ParamEntry<>("where", s.toString())).collect(Collectors.toList()));
}

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

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

ByProjectKeyProductTailoringHead that = (ByProjectKeyProductTailoringHead) o;

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

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

@Override
protected ByProjectKeyProductTailoringHead copy() {
return new ByProjectKeyProductTailoringHead(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public ByProjectKeyProductTailoringGet get() {
return new ByProjectKeyProductTailoringGet(apiHttpClient, projectKey);
}

public ByProjectKeyProductTailoringHead head() {
return new ByProjectKeyProductTailoringHead(apiHttpClient, projectKey);
}

public ByProjectKeyProductTailoringPost post(
com.commercetools.api.models.product_tailoring.ProductTailoringDraft productTailoringDraft) {
return new ByProjectKeyProductTailoringPost(apiHttpClient, projectKey, productTailoringDraft);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.commercetools.api.models.common.BaseResource;
import com.commercetools.api.models.common.CreatedBy;
import com.commercetools.api.models.common.LastModifiedBy;
import com.commercetools.api.models.type.CustomFields;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.databind.annotation.*;

Expand Down Expand Up @@ -162,6 +163,14 @@ public interface ApprovalRule extends BaseResource {
@JsonProperty("businessUnit")
public BusinessUnitKeyReference getBusinessUnit();

/**
* <p>Custom Fields on the Approval Rule.</p>
* @return custom
*/
@Valid
@JsonProperty("custom")
public CustomFields getCustom();

/**
* <p>Unique identifier of the Approval Rule.</p>
* @param id value to be set
Expand Down Expand Up @@ -268,6 +277,13 @@ public interface ApprovalRule extends BaseResource {

public void setBusinessUnit(final BusinessUnitKeyReference businessUnit);

/**
* <p>Custom Fields on the Approval Rule.</p>
* @param custom value to be set
*/

public void setCustom(final CustomFields custom);

/**
* factory method
* @return instance of ApprovalRule
Expand Down Expand Up @@ -297,6 +313,7 @@ public static ApprovalRule of(final ApprovalRule template) {
instance.setApprovers(template.getApprovers());
instance.setRequesters(template.getRequesters());
instance.setBusinessUnit(template.getBusinessUnit());
instance.setCustom(template.getCustom());
return instance;
}

Expand Down Expand Up @@ -332,6 +349,7 @@ public static ApprovalRule deepCopy(@Nullable final ApprovalRule template) {
.orElse(null));
instance.setBusinessUnit(
com.commercetools.api.models.business_unit.BusinessUnitKeyReference.deepCopy(template.getBusinessUnit()));
instance.setCustom(com.commercetools.api.models.type.CustomFields.deepCopy(template.getCustom()));
return instance;
}

Expand Down
Loading

0 comments on commit 32cf601

Please sign in to comment.