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

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

    • Optional context: EvaluationContext

      The evaluation context used on an individual flag evaluation

    • Optional options: 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)