Created
June 16, 2020 20:22
-
-
Save GabriellCosta/2c3385ceef5c7963b54e6a3ab094e129 to your computer and use it in GitHub Desktop.
Scratch file for api
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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