Skip to content

JKamsker/shlink-dotnet

Repository files navigation

Shlink .NET

NuGet version (ShlinkDotnet) Nuget GitHub Workflow Status GitHub license PR

An API client for shlink.io.

How to use

Example console app using DI

Basic sample:

Initialization:

var restClient = ShlinkRestClient.Create("https://sh.link.cf", "1b7f1396-0c14-48ea-b581-07c2bf229ca1");
var apiClient = new ShlinkApiClient(restClient);

Enumerating through all shorted links:

await foreach (var it in apiClient.EnumerateShortUrls())
{
    Console.WriteLine($"{it.ShortCode}: {it.LongUrl}");
}

Creating a new shortlink:

var res = await apiClient.CreateOrUpdateAsync(new CreateShortUrlWithSlugRequest
{
    LongUrl = "https://www.google.at",
    ShortCode = "google"
});

Made with in Austria