Skip to content

carolynvs/nutritionix

Repository files navigation

Nutritionix Client Library for .NET

===========

This is a .NET client for the Nutritionix API. It is also available as a NuGet package.

Nutritionix NuGet Package
Nutritionix.Sample NuGet Package

Use

using Nutritionix;

namespace MyApp
{
    public class FooBar
    {
        private const string myApiId = "xxx";
        private const string myApiKey = "abc123";

        public NutritionixSearchResult[] Search(string query)
        {
            var nutritionix = new NutritionixClient();
            nutritionix.Initialize(myApiId, myApiKey);

            var request = new NutritionixSearchRequest { Query = query };
            NutritionixSearchResponse response = nutritionix.SearchItems(request);

            return response.Results;
        }

        public NutritionixItem Retrieve(string id)
        {
            var nutritionix = new NutritionixClient();
            nutritionix.Initialize(myApiId, myApiKey);

            return nutritionix.RetrieveItem(id);
        }
    }
}

About

This is a .NET client for the Nutritionix API

Resources

License

Stars

Watchers

Forks

Packages

No packages published