Skip to content

Instantly share code, notes, and snippets.

@krzdabrowski
Last active April 17, 2019 08:19
Show Gist options
  • Save krzdabrowski/5b3290e733cde27249107b9bcdbdd152 to your computer and use it in GitHub Desktop.
Save krzdabrowski/5b3290e733cde27249107b9bcdbdd152 to your computer and use it in GitHub Desktop.
@GET("rockets")
fun getRocketsAsync(): Deferred<Response<List<Rocket>>>
@GET("launches/upcoming")
fun getNextFlightsAsync(): Deferred<Response<List<Flight>>>
@GET("history")
fun getPastEventsAsync(): Deferred<Response<List<Event>>>
companion object {
fun create(): SpaceXService {
return Retrofit.Builder()
.baseUrl(BuildConfig.SPACEX_API_URL)
.addConverterFactory(GsonConverterFactory.create())
.addCallAdapterFactory(CoroutineCallAdapterFactory())
.build()
.create(SpaceXService::class.java)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment