Thingsboard.Net.Abstractions 3.4.26

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

// Install Thingsboard.Net.Abstractions as a Cake Tool
#tool nuget:?package=Thingsboard.Net.Abstractions&version=3.4.26                

Thingsboard.Net

Build status CodeQL GitHub license

Thingsboard.NET is a .NET client library for Thingsboard IoT Platform. It is a .NET Standard 2.0 library, so it can be used in .NET Core and .NET Framework applications.

All client API are tested in Thingsboard v3.4.x

Nuget packages

Name Version Downloads
Thingsboard.Net.Abstractions nuget stats
Thingsboard.Net.Flurl nuget stats
Thingsboard.Net.Flurl.DependencyInjection nuget stats

Usage

Creating a client and trying to invoke getCurrentUser method:

Basic usage

Install the NuGet package Thingsboard.Net.Flurl.

PM> Install-Package Thingsboard.NET.Flurl

Then put following code into your project

// Initial factory
var factory = new FlurlTbClientFactory
{
    Options = new ThingsboardNetFlurlOptions()
    {
        BaseUrl  = "http://localhost:8080",
        Username = "tenant@thingsboard.org",
        Password = "tenant",
    }
};

// Get the client
var authClient = factory.CreateAuthClient();
var userInfo = await authClient.GetCurrentUserAsync();
Console.WriteLine($"Hello {userInfo.Email}");

You will get the output from console:

Hello tenant@thingsboard.org

Integration to ASP.NET Core

You can use the Thingsboard.NET.Flurl library in ASP.NET Core applications. Te dependency injection mode is supported.

First, add the Thingsboard.NET.Flurl.DependencyInjection library to your project:

PM> Install-Package Thingsboard.NET.Flurl.DependencyInjection

Then, register the Thingsboard.NET.Flurl services in the ConfigureServices method of Startup.cs:

// add package "Thingsboard.Net.Flurl.DependencyInjection" Version="3.4.1.1"
serviceBuilder.AddThingsboardNet(options =>
{
    options.Username = "tenant@thingsboard.org";
    options.Password = "tenant";
    options.BaseUrl  = "http://localhost:8080";
});

Then you can inject the client factory in your controllers:

public class HomeController : Controller
{
    private readonly ITbAuthClient _authClient;

    public HomeController(ITbAuthClient authClient)
    {
        _authClient = authClient;
    }

    public async Task<IActionResult> Index()
    {
        var userInfo = await _authClient.GetCurrentUserAsync();
        return View(userInfo);
    }
}

Customization options

You can customize the client options before invoke RPC methods:

public class HomeController : Controller
{
    private readonly ITbAuthClient _authClient;

    public HomeController(ITbAuthClient authClient)
    {
        _authClient = authClient;
    }

    public async Task<IActionResult> Index()
    {
        var userInfo = await auth
            .WithCredentials("newuser@thingsboard.com", "your-password")
            .WithBaseUrl("https://tb-server")
            .GetCurrentUserAsync();
        return View(userInfo);
    }
}

Thanks

  • Thanks to Flurl for the great HTTP library.
  • Thanks to Thingsboard for the great IoT platform.
  • Thanks to Polly for the great resilience and transient-fault-handling library.

Final

Leave a comment on GitHub if you have any questions or suggestions.

Turn on the star if you like this project.

License

This project is licensed under the MIT License

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 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Thingsboard.Net.Abstractions:

Package Downloads
Thingsboard.Net.Flurl

The dotnet restful api client for thingsboard v3.4.x

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.5.1.5 783 10/11/2023
3.5.1.4 341 7/7/2023
3.5.1.2 233 7/7/2023
3.5.1 278 7/7/2023
3.4.33 558 3/22/2023
3.4.32 449 3/14/2023
3.4.31 495 3/13/2023
3.4.30 476 3/7/2023
3.4.29 489 3/7/2023
3.4.28 435 3/7/2023
3.4.27 454 3/7/2023
3.4.26 472 3/7/2023
3.4.25 471 3/6/2023
3.4.24 481 3/6/2023
3.4.23 456 3/3/2023
3.4.22 473 3/3/2023
3.4.21 461 3/3/2023
3.4.20 493 2/27/2023
3.4.19 548 2/6/2023
3.4.18 667 1/4/2023
3.4.17 632 1/4/2023
3.4.16 721 11/22/2022
3.4.15 776 11/15/2022
3.4.14 758 11/14/2022
3.4.13 760 11/10/2022
3.4.12 757 11/10/2022
3.4.11 879 10/28/2022
3.4.10 869 10/22/2022
3.4.9 905 10/22/2022
3.4.8 909 10/22/2022
3.4.7 909 10/21/2022
3.4.6 890 10/21/2022
3.4.5 959 10/20/2022
3.4.3 937 10/18/2022
3.4.1.9 1,257 10/18/2022
3.4.1.8 401 10/18/2022
3.4.1.7 662 10/18/2022
3.4.1.6 657 10/18/2022
3.4.1.5 704 10/17/2022
3.4.1.4 993 10/17/2022
3.4.1.3 395 10/17/2022
3.4.1.2 399 10/17/2022
3.4.1.1 1,678 10/17/2022