Skip to content

Instantly share code, notes, and snippets.

@Audhil Audhil/APIs.kt
Created Jul 27, 2019

Embed
What would you like to do?
class APIKindaStuff {
interface APIService {
@GET("/users/{user}")
fun greetUser(@Path("user") user: String): Call<ResponseBody>
@Headers("Content-type: application/json")
@POST("/api/post_some_data")
fun getVectors(@Body body: JsonObject): Call<ResponseBody>
}
companion object {
private val retrofit = Retrofit.Builder()
.baseUrl("http://XXX.XXX.X.X:5000")
.addConverterFactory(GsonConverterFactory.create(GsonBuilder().create()))
.build()
var service = retrofit.create(APIService::class.java)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.