Define a Retrofit API Interface
Declare endpoints with annotations.
What Retrofit Does
Retrofit turns a plain Kotlin interface into a working HTTP client, so you describe your API and it writes the networking code for you.
It Starts With an Interface
You declare each endpoint as a function inside a Kotlin interface. Retrofit reads the annotations and builds the real implementation at runtime.
interface UserApi {
// endpoint functions go here
}All lessons in this course
- Define a Retrofit API Interface
- Parsing JSON with Moshi
- suspend Calls in the ViewModel
- Loading, Success & Error UI