Skip to content

Commit

Permalink
feat: createJsonRetrofit的变体
Browse files Browse the repository at this point in the history
  • Loading branch information
muedsa committed Nov 12, 2024
1 parent 7cc08ac commit 9d4d3ee
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions api/src/main/java/com/muedsa/tvbox/tool/HttpTool.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ fun createOkHttpClient(
}
.build()

fun <T> createJsonRetrofit(
baseUrl: String,
service: Class<T>,
okHttpClient: OkHttpClient
): T {
return Retrofit.Builder()
.baseUrl(baseUrl)
.addConverterFactory(LenientJson.asConverterFactory("application/json".toMediaType()))
.client(okHttpClient)
.build()
.create(service)
}

fun <T> createJsonRetrofit(
baseUrl: String,
service: Class<T>,
Expand Down

0 comments on commit 9d4d3ee

Please sign in to comment.