使用GitHub Java API检索有关登录用户的信息?

时间:2021-07-12 16:50:10

I'm having trouble using this https://github.com/eclipse/egit-github/tree/master/org.eclipse.egit.github.core library to access the Github API through Eclipse. I'm trying find and retrieve information about the currently logged in user (e.g. login, followers, repos) and print the information. I'm having trouble understanding the library, and I'm not exactly sure how to go about this with this library. I know I need to authenticate the user and to somehow retrieve the data, but I'm unsure as to how to do this or what objects to use to accomplish this.

我在使用这个https://github.com/eclipse/egit-github/tree/master/org.eclipse.egit.github.core库来通过Eclipse访问Github API时遇到了麻烦。我正在尝试查找并检索有关当前登录用户的信息(例如登录,关注者,回购)并打印信息。我无法理解库,我不确定如何使用这个库来解决这个问题。我知道我需要对用户进行身份验证并以某种方式检索数据,但我不确定如何执行此操作或使用哪些对象来完成此操作。

1 个解决方案

#1


2  

Have a look at the documentation under https://github.com/eclipse/egit-github/tree/master/org.eclipse.egit.github.core

看一下https://github.com/eclipse/egit-github/tree/master/org.eclipse.egit.github.core下的文档。

//Basic authentication
GitHubClient client = new GitHubClient();
client.setCredentials("user", "passw0rd");

User related method should be listed at https://github.com/eclipse/egit-github/blob/master/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/UserService.java

用户相关方法应列在https://github.com/eclipse/egit-github/blob/master/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/UserService的.java

#1


2  

Have a look at the documentation under https://github.com/eclipse/egit-github/tree/master/org.eclipse.egit.github.core

看一下https://github.com/eclipse/egit-github/tree/master/org.eclipse.egit.github.core下的文档。

//Basic authentication
GitHubClient client = new GitHubClient();
client.setCredentials("user", "passw0rd");

User related method should be listed at https://github.com/eclipse/egit-github/blob/master/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/UserService.java

用户相关方法应列在https://github.com/eclipse/egit-github/blob/master/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/UserService的.java