QueryBuilder

Collects the questions for one request, keyed by ids you choose. Every function returns a QuestionRef handle, so val urgent = noul(...) then result[urgent] works too.

Functions

Link copied to clipboard
fun attach(vararg images: JevImage)

Attaches images to this request, so their bytes are sent. Placing an image (in a string, an entry, a builder overload or the state) never attaches it.

Link copied to clipboard
fun box(id: String, instructions: String): QuestionRef<BoxAnswer>

A Box: where, in an image attached to the request, the thing instructions describes is. Needs Jev 1.14.

fun box(id: String, instructions: JsonElement): QuestionRef<BoxAnswer>
Link copied to clipboard
inline fun <E : Enum<E>> choice(id: String, instructions: String): QuestionRef<ChoiceAnswer<E>>

A Choice over the constants of E; see JevOption for descriptions and custom keys.

inline fun <E : Enum<E>> choice(id: String, instructions: JsonElement): QuestionRef<ChoiceAnswer<E>>
fun choice(id: String, instructions: String, options: ChoiceBuilder.() -> Unit): QuestionRef<ChoiceAnswer<String>>
fun choice(id: String, instructions: JsonElement, options: ChoiceBuilder.() -> Unit): QuestionRef<ChoiceAnswer<String>>
Link copied to clipboard
fun include(query: JevQuery)

Adds every question of query, keeping its handles, so typed and ad-hoc questions share one request. The images the query attaches come too.

Link copied to clipboard
fun noul(id: String, instructions: String, criteria: NoulBuilder.() -> Unit? = null): QuestionRef<NoulAnswer>
fun noul(id: String, instructions: JsonElement, criteria: NoulBuilder.() -> Unit? = null): QuestionRef<NoulAnswer>
Link copied to clipboard
fun question(id: String, question: Question): QuestionRef<Answer>

Adds a Question built directly, e.g. one generated programmatically. Its option map or level list is copied, so changing the original afterwards changes nothing. Reading the handle checks that the answer is of the question's type, as the typed builders' handles do.

Link copied to clipboard
fun score(id: String, instructions: String, levels: ScoreBuilder.() -> Unit): QuestionRef<ScoreAnswer>
fun score(id: String, instructions: JsonElement, levels: ScoreBuilder.() -> Unit): QuestionRef<ScoreAnswer>