Current section

Files

Jump to
split_client lib core treatment.ex
Raw

lib/core/treatment.ex

defmodule SplitClient.Treatment do
@moduledoc """
A structured way to represent Split.io treatment data.
This respresents the treatment the user should receive
based on the parameters given to Split.io
## Fields
* `split_name` - The name of the Split the treatment applies to. Split names
are unique even if they are associated with a different traffic type
* `treatment` - Which treatment to apply (e.g. "on"/"off")
* `config` - Optional. Extra configuration that applies to the treatment
(e.g. `%{color: "blue"}`)
"""
@type t() :: %__MODULE__{
split_name: String.t() | nil,
treatment: any() | nil,
config: map() | nil
}
defstruct split_name: nil, treatment: nil, config: nil
@spec new(fields :: keyword() | map()) :: t()
def new(fields \\ []) do
struct!(__MODULE__, fields)
end
end