API reference
FlagsmithBehaviour (MonoBehaviour)
| Member | Description |
|---|---|
Flags Flags |
The latest flags. Empty until the first fetch |
string Identifier |
The identity flags are fetched for |
IDictionary<string, object> Traits |
Traits sent with every refresh |
FlagsmithClient Client |
The underlying client |
event Action<Flags> FlagsChanged |
First fetch and every change |
void Init(FlagsmithOptions, string id = null, float refresh = 60) |
Configure from code, right after AddComponent |
void Bind(object target) |
Keep [FlagsmithValue] members in sync |
Flag GetExperimentFlag(string name) |
The flag, recording an exposure if enrolled |
void TrackEvent(string name, object value = null, IDictionary<string, object> metadata = null) |
Queue an event for this identity |
Task Refresh() |
Fetch now |
FlagsmithClient
| Member | Description |
|---|---|
FlagsmithClient(FlagsmithOptions, ITransport = null, IFlagCache = null, Func<long> nowMs = null) |
Throws for a missing or server-side key. Loads events saved by a previous session |
Task<Flags> GetEnvironmentFlags() |
Environment defaults |
Task<Flags> GetIdentityFlags(string identifier, IDictionary<string, object> traits = null) |
Flags for one identity |
Task<Flag> GetExperimentFlag(string name, string identifier, IDictionary<string, object> traits = null) |
Fetch and record an exposure |
void TrackExposure(Flag flag, string identifier) |
Record an exposure for a flag you already have |
void TrackEvent(string name, string identifier = null, object value = null, IDictionary<string, object> metadata = null) |
Queue an event |
Task FlushEvents() |
Send the queue now |
void SaveEvents() |
Write the queue to the cache |
int PendingEvents |
Events waiting to be sent |
Flags and Flag
| Member | Description |
|---|---|
Flags.Source |
Server, Cache or Defaults |
Flags.All |
Every flag |
Flags.Get(name) |
A Flag, or null |
Flags.IsEnabled(name) |
The on/off state, false when missing |
Flags.GetValue<T>(name, fallback) |
The converted value, or the fallback |
Flag.Name, Enabled, Value |
Value is text, or null |
Flag.Variant |
The multivariate option key, for example control |
Flag.ExperimentId, ExperimentName, InExperiment |
Set when an experiment runs on the flag |