Resources
Adds support for type-safe requests using ResourcesCore.
Example:
@Serializable
@Resource("/users")
data class Users {
@Serializable
@Resource("/{id}")
data class ById(val parent: Users = Users(), val id: Long)
@Serializable
@Resource("/add")
data class Add(val parent: Users = Users(), val name: String)
}
// client-side
val newUserId = client.post(Users.Add("new_user")) // "/users?name=new_user"
val addedUser = client.get(Users.ById(newUserId)) // "/user/123"
Content copied to clipboard
See also
Functions
Link copied to clipboard
Link copied to clipboard
open override fun prepare(block: Resources.Configuration.() -> Unit): Resources
Content copied to clipboard