KiwiSoft.Bitly 1.0.2

.NET 6.0
Install-Package KiwiSoft.Bitly -Version 1.0.2
dotnet add package KiwiSoft.Bitly --version 1.0.2
<PackageReference Include="KiwiSoft.Bitly" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add KiwiSoft.Bitly --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: KiwiSoft.Bitly, 1.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install KiwiSoft.Bitly as a Cake Addin
#addin nuget:?package=KiwiSoft.Bitly&version=1.0.2

// Install KiwiSoft.Bitly as a Cake Tool
#tool nuget:?package=KiwiSoft.Bitly&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

KiwiSoft.Bitly

This nuget package is meant to be used to shrink long Url into shorter one with the helps of Bitly Rest API. You need to create your own subscription with https://bitly.com before you can use this nuget package.
Once you have a subscription, you need to get a group guid id and generate a token. Those informations will be used by the package while communicating with the Bitly Rest API.
There are two way to pass in GroupId and Token to the instant object
A) By adding new section on appsettings.json as see below :
appsettings.json
{
  "KiwiSoft.Bitly": {
    "GroupGuidId": "GKcgnMiNain",
    "Token": "563e96dfffd3d5e744dca8172719b01aed23eb09"
  }
}

And on the C# code, you just need to call new Shortener() to create a new instant.

  Shortener shortener = new Shortener();
  ReturnURL result = await shortener.CreateAsync("https://edi.wang/post/2019/4/24/how-to-pack-a-net-core-class-library-and-upload-to-nuget");
  string url = result.Status?result.Url:string.Empty;
B) By instantiating Configuration class and pass it to the constructor :
  Configuration configuration = new Configuration();
  configuration.GroupGuid = "GKcgnMiNain";
  configuration.Token = "563e96dfffd3d5e744dca8172719b01aed23eb09";

  Shortener shortener = new Shortener(configuration);
  ReturnURL result = await shortener.CreateAsync("https://edi.wang/post/2019/4/24/how-to-pack-a-net-core-class-library-and-upload-to-nuget");
  string url = result.Status?result.Url:string.Empty;

You can find out whether the operation is successful or not by looking at the value of Status property on ReturnUrl. And the shortened url can be retrieved from Url property.

Product Versions
.NET net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

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.2 102 1/29/2022
1.0.1 73 1/22/2022
1.0.0 96 1/17/2022