Created
November 16, 2019 16:48
-
-
Save shekhargulati/6e4224149abaf7638b427d2f9d4d58b3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 retrofit2.Call; | |
import retrofit2.Response; | |
import retrofit2.Retrofit; | |
import retrofit2.converter.gson.GsonConverterFactory; | |
public class RetrofitExample { | |
public static void main(String[] args) throws IOException { | |
Retrofit retrofit = new Retrofit.Builder() | |
.baseUrl("https://api.github.com/") | |
.addConverterFactory(GsonConverterFactory.create()) | |
.build(); | |
GitHubService gitHubService = retrofit.create(GitHubService.class); | |
Call<List<Repo>> reposCall = gitHubService.listRepos("shekhargulati"); | |
Response<List<Repo>> response = reposCall.execute(); | |
response.body().forEach(System.out::println); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment