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 Apr 15, 2024
1 parent d1f8738 commit cc3c20b
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 4 deletions.
1 change: 1 addition & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

- added property `attributedTo` to type `CreatedBy`
- added property `attributedTo` to type `LastModifiedBy`
- added property `postFilter` to type `ProductSearchRequest`
</details>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ public interface ProductSearchRequest {
@JsonProperty("facets")
public List<ProductSearchFacetExpression> getFacets();

/**
* <p>Specify an additional filter on the result of the <code>query</code> after the API calculated <code>facets</code>. This feature assists you in implementing faceted search.</p>
* @return postFilter
*/
@Valid
@JsonProperty("postFilter")
public SearchQuery getPostFilter();

/**
* <p>The search query against searchable Product fields.</p>
* @param query value to be set
Expand Down Expand Up @@ -153,6 +161,13 @@ public interface ProductSearchRequest {

public void setFacets(final List<ProductSearchFacetExpression> facets);

/**
* <p>Specify an additional filter on the result of the <code>query</code> after the API calculated <code>facets</code>. This feature assists you in implementing faceted search.</p>
* @param postFilter value to be set
*/

public void setPostFilter(final SearchQuery postFilter);

/**
* factory method
* @return instance of ProductSearchRequest
Expand All @@ -175,6 +190,7 @@ public static ProductSearchRequest of(final ProductSearchRequest template) {
instance.setMarkMatchingVariants(template.getMarkMatchingVariants());
instance.setProductProjectionParameters(template.getProductProjectionParameters());
instance.setFacets(template.getFacets());
instance.setPostFilter(template.getPostFilter());
return instance;
}

Expand Down Expand Up @@ -206,6 +222,7 @@ public static ProductSearchRequest deepCopy(@Nullable final ProductSearchRequest
.map(com.commercetools.api.models.product_search.ProductSearchFacetExpression::deepCopy)
.collect(Collectors.toList()))
.orElse(null));
instance.setPostFilter(com.commercetools.api.models.search.SearchQuery.deepCopy(template.getPostFilter()));
return instance;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public class ProductSearchRequestBuilder implements Builder<ProductSearchRequest
@Nullable
private java.util.List<com.commercetools.api.models.product_search.ProductSearchFacetExpression> facets;

@Nullable
private com.commercetools.api.models.search.SearchQuery postFilter;

/**
* <p>The search query against searchable Product fields.</p>
* @param builder function to build the query value
Expand Down Expand Up @@ -334,6 +337,42 @@ public ProductSearchRequestBuilder setFacets(
builder.apply(com.commercetools.api.models.product_search.ProductSearchFacetExpressionBuilder.of()));
}

/**
* <p>Specify an additional filter on the result of the <code>query</code> after the API calculated <code>facets</code>. This feature assists you in implementing faceted search.</p>
* @param builder function to build the postFilter value
* @return Builder
*/

public ProductSearchRequestBuilder postFilter(
Function<com.commercetools.api.models.search.SearchQueryBuilder, com.commercetools.api.models.search.SearchQueryBuilder> builder) {
this.postFilter = builder.apply(com.commercetools.api.models.search.SearchQueryBuilder.of()).build();
return this;
}

/**
* <p>Specify an additional filter on the result of the <code>query</code> after the API calculated <code>facets</code>. This feature assists you in implementing faceted search.</p>
* @param builder function to build the postFilter value
* @return Builder
*/

public ProductSearchRequestBuilder withPostFilter(
Function<com.commercetools.api.models.search.SearchQueryBuilder, com.commercetools.api.models.search.SearchQuery> builder) {
this.postFilter = builder.apply(com.commercetools.api.models.search.SearchQueryBuilder.of());
return this;
}

/**
* <p>Specify an additional filter on the result of the <code>query</code> after the API calculated <code>facets</code>. This feature assists you in implementing faceted search.</p>
* @param postFilter value to be set
* @return Builder
*/

public ProductSearchRequestBuilder postFilter(
@Nullable final com.commercetools.api.models.search.SearchQuery postFilter) {
this.postFilter = postFilter;
return this;
}

/**
* <p>The search query against searchable Product fields.</p>
* @return query
Expand Down Expand Up @@ -404,13 +443,23 @@ public java.util.List<com.commercetools.api.models.product_search.ProductSearchF
return this.facets;
}

/**
* <p>Specify an additional filter on the result of the <code>query</code> after the API calculated <code>facets</code>. This feature assists you in implementing faceted search.</p>
* @return postFilter
*/

@Nullable
public com.commercetools.api.models.search.SearchQuery getPostFilter() {
return this.postFilter;
}

/**
* builds ProductSearchRequest with checking for non-null required values
* @return ProductSearchRequest
*/
public ProductSearchRequest build() {
return new ProductSearchRequestImpl(query, sort, limit, offset, markMatchingVariants,
productProjectionParameters, facets);
productProjectionParameters, facets, postFilter);
}

/**
Expand All @@ -419,7 +468,7 @@ public ProductSearchRequest build() {
*/
public ProductSearchRequest buildUnchecked() {
return new ProductSearchRequestImpl(query, sort, limit, offset, markMatchingVariants,
productProjectionParameters, facets);
productProjectionParameters, facets, postFilter);
}

