This repository contains .NET clients for interacting with the Money ERP system, a popular accounting and business management software in the Czech Republic and Slovakia. The clients provide convenient access to both the GraphQL and REST APIs of Money ERP.
To get started, you need to add the desired client library to your project and configure the necessary services in your dependency injection container.
First, add the core package to your project:
dotnet add package Aviationexam.MoneyErp.CommonThen, in your Program.cs or Startup.cs, configure the Money ERP services:
using Aviationexam.MoneyErp.Common.Extensions;
// ...
builder.Services.AddMoneyErp(
options => options.Configure(builder.Configuration.GetSection("MoneyErp"))
);This will configure the basic services required for authentication and communication with the Money ERP API. The configuration section in your appsettings.json should look like this:
{
"MoneyErp": {
"Endpoint": "https://your-money-erp-endpoint",
"ClientId": "your-client-id",
"ClientSecret": "your-client-secret"
}
}To use the GraphQL client, you need to add the Aviationexam.MoneyErp.Graphql package to your project:
dotnet add package Aviationexam.MoneyErp.GraphqlThen, chain the AddGraphQlClient method to the AddMoneyErp call:
using Aviationexam.MoneyErp.Graphql.Extensions;
// ...
builder.Services.AddMoneyErp(
options => options.Configure(builder.Configuration.GetSection("MoneyErp"))
)
.AddGraphQlClient(
options => options.Configure(builder.Configuration.GetSection("MoneyErp"))
);Now you can inject MoneyErpGraphqlClient into your services and use it to make GraphQL queries:
public class MyService(MoneyErpGraphqlClient graphqlClient)
{
public async Task<string> GetMoneyErpVersion()
{
var version = await graphqlClient.Query(x => x.Version);
return version.Data;
}
}To use the REST API client, you need to add the Aviationexam.MoneyErp.RestApi package to your project:
dotnet add package Aviationexam.MoneyErp.RestApiThen, chain the AddRestApiClient method to the AddMoneyErp call:
using Aviationexam.MoneyErp.RestApi.Extensions;
// ...
builder.Services.AddMoneyErp(
options => options.Configure(builder.Configuration.GetSection("MoneyErp"))
)
.AddRestApiClient(
options => options.Configure(builder.Configuration.GetSection("MoneyErp"))
);You can then inject MoneyErpApiV1Client or MoneyErpApiV2Client into your services to interact with the v1 and v2 REST APIs respectively.
public class MyService(MoneyErpApiV1Client client)
{
public async Task<ArticleResponse?> GetArticles()
{
var articles = await client.V10.Article.GetAsync();
return articles;
}
}public class MyService(MoneyErpApiV2Client client)
{
public async Task<SomeV2Response?> GetSomething()
{
// Example usage of V2 client
// var result = await client.SomeEndpoint.GetAsync();
// return result;
return null;
}
}