Skip to content

Instantly share code, notes, and snippets.

@hiteshchopra11
Created January 16, 2022 21:43
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 hiteshchopra11/e5ff2f82fa525de58f0b86ac5a4ae563 to your computer and use it in GitHub Desktop.
Save hiteshchopra11/e5ff2f82fa525de58f0b86ac5a4ae563 to your computer and use it in GitHub Desktop.
interface ImageService {
@GET("/photos?page=1")
suspend fun getImages(): ImageResponse
}
object RetrofitBuilder {
private const val BASE_URL = "https://api.unsplash.com/"
private fun getRetrofit(): Retrofit {
return Retrofit.Builder()
.baseUrl(BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build()
}
val apiService: ApiService = getRetrofit().create(ApiService::class.java)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment