Skip to content

Instantly share code, notes, and snippets.

@aqua30
Created November 6, 2022 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aqua30/6a83e1255cf263a0235bc179d4710be9 to your computer and use it in GitHub Desktop.
Save aqua30/6a83e1255cf263a0235bc179d4710be9 to your computer and use it in GitHub Desktop.
object RetrofitHelper {
/**
* as dependency injection is not used in this project for brevity,
* static object initialization is done for demo purpose.
*
* @param url: Base url for apis
* @return TestApis: Instance of the test api retrofit interface
**/
fun testApiInstance(url: String): TestApis {
return Retrofit.Builder()
.baseUrl(url)
.addConverterFactory(GsonConverterFactory.create())
.build()
.create(TestApis::class.java)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment