BulletTrain 2.0.1

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

// Install BulletTrain as a Cake Tool
#tool nuget:?package=BulletTrain&version=2.0.1                

<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 once 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);

You can then use the instance static variable on BulletTrainClient anywhere within your app.

To check if a feature flag exists and is enabled:

bool featureEnabled = await BulletTrainClient.instance.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 BulletTrainClient.instance.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 BulletTrainClient.instance.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 BulletTrainClient.instance.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 BulletTrainClient.instance.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:

string userTrait = await BulletTrainClient.instance.GetTrait("my_user_id", "cookies_key");
bool userTrait = await BulletTrainClient.instance.GetBoolTrait("my_user_id", "cookies_key");
int userTrait = await BulletTrainClient.instance.GetIntegerTrait("my_user_id", "cookies_key");

To get filtered user traits:

List<Trait> userTraits = await BulletTrainClient.instance.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 BulletTrainClient.instance.SetTrait("my_user_id", "my_user_trait", "blue");
Trait userTrait = await BulletTrainClient.instance.SetTrait("my_user_id", "my_user_number_trait", 4);
Trait userTrait = await BulletTrainClient.instance.SetTrait("my_user_id", "my_user_bool_trait", true);

To increment a numeric user trait:

Trait userTrait = await BulletTrainClient.instance.IncrementTrait("my_user_id", "my_user_number_trait", 1);

To retrieve a user identity (both features and traits):

Identity userIdentity = await BulletTrainClient.instance.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 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.

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
2.2.0 27,721 7/30/2021 2.2.0 is deprecated because it is no longer maintained.
2.1.7 413 7/13/2021
2.1.6 344 7/12/2021
2.1.4 33,828 11/30/2020
2.1.3 65,888 11/6/2020
2.1.2 477 11/3/2020
2.1.1 1,019 10/30/2020
2.1.0 444 10/28/2020
2.0.1 11,942 5/28/2020
2.0.0 2,893 4/26/2020
1.0.1 10,468 3/8/2019
1.0.0 3,041 1/14/2019

Singleton HTTP client