Yourls.Net.JsonNet
1.1.1
dotnet add package Yourls.Net.JsonNet --version 1.1.1
NuGet\Install-Package Yourls.Net.JsonNet -Version 1.1.1
<PackageReference Include="Yourls.Net.JsonNet" Version="1.1.1" />
<PackageVersion Include="Yourls.Net.JsonNet" Version="1.1.1" />
<PackageReference Include="Yourls.Net.JsonNet" />
paket add Yourls.Net.JsonNet --version 1.1.1
#r "nuget: Yourls.Net.JsonNet, 1.1.1"
#:package Yourls.Net.JsonNet@1.1.1
#addin nuget:?package=Yourls.Net.JsonNet&version=1.1.1
#tool nuget:?package=Yourls.Net.JsonNet&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.
IAuthenticationHandleris described in Authentication section.YourlsClientdisposes theHttpClientupon it's own disposal.IJsonDeserializer.DeserializerToDictionarymethod 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:
SignatureAuthenticationwhich takes the signature value as it's constructor parameters.UsernamePasswordAuthenticationwhich 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.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
- Newtonsoft.Json (>= 12.0.3)
- Yourls.Net (>= 1.1.1)
-
.NETStandard 2.1
- Newtonsoft.Json (>= 12.0.3)
- Yourls.Net (>= 1.1.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Yourls.Net.JsonNet:
| Package | Downloads |
|---|---|
|
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 | 15,813 | 6/2/2020 |