validate method

void validate()

Implementation

void validate() {
  var query = this.query;
  if (query.isEmpty) {
    throw FGoogleBooksApiException('Query - Cannot be empty');
  }

  var maxResults = this.maxResults ?? 0;
  if (maxResults > 40) {
    throw FGoogleBooksApiException(
        'MaxResults - Maximum number of results is 40');
  }

  var startIndex = this.startIndex ?? 0;
  if (startIndex < 0) {
    throw FGoogleBooksApiException('StartIndex - Cannot be less than 0');
  }

  var filter = this.filter;
  if (filter != null && !_isValidFilter(filter)) {
    throw FGoogleBooksApiException('Filter - Invalid type');
  }

  var printType = this.printType;
  if (printType != null && !_isValidPrintType(printType)) {
    throw FGoogleBooksApiException('PrintType - Invalid type');
  }
}