FatSecretDotNet 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package FatSecretDotNet --version 1.0.0
NuGet\Install-Package FatSecretDotNet -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FatSecretDotNet" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FatSecretDotNet --version 1.0.0
#r "nuget: FatSecretDotNet, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install FatSecretDotNet as a Cake Addin
#addin nuget:?package=FatSecretDotNet&version=1.0.0

// Install FatSecretDotNet as a Cake Tool
#tool nuget:?package=FatSecretDotNet&version=1.0.0

FatSecretDotNet

.Net 5.0 Class Library to wrap the Fat Secret public REST API.

Summary

FatSecretDotNet is a a .Net 5.0 class library which makes it super simple to access the FatSecret Fat Secret public REST API.

Getting Started

Prerequisites

To begin using this library in your project first make sure you Register for a FatSecret developer account once registered apply for API access to retrieve your client id and client secret, these will be needed to authenticate.

Instalation

FatSecretDotNet is hosted on Nuget and can easily be added to your project by using a nuget package managger or by using a command line tool.

Install-Package FatSecretDotNet -Version 1.0.0

Usage

The fat secret API is accessed through an instance of the FatSecretClient class. This classes constructor takes your credentials and will automatically manage authentication for your requests

Creating an instance of the client

The client must be instanciated before a request is made. Each client contains its own AuthManager scheme which means each client will try to get its own access token. For this reason it is recommened to reuse the client when possible, and to register it with your DI container if you are using one.

  var credentials = new FatSecretCredentials()
  {
     ClientId = "Your Client Id",
     ClientSecret = "Your Client Secret",
     Scope = "your scope" // basic or premier
  };

  var client = new FatSecretClient(credentials);

Note: It is not recommended to ever store your secret in plain text, please use a secure method to store your secret in your application

Using the client

The client has a method for each FatSecret API resource. Each Method takes a Request Object that is used to form the paramaters of the reques

var foodSearchRequest = new FoodsSearchRequest()
{
  SearchExpression = "Apples"
};

var foods = client.FoodsSearch(foodSearchRequest);

See more usage examples here

Technical Details

Client Methods

Each client method is modeled after the Fat Secret REST API Documentation The method names should match the name of the method in the docs.

Request Objects

Each client method takes a unique request object, the request object is modeled after the required and optional paramaters as documented in the FatSecret API Docs

Response Objects

Each client method returns a unique response object, the response object is modeled exactly after the example responses in the FatSecret API Docs. Two Additional properties are added to each response object, Successful and Error which are populated with information regarding any errors returned by the API.

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 483 4/15/2021
1.1.2 331 4/7/2021
1.1.1 291 4/7/2021
1.1.0 303 4/7/2021
1.0.1 400 3/21/2021
1.0.0 343 3/19/2021