Closed dessalines closed 4 months ago
Which types beside SuccessResponse
is missing?
I have SuccessResponse
explicitly not included because currently it just hardcoded true
value. I did not see any value in having the extra parsing cost + extra complexity to turn the result into a failure if success is false.
Result<Unit>
conveys the same information
SuccessResponse is a struct that's used in a lot of responses, and has a success field:
pub struct SuccessResponse {
pub success: bool,
}
I suppose I could force that into Result
No I mean for this client.
I return Result<Unit>
Result<SuccessResponse>
is awkard API to use
For example
api.hidePost(HidePost(listOf(1), true)).onSuccess {
if (it.sucesss) {
doSucess()
} else {
doFailure()
}
}.onFailure {
doFailure()
}
vs
api.hidePost(HidePost(listOf(1), true))
.onSuccess {
doSuccess()
}
.onFailure {
doFailure()
}
Same in Lemmy-js-client where it returns a promise, you will have to explicitly check success in your then
chain instead of your catch
Since Result already perfectly represents success/failure its pointless to have another object
Okay thx, I'll try this out.
I'm trying to add
HidePost
, and a few other related0.19.4
actions to jerboa, but some types are missing.