Skip to content

Latest commit

 

History

History
51 lines (43 loc) · 1.99 KB

Readme.md

File metadata and controls

51 lines (43 loc) · 1.99 KB

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