MΓ³dulo 07 Β· Networking with Retrofit β LecciΓ³n 3 de 4 Β· ~9 min
The Network Stack
What actually builds the client
PawWalkApi is just an interface β something has to construct the real thing. That's Network.kt: one object, built once, shared by every repository in the app. Three ingredients stack on top of each other:
- OkHttp β the actual HTTP engine underneath Retrofit. It opens connections, sends bytes, receives bytes.
- A converter factory β teaches Retrofit how to turn JSON bytes into Kotlin objects (and back). PawWalk uses
kotlinx.serialization's converter, the same annotations (@Serializable,@SerialName) you met in Module 3. - Retrofit itself β glues a
baseUrl, the OkHttp client, and the converter factory together, then.create(PawWalkApi::class.java)produces the real, working implementation of your interface.