KSoftNet 2.4.1
See the version list below for details.
dotnet add package KSoftNet --version 2.4.1
NuGet\Install-Package KSoftNet -Version 2.4.1
<PackageReference Include="KSoftNet" Version="2.4.1" />
paket add KSoftNet --version 2.4.1
#r "nuget: KSoftNet, 2.4.1"
// Install KSoftNet as a Cake Addin #addin nuget:?package=KSoftNet&version=2.4.1 // Install KSoftNet as a Cake Tool #tool nuget:?package=KSoftNet&version=2.4.1
KSoft.si API Wrapper
Overview
KSoft.Si API is a service that provides Discord bot developers or others the ease in getting content from the internet. We provide easy to use interface and take hard tasks away from developers.
Getting started
Installing the package
Add the NuGet package KSoftNet
to your project:
dotnet add package KSoftNet
Simple Example usage
You can use the wrapper with the images API for example like so:
Create an instance of the KSoftApi and ImagesApi classes:
using KSoftNet.KSoft;
public class ExampleClass {
string token = "token";
KSoftApi kSoftApi;
ImagesApi imagesApi;
public void Setup() {
kSoftApi = new KSoftApi(token);
imagesApi = new ImagesApi(kSoftApi);
}
}
An example implementation of the RandomImage method:
public void ExampleMethod(string tag) {
KSoftImage image = imagesApi.RandomImage(tag: tag);
}
Example using dependency injection
Create instances of the classes you're going to use, then create a ServiceCollection, add them to it, and then build the service provider:
using Microsoft.Extensions.DependencyInjection;
using KSoftNet.KSoft;
public class Program {
static void Main(string[] args) {
new Startup().Init();
}
}
public class Startup {
private KSoftAPI kSoftAPI;
private ImagesAPI imagesAPI;
private string token = "token123";
public void Init() {
ServiceCollection services = new ServiceCollection();
kSoftAPI = new KSoftAPI(token);
imagesAPI = new ImagesAPI(kSoftAPI);
ConfigureServices(services);
ServiceProvider provider = services.BuildServiceProvider();
}
private void ConfigureServices(IServiceCollection services) {
services.AddSingleton(imagesAPI);
}
}
Using this in a class:
using KSoftNet.KSoft;
public class ExampleClass {
private ImagesAPI imagesApi;
public ExampleClass(ImagesAPI imagesApi) {
this.imagesApi = imagesApi;
}
public void GetRandomImage(string tag) {
var image = imagesApi.RandomImage(tag: tag);
Console.WriteLine(image.Url);
}
}
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 is compatible. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
-
.NETCoreApp 2.0
- RestSharp (>= 106.10.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.