aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/xyz/adjutor/aniki/presentation/Singletons.kt
diff options
context:
space:
mode:
authorClyhtsuriva <aimeric@adjutor.xyz>2021-05-14 14:27:11 +0200
committerClyhtsuriva <aimeric@adjutor.xyz>2021-05-14 14:27:11 +0200
commit6484782745a29752cf2a9a5015b34494513eb376 (patch)
treec9b4af4deb4acbac4c394e48d3df7874120d24a1 /app/src/main/java/xyz/adjutor/aniki/presentation/Singletons.kt
parenta4fbe1308bb4cf61358d8169dd32505e2783a9af (diff)
parente3104c145727c10ff80cad0fe1e916a0a45239eb (diff)
Merge branch 'release/3.1'v3.1.0
Diffstat (limited to 'app/src/main/java/xyz/adjutor/aniki/presentation/Singletons.kt')
-rw-r--r--app/src/main/java/xyz/adjutor/aniki/presentation/Singletons.kt58
1 files changed, 58 insertions, 0 deletions
diff --git a/app/src/main/java/xyz/adjutor/aniki/presentation/Singletons.kt b/app/src/main/java/xyz/adjutor/aniki/presentation/Singletons.kt
new file mode 100644
index 0000000..827c7e3
--- /dev/null
+++ b/app/src/main/java/xyz/adjutor/aniki/presentation/Singletons.kt
@@ -0,0 +1,58 @@
+package xyz.adjutor.aniki.presentation
+
+import com.google.gson.Gson
+import com.google.gson.GsonBuilder
+import retrofit2.Retrofit
+import retrofit2.converter.gson.GsonConverterFactory
+import xyz.adjutor.aniki.data.anime.AnimeApi
+import xyz.adjutor.aniki.data.anime.SearchAnimeApi
+import xyz.adjutor.aniki.data.anime.TopAnimeApi
+import xyz.adjutor.aniki.data.manga.MangaApi
+import xyz.adjutor.aniki.data.manga.SearchMangaApi
+import xyz.adjutor.aniki.data.manga.TopMangaApi
+
+class Singletons {
+
+ companion object {
+ val gson: Gson = GsonBuilder()
+ .setLenient()
+ .create()!!
+ private const val BASE_URL = "https://api.jikan.moe/"
+
+ val topMangaApi: TopMangaApi = Retrofit.Builder()
+ .baseUrl(BASE_URL)
+ .addConverterFactory(GsonConverterFactory.create(gson))
+ .build()
+ .create(TopMangaApi::class.java)
+
+ val searchMangaApi: SearchMangaApi = Retrofit.Builder()
+ .baseUrl(BASE_URL)
+ .addConverterFactory(GsonConverterFactory.create(gson))
+ .build()
+ .create(SearchMangaApi::class.java)
+
+ val mangaApi: MangaApi = Retrofit.Builder()
+ .baseUrl(BASE_URL)
+ .addConverterFactory(GsonConverterFactory.create(gson))
+ .build()
+ .create(MangaApi::class.java)
+
+ val topAnimeApi: TopAnimeApi = Retrofit.Builder()
+ .baseUrl(BASE_URL)
+ .addConverterFactory(GsonConverterFactory.create(gson))
+ .build()
+ .create(TopAnimeApi::class.java)
+
+ val searchAnimeApi: SearchAnimeApi = Retrofit.Builder()
+ .baseUrl(BASE_URL)
+ .addConverterFactory(GsonConverterFactory.create(gson))
+ .build()
+ .create(SearchAnimeApi::class.java)
+
+ val animeApi: AnimeApi = Retrofit.Builder()
+ .baseUrl(BASE_URL)
+ .addConverterFactory(GsonConverterFactory.create(gson))
+ .build()
+ .create(AnimeApi::class.java)
+ }
+}