buildKtorMutationKey
inline fun <T, S> buildKtorMutationKey(id: MutationId<T, S> = MutationId.auto(), crossinline mutate: suspend HttpClient.(variable: S) -> T): MutationKey<T, S>
A delegation function to build a MutationKey for Ktor.
class CreatePostKey : MutationKey<Post, PostForm> by buildKtorMutationKey(
mutate = { body ->
post("https://jsonplaceholder.typicode.com/posts") {
setBody(body)
}.body()
}
)
Content copied to clipboard
Note: httpClient is required to use the builder functions designed for soil.query.core.ContextReceiver.
Parameters
id
The identifier of the mutation key.
mutate
The mutation function that sends a request to the server.