Skip to content

ListFoods

alex-caroline edited this page Nov 9, 2018 · 5 revisions

All Published Foods

var foodsListResponse = foodQueryServiceClient.ListFoods(new FoodsListRequest());

All Foods

var foodsListRequest = new FoodsListRequest
{
    FilterByPublicationStates = new[] { PublicationState.Draft, PublicationState.Published }
};
var foodsListResponse = foodQueryServiceClient.ListFoods(foodsListRequest);

All Ingredients

var foodsListRequest = new FoodsListRequest
{
    FilterByPublicationStates = new[] { PublicationState.Draft, PublicationState.Published },
    FilterByFoodTypes = new[] {FoodType.Ingredient}
};
var foodsListResponse = foodQueryServiceClient.ListFoods(foodsListRequest);

First 10 Ingredients

var foodsListRequest = new FoodsListRequest
{
    FilterByPublicationStates = new[] { PublicationState.Draft, PublicationState.Published },
    FilterByFoodTypes = new[] {FoodType.Ingredient},
    StartIndex = 1,
    PageSize = 10
};
var foodsListResponse = foodQueryServiceClient.ListFoods(foodsListRequest);

All User Created Ingredients

var foodsListRequest = new FoodsListRequest
{
    FilterByPublicationStates = new[] { PublicationState.Draft, PublicationState.Published },
    FilterByFoodTypes = new[] {FoodType.Ingredient},
    DataSourceFilter = new[] {DataSources.UserFoods}
};
var foodsListResponse = foodQueryServiceClient.ListFoods(foodsListRequest);