Fetching contributors…
Cannot retrieve contributors at this time
25 lines (22 sloc) 1.04 KB
package com.andresjakl.partslist
import android.util.Log
import com.jakewharton.retrofit2.adapter.kotlin.coroutines.CoroutineCallAdapterFactory
import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory
// Singleton pattern in Kotlin:
object WebAccess {
val partsApi : PartsApiClient by lazy {
Log.d("WebAccess", "Creating retrofit client")
val retrofit = Retrofit.Builder()
// The address routes request from the Android emulator
// to the localhost / of the host PC
// Moshi maps JSON to classes
// The call adapter handles threads
// Create Retrofit client
return@lazy retrofit.create(