/**
Expand All @@ -444,6 +493,7 @@ public static ProductSearchRequestBuilder of(final ProductSearchRequest template
builder.markMatchingVariants = template.getMarkMatchingVariants();
builder.productProjectionParameters = template.getProductProjectionParameters();
builder.facets = template.getFacets();
builder.postFilter = template.getPostFilter();
return builder;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class ProductSearchRequestImpl implements ProductSearchRequest, ModelBase

private java.util.List<com.commercetools.api.models.product_search.ProductSearchFacetExpression> facets;

private com.commercetools.api.models.search.SearchQuery postFilter;

/**
* create instance with all properties
*/
Expand All @@ -45,14 +47,16 @@ public class ProductSearchRequestImpl implements ProductSearchRequest, ModelBase
@JsonProperty("limit") final Integer limit, @JsonProperty("offset") final Integer offset,
@JsonProperty("markMatchingVariants") final Boolean markMatchingVariants,
@JsonProperty("productProjectionParameters") final com.commercetools.api.models.product_search.ProductSearchProjectionParams productProjectionParameters,
@JsonProperty("facets") final java.util.List<com.commercetools.api.models.product_search.ProductSearchFacetExpression> facets) {
@JsonProperty("facets") final java.util.List<com.commercetools.api.models.product_search.ProductSearchFacetExpression> facets,
@JsonProperty("postFilter") final com.commercetools.api.models.search.SearchQuery postFilter) {
this.query = query;
this.sort = sort;
this.limit = limit;
this.offset = offset;
this.markMatchingVariants = markMatchingVariants;
this.productProjectionParameters = productProjectionParameters;
this.facets = facets;
this.postFilter = postFilter;
}

/**
Expand Down Expand Up @@ -117,6 +121,14 @@ public java.util.List<com.commercetools.api.models.product_search.ProductSearchF
return this.facets;
}

/**
* <p>Specify an additional filter on the result of the <code>query</code> after the API calculated <code>facets</code>. This feature assists you in implementing faceted search.</p>
*/

public com.commercetools.api.models.search.SearchQuery getPostFilter() {
return this.postFilter;
}

public void setQuery(final com.commercetools.api.models.search.SearchQuery query) {
this.query = query;
}
Expand Down Expand Up @@ -155,6 +167,10 @@ public void setFacets(
this.facets = facets;
}

public void setPostFilter(final com.commercetools.api.models.search.SearchQuery postFilter) {
this.postFilter = postFilter;
}

@Override
public boolean equals(Object o) {
if (this == o)
Expand All @@ -172,13 +188,15 @@ public boolean equals(Object o) {
.append(markMatchingVariants, that.markMatchingVariants)
.append(productProjectionParameters, that.productProjectionParameters)
.append(facets, that.facets)
.append(postFilter, that.postFilter)
.append(query, that.query)
.append(sort, that.sort)
.append(limit, that.limit)
.append(offset, that.offset)
.append(markMatchingVariants, that.markMatchingVariants)
.append(productProjectionParameters, that.productProjectionParameters)
.append(facets, that.facets)
.append(postFilter, that.postFilter)
.isEquals();
}

Expand All @@ -191,6 +209,7 @@ public int hashCode() {
.append(markMatchingVariants)
.append(productProjectionParameters)
.append(facets)
.append(postFilter)
.toHashCode();
}

Expand All @@ -203,6 +222,7 @@ public String toString() {
.append("markMatchingVariants", markMatchingVariants)
.append("productProjectionParameters", productProjectionParameters)
.append("facets", facets)
.append("postFilter", postFilter)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,13 @@ public CollectionPredicateBuilder<ProductSearchRequestQueryBuilderDsl> facets()
p -> new CombinationQueryPredicate<>(p, ProductSearchRequestQueryBuilderDsl::of));
}

public CombinationQueryPredicate<ProductSearchRequestQueryBuilderDsl> postFilter(
Function<com.commercetools.api.predicates.query.search.SearchQueryQueryBuilderDsl, CombinationQueryPredicate<com.commercetools.api.predicates.query.search.SearchQueryQueryBuilderDsl>> fn) {
return new CombinationQueryPredicate<>(
ContainerQueryPredicate.of()
.parent(ConstantQueryPredicate.of().constant("postFilter"))
.inner(fn.apply(com.commercetools.api.predicates.query.search.SearchQueryQueryBuilderDsl.of())),
ProductSearchRequestQueryBuilderDsl::of);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ public static Object[][] objectBuilder() {
new com.commercetools.api.models.product_search.ProductSearchProjectionParamsImpl()) },
new Object[] { ProductSearchRequest.builder()
.facets(Collections.singletonList(
new com.commercetools.api.models.product_search.ProductSearchFacetExpressionImpl())) } };
new com.commercetools.api.models.product_search.ProductSearchFacetExpressionImpl())) },
new Object[] { ProductSearchRequest.builder()
.postFilter(new com.commercetools.api.models.search.SearchQueryImpl()) } };
}

@Test
Expand Down Expand Up @@ -96,4 +98,12 @@ public void facets() {
.isEqualTo(Collections.singletonList(
new com.commercetools.api.models.product_search.ProductSearchFacetExpressionImpl()));
}

@Test
public void postFilter() {
ProductSearchRequest value = ProductSearchRequest.of();
value.setPostFilter(new com.commercetools.api.models.search.SearchQueryImpl());
Assertions.assertThat(value.getPostFilter())
.isEqualTo(new com.commercetools.api.models.search.SearchQueryImpl());
}
}
1 change: 1 addition & 0 deletions references.txt
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,4 @@ a9d748dbcbfc8d2a1cd8d0f8c4e48807e502e79e
22d37e3825d895d44abb4ba0b5e4b8785f7f0968
90f86a472abcdf9adc0c3f0147e3094ec0a7c8ba
c8a374e9c967c7b8c5080c9a6ed2cd92261680ef
cbdd859f3702f084fa22a22d7e4459f7e4b43316

0 comments on commit cc3c20b

Please sign in to comment.