This project hosts the .NET client library for the Zenmoney API.
.NET Standard 2.1
- Package Manager
Install-Package Zenmoney -Version 1.0.0
- .NET CLI
dotnet add package Zenmoney --version 1.0.0
- Package Reference
<PackageReference Include="Zenmoney" Version="1.0.0" />
Get updates for the last 7 days
var client = new Client(new HttpClient(), new NewtonsoftSerializer());
var token = "YOUR_ACCESS_TOKEN";
var currentTimestamp = (int) DateTimeOffset.UtcNow.ToUnixTimeSeconds();
var lastTimestamp = (int) DateTimeOffset.UtcNow.AddDays(-7).ToUnixTimeSeconds();
var request = new Request(token, currentTimestamp, lastTimestamp);
var result = await client.Sync(request);
// Getting some entities
result.Transaction
result.Account
// etc...
Create entity (for example account)
var client = new Client(new HttpClient(), new NewtonsoftSerializer());
var token = "YOUR_ACCESS_TOKEN";
var currentTimestamp = (int) DateTimeOffset.UtcNow.ToUnixTimeSeconds();
var request = new Request(token, currentTimestamp, currentTimestamp);
var account = new Account
{
Balance = 1000,
Title = "My Account",
Type = Account.AccountType.Ccard,
Id = Guid.NewGuid().ToString(),
Changed = DateTime.Now,
Instrument = 1,
};
request.Account.Add(account);
await client.Sync(request);