Retrofit이란?
REST API 호출을 인터페이스 선언만으로 구현하게 하는 Android HTTP 라이브러리다.
예
interface Api {
@GET("users/{id}")
suspend fun getUser(@Path("id") id: String): User
}생태계
OkHttp + Moshi(JSON) + Kotlinx Serialization 조합이 표준.
Square의 Android HTTP 클라이언트. 타입 안전 API 호출.
REST API 호출을 인터페이스 선언만으로 구현하게 하는 Android HTTP 라이브러리다.
interface Api {
@GET("users/{id}")
suspend fun getUser(@Path("id") id: String): User
}OkHttp + Moshi(JSON) + Kotlinx Serialization 조합이 표준.