Skip to content

Instantly share code, notes, and snippets.

@lukaszkalnik
Last active February 10, 2020 21:48
Show Gist options
  • Save lukaszkalnik/f6a252ad422ba4b55ccbb64f6bb106e0 to your computer and use it in GitHub Desktop.
Save lukaszkalnik/f6a252ad422ba4b55ccbb64f6bb106e0 to your computer and use it in GitHub Desktop.
package net.grandcentrix.gatewayapi.api
interface GatewayApiService {
suspend fun getLights(roomId: String): Either<Throwable, List<Light>>
suspend fun getSystemDetail(): Either<Throwable, SystemDetail>
companion object {
fun with(baseUrl: String): GatewayApiService {
val api = GatewayApi.create(baseUrl)
val lightsConverter = provideConverter<List<Light>>(tag = Tag.LIGHT_LIST)
val systemDetailConverter = //...
return DefaultGatewayApiService(
getLightsUseCase = getLightsUseCaseFactory(api, lightsConverter),
getSystemDetailUseCase = getSystemDetailUseCaseFactory(api, systemDetailConverter)
)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment