View Source SplitClient (SplitClient v0.5.0)

A Split.io client for Elixir.

See Glossary for explanations about function arguments and return values

Link to this section Summary

Functions

Get all the treatments for one or more traffic types.

Get the treatment for a specific split.

Get the treatments for multiple splits.

Determine if a particular split is turned off. This is syntax sugar around the get_treatment/3 function. If your treatment has a meaningful config that could be returned then use get_treatment/3 instead

Determine if a particular split is turned on. This is syntax sugar around the get_treatment/3 function. If your treatment has a meaningful config that could be returned then use get_treatment/3 instead

Link to this section Functions

Link to this function

get_all_treatments(keys, opts \\ [])

View Source
@spec get_all_treatments(keys :: [map()], options :: keyword()) :: map()

Get all the treatments for one or more traffic types.

args

Args

  • keys - A list of maps containing the following:
    • :matching_key
    • :traffic_type
    • :bucketing_key - Optional

options

Options

  • :attributes

examples

Examples

iex> SplitClient.get_all_treatments(%{matching_key: "unique-customer-id", target_type: "customer"}, %{matching_key: "unique-user-id", target_type: "user"})
%{"customer" => %{"shiny-feature" => %Treatment{treatment: "on"}}, "user" => %{"my-experiment" => %Treatment{treatment: "off"}}}
Link to this function

get_treatment(key, split_name, opts \\ [])

View Source
@spec get_treatment(key :: String.t(), split_name :: String.t(), options :: keyword()) ::
  Treatment.t()

Get the treatment for a specific split.

args

Args

  • key
  • split_name

options

Options

  • :attributes
  • :bucketing_key
  • :cache - (defaults to true) By default the SplitClient caches evaluation results. To ignore the cache and make a direct request to the split-evaluator pass false here. This only affects reads. Results will still added to the cache.

examples

Examples

iex> SplitClient.get_treatment("unique-customer-id", "shiny-feature")
%Treatment{split_name: "shiny-feature", treatment: "on"}
Link to this function

get_treatments(key, split_names, opts \\ [])

View Source
@spec get_treatments(
  key :: String.t(),
  split_names :: [String.t()],
  options :: keyword()
) :: map()

Get the treatments for multiple splits.

args

Args

  • key
  • split_name

options

Options

  • :attributes
  • :bucketing_key
  • :cache - (defaults to true) By default the SplitClient caches evaluation results. To ignore the cache and make a direct request to the split-evaluator pass false here. This only affects reads. Results will still added to the cache.

examples

Examples

iex> SplitClient.get_treatments("unique-customer-id", ["shiny-feature", "my-experiment"])
%{"shiny-feature" => %Treatment{treatment: "on"}, "my-experiment" => %Treatment{split_name: "my-experiment", treatment: "off"}}
Link to this function

off?(key, split_name, opts \\ [])

View Source
@spec off?(key :: String.t(), split_name :: String.t(), options :: keyword()) ::
  boolean()

Determine if a particular split is turned off. This is syntax sugar around the get_treatment/3 function. If your treatment has a meaningful config that could be returned then use get_treatment/3 instead

args

Args

  • key
  • split_name

options

Options

  • :attributes
  • :bucketing_key
  • :cache - (defaults to true) By default the SplitClient caches evaluation results. To ignore the cache and make a direct request to the split-evaluator pass false here. This only affects reads. Results will still added to the cache.

examples

Examples

iex> SplitClient.off?("unique-customer-id", "shiny-feature")
true
Link to this function

on?(key, split_name, opts \\ [])

View Source
@spec on?(key :: String.t(), split_name :: String.t(), options :: keyword()) ::
  boolean()

Determine if a particular split is turned on. This is syntax sugar around the get_treatment/3 function. If your treatment has a meaningful config that could be returned then use get_treatment/3 instead

args

Args

  • key
  • split_name

options

Options

  • :attributes
  • :bucketing_key
  • :cache - (defaults to true) By default the SplitClient caches evaluation results. To ignore the cache and make a direct request to the split-evaluator pass false here. This only affects reads. Results will still added to the cache.

examples

Examples

iex> SplitClient.on?("unique-customer-id", "shiny-feature")
true