https://kotlinlang.org logo
c

cdepillabout

06/13/2016, 2:17 AM
If I were to change this to something like, it would still compile, but might fail at runtime if there is no way to deserialize a
RequestBody
to an
Int
.
Copy code
interface MyService {
    @POST("user/register")
    fun register(@Body registerRequest: RegistrationRequest): Call<Int>

    companion object Factory {
        fun create(): MyService {
            return Retrofit.Builder()
                    .baseUrl("<http://192.168.223.101:8091/v0/>")
                    .addConverterFactory(GsonConverterFactory.create())
                    .build()
                    .create(MyService::class.java)
        }
    }
}