getProducts method
Returns a list of all products that match the filter criteria.
May throw AccessDeniedException.
May throw ExpiredNextTokenException.
May throw InternalErrorException.
May throw InvalidNextTokenException.
May throw InvalidParameterException.
May throw NotFoundException.
May throw ThrottlingException.
Parameter serviceCode :
The code for the service whose products you want to retrieve.
Parameter filters :
The list of filters that limit the returned products. only products that
match all filters are returned.
Parameter formatVersion :
The format version that you want the response to be in.
Valid values are: aws_v1
Parameter maxResults :
The maximum number of results to return in the response.
Parameter nextToken :
The pagination token that indicates the next set of results that you want
to retrieve.
Implementation
Future<GetProductsResponse> getProducts({
required String serviceCode,
List<Filter>? filters,
String? formatVersion,
int? maxResults,
String? nextToken,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
100,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSPriceListService.GetProducts'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ServiceCode': serviceCode,
if (filters != null) 'Filters': filters,
if (formatVersion != null) 'FormatVersion': formatVersion,
if (maxResults != null) 'MaxResults': maxResults,
if (nextToken != null) 'NextToken': nextToken,
},
);
return GetProductsResponse.fromJson(jsonResponse.body);
}