Moneybird client for .NET Framework and .NET (Core).
Installation instructions will get updated as the project matures
Install Moneybird.Net
through NuGet:
PM> Install-Package Moneybird.Net
Usage instructions will get updated as the project matures
For both the authenticator and the client, an instance of the moneybird configuration is required.
Note: both options will create an instance with the default api url and default authentication url values assigned.
In case you do not need to use the OAuth functionality, you can create the default config as follows.
var moneybirdConfig = new MoneybirdConfig();
In case you do need to use the OAuth functionality, you can create a custom config as follows.
var moneybirdConfig = new MoneybirdConfig("YOUR_CLIENT_ID", "YOUR_CLIENT_SECRET", "YOUR_REDIRECT_URI");
In order to access the resources of foreign administrations, you first need to authenticate the user.
The main entry point to the authentication endpoint can be established as follows
using var authenticator = new MoneybirdAuthenticator(moneybirdConfig);
// An array of scopes you need access to.
var scopes = new[] {AuthScope.SalesInvoices, AuthScope.Bank};
var uri = authenticator.GetRequestTokenUri(scopes);
Redirect the user to this uri to get the actual request token.
// Pass the request token to request the access token.
var accessToken = await authenticator.GetAccessTokenAsync(requestToken);
// Pass the refresh token from the access token object to refresh the access token.
var accessToken = await authenticator.RefreshAccessTokenAsync(refreshToken);
In order to access the API, an instance of the moneybird configuration is required.
var client = MoneybirdClient.GetInstance(config);
using var moneybirdClient = new MoneybirdClient(config);
using var moneybirdClient = new MoneybirdClient(config, httpClient);
See the example below to learn how to request a list of administrations.
try
{
var administrations = await client.Administration.GetAdministrationsAsync("{ACCESS_TOKEN}");
var id = administrations[0].Id;
var name = administrations[0].Name;
var language = administrations[0].Language;
var currency = administrations[0].Currency;
}
catch (MoneybirdException ex)
{
// Handle the exception however you want.
}
We're continuously working on expanding this library to include additional endpoints, giving you even more options and functionality.
To see the full list of currently supported endpoints, and get a glimpse of what's coming next, head over to our roadmap.
See our roadmap for an overview of what we are planning to work on and in what time frame.
This project uses Semver v2.0 and is currently in initial development.
Copyright (c) 2021 Vincent Vrijburg
Licensed under the MIT license.
This package is not an official library for the Moneybird API and doesn't reflect the views or opinions of Moneybird B.V. or anyone officially involved in producing or managing Moneybird.
Not all endpoints are implemented and/or tested. Use at your own risk.