Multiplatform Ktor schema declaration • opensavvy.spine.api • Parameters
Parameters¶
abstract class Parameters(val data: ParameterStorage = HashMap())
Additional parameters for endpoints.
Endpoints declare mandatory parameters, such as the identifier of the resource. This abstract class allows to declare additional parameters in a type-safe manner.
Usage¶
In common code, declare a class that inherits from Parameters, and use it to declare the name and type of the available parameters:
class MyRequestParameters(data: ParameterStorage) : Parameters(data) {
var param1: String? by parameter()
var isSubscribed: Boolean by parameter("is_subscribed", default = false)
}
To create a new parameter bundle, use the helper buildParameters function:
The values can be accessed in a type-safe manner:
The values can also be accessed via their string representation:
Inheritors¶
Constructors¶
Parameters¶
constructor(data: ParameterStorage = HashMap())
Types¶
Empty¶
object Empty : Parameters
The default parameter instance.
Parameter¶
A declared query parameter in an API schema.
UnnamedParameter¶
@JvmInline
value class UnnamedParameter<T>
Internal type used by the parameter declaration syntax.
Properties¶
data¶
val data: ParameterStorage
Internal string representation of the parameters.