From e3aba7bb8157ab06bb9f2f1d32d214e8daf67415 Mon Sep 17 00:00:00 2001 From: Giovanni Junseo Kim Date: Tue, 2 Apr 2024 01:28:32 +0900 Subject: [PATCH] update data logic (#12) * chore: add kotlin.serialization * chore: update ApiFactory --- app/build.gradle.kts | 1 + .../java/univ/earthbreaker/namu/data/ApiFactory.kt | 10 ++++++---- build.gradle.kts | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 1113e4e..b3085c8 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -3,6 +3,7 @@ plugins { alias(libs.plugins.jetbrainsKotlinAndroid) alias(libs.plugins.ktlint) id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin") + kotlin("plugin.serialization") } android { diff --git a/app/src/main/java/univ/earthbreaker/namu/data/ApiFactory.kt b/app/src/main/java/univ/earthbreaker/namu/data/ApiFactory.kt index a2081ca..80f9cd8 100644 --- a/app/src/main/java/univ/earthbreaker/namu/data/ApiFactory.kt +++ b/app/src/main/java/univ/earthbreaker/namu/data/ApiFactory.kt @@ -20,18 +20,20 @@ object ApiFactory { val retrofitForGrowTreeServer: Retrofit by lazy { Retrofit.Builder().baseUrl(BuildConfig.GROW_TREE_BASE_URL).client(client) - .addConverterFactory(Json.asConverterFactory("application/json".toMediaType())).build() + .addConverterFactory( + Json.asConverterFactory("application/json".toMediaType()), + ).build() } - val retrofitForChatGPT: Retrofit by lazy { - Retrofit.Builder().baseUrl(BuildConfig.CHAT_GPT_BASE_URL).client(client) + val retrofitForOpenAiService: Retrofit by lazy { + Retrofit.Builder().baseUrl(BuildConfig.OPEN_AI_BASE_URL).client(client) .addConverterFactory(Json.asConverterFactory("application/json".toMediaType())).build() } inline fun create(forWhichServer: Server): T = when (forWhichServer) { Server.GrowTreeServer -> retrofitForGrowTreeServer.create(T::class.java) - Server.ChatGPT -> retrofitForChatGPT.create(T::class.java) + Server.ChatGPT -> retrofitForOpenAiService.create(T::class.java) } } diff --git a/build.gradle.kts b/build.gradle.kts index d8fe9fc..2c42a1e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,8 +4,8 @@ plugins { alias(libs.plugins.jetbrainsKotlinAndroid) apply false alias(libs.plugins.ktlint) apply false - kotlin("jvm") version "1.9.23" - kotlin("plugin.serialization") version "1.9.23" + kotlin("jvm") version "1.9.23" apply false + kotlin("plugin.serialization") version "1.9.23" apply false } buildscript {