YNAB.API.CLIENT 1.0.1

dotnet add package YNAB.API.CLIENT --version 1.0.1                
NuGet\Install-Package YNAB.API.CLIENT -Version 1.0.1                
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="YNAB.API.CLIENT" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YNAB.API.CLIENT --version 1.0.1                
#r "nuget: YNAB.API.CLIENT, 1.0.1"                
#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 YNAB.API.CLIENT as a Cake Addin
#addin nuget:?package=YNAB.API.CLIENT&version=1.0.1

// Install YNAB.API.CLIENT as a Cake Tool
#tool nuget:?package=YNAB.API.CLIENT&version=1.0.1                

YNAB.API.Client

A simple and maintainable .NET 8+ client for the YNAB API. This client was generated using NSwag Studio with very few manual changes and has no dependencies. This allows the client to be quickly regenerated as both the YNAB API and .NET SDK evolve over the years.

These are the configuration options used in NSwag:

  • Namespace: Ynab.Api
  • ☑ Generate optional schema properties as nullable
  • ☑ Generate nullable Reference Type annotations
  • Select: SystemTextJson
  • Output: Path to a single .cs file

It generates one big file so Rider was used to automatically separate all the classes and types into individual files (some of the classes were also renamed to be more descriptive).

Usage

Add the nuget to your app:

dotnet add package ynab.api.client

Create an access token via the YNAB website and add it to the following code snippet, which shows how to add the client to your app's services (you can alternatively just instantiate the client directly if preferred):

services.AddSingleton<YnabApiClient>(sp =>
{
    var accessToken = "<YOUR ACCESS TOKEN>";
    return new YnabApiClient(new HttpClient()
    {
        DefaultRequestHeaders = {
            Authorization = new AuthenticationHeaderValue("Bearer", accessToken)
        }
    });
});

...

public class MyClass(YnabApiClient ynabClient)
{
  (await _ynabClient.GetBudgetsAsync(false)).Data.Budgets
    .ToList()
    .ForEach(budget => {
      Console.WriteLine($"Budget Name: {budget.Name}");
  });
}

License

Copyright (c) 2024 Tom Bulatewicz

Licensed under the MIT license

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

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.0.1 149 6/28/2024
1.0.0 118 6/27/2024