NugLabs 1.3.1
dotnet add package NugLabs --version 1.3.1
NuGet\Install-Package NugLabs -Version 1.3.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="NugLabs" Version="1.3.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NugLabs" Version="1.3.1" />
<PackageReference Include="NugLabs" />
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 NugLabs --version 1.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NugLabs, 1.3.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.
#:package NugLabs@1.3.1
#: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=NugLabs&version=1.3.1
#tool nuget:?package=NugLabs&version=1.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
NugLabs .NET SDK
Local-first SDK for https://strains.nuglabs.co.
Current NuGet package version: 1.3.1.
Design
- Ships with a bundled
NugLabs/dataset.json - Loads bundled data on startup
- Uses persisted local data if a newer synced copy exists
- Performs all reads and searches against local data only
- Auto-syncs from the API every 12 hours
- Supports manual
ForceResyncAsync()(dataset+rules) - Supports targeted
ForceResyncDatasetAsync()andForceResyncRulesAsync() - Uses ETag conditional requests (
If-None-Match) for sync efficiency - Falls back to memory-only behavior if local writes fail
Install
dotnet add package NugLabs
Usage
using NugLabs;
var client = new NugLabsClient();
var blueDream = await client.GetStrainAsync("Blue Dream");
var allStrains = await client.GetAllStrainsAsync();
var matches = client.SearchStrains("dream");
var sync = await client.ForceResyncAsync();
var datasetOnly = await client.ForceResyncDatasetAsync();
var rulesOnly = await client.ForceResyncRulesAsync();
await client.DisposeAsync();
using NugLabs;
using NugLabs.Options;
var client = new NugLabsClient(new NugLabsClientOptions
{
StorageDirectory = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"NugLabs"),
SyncInterval = TimeSpan.FromHours(12),
HttpClient = new HttpClient()
});
Sync uses canonical URLs from NugLabsApi.StrainsDatasetUrl and NugLabsApi.RulesUrl (aligned with Rust nuglabs_core::strains_dataset_url() / nuglabs_core::rules_url()).
Constructor Options
StorageDirectory: local persistence directorySyncInterval: background sync intervalHttpClient: custom HTTP client for syncWasmPath: optional explicit path tonuglabs_core.wasm
Return Shapes
GetStrainAsync(name): returnsStrain?GetAllStrainsAsync(): returnsIReadOnlyList<Strain>SearchStrains(query): returnsIReadOnlyList<Strain>ForceResyncAsync(): returnsNugLabsSyncResultForceResyncDatasetAsync(): returnsNugLabsArtifactSyncResultForceResyncRulesAsync(): returnsNugLabsArtifactSyncResult
Typical Strain fields include:
IdNameAkasTypeThcDescription- plus any additional dataset fields bundled with NugLabs
Behavior
GetStrainAsync(name)does case-insensitive exact matching againstNameandAkasSearchStrains(query)does case-insensitive partial matching againstNameandAkasGetAllStrainsAsync()returns the full locally loaded dataset- Reads never call the API directly
- Sync failures keep the last good local artifacts
- Rules endpoint
404is treated asnot-modifiedfor backward-compatible deployments
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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.
-
net8.0
- Wasmtime (>= 34.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.