TLY.ShortUrl 1.0.3

dotnet add package TLY.ShortUrl --version 1.0.3                
NuGet\Install-Package TLY.ShortUrl -Version 1.0.3                
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="TLY.ShortUrl" Version="1.0.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TLY.ShortUrl --version 1.0.3                
#r "nuget: TLY.ShortUrl, 1.0.3"                
#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 TLY.ShortUrl as a Cake Addin
#addin nuget:?package=TLY.ShortUrl&version=1.0.3

// Install TLY.ShortUrl as a Cake Tool
#tool nuget:?package=TLY.ShortUrl&version=1.0.3                

TLY.ShortUrl

A .NET library for creating shortened URLs using the T.ly URL shortening service.

Getting Started

To use TLY.ShortUrl, you'll need an API key from T.ly. You can obtain one by registering at their official website.

Installation

Install the package via NuGet:

dotnet add package TLY.ShortUrl

Usage

Initialization

To use the TlyContext, you need an API key from TLY. You can instantiate the TlyContext with the API key as shown below:

using TLY.ShortUrl;

string apiKey = "your_api_key_here";
var context = new TlyContext(apiKey);

Creating a Short URL

You can create a short URL by calling the CreateShortUrlAsync method:

var response = await context.CreateShortUrlAsync(
    longUrl: "https://example.com",
    description: "Example URL",
    domain: "https://t.ly",
    publicStats: true
);

Console.WriteLine($"Short URL: {response.ShortUrl}");

Searching for Short URLs

You can search for existing short URLs by description using the SearchShortUrlAsync method:

var response = await context.SearchShortUrlAsync("Example URL");

foreach (var shortUrl in response.Data)
{
    Console.WriteLine($"Found Short URL: {shortUrl.ShortUrl}");
}

Custom API Endpoints

If you need to use custom API endpoints, you can implement the IApiEndpoints interface and pass it to the TlyContext constructor:

using TLY.ShortUrl.Settings;

public class CustomApiEndpoints : IApiEndpoints
{
    public string CreateShortLink => "https://custom-api.t.ly/v1/link/shorten";
    public string ListShortLinks => "https://custom-api.t.ly/v1/link/list";
}

var customEndpoints = new CustomApiEndpoints();
var context = new TlyContext(apiKey, customEndpoints);

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvement, please open an issue or submit a pull request.

License

This project is licensed under the unlicense - see the LICENSE file for details.

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 netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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.0.3 124 7/2/2024
1.0.2 112 7/1/2024 1.0.2 is deprecated because it has critical bugs.
1.0.1 161 6/20/2024
1.0.0 1,354 5/17/2024