Koople
Search…
C#

If still not registered, sign up and create an account at https://koople.io.
  1. 1.
    Add SDK library
Package Manager
.NET CLI
PackageReference
Paket CLI
Install-Package koople-sdk -Version 0.1.1
dotnet add package koople-sdk --version 0.1.1
<PackageReference Include="koople-sdk" Version="0.1.1" />
paket add koople-sdk --version 0.1.1
Refer to the Nuget release page to identify the latest version.
2. Initliaze the SDK
var client = KClient.Initialize('YOUR_API_KEY');
3. Get your feature flags values
var user = KUser.Create('aUserId');
var isEnabled = client.IsEnabled('myAwesomeFeature', user);
if (isEnabled) {
// Do something when the feature is enabled.
} else {
// Do something when the feature is not enabled.
}
Identify users to allow specific targets. See KUser.
var user = KUser.Create('aUserId');
var isEnabled = client.IsEnabled('myAwesomeFeature', user);
if (isEnabled) {
// Do something when the feature is enabled.
} else {
// Do something when the feature is not enabled.
}

Use initialize to get a validated client object.
Parameter
Description
apiKey
The server ApiKey for your project environment.
required
poolingInterval
Interval in seconds with which the SDK makes requests to the server to update the evaluation object.
optional
Interval in seconds with which the SDK makes requests to the server to update the evaluation object. The minimum value is 10 seconds. If the value is less than 10 it will be ignored and automatically set to 10. The default value is 60 seconds.
var fclient = KClient.Initialize('YOUR_API_KEY', 30);

The isEnabled method will return a boolean indicating whether a release toggle is enabled or disabled.
Name
Type
releaseToggleKey
string
required
user
KUser
optional
//anonymous evaluation
client.IsEnabled('myAwesomeFeature');
var user = KUser.create('aUserId');
client.IsEnabled('myAwesomeFeature', user);
The evaluation of an unexistent releaseToggleKey will return false as an evaluation result.

The valueOf method will return a value for a remote config. You can pass an optional second parameter that will be used as a fallback if there is no value.
Name
Type
remoteConfigKey
string
required
user
KUser
optional
defaultValue
string
optional
client.ValueOf('theme');
// or
client.ValueOf('theme', 'defaultValue');
var user = KUser.Create('aUserId');
client.ValueOf('theme', user);
//or
client.ValueOf('theme', user, 'defaultValue');

The KUser object represents a user with the properties to be evaluated. The properties can be added in the following ways.
Name
Type
identity
string
required
attributes
List<KUserAttribute>
optional
var attributes = new[] {
new KUserAttribute("age", 17),
new KUserAttribute("gender", "male")
};
var user = KUser.Create("userId", attributes);
The user can be created first for adding attributes later.
var user = KUser.Create("userId")
.With("age", 17)
.With("gender", "male");
Also, the user can be created as an anonymous user.
var user = KUser.Anonymous();

The KUserAttribute represents a key-value object to set the name and value of a user attribute.
Name
Type
name
string
required
value
Object
required
Value object can be a string, a number or a boolean type.
new KUserAttribute("age", 17);
new KUserAttribute("gender", "male");
new KUserAttribute("vip", true);
Copy link
On this page
Getting Started
Methods
Initialize
IsEnabled
ValueOf
Objects
KUser
KUserAttribute