TLY.ShortUrl
1.0.0
See the version list below for details.
dotnet add package TLY.ShortUrl --version 1.0.0
NuGet\Install-Package TLY.ShortUrl -Version 1.0.0
<PackageReference Include="TLY.ShortUrl" Version="1.0.0" />
paket add TLY.ShortUrl --version 1.0.0
#r "nuget: TLY.ShortUrl, 1.0.0"
// Install TLY.ShortUrl as a Cake Addin #addin nuget:?package=TLY.ShortUrl&version=1.0.0 // Install TLY.ShortUrl as a Cake Tool #tool nuget:?package=TLY.ShortUrl&version=1.0.0
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
Here's how to use the library to shorten a URL:
using TLY.ShortUrl;
class Program
{
static async Task Main(string[] args)
{
string apiKey = "YOUR_API_KEY"; // Replace with your actual TLY API key.
var tlyContext = new TlyContext(apiKey);
string longUrl = "http://example.com/";
string description = "Social Media Link";
var shortenedLink = await tlyContext.GetShortUrlAsync(longUrl, description);
Console.WriteLine($"Shortened URL: {shortenedLink.short_url}");
}
}
Classes and Methods
TlyContext
Task<ShortenedLinkResponse> GetShortUrlAsync(string longUrl, string description, string domain = "https://t.ly", bool publicStats = true)
Initiates a request to shorten a URL and returns aShortenedLinkResponse
object containing details about the shortened URL.
ShortenedLinkResponse
- Properties:
string short_url
- The shortened URL.string description
- A description of the shortened URL.string long_url
- The original URL before shortening.string domain
- The domain used for the shortened URL.string short_id
- A unique identifier for the shortened URL.int? expire_at_views
- The number of views after which the link will expire.DateTime? expire_at_datetime
- The date and time when the link will expire.bool public_stats
- Indicates whether the statistics of the shortened URL are public.DateTime created_at
- The date and time when the shortened URL was created.DateTime updated_at
- The date and time when the shortened URL was last updated.
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 | 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 | 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. |
-
.NETStandard 2.1
- Flurl.Http (>= 4.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.