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
8 changes: 8 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

- :warning: changed property `triggerPattern` of type `CartDiscountPatternTarget` to be required
- changed property `images` of type `ProductTailoringSetExternalImagesAction` to be optional
- changed property `facets` of type `ProductProjectionPagedSearchResponse` to be optional
</details>


Expand Down Expand Up @@ -74,6 +75,13 @@
</details>


<details>
<summary>Removed QueryParameter(s)</summary>

- :warning: removed query parameter `withTotal` from method `get /{projectKey}/product-projections/search`
</details>


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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,77 +102,77 @@ function (ApiRequestBuilder $builder): RequestInterface {
'post',
'test_projectKey/product-projections/search',
],
'ByProjectKeyProductProjectionsSearchGet_withFuzzy' => [
'ByProjectKeyProductProjectionsSearchGet_withMarkMatchingVariants' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey('test_projectKey')
->productProjections()
->search()
->get()
->withFuzzy('fuzzy');
->withMarkMatchingVariants('markMatchingVariants');
},
'get',
'test_projectKey/product-projections/search?fuzzy=fuzzy',
'test_projectKey/product-projections/search?markMatchingVariants=markMatchingVariants',
],
'ByProjectKeyProductProjectionsSearchGet_withFuzzyLevel' => [
'ByProjectKeyProductProjectionsSearchGet_withText' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey('test_projectKey')
->productProjections()
->search()
->get()
->withFuzzyLevel('fuzzyLevel');
->withText('locale', 'text.locale');
},
'get',
'test_projectKey/product-projections/search?fuzzyLevel=fuzzyLevel',
'test_projectKey/product-projections/search?text.locale=text.locale',
],
'ByProjectKeyProductProjectionsSearchGet_withMarkMatchingVariants' => [
'ByProjectKeyProductProjectionsSearchGet_withFuzzy' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey('test_projectKey')
->productProjections()
->search()
->get()
->withMarkMatchingVariants('markMatchingVariants');
->withFuzzy('fuzzy');
},
'get',
'test_projectKey/product-projections/search?markMatchingVariants=markMatchingVariants',
'test_projectKey/product-projections/search?fuzzy=fuzzy',
],
'ByProjectKeyProductProjectionsSearchGet_withFilter' => [
'ByProjectKeyProductProjectionsSearchGet_withFuzzyLevel' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey('test_projectKey')
->productProjections()
->search()
->get()
->withFilter('filter');
->withFuzzyLevel('fuzzyLevel');
},
'get',
'test_projectKey/product-projections/search?filter=filter',
'test_projectKey/product-projections/search?fuzzyLevel=fuzzyLevel',
],
'ByProjectKeyProductProjectionsSearchGet_withFilterFacets' => [
'ByProjectKeyProductProjectionsSearchGet_withFilterQuery' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey('test_projectKey')
->productProjections()
->search()
->get()
->withFilterFacets('filter.facets');
->withFilterQuery('filter.query');
},
'get',
'test_projectKey/product-projections/search?filter.facets=filter.facets',
'test_projectKey/product-projections/search?filter.query=filter.query',
],
'ByProjectKeyProductProjectionsSearchGet_withFilterQuery' => [
'ByProjectKeyProductProjectionsSearchGet_withFilter' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey('test_projectKey')
->productProjections()
->search()
->get()
->withFilterQuery('filter.query');
->withFilter('filter');
},
'get',
'test_projectKey/product-projections/search?filter.query=filter.query',
'test_projectKey/product-projections/search?filter=filter',
],
'ByProjectKeyProductProjectionsSearchGet_withFacet' => [
function (ApiRequestBuilder $builder): RequestInterface {
Expand All @@ -186,65 +186,65 @@ function (ApiRequestBuilder $builder): RequestInterface {
'get',
'test_projectKey/product-projections/search?facet=facet',
],
'ByProjectKeyProductProjectionsSearchGet_withText' => [
'ByProjectKeyProductProjectionsSearchGet_withFilterFacets' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey('test_projectKey')
->productProjections()
->search()
->get()
->withText('locale', 'text.locale');
->withFilterFacets('filter.facets');
},
'get',
'test_projectKey/product-projections/search?text.locale=text.locale',
'test_projectKey/product-projections/search?filter.facets=filter.facets',
],
'ByProjectKeyProductProjectionsSearchGet_withSort' => [
'ByProjectKeyProductProjectionsSearchGet_withExpand' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey('test_projectKey')
->productProjections()
->search()
->get()
->withSort('sort');
->withExpand('expand');
},
'get',
'test_projectKey/product-projections/search?sort=sort',
'test_projectKey/product-projections/search?expand=expand',
],
'ByProjectKeyProductProjectionsSearchGet_withLimit' => [
'ByProjectKeyProductProjectionsSearchGet_withSort' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey('test_projectKey')
->productProjections()
->search()
->get()
->withLimit('limit');
->withSort('sort');
},
'get',
'test_projectKey/product-projections/search?limit=limit',
'test_projectKey/product-projections/search?sort=sort',
],
'ByProjectKeyProductProjectionsSearchGet_withOffset' => [
'ByProjectKeyProductProjectionsSearchGet_withLimit' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey('test_projectKey')
->productProjections()
->search()
->get()
->withOffset('offset');
->withLimit('limit');
},
'get',
'test_projectKey/product-projections/search?offset=offset',
'test_projectKey/product-projections/search?limit=limit',
],
'ByProjectKeyProductProjectionsSearchGet_withWithTotal' => [
'ByProjectKeyProductProjectionsSearchGet_withOffset' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey('test_projectKey')
->productProjections()
->search()
->get()
->withWithTotal('withTotal');
->withOffset('offset');
},
'get',
'test_projectKey/product-projections/search?withTotal=withTotal',
'test_projectKey/product-projections/search?offset=offset',
],
'ByProjectKeyProductProjectionsSearchGet_withStaged' => [
function (ApiRequestBuilder $builder): RequestInterface {
Expand Down Expand Up @@ -342,18 +342,6 @@ function (ApiRequestBuilder $builder): RequestInterface {
'get',
'test_projectKey/product-projections/search?storeProjection=storeProjection',
],
'ByProjectKeyProductProjectionsSearchGet_withExpand' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
->withProjectKey('test_projectKey')
->productProjections()
->search()
->get()
->withExpand('expand');
},
'get',
'test_projectKey/product-projections/search?expand=expand',
],
'ByProjectKeyProductProjectionsSearchGet' => [
function (ApiRequestBuilder $builder): RequestInterface {
return $builder
Expand Down
10 changes: 8 additions & 2 deletions lib/commercetools-api/docs/RequestBuilder.md
Original file line number Diff line number Diff line change
Expand Up @@ -9134,7 +9134,9 @@ $request = $builder
```
## `withProjectKey("projectKey")->productProjections()->search()->post(null)`

Product Projection Search
For implementing funnel search on Product Listing Pages where users select multiple filters, use this POST method.
To avoid URL length restrictions, this method passes the same query parameters as defined in the [GET](ctp:api:endpoint:/{projectKey}/product-projections/search:GET) method, within the request body in URL-encoded format.


### Example
```php
Expand All @@ -9149,7 +9151,11 @@ $request = $builder
```
## `withProjectKey("projectKey")->productProjections()->search()->get()`

Product Projection Search
This method appends query parameters to the URL.
The maximum allowed URL length is 8192 characters.
Exceeding this limit will result in URL truncation, potentially leading to unexpected results.
For funnel searches on Product Listing Pages, where users select multiple filters, we recommend the [POST](ctp:api:endpoint:/{projectKey}/product-projections/search:POST) method which passes the query parameters within the request body, avoiding URL length restrictions.


### Example
```php
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,14 @@
/**

* @psalm-suppress PropertyNotSetInConstructor
* @template-implements Sortable<ByProjectKeyProductProjectionsSearchGet>
* @template-implements Paging<ByProjectKeyProductProjectionsSearchGet>
* @template-implements ProjectionSelecting<ByProjectKeyProductProjectionsSearchGet>
* @template-implements PriceSelecting<ByProjectKeyProductProjectionsSearchGet>
* @template-implements LocaleProjecting<ByProjectKeyProductProjectionsSearchGet>
* @template-implements StoreProjectingTailoring<ByProjectKeyProductProjectionsSearchGet>
* @template-implements Expandable<ByProjectKeyProductProjectionsSearchGet>
* @template-implements Errorable<ByProjectKeyProductProjectionsSearchGet>
* @template-implements Deprecatable200<ByProjectKeyProductProjectionsSearchGet>
*/
class ByProjectKeyProductProjectionsSearchGet extends ApiRequest implements Sortable, Paging, ProjectionSelecting, PriceSelecting, LocaleProjecting, StoreProjectingTailoring, Expandable, Errorable, Deprecatable200
class ByProjectKeyProductProjectionsSearchGet extends ApiRequest implements ProjectionSelecting, PriceSelecting, LocaleProjecting, StoreProjectingTailoring, Errorable, Deprecatable200
{
/**
* @param ?object|array|string $body
Expand Down Expand Up @@ -150,6 +147,24 @@ function (RequestException $e) use ($resultType) {
);
}

/**
*
* @psalm-param scalar|scalar[] $markMatchingVariants
*/
public function withMarkMatchingVariants($markMatchingVariants): ByProjectKeyProductProjectionsSearchGet
{
return $this->withQueryParam('markMatchingVariants', $markMatchingVariants);
}

/**
* @psalm-param string $locale
* @psalm-param scalar|scalar[] $text
*/
public function withText(string $locale, $text): ByProjectKeyProductProjectionsSearchGet
{
return $this->withQueryParam(sprintf('text.%s', $locale), $text);
}

/**
*
* @psalm-param scalar|scalar[] $fuzzy
Expand All @@ -170,11 +185,11 @@ public function withFuzzyLevel($fuzzyLevel): ByProjectKeyProductProjectionsSearc

/**
*
* @psalm-param scalar|scalar[] $markMatchingVariants
* @psalm-param scalar|scalar[] $filterQuery
*/
public function withMarkMatchingVariants($markMatchingVariants): ByProjectKeyProductProjectionsSearchGet
public function withFilterQuery($filterQuery): ByProjectKeyProductProjectionsSearchGet
{
return $this->withQueryParam('markMatchingVariants', $markMatchingVariants);
return $this->withQueryParam('filter.query', $filterQuery);
}

/**
Expand All @@ -188,38 +203,29 @@ public function withFilter($filter): ByProjectKeyProductProjectionsSearchGet

/**
*
* @psalm-param scalar|scalar[] $filterFacets
* @psalm-param scalar|scalar[] $facet
*/
public function withFilterFacets($filterFacets): ByProjectKeyProductProjectionsSearchGet
public function withFacet($facet): ByProjectKeyProductProjectionsSearchGet
{
return $this->withQueryParam('filter.facets', $filterFacets);
return $this->withQueryParam('facet', $facet);
}

/**
*
* @psalm-param scalar|scalar[] $filterQuery
* @psalm-param scalar|scalar[] $filterFacets
*/
public function withFilterQuery($filterQuery): ByProjectKeyProductProjectionsSearchGet
public function withFilterFacets($filterFacets): ByProjectKeyProductProjectionsSearchGet
{
return $this->withQueryParam('filter.query', $filterQuery);
return $this->withQueryParam('filter.facets', $filterFacets);
}

/**
*
* @psalm-param scalar|scalar[] $facet
*/
public function withFacet($facet): ByProjectKeyProductProjectionsSearchGet
{
return $this->withQueryParam('facet', $facet);
}

/**
* @psalm-param string $locale
* @psalm-param scalar|scalar[] $text
* @psalm-param scalar|scalar[] $expand
*/
public function withText(string $locale, $text): ByProjectKeyProductProjectionsSearchGet
public function withExpand($expand): ByProjectKeyProductProjectionsSearchGet
{
return $this->withQueryParam(sprintf('text.%s', $locale), $text);
return $this->withQueryParam('expand', $expand);
}

/**
Expand Down Expand Up @@ -249,15 +255,6 @@ public function withOffset($offset): ByProjectKeyProductProjectionsSearchGet
return $this->withQueryParam('offset', $offset);
}

/**
*
* @psalm-param scalar|scalar[] $withTotal
*/
public function withWithTotal($withTotal): ByProjectKeyProductProjectionsSearchGet
{
return $this->withQueryParam('withTotal', $withTotal);
}

/**
*
* @psalm-param scalar|scalar[] $staged
Expand Down Expand Up @@ -329,13 +326,4 @@ public function withStoreProjection($storeProjection): ByProjectKeyProductProjec
{
return $this->withQueryParam('storeProjection', $storeProjection);
}

/**
*
* @psalm-param scalar|scalar[] $expand
*/
public function withExpand($expand): ByProjectKeyProductProjectionsSearchGet
{
return $this->withQueryParam('expand', $expand);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,17 @@ public function getCount();
public function getTotal();

/**
* <p>The resources matching the query predicate.
* Each query endpoint returns resources of its specific type.</p>
*

* @return null|BaseResourceCollection
*/
public function getResults();

/**
* <p>Object containing supplementary information about the results.</p>
*

* @return null|mixed
*/
Expand Down
Loading