Skip to content

Instantly share code, notes, and snippets.

@raamcosta
Last active November 30, 2021 17:10
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 raamcosta/40845046732d61b5f590ef69f214bec1 to your computer and use it in GitHub Desktop.
Save raamcosta/40845046732d61b5f590ef69f214bec1 to your computer and use it in GitHub Desktop.
class GetMagicCardUseCase(
private val magicCardsRepository: MagicTheGatheringCardsRepository
) {
suspend operator fun invoke(cardName: String) : Result<MagicCard, GetMagicCardUseCaseError> {
if (!isCardNameValid(cardName)) {
return Error(InvalidCardNameFormat)
}
//...
return magicCardsRepository.getCard(cardName)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment