https://kotlinlang.org logo
s

sschneider

02/13/2016, 8:18 PM
So I'm very new to kotlin and I'm trying to make a client library for my api using Fuel, is there anything wrong with how I am wrapping fuel functions?
Copy code
fun createUser(username: String, password: String, email: String, uuid: UUID, handler: (Boolean) -> Unit) {
        val body = listOf("username" to username, "password" to password, "email" to email, "uuid" to uuid)
        "/users".httpPost(body).response {request, response, result ->
            when(result) {
                is Result.Success -> handler(true)
                is Result.Failure -> handler(false)
            }
        }
    }