View Source OpenFeature.Client (OpenFeature v0.1.1)
This module defines the Client
struct and functions for managing the client's context and callbacks.
Summary
Functions
Adds an event handler for the client.
Adds hooks to the end of the list of current client hooks.
Clears all event handlers for the client.
Clears all hooks for the client.
Returns the evaluation details for a given client flag with boolean value.
Returns a boolean value for a given client flag.
Retrieves the context of the client.
Retrieves the list of hooks for the client.
Returns the evaluation details for a given client flag with map value.
Returns a map value for a given client flag.
Returns the evaluation details for a given client flag with number value.
Returns a number value for a given client flag.
Returns the evaluation details for a given client flag with string value.
Returns a string value for a given client flag.
Lists all event handlers for the client.
Removes an event handler for the client.
Sets the context for the client.
Types
@type options() :: keyword()
@type t() :: %OpenFeature.Client{ context: OpenFeature.Types.context(), domain: OpenFeature.Types.domain(), hooks: [OpenFeature.Hook.t()], provider: OpenFeature.Provider.t() }
Functions
@spec add_event_handler( client :: t(), type :: OpenFeature.Types.event_type(), handler :: OpenFeature.Types.event_handler() ) :: :ok
Adds an event handler for the client.
If the event type is the same as the client's provider state, the handler will be executed immediately.
@spec add_hooks(client :: t(), hooks :: [OpenFeature.Hook.t()]) :: t()
Adds hooks to the end of the list of current client hooks.
@spec clear_handlers(client :: t()) :: :ok
Clears all event handlers for the client.
Clears all hooks for the client.
get_boolean_details(client, key, default, opts \\ [])
View Source (since 0.1.0)@spec get_boolean_details( client :: t(), key :: binary(), default :: boolean(), opts :: options() ) :: OpenFeature.EvaluationDetails.t()
Returns the evaluation details for a given client flag with boolean value.
@spec get_boolean_value( client :: t(), key :: binary(), default :: boolean(), opts :: options() ) :: boolean()
Returns a boolean value for a given client flag.
@spec get_context(client :: t()) :: OpenFeature.Types.context()
Retrieves the context of the client.
@spec get_hooks(client :: t()) :: [OpenFeature.Hook.t()]
Retrieves the list of hooks for the client.
@spec get_map_details( client :: t(), key :: binary(), default :: map(), opts :: options() ) :: OpenFeature.EvaluationDetails.t()
Returns the evaluation details for a given client flag with map value.
Returns a map value for a given client flag.
get_number_details(client, key, default, opts \\ [])
View Source (since 0.1.0)@spec get_number_details( client :: t(), key :: binary(), default :: number(), opts :: options() ) :: OpenFeature.EvaluationDetails.t()
Returns the evaluation details for a given client flag with number value.
@spec get_number_value( client :: t(), key :: binary(), default :: number(), opts :: options() ) :: number()
Returns a number value for a given client flag.
get_string_details(client, key, default, opts \\ [])
View Source (since 0.1.0)@spec get_string_details( client :: t(), key :: binary(), default :: binary(), opts :: options() ) :: OpenFeature.EvaluationDetails.t()
Returns the evaluation details for a given client flag with string value.
@spec get_string_value( client :: t(), key :: binary(), default :: binary(), opts :: options() ) :: binary()
Returns a string value for a given client flag.
@spec list_handlers(client :: t(), type :: OpenFeature.Types.event_type()) :: [ OpenFeature.Types.event_handler() ]
Lists all event handlers for the client.
@spec remove_event_handler( client :: t(), type :: OpenFeature.Types.event_type(), handler :: OpenFeature.Types.event_handler() ) :: :ok
Removes an event handler for the client.
@spec set_context(client :: t(), context :: OpenFeature.Types.context()) :: t()
Sets the context for the client.