-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Kotlin's Result #3558
Comments
I doubt if Retrofit should support kotlin Result at this moment, because returning kotlin Result from functions is not the default behavior. Anyway, this call adapter will work for your use case. |
Initially I thought that might be a good addition, but I guess you can always use runCatching if you want the type wrapped in
|
|
You can try my solution - https://github.com/agamula90/RetrofitKx, hosted on mavenCentral, based on retrofit + moshi + ksp if you are are looking for better kotlin api |
As a workaround, you can try out https://github.com/connyduck/networkresult-calladapter. |
Now that inline classes are stable in Kotlin 1.5.0, it would be nice to have API endpoints return Result to wrap the outcome (success/failure) of a retrofit call, instead of returning a value or throwing an exception.
For example:
The text was updated successfully, but these errors were encountered: