QueryParameter

data class QueryParameter<Q : Any>(val name: String, val codec: StringCodec<Q>, val default: Option<Q?>) : Parameter<Q> (source)

Query-string parameter that may be required or optional.

Query parameters become optional only when default is present, which gives generated code a value to use when the caller omits the parameter.

Constructors

Link copied to clipboard
constructor(name: String, codec: StringCodec<Q>, default: Option<Q?>)

Properties

Link copied to clipboard
open override val codec: StringCodec<Q>

Codec responsible for encoding and decoding parameter values.

Link copied to clipboard
val default: Option<Q?>

fallback used when the parameter is omitted. None means the parameter is required.

Link copied to clipboard
open override val name: String

Canonical parameter name.

Link copied to clipboard
open override val position: ParameterPosition

Location of the parameter within the HTTP request.

Link copied to clipboard
open override val required: Boolean

Indicates whether the parameter must be supplied by the caller.

Functions

Link copied to clipboard
fun optional(default: Q? = null): QueryParameter<Q>

Marks this query parameter as optional by recording the default to use when it is absent.