summaryrefslogtreecommitdiff
path: root/app/src/main/java/xyz/adjutor/aniki/presentation/Singletons.kt
blob: 896757c1287e68ff83eaa5c1268e7197a9a58e05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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.*
import xyz.adjutor.aniki.presentation.Constants.Companion.baseUrl

class Singletons {

    companion object {

        val gson: Gson = GsonBuilder()
            .setLenient()
            .create()

        val topMangaApi: TopMangaApi = Retrofit.Builder()
            .baseUrl(baseUrl)
            .addConverterFactory(GsonConverterFactory.create(gson))
            .build()
            .create(TopMangaApi::class.java)

        val searchMangaApi: SearchMangaApi = Retrofit.Builder()
            .baseUrl(baseUrl)
            .addConverterFactory(GsonConverterFactory.create(gson))
            .build()
            .create(SearchMangaApi::class.java)

        val mangaApi: MangaApi = Retrofit.Builder()
            .baseUrl(baseUrl)
            .addConverterFactory(GsonConverterFactory.create(gson))
            .build()
            .create(MangaApi::class.java)

        val topAnimeApi: TopAnimeApi = Retrofit.Builder()
            .baseUrl(baseUrl)
            .addConverterFactory(GsonConverterFactory.create(gson))
            .build()
            .create(TopAnimeApi::class.java)

        val searchAnimeApi: SearchAnimeApi = Retrofit.Builder()
            .baseUrl(baseUrl)
            .addConverterFactory(GsonConverterFactory.create(gson))
            .build()
            .create(SearchAnimeApi::class.java)

        val animeApi: AnimeApi = Retrofit.Builder()
            .baseUrl(baseUrl)
            .addConverterFactory(GsonConverterFactory.create(gson))
            .build()
            .create(AnimeApi::class.java)
    }

}