From 66bfc2c31047f315bedf06eb558eff69037eeabf Mon Sep 17 00:00:00 2001 From: oliver Date: Tue, 25 Jun 2024 10:03:20 +0200 Subject: [PATCH 1/2] Added a modification to the catalog-items 2022 data. Pagination and Refinements must be nullable. --- resources/metadata/modifications.json | 13 ++++++++ .../seller/catalog-items/v2022-04-01.json | 4 +-- .../Responses/ItemSearchResults.php | 32 ++++++++++--------- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/resources/metadata/modifications.json b/resources/metadata/modifications.json index 538fb18c9..843ec22be 100644 --- a/resources/metadata/modifications.json +++ b/resources/metadata/modifications.json @@ -73,6 +73,19 @@ ] } ] + }, + "catalog-items": { + "2022-04-01": [ + { + "comment": "Remove required 'Pagination' and 'Refinements', see https://github.com/jlevers/selling-partner-api/issues/740", + "action": "replace", + "path": "components.schemas.ItemSearchResults.required", + "value": [ + "items", + "numberOfResults" + ] + } + ] } } } diff --git a/resources/models/seller/catalog-items/v2022-04-01.json b/resources/models/seller/catalog-items/v2022-04-01.json index 39902a026..24d8e663c 100644 --- a/resources/models/seller/catalog-items/v2022-04-01.json +++ b/resources/models/seller/catalog-items/v2022-04-01.json @@ -4111,9 +4111,7 @@ "ItemSearchResults": { "required": [ "items", - "numberOfResults", - "pagination", - "refinements" + "numberOfResults" ], "type": "object", "properties": { diff --git a/src/Seller/CatalogItemsV20220401/Responses/ItemSearchResults.php b/src/Seller/CatalogItemsV20220401/Responses/ItemSearchResults.php index f85078410..a25d416b9 100644 --- a/src/Seller/CatalogItemsV20220401/Responses/ItemSearchResults.php +++ b/src/Seller/CatalogItemsV20220401/Responses/ItemSearchResults.php @@ -16,20 +16,22 @@ final class ItemSearchResults extends Response { - protected static array $complexArrayTypes = ['items' => [Item::class]]; + protected static array $complexArrayTypes = ['items' => [Item::class]]; - /** - * @param int $numberOfResults For `identifiers`-based searches, the total number of Amazon catalog items found. For `keywords`-based searches, the estimated total number of Amazon catalog items matched by the search query (only results up to the page count limit will be returned per request regardless of the number found). - * - * Note: The maximum number of items (ASINs) that can be returned and paged through is 1000. - * @param Pagination $pagination When a request produces a response that exceeds the `pageSize`, pagination occurs. This means the response is divided into individual pages. To retrieve the next page or the previous page, you must pass the `nextToken` value or the `previousToken` value as the `pageToken` parameter in the next request. When you receive the last page, there will be no `nextToken` key in the pagination object. - * @param Refinements $refinements Search refinements. - * @param Item[] $items A list of items from the Amazon catalog. - */ - public function __construct( - public readonly int $numberOfResults, - public readonly Pagination $pagination, - public readonly Refinements $refinements, - public readonly array $items, - ) {} + + /** + * @param int $numberOfResults For `identifiers`-based searches, the total number of Amazon catalog items found. For `keywords`-based searches, the estimated total number of Amazon catalog items matched by the search query (only results up to the page count limit will be returned per request regardless of the number found). + * + * Note: The maximum number of items (ASINs) that can be returned and paged through is 1000. + * @param Item[] $items A list of items from the Amazon catalog. + * @param ?Pagination $pagination When a request produces a response that exceeds the `pageSize`, pagination occurs. This means the response is divided into individual pages. To retrieve the next page or the previous page, you must pass the `nextToken` value or the `previousToken` value as the `pageToken` parameter in the next request. When you receive the last page, there will be no `nextToken` key in the pagination object. + * @param ?Refinements $refinements Search refinements. + */ + public function __construct( + public readonly int $numberOfResults, + public readonly array $items, + public readonly ?Pagination $pagination = null, + public readonly ?Refinements $refinements = null, + ) { + } } From 2d5ddd168b482a7e8f228a2964de93aef2d08c14 Mon Sep 17 00:00:00 2001 From: oliver Date: Wed, 26 Jun 2024 09:33:54 +0200 Subject: [PATCH 2/2] Fixed Indents via composer lint --- .../Responses/ItemSearchResults.php | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/Seller/CatalogItemsV20220401/Responses/ItemSearchResults.php b/src/Seller/CatalogItemsV20220401/Responses/ItemSearchResults.php index a25d416b9..feac4053a 100644 --- a/src/Seller/CatalogItemsV20220401/Responses/ItemSearchResults.php +++ b/src/Seller/CatalogItemsV20220401/Responses/ItemSearchResults.php @@ -16,22 +16,20 @@ final class ItemSearchResults extends Response { - protected static array $complexArrayTypes = ['items' => [Item::class]]; + protected static array $complexArrayTypes = ['items' => [Item::class]]; - - /** - * @param int $numberOfResults For `identifiers`-based searches, the total number of Amazon catalog items found. For `keywords`-based searches, the estimated total number of Amazon catalog items matched by the search query (only results up to the page count limit will be returned per request regardless of the number found). - * - * Note: The maximum number of items (ASINs) that can be returned and paged through is 1000. - * @param Item[] $items A list of items from the Amazon catalog. - * @param ?Pagination $pagination When a request produces a response that exceeds the `pageSize`, pagination occurs. This means the response is divided into individual pages. To retrieve the next page or the previous page, you must pass the `nextToken` value or the `previousToken` value as the `pageToken` parameter in the next request. When you receive the last page, there will be no `nextToken` key in the pagination object. - * @param ?Refinements $refinements Search refinements. - */ - public function __construct( - public readonly int $numberOfResults, - public readonly array $items, - public readonly ?Pagination $pagination = null, - public readonly ?Refinements $refinements = null, - ) { - } + /** + * @param int $numberOfResults For `identifiers`-based searches, the total number of Amazon catalog items found. For `keywords`-based searches, the estimated total number of Amazon catalog items matched by the search query (only results up to the page count limit will be returned per request regardless of the number found). + * + * Note: The maximum number of items (ASINs) that can be returned and paged through is 1000. + * @param Item[] $items A list of items from the Amazon catalog. + * @param ?Pagination $pagination When a request produces a response that exceeds the `pageSize`, pagination occurs. This means the response is divided into individual pages. To retrieve the next page or the previous page, you must pass the `nextToken` value or the `previousToken` value as the `pageToken` parameter in the next request. When you receive the last page, there will be no `nextToken` key in the pagination object. + * @param ?Refinements $refinements Search refinements. + */ + public function __construct( + public readonly int $numberOfResults, + public readonly array $items, + public readonly ?Pagination $pagination = null, + public readonly ?Refinements $refinements = null, + ) {} }