Class UsersClient
java.lang.Object
ink.icoding.github4j.GithubClient
ink.icoding.github4j.client.UsersClient
GitHub 用户操作客户端。
提供获取用户信息、管理关注者、邮箱、SSH 公钥等功能。
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancheckFollowing(String targetUser) 检查当前用户是否关注了指定用户。booleancheckFollowing(String username, String targetUser) 检查用户 A 是否关注了用户 B。void关注指定用户。获取当前已认证用户的信息。getByUsername(String username) 通过用户名获取用户信息。listAuthenticatedFollowers(PageOptions options) 列出当前已认证用户的关注者。listAuthenticatedFollowing(PageOptions options) 列出当前已认证用户关注的人。listAuthenticatedKeys(PageOptions options) 列出当前已认证用户的 SSH 公钥。listEmails(PageOptions options) 列出当前已认证用户的邮箱地址。listFollowers(String username, PageOptions options) 列出指定用户的关注者。listFollowing(String username, PageOptions options) 列出指定用户关注的人。listPublicEmails(String username) 列出指定用户的公开邮箱地址。listPublicKeys(String username) 列出指定用户的公开 SSH 公钥。void取消关注指定用户。updateAuthenticatedUser(Map<String, Object> updates) 更新当前已认证用户的个人信息。Methods inherited from class GithubClient
actions, builder, configureObjectMapper, delete, get, get, getPaged, getRaw, gists, git, issues, meta, notifications, orgs, patch, post, projects, pulls, put, putNoBody, releases, repos, search, teams, users, webhooksModifier and TypeMethodDescriptionactions()static GithubClientBuilderbuilder()protected com.fasterxml.jackson.databind.ObjectMapperconfigureObjectMapper(com.fasterxml.jackson.databind.ObjectMapper mapper) protected GithubResponse<Void> protected <T> GithubResponse<T> get(String path, com.fasterxml.jackson.core.type.TypeReference<T> typeRef, Map<String, String> queryParams) protected <T> GithubResponse<T> protected <T> Page<T> protected GithubResponse<byte[]> gists()git()issues()meta()orgs()protected <T> GithubResponse<T> protected <T> GithubResponse<T> projects()pulls()protected <T> GithubResponse<T> protected GithubResponse<Void> releases()repos()search()teams()users()webhooks()
-
Constructor Details
-
UsersClient
-
-
Method Details
-
getAuthenticatedUser
获取当前已认证用户的信息。对应端点:
GET /user- Returns:
- 当前已认证用户的详细信息
-
updateAuthenticatedUser
更新当前已认证用户的个人信息。对应端点:
PATCH /user- Parameters:
updates- 要更新的字段(如 name, email, bio, company, location, blog 等)- Returns:
- 更新后的用户信息
-
getByUsername
通过用户名获取用户信息。对应端点:
GET /users/{username}- Parameters:
username- 目标用户名- Returns:
- 用户的公开信息
-
listFollowers
列出指定用户的关注者。对应端点:
GET /users/{username}/followers- Parameters:
username- 目标用户名options- 分页参数- Returns:
- 关注者列表(分页)
-
listAuthenticatedFollowers
列出当前已认证用户的关注者。对应端点:
GET /user/followers- Parameters:
options- 分页参数- Returns:
- 关注者列表(分页)
-
listFollowing
列出指定用户关注的人。对应端点:
GET /users/{username}/following- Parameters:
username- 目标用户名options- 分页参数- Returns:
- 关注列表(分页)
-
listAuthenticatedFollowing
列出当前已认证用户关注的人。对应端点:
GET /user/following- Parameters:
options- 分页参数- Returns:
- 关注列表(分页)
-
checkFollowing
检查当前用户是否关注了指定用户。对应端点:
GET /user/following/{username}- Parameters:
targetUser- 目标用户名- Returns:
- true 表示已关注,false 表示未关注
-
checkFollowing
-
follow
关注指定用户。对应端点:
PUT /user/following/{username}- Parameters:
targetUser- 要关注的用户名
-
unfollow
取消关注指定用户。对应端点:
DELETE /user/following/{username}- Parameters:
targetUser- 要取消关注的用户名
-
listEmails
列出当前已认证用户的邮箱地址。对应端点:
GET /user/emails- Parameters:
options- 分页参数- Returns:
- 邮箱列表(分页)
-
listPublicEmails
-
listPublicKeys
-
listAuthenticatedKeys
列出当前已认证用户的 SSH 公钥。对应端点:
GET /user/keys- Parameters:
options- 分页参数- Returns:
- SSH 公钥列表(分页)
-