Last active
February 10, 2020 20:27
-
-
Save lukaszkalnik/78febf9c533507544272a91f974b56b3 to your computer and use it in GitHub Desktop.
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
package net.grandcentrix.gatewayapi.domain.usecase | |
internal typealias GetLightsUseCase = suspend (String) -> Either<Throwable, List<Light>> | |
internal typealias EntityConverter<T> = (Entity) -> T | |
internal fun getLightsUseCaseFactory( | |
api: GatewayApi, | |
converter: EntityConverter<List<Light>> | |
): GetLightsUseCase = { roomId: String -> | |
api.getLights(roomId) | |
.toEither() | |
.map { converter(it) } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment