BMSnet.Client
3.2.0
dotnet add package BMSnet.Client --version 3.2.0
NuGet\Install-Package BMSnet.Client -Version 3.2.0
<PackageReference Include="BMSnet.Client" Version="3.2.0" />
<PackageVersion Include="BMSnet.Client" Version="3.2.0" />
<PackageReference Include="BMSnet.Client" />
paket add BMSnet.Client --version 3.2.0
#r "nuget: BMSnet.Client, 3.2.0"
#:package BMSnet.Client@3.2.0
#addin nuget:?package=BMSnet.Client&version=3.2.0
#tool nuget:?package=BMSnet.Client&version=3.2.0
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
GetLastTimeSeriesAsyncnow supports an optionalcountparameter
Migration from version 3.1.x
- The
enableEntityCacheconstructor parameter has been removed — setoptions.EnableEntityCache = trueinstead AddBMSnetClientoverloads have been simplified: useAddBMSnetClient()(reads from DI-registeredIConfiguration) orAddBMSnetClient(Action<BMSnetClientOptions>)
License
MIT
| Product | Versions 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. |
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Http (>= 10.0.8)
- Microsoft.Extensions.Options (>= 10.0.8)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.8)
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.