Where is suspendCoroutine supposed to be used?

Yes, it is.
However you have to resume always or you coroutine suspends indefinitely.

Consider the following code:

suspend fun <T> Call<T>.executeAwait(): Response<T> = suspendCancellableCoroutine { continuation ->
    check(!isExecuted())
    continuation.invokeOnCancellation { this@executeAwait.cancel() }

    enqueue(object : Callback<T> {
        override fun onFailure(call: Call<T>, error: Throwable) {
            continuation.resumeWithException(error)
        }

        override fun onResponse(call: Call<T>, response: Response<T>) {
            continuation.resume(response)
        }
    })
}
4 Likes