/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (Pagination == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Pagination"); } if (Refinements == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Refinements"); } if (Items == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Items"); } if (Refinements != null) { Refinements.Validate(); } if (Items != null) { foreach (var element in Items) { if (element != null) { element.Validate(); } } } }
/// <summary> /// Initializes a new instance of the ItemSearchResults class. /// </summary> /// <param name="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> /// <param name="pagination">If available, the `nextToken` and/or /// `previousToken` values required to return paginated /// results.</param> /// <param name="refinements">Search refinements for `keywords`-based /// searches.</param> /// <param name="items">A list of items from the Amazon /// catalog.</param> public ItemSearchResults(int numberOfResults, Pagination pagination, Refinements refinements, IList <Item> items) { NumberOfResults = numberOfResults; Pagination = pagination; Refinements = refinements; Items = items; CustomInit(); }