C# api for https://lightr.nl/ a SAAS to send handwritten cards via an API.
Install the package:
dotnet add package LightrThen simply add the ILightrClient to your DI using:
services.AddLightr("my-token");Or:
services
.AddLightr((provider, options) =>
{
var token = provider.GetRequiredService<ILightrSettings>().ApiKey;
options.UseToken(token);
});Then use this service;
public class MyAwesomeApp
{
private readonly ILightrClient _lightrClient;
public MyAwesomeApp(ILightrClient lightrClient)
{
_lightrClient = lightrClient;
}
public async Task MyBusinessMethod(CancellationToken cancellationToken = default)
{
await _lightrClient.MeAsync(cancellationToken);
}
}For more information check the sample.
A LightrRateLimitedHandler is added by default which handles the rate limits of the API.
Requests are delayed when the limit is reached. See the ServiceCollectionExtensions for the precise configuration.
The library is generated from the upstream OpenAPI document and requires the .NET 10 SDK. Restore the repository-local tools before building:
dotnet tool restore
dotnet buildTo refresh the checked-in OpenAPI document, run:
.\scripts\Refresh-OpenApi.ps1
dotnet buildThe build automatically applies schema-corrections.overlay.yaml before NSwag generates the client. The overlay corrects known upstream schema defects, so no manual post-processing of the downloaded document is needed.
Dependency updates are handled by a self-hosted Renovate workflow; see docs/Renovate/Renovate.md for its triggers, automerge rules and troubleshooting.
Versions are computed by Nerdbank.GitVersioning from version.json: <major>.<minor> comes from the file and the patch is the git height since that value last changed. Builds from main and from tags named X.Y.Z (no v prefix) are public versions; every other ref gets a -g<sha> prerelease suffix. CI and the deploy workflow therefore check out the full history (fetch-depth: 0).
To release, publish a GitHub release on a tag that matches the version nbgv get-version -v NuGetPackageVersion prints for the commit on main (for example 1.7.1). The deploy workflow builds that tag and pushes the package to nuget.org and GitHub Packages. To start a new minor or major line, bump version in version.json.