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

Link to this type

options()

View Source (since 0.1.0)
@type options() :: keyword()
@type t() :: %OpenFeature.Client{
  context: OpenFeature.Types.context(),
  domain: OpenFeature.Types.domain(),
  hooks: [OpenFeature.Hook.t()],
  provider: OpenFeature.Provider.t()
}

Functions

Link to this function

add_event_handler(client, type, handler)

View Source (since 0.1.0)
@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.

Link to this function

add_hooks(client, hooks)

View Source (since 0.1.0)
@spec add_hooks(client :: t(), hooks :: [OpenFeature.Hook.t()]) :: t()

Adds hooks to the end of the list of current client hooks.

Link to this function

clear_handlers(client)

View Source (since 0.1.0)
@spec clear_handlers(client :: t()) :: :ok

Clears all event handlers for the client.

Link to this function

clear_hooks(client)

View Source (since 0.1.0)
@spec clear_hooks(client :: t()) :: t()

Clears all hooks for the client.

Link to this function

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.

Link to this function

get_boolean_value(client, key, default, opts \\ [])

View Source (since 0.1.0)
@spec get_boolean_value(
  client :: t(),
  key :: binary(),
  default :: boolean(),
  opts :: options()
) :: boolean()

Returns a boolean value for a given client flag.

Link to this function

get_context(client)

View Source (since 0.1.0)
@spec get_context(client :: t()) :: OpenFeature.Types.context()

Retrieves the context of the client.

Link to this function

get_hooks(client)

View Source (since 0.1.0)
@spec get_hooks(client :: t()) :: [OpenFeature.Hook.t()]

Retrieves the list of hooks for the client.

Link to this function

get_map_details(client, key, default, opts \\ [])

View Source (since 0.1.0)
@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.

Link to this function

get_map_value(client, key, default, opts \\ [])

View Source (since 0.1.0)
@spec get_map_value(
  client :: t(),
  key :: binary(),
  default :: map(),
  opts :: options()
) :: map()

Returns a map value for a given client flag.

Link to this function

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.

Link to this function

get_number_value(client, key, default, opts \\ [])

View Source (since 0.1.0)
@spec get_number_value(
  client :: t(),
  key :: binary(),
  default :: number(),
  opts :: options()
) :: number()

Returns a number value for a given client flag.

Link to this function

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.

Link to this function

get_string_value(client, key, default, opts \\ [])

View Source (since 0.1.0)
@spec get_string_value(
  client :: t(),
  key :: binary(),
  default :: binary(),
  opts :: options()
) :: binary()

Returns a string value for a given client flag.

Link to this function

list_handlers(client, type)

View Source (since 0.1.0)
@spec list_handlers(client :: t(), type :: OpenFeature.Types.event_type()) :: [
  OpenFeature.Types.event_handler()
]

Lists all event handlers for the client.

Link to this function

remove_event_handler(client, type, handler)

View Source (since 0.1.0)
@spec remove_event_handler(
  client :: t(),
  type :: OpenFeature.Types.event_type(),
  handler :: OpenFeature.Types.event_handler()
) :: :ok

Removes an event handler for the client.

Link to this function

set_context(client, context)

View Source (since 0.1.0)
@spec set_context(client :: t(), context :: OpenFeature.Types.context()) :: t()

Sets the context for the client.