BulletTrain 2.0.0
See the version list below for details.
dotnet add package BulletTrain --version 2.0.0
NuGet\Install-Package BulletTrain -Version 2.0.0
<PackageReference Include="BulletTrain" Version="2.0.0" />
paket add BulletTrain --version 2.0.0
#r "nuget: BulletTrain, 2.0.0"
// Install BulletTrain as a Cake Addin #addin nuget:?package=BulletTrain&version=2.0.0 // Install BulletTrain as a Cake Tool #tool nuget:?package=BulletTrain&version=2.0.0
<img width="100%" src="https://raw.githubusercontent.com/SolidStateGroup/bullet-train-frontend/master/hero.png"/>
Bullet Train SDK for .NET applications
Bullet Train allows you to manage feature flags and remote config across multiple projects, environments and organisations.
The SDK for .NET Core, .NET Framework, Mono, Xamarin and Universal Windows Platform applications for https://bullet-train.io/.
Getting Started
Quick Setup
The client library is available from NuGet and can be added to your project by many tools. You can find the package here https://www.nuget.org/packages/BulletTrain/
Usage
Retrieving feature flags for your project
For full documentation visit https://docs.bullet-train.io
Sign Up and create account at https://bullet-train.io/
In your application initialise the Bullet Train client with your environment API key and API URL.
BulletTrainConfiguration configuration = new BulletTrainConfiguration()
{
ApiUrl = "https://api.bullet-train.io/api/v1/",
EnvironmentKey = "env-key-goes-here"
};
BulletTrainClient bulletClient = new BulletTrainClient(configuration);
To check if a feature flag exists and is enabled:
bool featureEnabled = await bulletClient.HasFeatureFlag("my_test_feature");
if (featureEnabled) {
// run the code to execute enabled feature
} else {
// run the code if feature switched off
}
To get a remote config feature value:
string myRemoteConfig = await bulletClient.GetFeatureValue("my_test_feature");
if (myRemoteConfig != null) {
// run the code to use remote config value
} else {
// run the code without remote config
}
Identifying users
Identifying users allows you to target specific users from the Bullet Train dashboard.
To check if a feature exists and is enabled for a specific user:
bool featureEnabled = await bulletClient.HasFeatureFlag("my_test_feature", "my_user_id");
if (featureEnabled) {
// run the code to execute enabled feature for given user
} else {
// run the code when feature switched off
}
To get a remote config value for specific user:
string myRemoteConfig = await bulletClient.GetFeatureValue("my_test_feature", "my_user_id");
if (myRemoteConfig != null) {
// run the code to use remote config value
} else {
// run the code without remote config
}
To get user traits:
List<Trait> userTraits = await bulletClient.GetTraits("my_user_id")
if (userTraits != null && userTraits) {
// run the code to use user traits
} else {
// run the code without user traits
}
To get a specific user trait:
Trait userTrait = await bulletClient.GetTrait("my_user_id", "cookies_key");
if (userTrait != null) {
// run the code to use user trait
} else {
// run the code without user trait
}
To get filtered user traits:
List<Trait> userTraits = await bulletClient.GetTraits("my_user_id", new List<string> { "specific_key", /* rest of elements */ });
if (userTraits != null) {
// run the code to use user traits
} else {
// run the code without user traits
}
To set or update a user trait:
Trait userTrait = await bulletClient.SetTrait("my_user_id", "my_user_trait", "blue");
Trait userTrait = await bulletClient.SetTrait("my_user_id", "my_user_number_trait", 4);
Trait userTrait = await bulletClient.SetTrait("my_user_id", "my_user_bool_trait", true);
To increment a numeric user trait:
Trait userTrait = await bulletClient.IncrementTrait("my_user_id", "my_user_number_trait", 1);
To retrieve a user identity (both features and traits):
Identity userIdentity = await bulletClient.GetUserIdentity("my_user_id");
if (userIdentity != null) {
// Run the code to use user identity i.e. userIdentity.flags or userIdentity.traits
}
Contributing
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
Getting Help
If you encounter a bug or feature request we would like to hear about it. Before you submit an issue please search existing issues in order to prevent duplicates.
Get in touch
If you have any questions about our projects you can email <a href="mailto:projects@solidstategroup.com">projects@solidstategroup.com</a>.
Product | Versions 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. |
-
.NETStandard 2.0
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 12.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Singleton HTTP client