WalkerTX.Ynab.SDK
0.1.1
dotnet add package WalkerTX.Ynab.SDK --version 0.1.1
NuGet\Install-Package WalkerTX.Ynab.SDK -Version 0.1.1
<PackageReference Include="WalkerTX.Ynab.SDK" Version="0.1.1" />
<PackageVersion Include="WalkerTX.Ynab.SDK" Version="0.1.1" />
<PackageReference Include="WalkerTX.Ynab.SDK" />
paket add WalkerTX.Ynab.SDK --version 0.1.1
#r "nuget: WalkerTX.Ynab.SDK, 0.1.1"
#:package WalkerTX.Ynab.SDK@0.1.1
#addin nuget:?package=WalkerTX.Ynab.SDK&version=0.1.1
#tool nuget:?package=WalkerTX.Ynab.SDK&version=0.1.1
WalkerTX.Ynab.SDK
Developer-friendly & type-safe Csharp SDK specifically catered to leverage WalkerTX.Ynab.SDK API.
<div align="left"> <a href="https://www.speakeasy.com/?utm_source=walker-tx-ynab-sdk&utm_campaign=csharp"><img src="https://www.speakeasy.com/assets/badges/built-by-speakeasy.svg" /></a> <a href="https://opensource.org/licenses/MIT"> <img src="https://img.shields.io/badge/License-MIT-blue.svg" style="width: 100px; height: 28px;" /> </a> </div>
<br /><br />
This SDK is not yet ready for production use. To complete setup please follow the steps outlined in your workspace. Delete this section before > publishing to a package manager.
Summary
YNAB API Endpoints an edit: Our API uses a REST based design, leverages the JSON data format, and relies upon HTTPS for transport. We respond with meaningful HTTP response codes and if an error occurs, we include error details in the response body. API Documentation is at https://api.ynab.com
Table of Contents
SDK Installation
To add a reference to a local instance of the SDK in a .NET project:
dotnet add reference src/WalkerTX/Ynab/SDK/WalkerTX.Ynab.SDK.csproj
SDK Example Usage
Example
using WalkerTX.Ynab.SDK;
using WalkerTX.Ynab.SDK.Models.Components;
var sdk = new Ynab(bearer: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.User.GetAsync();
// handle response
Authentication
Per-Client Security Schemes
This SDK supports the following security scheme globally:
| Name | Type | Scheme |
|---|---|---|
Bearer |
http | HTTP Bearer |
To authenticate with the API the Bearer parameter must be set when initializing the SDK client instance. For example:
using WalkerTX.Ynab.SDK;
using WalkerTX.Ynab.SDK.Models.Components;
var sdk = new Ynab(bearer: "<YOUR_BEARER_TOKEN_HERE>");
var res = await sdk.User.GetAsync();
// handle response
Available Resources and Operations
<details open> <summary>Available methods</summary>
Accounts
Budgets
- List - List budgets
- Get - Single budget
- GetSettings - Budget Settings
Categories
- List - List categories
- Get - Single category
- Update - Update a category
- GetByMonth - Single category for a specific budget month
- UpdateMonth - Update a category for a specific month
Months
PayeeLocations
- List - List payee locations
- Get - Single payee location
- ListByPayee - List locations for a payee
Payees
ScheduledTransactions
- List - List scheduled transactions
- Create - Create a single scheduled transaction
- Get - Single scheduled transaction
- Update - Updates an existing scheduled transaction
- Delete - Deletes an existing scheduled transaction
Transactions
- List - List transactions
- Create - Create a single transaction or multiple transactions
- UpdateMany - Update multiple transactions
- Import - Import transactions
- Get - Single transaction
- UpdateOne - Updates an existing transaction
- Delete - Deletes an existing transaction
- ListByAccount - List account transactions
- ListByCategory - List category transactions, excluding any pending transactions
- ListByPayee - List payee transactions, excluding any pending transactions
- ListByMonth - List transactions in month, excluding any pending transactions
User
- Get - User info
</details>
Error Handling
YnabException is the base exception class for all HTTP error responses. It has the following properties:
| Property | Type | Description |
|---|---|---|
Message |
string | Error message |
Request |
HttpRequestMessage | HTTP request object |
Response |
HttpResponseMessage | HTTP response object |
Some exceptions in this SDK include an additional Payload field, which will contain deserialized custom error data when present. Possible exceptions are listed in the Error Classes section.
Example
using WalkerTX.Ynab.SDK;
using WalkerTX.Ynab.SDK.Models.Components;
using WalkerTX.Ynab.SDK.Models.Errors;
var sdk = new Ynab(bearer: "<YOUR_BEARER_TOKEN_HERE>");
try
{
var res = await sdk.User.GetAsync();
// handle response
}
catch (YnabException ex) // all SDK exceptions inherit from YnabException
{
// ex.ToString() provides a detailed error message
System.Console.WriteLine(ex);
// Base exception fields
HttpRequestMessage request = ex.Request;
HttpResponseMessage response = ex.Response;
var statusCode = (int)response.StatusCode;
var responseBody = ex.Body;
if (ex is ErrorResponse) // different exceptions may be thrown depending on the method
{
// Check error data fields
ErrorResponsePayload payload = ex.Payload;
ErrorDetail Error = payload.Error;
HTTPMetadata HttpMeta = payload.HttpMeta;
}
// An underlying cause may be provided
if (ex.InnerException != null)
{
Exception cause = ex.InnerException;
}
}
catch (System.Net.Http.HttpRequestException ex)
{
// Check ex.InnerException for Network connectivity errors
}
Error Classes
Primary exceptions:
YnabException: The base class for HTTP error responses.ErrorResponse: Generic error.
<details><summary>Less common exceptions (2)</summary>
System.Net.Http.HttpRequestException: Network connectivity error. For more details about the underlying cause, inspect theex.InnerException.Inheriting from
YnabException:ResponseValidationError: Thrown when the response data could not be deserialized into the expected type. </details>
Server Selection
Select Server by Index
You can override the default server globally by passing a server index to the serverIndex: int optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
| # | Server | Description |
|---|---|---|
| 0 | https://api.ynab.com/v1 |
production |
| 1 | https://staging.api.ynab.com/v1 |
staging |
Example
using WalkerTX.Ynab.SDK;
using WalkerTX.Ynab.SDK.Models.Components;
var sdk = new Ynab(
serverIndex: 1,
bearer: "<YOUR_BEARER_TOKEN_HERE>"
);
var res = await sdk.User.GetAsync();
// handle response
Override Server URL Per-Client
The default server can also be overridden globally by passing a URL to the serverUrl: string optional parameter when initializing the SDK client instance. For example:
using WalkerTX.Ynab.SDK;
using WalkerTX.Ynab.SDK.Models.Components;
var sdk = new Ynab(
serverUrl: "https://staging.api.ynab.com/v1",
bearer: "<YOUR_BEARER_TOKEN_HERE>"
);
var res = await sdk.User.GetAsync();
// handle response
Development
Maturity
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally looking for the latest version.
Contributions
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation. We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
SDK Created by Speakeasy
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. 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. 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. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- newtonsoft.json (>= 13.0.3)
- nodatime (>= 3.1.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.