Rate the state along an ordered scale you describe in steps.
TypeSafe.score("How frustrated is the customer?", ["Calm", "Frustrated", "Very angry"])TypeSafe's advice: ask for one snap judgment per question, and write the levels in order from low to high, two at minimum and ten at most.
levels is an ordered list from the low end of the scale to the high end.
The API needs at least two levels and accepts up to ten. Each level is a
description: a string, or a map or list when a level needs structure.
A level may also be given as {label, description}. The label is a short
name you want back in the answer (TypeSafe.Answer.Score.label), and the
pair is sent to the API as a structured level:
{"Very angry", "Threats to cancel, profanity, all caps"}
#=> {"label": "Very angry", "description": "Threats to cancel, ..."}Every level has a string label in the answer. A plain string level is its
own label; a structured level without one gets a truncated inspect/1 of
itself, which is fine for logs but not for display, so give structured
levels a label when the label matters.
Summary
Functions
The description sent to the API for a level, without any label wrapper.
The string label for a level: the label of a {label, description} pair,
a string level itself, or a truncated inspect/1 of a structured level.
Builds a Score question.
The type tag this question and its answer carry on the wire.
Types
@type level() :: TypeSafe.Question.description() | {String.t(), TypeSafe.Question.description()}
@type t() :: %TypeSafe.Question.Score{ instructions: TypeSafe.Question.description(), levels: [level()] }
Functions
@spec description(level()) :: TypeSafe.Question.description()
The description sent to the API for a level, without any label wrapper.
The string label for a level: the label of a {label, description} pair,
a string level itself, or a truncated inspect/1 of a structured level.
@spec new(TypeSafe.Question.description(), [level()]) :: t()
Builds a Score question.
@spec wire_type() :: String.t()
The type tag this question and its answer carry on the wire.