Search in sources :

Example 1 with ListRecipesResult

use of com.amazonaws.services.personalize.model.ListRecipesResult in project knime-cloud by knime.

the class AmazonPersonalizeUtils method listAllRecipes.

/**
 * @param personalize the amazon personalize client
 * @return all recipes
 */
public static List<RecipeSummary> listAllRecipes(final AmazonPersonalize personalize) {
    final ListRecipesRequest request = new ListRecipesRequest().withMaxResults(100);
    ListRecipesResult result = personalize.listRecipes(request);
    List<RecipeSummary> list = result.getRecipes();
    String nextToken;
    while ((nextToken = result.getNextToken()) != null) {
        result = personalize.listRecipes(request.withNextToken(nextToken));
        list.addAll(result.getRecipes());
    }
    return list;
}
Also used : ListRecipesRequest(com.amazonaws.services.personalize.model.ListRecipesRequest) ListRecipesResult(com.amazonaws.services.personalize.model.ListRecipesResult) RecipeSummary(com.amazonaws.services.personalize.model.RecipeSummary)

Aggregations

ListRecipesRequest (com.amazonaws.services.personalize.model.ListRecipesRequest)1 ListRecipesResult (com.amazonaws.services.personalize.model.ListRecipesResult)1 RecipeSummary (com.amazonaws.services.personalize.model.RecipeSummary)1