C# SDK for talking with Dinero API.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
DineroClientSDK
.gitattributes Added the two empty projects. Jul 6, 2015
.gitignore
LICENSE
README.md Update README.md Oct 17, 2015
docker-compose.publish.yml
docker-compose.yml

README.md

Dinero C# SDK

By uisng this SDK you can talk with Dinero's API. More on Dinero here.

Currently this repository consists of two C# projects.

DineroClientSDK

This is the actual SDK. Se below on how to use it.

DineroSampleApp

This is a very simple console application. Change the variables at the top of Program.cs to some valid values:

  • ClientId: This is obtained by applying as a developer (see below).
  • ClientSecret: Also obtained by applying as a developer.
  • ApiKey: The API key of the Dinero user (the user generates this herself in the Dinero web application).
  • OrganizationId: The id of the user's organization.

Running the app gives you the option of trying out various actions that exercise the API via the SDK.

The point of the sample application is simply to show how easy it is to use the SDK, and it is not meant to be an actual useful application.

How to use the SDK

The easy way is to install the Dinero client SDK nuget package. Another way is to download this repo if you want to look at the source.

After getting hold of the bits you need to sign up as a developer at this place. By signing up you'll get a client id and a client secret. These two pieces of information are necessary for accessing the Dinero API and identifies the client app.

You are now ready for the actual coding! Instantiate the Dinero class, passing in the client id, and client secret together with the Dinero user's API key or the Dinero user's username/password. You can also optionally supply an id of the user's organization (or choose to set that later).

After creating the Dinero instance, you need to authorize the client to the API.

Calling the API is as simple as calling a method on the Dinero instance, and passing in an Action that handles whatever is returned from the API. All calls to the API are availabable as syncronous or asyncronous methods.

For example, to add some ledger items, you do this:

var dinero = new Dinero(clientId, clientSecret, usersApiKey, usersOrganizationId);
//First authorize yourself against the API
dinero.Authorize();
// ledgerItemCollection is a collection of ledger items
dinero.LedgerAddLedgerItems(ledgerItemCollection, r =>
{
    if (!r.HasError)
    {
      Console.WriteLine("Items successfully added to your ledger!");
    }
});

The SDK supports the full Dinero API, which currently is:

  • Getting a list of the user's entry accounts.
  • Getting the next available voucher number.
  • Adding ledger items to the ledger.
  • Uploading an file (i.e. a voucher/receipt image).
  • Creating a new purchase voucher with some notes, and a file.
  • Getting a list of the user's organizations.

The API

You can see more about the Dinero API at Dinero API documentation.