Skip to content

Commit

Permalink
[Feat] createBaseRetrofit 수정 (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
arinming committed May 24, 2024
1 parent 0dac1b4 commit 272f707
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/src/main/java/com/sopt/now/data/module/ApiFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import kotlinx.serialization.json.Json
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.create

object ApiFactory {
private const val BASE_URL: String = BuildConfig.AUTH_BASE_URL
Expand All @@ -31,11 +32,11 @@ object ApiFactory {
.build()
}

inline fun <reified T> createBase(): T = baseRetrofit.create(T::class.java)
inline fun <reified T> createFollower(): T = followerRetrofit.create(T::class.java)
inline fun <reified T> createBaseRetrofit(): T = baseRetrofit.create()
inline fun <reified T> createFollowerRetrofit(): T = followerRetrofit.create()
}

object ServicePool {
val authService = ApiFactory.createBase<AuthService>()
val followerService = ApiFactory.createFollower<FollowerService>()
val authService = ApiFactory.createBaseRetrofit<AuthService>()
val followerService = ApiFactory.createFollowerRetrofit<FollowerService>()
}

0 comments on commit 272f707

Please sign in to comment.