BMSnet.Client 3.2.0

dotnet add package BMSnet.Client --version 3.2.0
                    
NuGet\Install-Package BMSnet.Client -Version 3.2.0
                    
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="BMSnet.Client" Version="3.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BMSnet.Client" Version="3.2.0" />
                    
Directory.Packages.props
<PackageReference Include="BMSnet.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BMSnet.Client --version 3.2.0
                    
#r "nuget: BMSnet.Client, 3.2.0"
                    
#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.
#:package BMSnet.Client@3.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BMSnet.Client&version=3.2.0
                    
Install as a Cake Addin
#tool nuget:?package=BMSnet.Client&version=3.2.0
                    
Install as a Cake Tool

BMSnet.Client

A .NET client library for accessing BMSnet APIs, including entity and time series operations through a unified client interface.

Version 3

Version 3 has moved to .NET 10.

Latest time series values

GetLastTimeSeriesAsync now accepts a count parameter, so you can request multiple latest values.

var options = new BMSnetClientOptions
{
    ClientId = "your-client-id",
    ClientSecret = "your-client-secret",
    Scope = BMSnetClientOptions.DataApiScope
};

using var client = new BMSnetClient(options);

var entityId = Guid.Parse("12345678-1234-1234-1234-123456789abc");
var latestValue = await client.GetLastTimeSeriesAsync(entityId);
var latestTenValues = await client.GetLastTimeSeriesAsync(entityId, count: 10);

Getting started

Installation

Add the package to your project and target .NET 10 for version 3.

Configuration

The library uses the options pattern. You must provide OAuth credentials and can optionally override the default endpoints and scope.

var options = new BMSnetClientOptions
{
    ClientId = "your-client-id",
    ClientSecret = "your-client-secret",
    Scope = BMSnetClientOptions.DataApiScope
};

Dependency injection

The simplest approach reads from IConfiguration already registered in the DI container. Options are validated at startup — the app will fail to start with a clear message if ClientId or ClientSecret are missing.

// Program.cs
builder.Services.AddBMSnetClient();

With a matching appsettings.json:

{
  "BMSnetClient": {
    "ClientId": "your-client-id",
    "ClientSecret": "your-client-secret"
  }
}

Or configure options manually (useful in console apps and tests):

services.AddBMSnetClient(options =>
{
    options.ClientId = "your-client-id";
    options.ClientSecret = "your-client-secret";
});

Configuration options

Property Type Required Default Description
ClientId string Yes - OAuth client ID
ClientSecret string Yes - OAuth client secret
Scope string Yes DataApiScope OAuth scope. Use DataApiScope for read/write or DataApiReadOnlyScope for read-only
AuthorityEndpoint Uri No https://bmsnet.online/login OAuth token endpoint
DataApiBaseUrl Uri No https://data.bmsnet.online/ Base URL for the BMSnet Data API
TokenRefreshBufferSeconds int No 60 Seconds before expiry to refresh the token
EnableEntityCache bool No false Cache GetEntity results in memory; invalidated on update/delete

Scope constants

  • BMSnetClientOptions.DataApiScope = "bmsnetdataapi"
  • BMSnetClientOptions.DataApiReadOnlyScope = "bmsnetdataapi_readonly"

Time series examples

Get the latest value

var latest = await client.GetLastTimeSeriesAsync(entityId);

Get the latest 10 values

var latestTen = await client.GetLastTimeSeriesAsync(entityId, count: 10);

Get a time range

var series = await client.GetTimeSeriesAsync(
    entityId,
    from: DateTime.UtcNow.AddHours(-24),
    to: DateTime.UtcNow,
    interval: "PT15M");  // ISO 8601 duration

Entity caching

Entity caching can be enabled to avoid repeated API calls for the same entity. Cache entries are invalidated when an entity is updated or deleted. Enable it via options:

{ "BMSnetClient": { "EnableEntityCache": true } }

or programmatically:

services.AddBMSnetClient(options => options.EnableEntityCache = true);
// or when constructing directly:
var options = new BMSnetClientOptions { ..., EnableEntityCache = true };

Thread safety

BMSnetClient is thread-safe. Token refresh is protected by internal locking, so it is safe to register as a singleton in web apps and Azure Functions.

Migration from version 2.x

  • Update your project to target .NET 10 for version 3
  • GetLastTimeSeriesAsync now supports an optional count parameter

Migration from version 3.1.x

  • The enableEntityCache constructor parameter has been removed — set options.EnableEntityCache = true instead
  • AddBMSnetClient overloads have been simplified: use AddBMSnetClient() (reads from DI-registered IConfiguration) or AddBMSnetClient(Action<BMSnetClientOptions>)

License

MIT

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows 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
3.2.0 90 5/19/2026
3.1.1 91 5/18/2026
3.1.0 87 5/18/2026
3.0.2 87 5/18/2026
3.0.1 84 5/18/2026
3.0.0 86 5/18/2026
2.0.3 101 3/31/2026
2.0.2 96 3/31/2026
2.0.1 105 3/27/2026
2.0.0 99 3/27/2026
1.0.6 108 2/27/2026
1.0.5 194 12/22/2025
1.0.4 191 12/22/2025
1.0.3 253 12/15/2025
1.0.2 254 12/15/2025
1.0.1 133 12/12/2025
1.0.0 198 11/24/2025

Internal improvements.