Skip to content

Commit 6a9214e

Browse files
throw exception when all query parameter are null
1 parent 88791c7 commit 6a9214e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Source/FikaAmazonAPI/Services/CatalogItemService.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ public IList<Item> ListCatalogItems(ParameterListCatalogItems parameterListCatal
2020
if (string.IsNullOrEmpty(parameterListCatalogItems.MarketplaceId))
2121
throw new InvalidDataException("MarketplaceId is a required property and cannot be null or empty");
2222

23+
if (
24+
string.IsNullOrEmpty(parameterListCatalogItems.Query) &&
25+
string.IsNullOrEmpty(parameterListCatalogItems.SellerSKU) &&
26+
string.IsNullOrEmpty(parameterListCatalogItems.UPC) &&
27+
string.IsNullOrEmpty(parameterListCatalogItems.EAN) &&
28+
string.IsNullOrEmpty(parameterListCatalogItems.ISBN) &&
29+
string.IsNullOrEmpty(parameterListCatalogItems.JAN)
30+
)
31+
throw new InvalidDataException("At least one of Query, SellerSKU, UPC, EAN, ISBN, JAN is also required and cannot be null or empty");
32+
2333
List<Item> list = new List<Item>();
2434

2535
var parameter = parameterListCatalogItems.getParameters();

0 commit comments

Comments
 (0)