ivano
08/13/2019, 12:04 PM@Parcelize
class RemoteDeclarationRepository : DeclarationRepositoryInterface {
private val declareService: ProActiveDeclareApi
get() = Api()
override fun getDeclarations(periodId: Int, offset: Int, limit: Int): Single<DeclarationsResponse> {
return declareService.getDeclarations(periodId, offset, limit)
}
override fun getDeclarationPeriod(id: Int): Single<DeclarationPeriod> {
return declareService.getPeriod(id).map { it.data }
} //and so on 50 times almost
Ash
08/13/2019, 12:07 PMdeclareService
inside these override functions`?ivano
08/13/2019, 12:09 PMdeclareService.getthis()
in one function, then the same in the next declareService.getThat()
ivano
08/13/2019, 12:10 PMwith
so that I can write only getThis()
or getThat
arekolek
08/13/2019, 12:57 PMclass RemoteDeclarationRepository : DeclarationRepositoryInterface, ProActiveDeclareApi by Api() {
override fun getDeclarations(periodId: Int, offset: Int, limit: Int): Single<DeclarationsResponse> {
return getDeclarations(periodId, offset, limit)
}
override fun getDeclarationPeriod(id: Int): Single<DeclarationPeriod> {
return getPeriod(id).map { it.data }
}
(then ProActiveDeclareApi
would be a public api of RemoteDeclarationRepository
, so maybe you don’t want that :P)ivano
08/13/2019, 1:14 PMivano
08/13/2019, 1:14 PM