KSoftNet 2.4.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package KSoftNet --version 2.4.1                
NuGet\Install-Package KSoftNet -Version 2.4.1                
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="KSoftNet" Version="2.4.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add KSoftNet --version 2.4.1                
#r "nuget: KSoftNet, 2.4.1"                
#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 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

http://api.ksoft.si

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 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. 
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
4.0.0 1,095 9/10/2021
3.0.1 820 3/17/2021
3.0.0 777 2/28/2021
2.4.1 869 8/2/2020
2.4.0 928 4/30/2020