Skip to content

Instantly share code, notes, and snippets.

@Audhil
Created July 27, 2019 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Audhil/0f1f5efca4a6f605f8ecbf270ab60518 to your computer and use it in GitHub Desktop.
Save Audhil/0f1f5efca4a6f605f8ecbf270ab60518 to your computer and use it in GitHub Desktop.
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