interface Client {
    metadata: ClientMetadata;
    providerStatus: ProviderStatus;
    addHandler(eventType: ConfigurationChanged, handler: EventHandler<ConfigurationChanged>): void;
    addHandler(eventType: ClientNotChangeEvents, handler: EventHandler<ClientNotChangeEvents>): void;
    addHandler(eventType: ProviderEvents, handler: EventHandler<ProviderEvents>): void;
    addHooks(...hooks: BaseHook<FlagValue, unknown, unknown>[]): Client;
    clearHooks(): Client;
    getBooleanDetails(flagKey: string, defaultValue: boolean, options?: FlagEvaluationOptions): EvaluationDetails<boolean>;
    getBooleanValue(flagKey: string, defaultValue: boolean, options?: FlagEvaluationOptions): boolean;
    getHandlers(eventType: ProviderEvents): EventHandler<ProviderEvents>[];
    getHooks(): BaseHook<FlagValue, unknown, unknown>[];
    getNumberDetails(flagKey: string, defaultValue: number, options?: FlagEvaluationOptions): EvaluationDetails<number>;
    getNumberDetails<T>(flagKey: string, defaultValue: T, options?: FlagEvaluationOptions): EvaluationDetails<T>;
    getNumberValue(flagKey: string, defaultValue: number, options?: FlagEvaluationOptions): number;
    getNumberValue<T>(flagKey: string, defaultValue: T, options?: FlagEvaluationOptions): T;
    getObjectDetails(flagKey: string, defaultValue: JsonValue, options?: FlagEvaluationOptions): EvaluationDetails<JsonValue>;
    getObjectDetails<T>(flagKey: string, defaultValue: T, options?: FlagEvaluationOptions): EvaluationDetails<T>;
    getObjectValue(flagKey: string, defaultValue: JsonValue, options?: FlagEvaluationOptions): JsonValue;
    getObjectValue<T>(flagKey: string, defaultValue: T, options?: FlagEvaluationOptions): T;
    getStringDetails(flagKey: string, defaultValue: string, options?: FlagEvaluationOptions): EvaluationDetails<string>;
    getStringDetails<T>(flagKey: string, defaultValue: T, options?: FlagEvaluationOptions): EvaluationDetails<T>;
    getStringValue(flagKey: string, defaultValue: string, options?: FlagEvaluationOptions): string;
    getStringValue<T>(flagKey: string, defaultValue: T, options?: FlagEvaluationOptions): T;
    removeHandler(eventType: ProviderEvents, handler: EventHandler<ProviderEvents>): void;
    setLogger(logger: Logger): Client;
    track(trackingEventName: string, 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

    • Optionaloptions: FlagEvaluationOptions

      Additional flag evaluation options

    Returns 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)

  • Track a user action or application state, usually representing a business objective or outcome.

    Parameters

    • trackingEventName: string

      an identifier for the event

    • OptionaltrackingEventDetails: TrackingEventDetails

      the details of the tracking event

    Returns void