searchProducts method

Future<SearchProductsOutput> searchProducts({
  1. String? acceptLanguage,
  2. Map<ProductViewFilterBy, List<String>>? filters,
  3. int? pageSize,
  4. String? pageToken,
  5. ProductViewSortBy? sortBy,
  6. SortOrder? sortOrder,
})

Gets information about the products to which the caller has access.

May throw InvalidParametersException.

Parameter acceptLanguage : The language code.

  • en - English (default)
  • jp - Japanese
  • zh - Chinese

Parameter filters : The search filters. If no search filters are specified, the output includes all products to which the caller has access.

Parameter pageSize : The maximum number of items to return with this call.

Parameter pageToken : The page token for the next set of results. To retrieve the first set of results, use null.

Parameter sortBy : The sort field. If no value is specified, the results are not sorted.

Parameter sortOrder : The sort order. If no value is specified, the results are not sorted.

Implementation

Future<SearchProductsOutput> searchProducts({
  String? acceptLanguage,
  Map<ProductViewFilterBy, List<String>>? filters,
  int? pageSize,
  String? pageToken,
  ProductViewSortBy? sortBy,
  SortOrder? sortOrder,
}) async {
  _s.validateStringLength(
    'acceptLanguage',
    acceptLanguage,
    0,
    100,
  );
  _s.validateNumRange(
    'pageSize',
    pageSize,
    0,
    20,
  );
  _s.validateStringLength(
    'pageToken',
    pageToken,
    0,
    2024,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWS242ServiceCatalogService.SearchProducts'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (acceptLanguage != null) 'AcceptLanguage': acceptLanguage,
      if (filters != null)
        'Filters': filters.map((k, e) => MapEntry(k.toValue(), e)),
      if (pageSize != null) 'PageSize': pageSize,
      if (pageToken != null) 'PageToken': pageToken,
      if (sortBy != null) 'SortBy': sortBy.toValue(),
      if (sortOrder != null) 'SortOrder': sortOrder.toValue(),
    },
  );

  return SearchProductsOutput.fromJson(jsonResponse.body);
}