interface Client {
    metadata: ClientMetadata;
    providerStatus: ProviderStatus;
    addHandler(eventType: ConfigurationChanged, handler: EventHandler<ConfigurationChanged>): void;
    addHandler(eventType: ServerNotChangeEvents, handler: EventHandler<ServerNotChangeEvents>): void;
    addHandler(eventType: ProviderEvents, handler: EventHandler<ProviderEvents>): void;
    addHooks(...hooks: BaseHook<FlagValue, unknown, unknown>[]): Client;
    clearHooks(): Client;
    getBooleanDetails(flagKey: string, defaultValue: boolean, context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<EvaluationDetails<boolean>>;
    getBooleanValue(flagKey: string, defaultValue: boolean, context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<boolean>;
    getContext(): EvaluationContext;
    getHandlers(eventType: ProviderEvents): EventHandler<ProviderEvents>[];
    getHooks(): BaseHook<FlagValue, unknown, unknown>[];
    getNumberDetails(flagKey: string, defaultValue: number, context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<EvaluationDetails<number>>;
    getNumberDetails<T>(flagKey: string, defaultValue: T, context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<EvaluationDetails<T>>;
    getNumberValue(flagKey: string, defaultValue: number, context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<number>;
    getNumberValue<T>(flagKey: string, defaultValue: T, context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<T>;
    getObjectDetails(flagKey: string, defaultValue: JsonValue, context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<EvaluationDetails<JsonValue>>;
    getObjectDetails<T>(flagKey: string, defaultValue: T, context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<EvaluationDetails<T>>;
    getObjectValue(flagKey: string, defaultValue: JsonValue, context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<JsonValue>;
    getObjectValue<T>(flagKey: string, defaultValue: T, context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<T>;
    getStringDetails(flagKey: string, defaultValue: string, context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<EvaluationDetails<string>>;
    getStringDetails<T>(flagKey: string, defaultValue: T, context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<EvaluationDetails<T>>;
    getStringValue(flagKey: string, defaultValue: string, context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<string>;
    getStringValue<T>(flagKey: string, defaultValue: T, context?: EvaluationContext, options?: FlagEvaluationOptions): Promise<T>;
    removeHandler(eventType: ProviderEvents, handler: EventHandler<ProviderEvents>): void;
    setContext(context: EvaluationContext): Client;
    setLogger(logger: Logger): Client;
    track(trackingEventName: string, context?: EvaluationContext, trackingEventDetails?: TrackingEventDetails): void;
}

Hierarchy (view full)

Properties

metadata: ClientMetadata
providerStatus: ProviderStatus

Returns the status of the associated provider.

Methods

  • Adds hooks that will run during flag evaluations on this receiver. Hooks are executed in the order they were registered. Adding additional hooks will not remove existing hooks. Hooks registered on the global API object run with all evaluations. Hooks registered on the client run with all evaluations on that client.

    Parameters

    • Rest...hooks: BaseHook<FlagValue, unknown, unknown>[]

      A list of hooks that should always run

    Returns Client

    The receiver (this object)

  • Performs a flag evaluation that returns a boolean.

    Parameters

    • flagKey: string

      The flag key uniquely identifies a particular flag

    • defaultValue: boolean

      The value returned if an error occurs

    • Optionalcontext: EvaluationContext

      The evaluation context used on an individual flag evaluation

    • Optionaloptions: FlagEvaluationOptions

      Additional flag evaluation options

    Returns Promise<boolean>

    Flag evaluation response

  • Sets a logger on this receiver. This logger supersedes to the global logger and is passed to various components in the SDK. The logger configured on the global API object will be used for all evaluations, unless overridden in a particular client.

    Parameters

    • logger: Logger

      The logger to be used

    Returns Client

    The receiver (this object)