Resources

Adds support for type-safe requests using ResourcesCore.

Example:

@Resource("/users")
class Users {
@Resource("/{id}")
class ById(val parent: Users = Users(), val id: Long)

@Resource("/add")
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"

See also

Functions

Link copied to clipboard
open override fun install(plugin: Resources, scope: HttpClient)
Link copied to clipboard
open override fun prepare(block: Resources.Configuration.() -> Unit): Resources

Properties

Link copied to clipboard
open override val key: AttributeKey<Resources>