Coverage Summary for Class: NetworkEitherToResourceKt (com.javiersc.network.either.resource)
Class |
Class, %
|
Method, %
|
Branch, %
|
Line, %
|
Instruction, %
|
NetworkEitherToResourceKt |
100%
(1/1)
|
100%
(2/2)
|
62.5%
(15/24)
|
81.8%
(9/11)
|
61.3%
(103/168)
|
| @file:Suppress("LongParameterList") |
| |
| package com.javiersc.network.either.resource |
| |
| import com.javiersc.network.either.NetworkEither |
| import com.javiersc.network.either.NetworkEither.Failure |
| import com.javiersc.resource.either.ResourceEither |
| import com.javiersc.resource.either.ResourceEither.Companion.resourceFailure |
| import com.javiersc.resource.either.ResourceEither.Companion.resourceSuccess |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| public inline fun <NF, NS, F, S> NetworkEither<NF, NS>.toResource( |
| failure: (Failure<NF>) -> ResourceEither<F, S>, |
| success: (NetworkEither.Success<NS>) -> ResourceEither<F, S>, |
| ): ResourceEither<F, S> = |
| when (this) { |
| is Failure -> failure(this) |
| is NetworkEither.Success -> success(this) |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| public inline fun <NF, NS, F, S> NetworkEither<NF, NS>.toResource( |
| httpError: (Failure.Http<NF>) -> F, |
| localError: () -> F, |
| remoteError: () -> F, |
| unknownError: (Throwable) -> F, |
| success: (NetworkEither.Success<NS>) -> S, |
| isLoading: Boolean = false |
| ): ResourceEither<F, S> = |
| when (this) { |
| is Failure.Http -> resourceFailure(httpError(this), null, isLoading) |
| is Failure.Local -> resourceFailure(localError(), null, isLoading) |
| is Failure.Remote -> resourceFailure(remoteError(), null, isLoading) |
| is Failure.Unknown -> resourceFailure(unknownError(throwable), null, isLoading) |
| is NetworkEither.Success -> resourceSuccess(success(this), isLoading) |
| } |