Skip to content

Instantly share code, notes, and snippets.

@GabriellCosta
Created June 16, 2020 20:22
Show Gist options
  • Save GabriellCosta/2c3385ceef5c7963b54e6a3ab094e129 to your computer and use it in GitHub Desktop.
Save GabriellCosta/2c3385ceef5c7963b54e6a3ab094e129 to your computer and use it in GitHub Desktop.
Scratch file for api
import com.google.gson.JsonElement
import me.tigrao.aegis.network.NetworkClient
import retrofit2.Call
import retrofit2.http.GET
//Interface usada em nossa instancia da retrofit
interface Myapi {
//endepoint para buscar a lista de repositorios em kotlin
@GET("search/repositories?q=language:kotlin&sort=stars")
fun fetchRepositoriesAsync(
): Call<JsonElement>
}
//Criamos uma instancia dessa interface pelo retrofit
val api = NetworkClient.getApi(Myapi::class.java)
//executamos e vemos o resultado :)
val result = api.fetchRepositoriesAsync().execute()
println(result.body()?.toString())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment