Yourls.Net.AspNet 1.1.1

dotnet add package Yourls.Net.AspNet --version 1.1.1
NuGet\Install-Package Yourls.Net.AspNet -Version 1.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Yourls.Net.AspNet" Version="1.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Yourls.Net.AspNet --version 1.1.1
#r "nuget: Yourls.Net.AspNet, 1.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Yourls.Net.AspNet as a Cake Addin
#addin nuget:?package=Yourls.Net.AspNet&version=1.1.1

// Install Yourls.Net.AspNet as a Cake Tool
#tool nuget:?package=Yourls.Net.AspNet&version=1.1.1

Yourls.Net

A simple strong-typed wrapper for YOURLS.org's API with async support.

Installation

Install the packages from nuget:

dotnet add package Yourls.Net

API Reference

For the start, you must create an instance of YourlsClient class to communicate with the remote API.
If you're using the Yourls.Net.AspNet, with correct configurations, the YourlsClient class should be injectable as a service.

YourlsClient class

The client service to communicate with the remote API. This class takes the remote API's url, an instance of IAuthenticationHandler, an object of HttpClient and an IJsonDeserializer as it's constructor's parameters.

  • IAuthenticationHandler is described in Authentication section.
  • YourlsClient disposes the HttpClient upon it's own disposal.
  • IJsonDeserializer.DeserializerToDictionary method should return an IDictionary<string, object> for json objects.
ShortenUrl

ShortenUrl(ShortenUrlRequestModel model, CancellationToken ct)
This method shortens a url.

  • Url(required): The url which you want to shorten.
  • Keyword(optional): The shortened url name, it should be a unique keyword or null.
  • Title(optional): The title parameter for yourls.
GetDbStats

GetDbStats(CancellationToken ct)
Returns general information about database. (i.e. total-links, total-clicks)

GetStats

GetStats(StatsFilterMode mode, int limit, CancellationToken ct)
Returns statistical information about links.

  • mode(required): It determines the filtering mode of the statistic, (Top, Bottom, Random, Last)
  • limit(required): The number of rows returned.
GetUrlStats

GetUrlStats(string shortUrl, CancellationToken ct)
Returns statistics about a link specified by it's short url.

  • shortUrl(required): The short url. (i.e. hash name of the url)

Authentication

YOURLS supports two types of authentication:

  1. Signature
  2. Username/Password

The authentication is provided with a dynamic approach so you can customize it if your gateway needs some extra information.

There's two classes for each type of these authentications in Yourls.Net:

  1. SignatureAuthentication which takes the signature value as it's constructor parameters.
  2. UsernamePasswordAuthentication which takes the username and the password as it's constructor parameters.

Yourls.Net.AspNet

With this library you can configure the YourlsClient as a service in the Asp.Net pipeline.

To register YourlsClient in the Asp.Net pipeline call the AddYourlsClient in your ConfigureServices method.

    services.AddYourlsClient(config => {
        config.ApiUrl = "XXX"; //(required) base url for your API, (e.g. http://test.com/yourls-api.php)
        
        //Choose between one of these authentication methods. (signature has the higher priority)
        config.Signature = "XXX";
        config.Username = "XXX";
        config.Password = "XXX";
        
        config.Timeout = TimeSpan.FromSeconds(3);

        config.JsonDeserializer = new YourlsJsonDeserializer(); //(optional) Sets the json deserializer used to deserialize json results.
        config.AuthenticationHandler = new XXX(); //(optional) Sets the authentication handler for requests.
    });
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.1 2,531 6/2/2020