listRecipes method

Future<ListRecipesResponse> listRecipes({
  1. int? maxResults,
  2. String? nextToken,
  3. RecipeProvider? recipeProvider,
})

Returns a list of available recipes. The response provides the properties for each recipe, including the recipe's Amazon Resource Name (ARN).

May throw InvalidNextTokenException.

Parameter maxResults : The maximum number of recipes to return.

Parameter nextToken : A token returned from the previous call to ListRecipes for getting the next set of recipes (if they exist).

Parameter recipeProvider : The default is SERVICE.

Implementation

Future<ListRecipesResponse> listRecipes({
  int? maxResults,
  String? nextToken,
  RecipeProvider? recipeProvider,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    0,
    1300,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonPersonalize.ListRecipes'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
      if (recipeProvider != null) 'recipeProvider': recipeProvider.toValue(),
    },
  );

  return ListRecipesResponse.fromJson(jsonResponse.body);
}