Defining Retrofit service

Retrofit turns your HTTP API into a Kotlin interface. Create an interface called JournalerBackendService inside the API package. Let's put some code in it:

 package com.journaler.api import com.journaler.model.Note import com.journaler.model.Todo import retrofit2.Call import retrofit2.http.* interface JournalerBackendService { @POST("user/authenticate") fun login( @HeaderMap headers: Map<String, String>, @Body payload: UserLoginRequest ): Call<JournalerApiToken> @GET("entity/note") fun getNotes( @HeaderMap headers: Map<String, String> ): Call<List<Note>> @GET("entity/todo") fun getTodos( @HeaderMap headers: Map<String, String> ): Call<List<Todo>> @PUT("entity/note") fun publishNotes( @HeaderMap headers: Map<String, ...

Get Mastering Android Development with Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.