Skip to content

Instantly share code, notes, and snippets.

@satoshun
Created September 6, 2018 23:18
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 satoshun/55447c1f56e8f9800700671c4c55e9b4 to your computer and use it in GitHub Desktop.
Save satoshun/55447c1f56e8f9800700671c4c55e9b4 to your computer and use it in GitHub Desktop.
interface RRR {
@GET("data/2.5/weather")
fun _getWeather(
@Query("a1") a1: Int,
@Query("a2") a2: String
): Deferred<Resp>
}
val RRR.getWeather get() = ::_getWeather.toSuspend
val <A1, A2, R> ((A1, A2) -> Deferred<R>).toSuspend
get(): (suspend (A1, A2) -> R) = { a1, a2 -> this(a1, a2).await() }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment