all: use retrofit suspend support to hide implementation details of API

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2020-09-23 13:48:37 +05:30
parent a3b1e02783
commit a66186adc3
No known key found for this signature in database
GPG key ID: 366D7BBAD1031E80
3 changed files with 3 additions and 20 deletions

View file

@ -7,7 +7,7 @@ dependencies {
def moshi_version = "1.9.3"
def retrofit_version = "2.9.0"
implementation project(":model")
api "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-moshi:$retrofit_version"
kaptTest "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"
testImplementation 'junit:junit:4.13'

View file

@ -1,10 +1,9 @@
package dev.msfjarvis.lobsters.api
import dev.msfjarvis.lobsters.model.LobstersPost
import retrofit2.Call
import retrofit2.http.GET
interface LobstersApi {
@GET("hottest.json")
fun getHottestPosts(): Call<List<dev.msfjarvis.lobsters.model.LobstersPost>>
suspend fun getHottestPosts(): List<LobstersPost>
}