diff --git a/changes.md b/changes.md index 873e2c2a21f..dbc7583b3d6 100644 --- a/changes.md +++ b/changes.md @@ -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 @@ -74,6 +75,13 @@ +
+Removed QueryParameter(s) + +- :warning: removed query parameter `withTotal` from method `get /{projectKey}/product-projections/search` +
+ +
Added Type(s) diff --git a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsSearchTest.php b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsSearchTest.php index 1980c42195a..b20d231f58a 100644 --- a/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsSearchTest.php +++ b/lib/commercetools-api-tests/test/unit/Client/Resource/ResourceByProjectKeyProductProjectionsSearchTest.php @@ -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 { @@ -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 { @@ -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 diff --git a/lib/commercetools-api/docs/RequestBuilder.md b/lib/commercetools-api/docs/RequestBuilder.md index 8a01d19f5cc..dc0394aad19 100644 --- a/lib/commercetools-api/docs/RequestBuilder.md +++ b/lib/commercetools-api/docs/RequestBuilder.md @@ -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 @@ -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 diff --git a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsSearchGet.php b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsSearchGet.php index 64231a2ea3f..ba76e80f20c 100644 --- a/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsSearchGet.php +++ b/lib/commercetools-api/src/Client/Resource/ByProjectKeyProductProjectionsSearchGet.php @@ -30,17 +30,14 @@ /** * @psalm-suppress PropertyNotSetInConstructor - * @template-implements Sortable - * @template-implements Paging * @template-implements ProjectionSelecting * @template-implements PriceSelecting * @template-implements LocaleProjecting * @template-implements StoreProjectingTailoring - * @template-implements Expandable * @template-implements Errorable * @template-implements Deprecatable200 */ -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 @@ -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 @@ -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); } /** @@ -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); } /** @@ -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 @@ -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); - } } diff --git a/lib/commercetools-api/src/Models/Common/PagedQueryResponse.php b/lib/commercetools-api/src/Models/Common/PagedQueryResponse.php index 03b8dcf87eb..4129f9d0f2c 100644 --- a/lib/commercetools-api/src/Models/Common/PagedQueryResponse.php +++ b/lib/commercetools-api/src/Models/Common/PagedQueryResponse.php @@ -57,12 +57,17 @@ public function getCount(); public function getTotal(); /** + *

The resources matching the query predicate. + * Each query endpoint returns resources of its specific type.

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

Object containing supplementary information about the results.

+ * * @return null|mixed */ diff --git a/lib/commercetools-api/src/Models/Common/PagedQueryResponseBuilder.php b/lib/commercetools-api/src/Models/Common/PagedQueryResponseBuilder.php index 4d68c061316..01d8bc0baa5 100644 --- a/lib/commercetools-api/src/Models/Common/PagedQueryResponseBuilder.php +++ b/lib/commercetools-api/src/Models/Common/PagedQueryResponseBuilder.php @@ -105,6 +105,9 @@ public function getTotal() } /** + *

The resources matching the query predicate. + * Each query endpoint returns resources of its specific type.

+ * * @return null|BaseResourceCollection */ @@ -114,6 +117,8 @@ public function getResults() } /** + *

Object containing supplementary information about the results.

+ * * @return null|JsonObject */ diff --git a/lib/commercetools-api/src/Models/Common/PagedQueryResponseModel.php b/lib/commercetools-api/src/Models/Common/PagedQueryResponseModel.php index 4628f15cb6a..4f9f1bd7f07 100644 --- a/lib/commercetools-api/src/Models/Common/PagedQueryResponseModel.php +++ b/lib/commercetools-api/src/Models/Common/PagedQueryResponseModel.php @@ -160,6 +160,9 @@ public function getTotal() } /** + *

The resources matching the query predicate. + * Each query endpoint returns resources of its specific type.

+ * * * @return null|BaseResourceCollection */ @@ -178,6 +181,8 @@ public function getResults() } /** + *

Object containing supplementary information about the results.

+ * * * @return null|mixed */ diff --git a/lib/commercetools-api/src/Models/Error/GraphQLInsufficientScopeError.php b/lib/commercetools-api/src/Models/Error/GraphQLInsufficientScopeError.php index 3ff1f284cfa..4a527533463 100644 --- a/lib/commercetools-api/src/Models/Error/GraphQLInsufficientScopeError.php +++ b/lib/commercetools-api/src/Models/Error/GraphQLInsufficientScopeError.php @@ -13,4 +13,9 @@ interface GraphQLInsufficientScopeError extends GraphQLErrorObject { + /** + + * @return null|string + */ + public function getCode(); } diff --git a/lib/commercetools-api/src/Models/Error/GraphQLInsufficientScopeErrorModel.php b/lib/commercetools-api/src/Models/Error/GraphQLInsufficientScopeErrorModel.php index 2037b566432..fa8488b0595 100644 --- a/lib/commercetools-api/src/Models/Error/GraphQLInsufficientScopeErrorModel.php +++ b/lib/commercetools-api/src/Models/Error/GraphQLInsufficientScopeErrorModel.php @@ -37,8 +37,6 @@ public function __construct( } /** - *

One of the error codes that is listed on the Errors page.

- * * * @return null|string */ diff --git a/lib/commercetools-api/src/Models/Error/InsufficientScopeError.php b/lib/commercetools-api/src/Models/Error/InsufficientScopeError.php index fd1f6155839..bf0b0cf95d7 100644 --- a/lib/commercetools-api/src/Models/Error/InsufficientScopeError.php +++ b/lib/commercetools-api/src/Models/Error/InsufficientScopeError.php @@ -13,4 +13,22 @@ interface InsufficientScopeError extends ErrorObject { + /** + + * @return null|string + */ + public function getCode(); + + /** + *

"Insufficient scope. One of the following scopes is missing:"

+ * + + * @return null|string + */ + public function getMessage(); + + /** + * @param ?string $message + */ + public function setMessage(?string $message): void; } diff --git a/lib/commercetools-api/src/Models/Error/InsufficientScopeErrorBuilder.php b/lib/commercetools-api/src/Models/Error/InsufficientScopeErrorBuilder.php index 309c39f7999..9a411395798 100644 --- a/lib/commercetools-api/src/Models/Error/InsufficientScopeErrorBuilder.php +++ b/lib/commercetools-api/src/Models/Error/InsufficientScopeErrorBuilder.php @@ -27,7 +27,7 @@ final class InsufficientScopeErrorBuilder implements Builder private $message; /** - *

Plain text description of the cause of the error.

+ *

"Insufficient scope. One of the following scopes is missing:"

* * @return null|string diff --git a/lib/commercetools-api/src/Models/Error/InsufficientScopeErrorModel.php b/lib/commercetools-api/src/Models/Error/InsufficientScopeErrorModel.php index 0798f5f14bb..b9f7979974f 100644 --- a/lib/commercetools-api/src/Models/Error/InsufficientScopeErrorModel.php +++ b/lib/commercetools-api/src/Models/Error/InsufficientScopeErrorModel.php @@ -45,8 +45,6 @@ public function __construct( } /** - *

Error identifier.

- * * * @return null|string */ @@ -65,7 +63,7 @@ public function getCode() } /** - *

Plain text description of the cause of the error.

+ *

"Insufficient scope. One of the following scopes is missing:"

* * * @return null|string diff --git a/lib/commercetools-api/src/Models/Product/FacetRange.php b/lib/commercetools-api/src/Models/Product/FacetRange.php index a05a61f2de4..ef4b2c8737b 100644 --- a/lib/commercetools-api/src/Models/Product/FacetRange.php +++ b/lib/commercetools-api/src/Models/Product/FacetRange.php @@ -25,60 +25,85 @@ interface FacetRange extends JsonObject public const FIELD_MEAN = 'mean'; /** + *

The range's lower endpoint.

+ *

0 represents -∞.

+ * * @return null|float */ public function getFrom(); /** + *

The range's lower endpoint.

+ *

An empty string represents -∞.

+ * * @return null|string */ public function getFromStr(); /** + *

The range's upper endpoint.

+ *

0 represents +∞.

+ * * @return null|float */ public function getTo(); /** + *

The range's upper endpoint.

+ *

An empty string represents +∞.

+ * * @return null|string */ public function getToStr(); /** + *

Number of ProductVariants for which the values in a field fall into the specified range.

+ * * @return null|int */ public function getCount(); /** + *

Number of Products for which the values in a field fall into the specified range.

+ *

Present only if the counting products extension is enabled.

+ * * @return null|int */ public function getProductCount(); /** + *

Sum of all values contained in the range.

+ * * @return null|float */ public function getTotal(); /** + *

Minimum value within the range.

+ * * @return null|float */ public function getMin(); /** + *

Maximum value within the range.

+ * * @return null|float */ public function getMax(); /** + *

Arithmetic mean of the values within the range.

+ * * @return null|float */ diff --git a/lib/commercetools-api/src/Models/Product/FacetRangeBuilder.php b/lib/commercetools-api/src/Models/Product/FacetRangeBuilder.php index ec9c818a00b..138c866436c 100644 --- a/lib/commercetools-api/src/Models/Product/FacetRangeBuilder.php +++ b/lib/commercetools-api/src/Models/Product/FacetRangeBuilder.php @@ -81,6 +81,9 @@ final class FacetRangeBuilder implements Builder private $mean; /** + *

The range's lower endpoint.

+ *

0 represents -∞.

+ * * @return null|float */ @@ -90,6 +93,9 @@ public function getFrom() } /** + *

The range's lower endpoint.

+ *

An empty string represents -∞.

+ * * @return null|string */ @@ -99,6 +105,9 @@ public function getFromStr() } /** + *

The range's upper endpoint.

+ *

0 represents +∞.

+ * * @return null|float */ @@ -108,6 +117,9 @@ public function getTo() } /** + *

The range's upper endpoint.

+ *

An empty string represents +∞.

+ * * @return null|string */ @@ -117,6 +129,8 @@ public function getToStr() } /** + *

Number of ProductVariants for which the values in a field fall into the specified range.

+ * * @return null|int */ @@ -126,6 +140,9 @@ public function getCount() } /** + *

Number of Products for which the values in a field fall into the specified range.

+ *

Present only if the counting products extension is enabled.

+ * * @return null|int */ @@ -135,6 +152,8 @@ public function getProductCount() } /** + *

Sum of all values contained in the range.

+ * * @return null|float */ @@ -144,6 +163,8 @@ public function getTotal() } /** + *

Minimum value within the range.

+ * * @return null|float */ @@ -153,6 +174,8 @@ public function getMin() } /** + *

Maximum value within the range.

+ * * @return null|float */ @@ -162,6 +185,8 @@ public function getMax() } /** + *

Arithmetic mean of the values within the range.

+ * * @return null|float */ diff --git a/lib/commercetools-api/src/Models/Product/FacetRangeModel.php b/lib/commercetools-api/src/Models/Product/FacetRangeModel.php index b312c795aee..0b33efc9199 100644 --- a/lib/commercetools-api/src/Models/Product/FacetRangeModel.php +++ b/lib/commercetools-api/src/Models/Product/FacetRangeModel.php @@ -108,6 +108,9 @@ public function __construct( } /** + *

The range's lower endpoint.

+ *

0 represents -∞.

+ * * * @return null|float */ @@ -126,6 +129,9 @@ public function getFrom() } /** + *

The range's lower endpoint.

+ *

An empty string represents -∞.

+ * * * @return null|string */ @@ -144,6 +150,9 @@ public function getFromStr() } /** + *

The range's upper endpoint.

+ *

0 represents +∞.

+ * * * @return null|float */ @@ -162,6 +171,9 @@ public function getTo() } /** + *

The range's upper endpoint.

+ *

An empty string represents +∞.

+ * * * @return null|string */ @@ -180,6 +192,8 @@ public function getToStr() } /** + *

Number of ProductVariants for which the values in a field fall into the specified range.

+ * * * @return null|int */ @@ -198,6 +212,9 @@ public function getCount() } /** + *

Number of Products for which the values in a field fall into the specified range.

+ *

Present only if the counting products extension is enabled.

+ * * * @return null|int */ @@ -216,6 +233,8 @@ public function getProductCount() } /** + *

Sum of all values contained in the range.

+ * * * @return null|float */ @@ -234,6 +253,8 @@ public function getTotal() } /** + *

Minimum value within the range.

+ * * * @return null|float */ @@ -252,6 +273,8 @@ public function getMin() } /** + *

Maximum value within the range.

+ * * * @return null|float */ @@ -270,6 +293,8 @@ public function getMax() } /** + *

Arithmetic mean of the values within the range.

+ * * * @return null|float */ diff --git a/lib/commercetools-api/src/Models/Product/FacetTerm.php b/lib/commercetools-api/src/Models/Product/FacetTerm.php index d0607a71605..f1859e84dc1 100644 --- a/lib/commercetools-api/src/Models/Product/FacetTerm.php +++ b/lib/commercetools-api/src/Models/Product/FacetTerm.php @@ -18,18 +18,25 @@ interface FacetTerm extends JsonObject public const FIELD_PRODUCT_COUNT = 'productCount'; /** + *

Value for the field specified in the term facet expression for which at least one ProductVariant could be found.

+ * * @return null|mixed */ public function getTerm(); /** + *

Number of ProductVariants for which the term applies.

+ * * @return null|int */ public function getCount(); /** + *

Number of Products for which the term applies. + * Only available if the counting products extension is enabled.

+ * * @return null|int */ diff --git a/lib/commercetools-api/src/Models/Product/FacetTermBuilder.php b/lib/commercetools-api/src/Models/Product/FacetTermBuilder.php index 18a684c362b..cc464bc63ad 100644 --- a/lib/commercetools-api/src/Models/Product/FacetTermBuilder.php +++ b/lib/commercetools-api/src/Models/Product/FacetTermBuilder.php @@ -39,6 +39,8 @@ final class FacetTermBuilder implements Builder private $productCount; /** + *

Value for the field specified in the term facet expression for which at least one ProductVariant could be found.

+ * * @return null|mixed */ @@ -48,6 +50,8 @@ public function getTerm() } /** + *

Number of ProductVariants for which the term applies.

+ * * @return null|int */ @@ -57,6 +61,9 @@ public function getCount() } /** + *

Number of Products for which the term applies. + * Only available if the counting products extension is enabled.

+ * * @return null|int */ diff --git a/lib/commercetools-api/src/Models/Product/FacetTermModel.php b/lib/commercetools-api/src/Models/Product/FacetTermModel.php index 98380ddc7af..5ca4ef6a954 100644 --- a/lib/commercetools-api/src/Models/Product/FacetTermModel.php +++ b/lib/commercetools-api/src/Models/Product/FacetTermModel.php @@ -52,6 +52,8 @@ public function __construct( } /** + *

Value for the field specified in the term facet expression for which at least one ProductVariant could be found.

+ * * * @return null|mixed */ @@ -70,6 +72,8 @@ public function getTerm() } /** + *

Number of ProductVariants for which the term applies.

+ * * * @return null|int */ @@ -88,6 +92,9 @@ public function getCount() } /** + *

Number of Products for which the term applies. + * Only available if the counting products extension is enabled.

+ * * * @return null|int */ diff --git a/lib/commercetools-api/src/Models/Product/FilteredFacetResult.php b/lib/commercetools-api/src/Models/Product/FilteredFacetResult.php index 0845c885c37..4d8da1113d7 100644 --- a/lib/commercetools-api/src/Models/Product/FilteredFacetResult.php +++ b/lib/commercetools-api/src/Models/Product/FilteredFacetResult.php @@ -17,12 +17,17 @@ interface FilteredFacetResult extends FacetResult public const FIELD_PRODUCT_COUNT = 'productCount'; /** + *

Number of ProductVariants matching the value specified in filtered facet expression.

+ * * @return null|int */ public function getCount(); /** + *

Number of Products matching the value specified in filtered facet expression.

+ *

Present only if the counting products extension is enabled.

+ * * @return null|int */ diff --git a/lib/commercetools-api/src/Models/Product/FilteredFacetResultBuilder.php b/lib/commercetools-api/src/Models/Product/FilteredFacetResultBuilder.php index 32549c27d3a..6842affb01c 100644 --- a/lib/commercetools-api/src/Models/Product/FilteredFacetResultBuilder.php +++ b/lib/commercetools-api/src/Models/Product/FilteredFacetResultBuilder.php @@ -33,6 +33,8 @@ final class FilteredFacetResultBuilder implements Builder private $productCount; /** + *

Number of ProductVariants matching the value specified in filtered facet expression.

+ * * @return null|int */ @@ -42,6 +44,9 @@ public function getCount() } /** + *

Number of Products matching the value specified in filtered facet expression.

+ *

Present only if the counting products extension is enabled.

+ * * @return null|int */ diff --git a/lib/commercetools-api/src/Models/Product/FilteredFacetResultModel.php b/lib/commercetools-api/src/Models/Product/FilteredFacetResultModel.php index 7ed9d8d6bc4..0f0517575ad 100644 --- a/lib/commercetools-api/src/Models/Product/FilteredFacetResultModel.php +++ b/lib/commercetools-api/src/Models/Product/FilteredFacetResultModel.php @@ -71,6 +71,8 @@ public function getType() } /** + *

Number of ProductVariants matching the value specified in filtered facet expression.

+ * * * @return null|int */ @@ -89,6 +91,9 @@ public function getCount() } /** + *

Number of Products matching the value specified in filtered facet expression.

+ *

Present only if the counting products extension is enabled.

+ * * * @return null|int */ diff --git a/lib/commercetools-api/src/Models/Product/ProductProjectionPagedSearchResponse.php b/lib/commercetools-api/src/Models/Product/ProductProjectionPagedSearchResponse.php index e0f30794f99..06a74030a29 100644 --- a/lib/commercetools-api/src/Models/Product/ProductProjectionPagedSearchResponse.php +++ b/lib/commercetools-api/src/Models/Product/ProductProjectionPagedSearchResponse.php @@ -14,14 +14,14 @@ interface ProductProjectionPagedSearchResponse extends JsonObject { public const FIELD_LIMIT = 'limit'; + public const FIELD_OFFSET = 'offset'; public const FIELD_COUNT = 'count'; public const FIELD_TOTAL = 'total'; - public const FIELD_OFFSET = 'offset'; public const FIELD_RESULTS = 'results'; public const FIELD_FACETS = 'facets'; /** - *

Number of results requested.

+ *

The maximum number of results returned on a page.

* * @return null|int @@ -29,32 +29,42 @@ interface ProductProjectionPagedSearchResponse extends JsonObject public function getLimit(); /** + *

The starting point for the retrieved paginated result.

+ * * @return null|int */ - public function getCount(); + public function getOffset(); /** + *

Actual number of results returned.

+ * * @return null|int */ - public function getTotal(); + public function getCount(); /** - *

Number of elements skipped.

+ *

Total number of results matching the query.

* * @return null|int */ - public function getOffset(); + public function getTotal(); /** + *

ProductProjections where at least one ProductVariant matches the search query, provided with the text.{language} and/or filter.query or filter query parameter. + * If the query parameter markMatchingVariants=true was provided with the request, the matching variants are marked as such.

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

Facet results for each facet expression specified in the search request.

+ *

Only present if at least one facet parameter was provided with the search request.

+ * * @return null|FacetResults */ @@ -65,6 +75,11 @@ public function getFacets(); */ public function setLimit(?int $limit): void; + /** + * @param ?int $offset + */ + public function setOffset(?int $offset): void; + /** * @param ?int $count */ @@ -75,11 +90,6 @@ public function setCount(?int $count): void; */ public function setTotal(?int $total): void; - /** - * @param ?int $offset - */ - public function setOffset(?int $offset): void; - /** * @param ?ProductProjectionCollection $results */ diff --git a/lib/commercetools-api/src/Models/Product/ProductProjectionPagedSearchResponseBuilder.php b/lib/commercetools-api/src/Models/Product/ProductProjectionPagedSearchResponseBuilder.php index 3b4f9956762..97d0610193e 100644 --- a/lib/commercetools-api/src/Models/Product/ProductProjectionPagedSearchResponseBuilder.php +++ b/lib/commercetools-api/src/Models/Product/ProductProjectionPagedSearchResponseBuilder.php @@ -30,19 +30,19 @@ final class ProductProjectionPagedSearchResponseBuilder implements Builder * @var ?int */ - private $count; + private $offset; /** * @var ?int */ - private $total; + private $count; /** * @var ?int */ - private $offset; + private $total; /** @@ -57,7 +57,7 @@ final class ProductProjectionPagedSearchResponseBuilder implements Builder private $facets; /** - *

Number of results requested.

+ *

The maximum number of results returned on a page.

* * @return null|int @@ -68,35 +68,42 @@ public function getLimit() } /** + *

The starting point for the retrieved paginated result.

+ * * @return null|int */ - public function getCount() + public function getOffset() { - return $this->count; + return $this->offset; } /** + *

Actual number of results returned.

+ * * @return null|int */ - public function getTotal() + public function getCount() { - return $this->total; + return $this->count; } /** - *

Number of elements skipped.

+ *

Total number of results matching the query.

* * @return null|int */ - public function getOffset() + public function getTotal() { - return $this->offset; + return $this->total; } /** + *

ProductProjections where at least one ProductVariant matches the search query, provided with the text.{language} and/or filter.query or filter query parameter. + * If the query parameter markMatchingVariants=true was provided with the request, the matching variants are marked as such.

+ * * @return null|ProductProjectionCollection */ @@ -106,6 +113,9 @@ public function getResults() } /** + *

Facet results for each facet expression specified in the search request.

+ *

Only present if at least one facet parameter was provided with the search request.

+ * * @return null|FacetResults */ @@ -126,34 +136,34 @@ public function withLimit(?int $limit) } /** - * @param ?int $count + * @param ?int $offset * @return $this */ - public function withCount(?int $count) + public function withOffset(?int $offset) { - $this->count = $count; + $this->offset = $offset; return $this; } /** - * @param ?int $total + * @param ?int $count * @return $this */ - public function withTotal(?int $total) + public function withCount(?int $count) { - $this->total = $total; + $this->count = $count; return $this; } /** - * @param ?int $offset + * @param ?int $total * @return $this */ - public function withOffset(?int $offset) + public function withTotal(?int $total) { - $this->offset = $offset; + $this->total = $total; return $this; } @@ -195,9 +205,9 @@ public function build(): ProductProjectionPagedSearchResponse { return new ProductProjectionPagedSearchResponseModel( $this->limit, + $this->offset, $this->count, $this->total, - $this->offset, $this->results, $this->facets instanceof FacetResultsBuilder ? $this->facets->build() : $this->facets ); diff --git a/lib/commercetools-api/src/Models/Product/ProductProjectionPagedSearchResponseModel.php b/lib/commercetools-api/src/Models/Product/ProductProjectionPagedSearchResponseModel.php index c442ca98038..ab47f184e2d 100644 --- a/lib/commercetools-api/src/Models/Product/ProductProjectionPagedSearchResponseModel.php +++ b/lib/commercetools-api/src/Models/Product/ProductProjectionPagedSearchResponseModel.php @@ -29,19 +29,19 @@ final class ProductProjectionPagedSearchResponseModel extends JsonObjectModel im * * @var ?int */ - protected $count; + protected $offset; /** * * @var ?int */ - protected $total; + protected $count; /** * * @var ?int */ - protected $offset; + protected $total; /** * @@ -61,22 +61,22 @@ final class ProductProjectionPagedSearchResponseModel extends JsonObjectModel im */ public function __construct( ?int $limit = null, + ?int $offset = null, ?int $count = null, ?int $total = null, - ?int $offset = null, ?ProductProjectionCollection $results = null, ?FacetResults $facets = null ) { $this->limit = $limit; + $this->offset = $offset; $this->count = $count; $this->total = $total; - $this->offset = $offset; $this->results = $results; $this->facets = $facets; } /** - *

Number of results requested.

+ *

The maximum number of results returned on a page.

* * * @return null|int @@ -96,62 +96,69 @@ public function getLimit() } /** + *

The starting point for the retrieved paginated result.

+ * * * @return null|int */ - public function getCount() + public function getOffset() { - if (is_null($this->count)) { + if (is_null($this->offset)) { /** @psalm-var ?int $data */ - $data = $this->raw(self::FIELD_COUNT); + $data = $this->raw(self::FIELD_OFFSET); if (is_null($data)) { return null; } - $this->count = (int) $data; + $this->offset = (int) $data; } - return $this->count; + return $this->offset; } /** + *

Actual number of results returned.

+ * * * @return null|int */ - public function getTotal() + public function getCount() { - if (is_null($this->total)) { + if (is_null($this->count)) { /** @psalm-var ?int $data */ - $data = $this->raw(self::FIELD_TOTAL); + $data = $this->raw(self::FIELD_COUNT); if (is_null($data)) { return null; } - $this->total = (int) $data; + $this->count = (int) $data; } - return $this->total; + return $this->count; } /** - *

Number of elements skipped.

+ *

Total number of results matching the query.

* * * @return null|int */ - public function getOffset() + public function getTotal() { - if (is_null($this->offset)) { + if (is_null($this->total)) { /** @psalm-var ?int $data */ - $data = $this->raw(self::FIELD_OFFSET); + $data = $this->raw(self::FIELD_TOTAL); if (is_null($data)) { return null; } - $this->offset = (int) $data; + $this->total = (int) $data; } - return $this->offset; + return $this->total; } /** + *

ProductProjections where at least one ProductVariant matches the search query, provided with the text.{language} and/or filter.query or filter query parameter. + * If the query parameter markMatchingVariants=true was provided with the request, the matching variants are marked as such.

+ * * * @return null|ProductProjectionCollection */ @@ -170,6 +177,9 @@ public function getResults() } /** + *

Facet results for each facet expression specified in the search request.

+ *

Only present if at least one facet parameter was provided with the search request.

+ * * * @return null|FacetResults */ @@ -197,6 +207,14 @@ public function setLimit(?int $limit): void $this->limit = $limit; } + /** + * @param ?int $offset + */ + public function setOffset(?int $offset): void + { + $this->offset = $offset; + } + /** * @param ?int $count */ @@ -213,14 +231,6 @@ public function setTotal(?int $total): void $this->total = $total; } - /** - * @param ?int $offset - */ - public function setOffset(?int $offset): void - { - $this->offset = $offset; - } - /** * @param ?ProductProjectionCollection $results */ diff --git a/lib/commercetools-api/src/Models/Product/RangeFacetResult.php b/lib/commercetools-api/src/Models/Product/RangeFacetResult.php index f407844c0e0..b437c69b2a6 100644 --- a/lib/commercetools-api/src/Models/Product/RangeFacetResult.php +++ b/lib/commercetools-api/src/Models/Product/RangeFacetResult.php @@ -16,6 +16,8 @@ interface RangeFacetResult extends FacetResult public const FIELD_RANGES = 'ranges'; /** + *

Statistical data over values for date, time, datetime, number, and money type fields.

+ * * @return null|FacetRangeCollection */ diff --git a/lib/commercetools-api/src/Models/Product/RangeFacetResultBuilder.php b/lib/commercetools-api/src/Models/Product/RangeFacetResultBuilder.php index af97b637a48..d23ef2f08f9 100644 --- a/lib/commercetools-api/src/Models/Product/RangeFacetResultBuilder.php +++ b/lib/commercetools-api/src/Models/Product/RangeFacetResultBuilder.php @@ -27,6 +27,8 @@ final class RangeFacetResultBuilder implements Builder private $ranges; /** + *

Statistical data over values for date, time, datetime, number, and money type fields.

+ * * @return null|FacetRangeCollection */ diff --git a/lib/commercetools-api/src/Models/Product/RangeFacetResultModel.php b/lib/commercetools-api/src/Models/Product/RangeFacetResultModel.php index e5aa7023fee..eb4a0ab6f1a 100644 --- a/lib/commercetools-api/src/Models/Product/RangeFacetResultModel.php +++ b/lib/commercetools-api/src/Models/Product/RangeFacetResultModel.php @@ -63,6 +63,8 @@ public function getType() } /** + *

Statistical data over values for date, time, datetime, number, and money type fields.

+ * * * @return null|FacetRangeCollection */ diff --git a/lib/commercetools-api/src/Models/Product/TermFacetResult.php b/lib/commercetools-api/src/Models/Product/TermFacetResult.php index 519f20f77cb..8c375f25f9f 100644 --- a/lib/commercetools-api/src/Models/Product/TermFacetResult.php +++ b/lib/commercetools-api/src/Models/Product/TermFacetResult.php @@ -20,30 +20,46 @@ interface TermFacetResult extends FacetResult public const FIELD_TERMS = 'terms'; /** + *

Data type to which the facet is applied.

+ * * @return null|string */ public function getDataType(); /** + *

Number of ProductVariants that have no value for the specified term facet expression.

+ * * @return null|int */ public function getMissing(); /** + *

Number of terms matching the term facet expression.

+ *
    + *
  • If the expression refers to Product fields like categories.id and reviewRatingStatistics.count, the value represents the number of Products.
  • + *
  • If the expression is defined for fields specific to Product Variants, for example, variants.attributes.{name}, the value represents the number of Product Variants matching the expression.
  • + *
+ * * @return null|int */ public function getTotal(); /** + *

Number of terms not represented in this object (such as the number of terms beyond the limit).

+ * * @return null|int */ public function getOther(); /** + *

Values for the field specified in term facet expression for which at least one ProductVariant could be found.

+ *

By default, facet terms are returned in a descending order of their count.

+ *

If the term facet expression specifies to count Products through the counting products extension, then facet terms are returned in a descending order of their productCount.

+ * * @return null|FacetTermCollection */ diff --git a/lib/commercetools-api/src/Models/Product/TermFacetResultBuilder.php b/lib/commercetools-api/src/Models/Product/TermFacetResultBuilder.php index da9e35ed0f2..8b3b0d362f9 100644 --- a/lib/commercetools-api/src/Models/Product/TermFacetResultBuilder.php +++ b/lib/commercetools-api/src/Models/Product/TermFacetResultBuilder.php @@ -51,6 +51,8 @@ final class TermFacetResultBuilder implements Builder private $terms; /** + *

Data type to which the facet is applied.

+ * * @return null|string */ @@ -60,6 +62,8 @@ public function getDataType() } /** + *

Number of ProductVariants that have no value for the specified term facet expression.

+ * * @return null|int */ @@ -69,6 +73,12 @@ public function getMissing() } /** + *

Number of terms matching the term facet expression.

+ *
    + *
  • If the expression refers to Product fields like categories.id and reviewRatingStatistics.count, the value represents the number of Products.
  • + *
  • If the expression is defined for fields specific to Product Variants, for example, variants.attributes.{name}, the value represents the number of Product Variants matching the expression.
  • + *
+ * * @return null|int */ @@ -78,6 +88,8 @@ public function getTotal() } /** + *

Number of terms not represented in this object (such as the number of terms beyond the limit).

+ * * @return null|int */ @@ -87,6 +99,10 @@ public function getOther() } /** + *

Values for the field specified in term facet expression for which at least one ProductVariant could be found.

+ *

By default, facet terms are returned in a descending order of their count.

+ *

If the term facet expression specifies to count Products through the counting products extension, then facet terms are returned in a descending order of their productCount.

+ * * @return null|FacetTermCollection */ diff --git a/lib/commercetools-api/src/Models/Product/TermFacetResultModel.php b/lib/commercetools-api/src/Models/Product/TermFacetResultModel.php index b6513162320..87ccd4fcc94 100644 --- a/lib/commercetools-api/src/Models/Product/TermFacetResultModel.php +++ b/lib/commercetools-api/src/Models/Product/TermFacetResultModel.php @@ -95,6 +95,8 @@ public function getType() } /** + *

Data type to which the facet is applied.

+ * * * @return null|string */ @@ -113,6 +115,8 @@ public function getDataType() } /** + *

Number of ProductVariants that have no value for the specified term facet expression.

+ * * * @return null|int */ @@ -131,6 +135,12 @@ public function getMissing() } /** + *

Number of terms matching the term facet expression.

+ *
    + *
  • If the expression refers to Product fields like categories.id and reviewRatingStatistics.count, the value represents the number of Products.
  • + *
  • If the expression is defined for fields specific to Product Variants, for example, variants.attributes.{name}, the value represents the number of Product Variants matching the expression.
  • + *
+ * * * @return null|int */ @@ -149,6 +159,8 @@ public function getTotal() } /** + *

Number of terms not represented in this object (such as the number of terms beyond the limit).

+ * * * @return null|int */ @@ -167,6 +179,10 @@ public function getOther() } /** + *

Values for the field specified in term facet expression for which at least one ProductVariant could be found.

+ *

By default, facet terms are returned in a descending order of their count.

+ *

If the term facet expression specifies to count Products through the counting products extension, then facet terms are returned in a descending order of their productCount.

+ * * * @return null|FacetTermCollection */ diff --git a/references.txt b/references.txt index b288b1dacf3..3f3a2ceb7d8 100644 --- a/references.txt +++ b/references.txt @@ -387,3 +387,4 @@ a33feaab360e352573f683dd36889c80735e3900 06a819cad13593c767f3b5dfcb7eddb81b93f2a7 6082ac4e80a66d271c68785c32ea07853e8211ef 00b9b10ab0fb8d96f289094775fe082b48068a5e +4055fc15c037521387c7c7687cfceee73527f55f