Skip to content

Instantly share code, notes, and snippets.

@lammertw
Created March 8, 2021 17:57
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 lammertw/98d61994a3a9b39600e670ddef2329f2 to your computer and use it in GitHub Desktop.
Save lammertw/98d61994a3a9b39600e670ddef2329f2 to your computer and use it in GitHub Desktop.
data class Restaurant(val id: Int, val name: String, val priceCategory: String)
data class Reservation(val id: Int, val date: Long, val numberOfGuests: Int)
sealed class Response<T> {
class Loading<T>: Response<T>()
class Failed<T>: Response<T>()
data class Success<T>(val data: T): Response<T>()
}
interface Api {
fun restaurant(id: Int): Flow<Response<Restaurant>>
fun restaurantReservations(restaurantId: Int): Flow<Response<List<Reservation>>>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment