Skip to content

Instantly share code, notes, and snippets.

@cdmunoz
Created April 22, 2020 20:59
Show Gist options
  • Save cdmunoz/8ee85cb3c675cb31059b6b91312eef84 to your computer and use it in GitHub Desktop.
Save cdmunoz/8ee85cb3c675cb31059b6b91312eef84 to your computer and use it in GitHub Desktop.
interface ApiService {
@GET("photos")
suspend fun getPhotos(@Query("sol") sol: Int, @Query("api_key") apiKey: String, @Query("page") page: Int): Response<PhotosResponse>?
}
object RetrofitService {
var client: OkHttpClient = OkHttpClient.Builder().build()
private var retrofit = Retrofit.Builder().baseUrl(BuildConfig.BASE_URL)
.addConverterFactory(GsonConverterFactory.create()).client(client).build()
fun <T> createService(serviceClass: Class<T>): T = retrofit.create(serviceClass)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment