A pluggable sealed API result type for modeling Retrofit responses.
1.9.22
.Full Changelog: https://github.com/slackhq/EitherNet/compare/1.8.0...1.8.1
fold()
functions and introduce new ones that use the underlying value rather than Success
. This was an oversight in the previous implementation. Binary compatibility is preserved.inline
where possible to allow carried over context (i.e. in suspend functions, etc)onSuccess
and onFailure*
functional extension APIs to ApiResult
.Full Changelog: https://github.com/slackhq/EitherNet/compare/1.7.0...1.8.0
ApiResult<*, *>.successOrNothing()
and ApiResult.Failure<*>.exceptionOrNull()
functional extension APIs.1.9.20
.Full Changelog: https://github.com/slackhq/EitherNet/compare/1.6.0...1.7.0
shouldRetry
parameter to retryWithExponentialBackoff()
to allow conditional short-circuiting of retries.Full Changelog: https://github.com/slackhq/EitherNet/compare/1.5.0...1.6.0
successOrNull
, successOrElse
, and fold
functional extension APIs to ApiResult
. These allow easy happy path-ing in user code to coerce results into a concrete value.1.9.0
.Unit
-returning endpoints when encountering a 204 or 205 response code.Thanks to @JDSM01 for contributing to this release!
Happy new year!
A common pattern in making network requests is to retry with exponential backoff. EitherNet now ships with a highly configurable retryWithExponentialBackoff()
function for this case.
// Defaults for reference
val result = retryWithExponentialBackoff(
maxAttempts = 3,
initialDelay = 500.milliseconds,
delayFactor = 2.0,
maxDelay = 10.seconds,
jitterFactor = 0.25,
onFailure = null, // Optional Failure callback for logging
) {
api.getData()
}
1.8.21
.1.7.1
.org.jetbrains.kotlinx:kotlinx-coroutines-core
.1.8.0
.Full Changelog: https://github.com/slackhq/EitherNet/compare/1.2.1...1.3.0
1.6.10
.1.6.0
(test-fixtures only)testFixtures(...)
syntax.