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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.