Created
October 15, 2019 13:34
-
-
Save DenisBronx/ffa906044c45cd26e316d3f6ee8a5a7a to your computer and use it in GitHub Desktop.
Dependencies for with usecase vs without usecase
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A wrapper for handling failing requests | |
sealed class Result<T> { | |
data class Success<T>(val value: T) : Result<T>() | |
data class Failure<T>(val throwable: Throwable) : Result<T>() | |
} | |
// The models (simplified) | |
data class User(val id: String) | |
data class Transaction(val id: String, val amount: Float) | |
// The repository for the transactions | |
interface TransactionRepository { | |
fun getUserTransactions(user: User): Single<Result<List<Transaction>>> | |
} | |
// The repository for the user | |
interface UserRepository { | |
fun getUser(): Result<User> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment