Yourls.Net
1.1.1
dotnet add package Yourls.Net --version 1.1.1
NuGet\Install-Package Yourls.Net -Version 1.1.1
<PackageReference Include="Yourls.Net" Version="1.1.1" />
paket add Yourls.Net --version 1.1.1
#r "nuget: Yourls.Net, 1.1.1"
// Install Yourls.Net as a Cake Addin
#addin nuget:?package=Yourls.Net&version=1.1.1
// Install Yourls.Net as a Cake Tool
#tool nuget:?package=Yourls.Net&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 theHttpClient
upon it's own disposal.IJsonDeserializer.DeserializerToDictionary
method should return anIDictionary<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:
- Signature
- 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:
SignatureAuthentication
which takes the signature value as it's constructor parameters.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 | Versions 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. |
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Yourls.Net:
Package | Downloads |
---|---|
Yourls.Net.JsonNet
A strongly typed wrapper for YOURLS.org's API with async support. |
|
Yourls.Net.AspNet
A strongly typed wrapper for YOURLS.org's API with async support. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.1 | 13,313 | 6/2/2020 |