Skip to content

Simple example of how Retrofit-like HTTP library can be written

License

Notifications You must be signed in to change notification settings

badadin/HttpClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Retrofit-like HTTP library

Based on Java Dynamic Proxy
Written in educational purposes only
Using Denom common library for networking

Usage

Init HttpClient

 val httpClient = HttpClient.Builder()
    .baseUrl("https://cataas.com")
    .build()

Create service interface

interface CatService {
    @Get("cat")
    fun getCatById(@Param("id") id: Long): HttpClientResponse

    @Get("api/cats")
    fun getCuteCats(@Param("tags") tags: String, @Param("limit") limit: Int): HttpClientResponse
}

Prepare service interface to use

val catService: CatService = httpClient.create()

About

Simple example of how Retrofit-like HTTP library can be written

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages