Challenge: Work with Moshi Parser
Repeat and practice what you’ve learned about the Moshi parser, and implement another request in which you’ll parse data using Moshi.
In this challenge, you’ll finish off learning how to work with Moshi, by implementing the last request that’s using GSON, using Moshi. You’ll also remove Gson, and the need for manual parsing, to rely on Retrofit entirely! :] That’s it! Now pause the video, and solve the challenge! Then once you’re done, unpause the video, and compare the two solutions!
class UserProfileResponse( @field:Json(name = "email") val email: String?, @field:Json(name = "name") val name: String?)
fun getMyProfile(@Header("Authorization") token: String): Call<UserProfileResponse>