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
How do I use Sandwich if the json is not a standard? #30
Comments
Hi, could you let me know what kind of serialization library do you use? e.g., Gson, Moshi |
Gson or Moshi ,I can use them all |
I think this issue is related to the usage of |
That way I can't request in Sandwich like Pokedex App. Now MyApp request like this
}`
` suspend fun safeApiCall(call: suspend () -> Result, errorMessage: String): Result { suspend fun executeResponse(
`sealed class Result {
}` So I think it's going to be more troublesome to use Sandwich in my app |
Hi, sorry I don't understand what you want to resolve. val response = disneyService.fetchDisneyPosterList()
when (response) {
is ApiResponse.Success -> // do something
is ApiRespnse.Error.Failure -> //
is ApiResponse.Error.Exception -> //
} Also, you can use like the below using if statement. val response = disneyService.fetchDisneyPosterList()
if (response is ApiResponse.Success) {
// do something
} |
hello @skydoves, i had a case like this. the endpoint return the json with template like @dempsey. my problem is when I created the base class for the response it's working. but when I'm trying to use runAndRetry extension, it's show the warning : but when i change the body without the BaseResponse model, the 'runAndRetry ' method working well without the warning show up. how do i solve this? this is my base response model class |
BTW, this dependency is aweseom! it's really helped me with the development process that I was doing |
Hey @ldileh, what is the return type of the |
How do I use Sandwich if the json is not a standard?
The response json is ....
success
{"code":0,"msg":"success", "data": {}}
fail
{"code":-1,"msg":"fail"}
The text was updated successfully, but these errors were encountered: