Class NotificationsClient
java.lang.Object
ink.icoding.github4j.GithubClient
ink.icoding.github4j.client.NotificationsClient
GitHub 通知 API 客户端。
提供通知的列表查询、标记已读、线程订阅管理、仓库通知管理等功能。
对应 GitHub REST API 文档: Notifications
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteThreadSubscription(long threadId) 删除指定通知线程的订阅。getThread(long threadId) 获取指定通知线程的详细信息。getThreadSubscription(long threadId) 获取指定通知线程的订阅状态。list(ListNotificationsOptions options) 列出当前认证用户的所有通知。listForRepo(String owner, String repo, ListNotificationsOptions options) 列出指定仓库的通知。voidmarkAllAsRead(Map<String, String> body) 将当前认证用户的所有通知标记为已读。markAsRead(long threadId) 将指定通知线程标记为已读。void将指定仓库的所有通知标记为已读。markThreadAsDone(long threadId) 将指定通知线程标记为已完成(从列表中移除)。setThreadSubscription(long threadId, Map<String, Boolean> body) 设置指定通知线程的订阅状态。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
-
NotificationsClient
-
-
Method Details
-
list
列出当前认证用户的所有通知。API 端点:
GET /notifications- Parameters:
options- 列表选项(是否显示全部、参与状态、时间范围筛选、分页),可为 null- Returns:
- 分页的通知线程列表
-
getThread
获取指定通知线程的详细信息。API 端点:
GET /notifications/threads/{thread_id}- Parameters:
threadId- 通知线程的 ID- Returns:
- 通知线程详细信息
-
markAsRead
将指定通知线程标记为已读。API 端点:
PATCH /notifications/threads/{thread_id}- Parameters:
threadId- 通知线程的 ID- Returns:
- 更新后的通知线程信息
-
markAllAsRead
-
markThreadAsDone
将指定通知线程标记为已完成(从列表中移除)。API 端点:
DELETE /notifications/threads/{thread_id}- Parameters:
threadId- 通知线程的 ID- Returns:
- 操作结果
-
getThreadSubscription
获取指定通知线程的订阅状态。API 端点:
GET /notifications/threads/{thread_id}/subscription- Parameters:
threadId- 通知线程的 ID- Returns:
- 订阅状态信息(包含 subscribed 和 ignored 字段)
-
setThreadSubscription
设置指定通知线程的订阅状态。API 端点:
PUT /notifications/threads/{thread_id}/subscription- Parameters:
threadId- 通知线程的 IDbody- 订阅参数(包含 subscribed 和 ignored 布尔值)- Returns:
- 更新后的订阅状态信息
-
deleteThreadSubscription
public void deleteThreadSubscription(long threadId) 删除指定通知线程的订阅。API 端点:
DELETE /notifications/threads/{thread_id}/subscription- Parameters:
threadId- 通知线程的 ID
-
listForRepo
列出指定仓库的通知。API 端点:
GET /repos/{owner}/{repo}/notifications- Parameters:
owner- 仓库所有者repo- 仓库名称options- 列表选项(是否显示全部、参与状态、时间范围筛选、分页),可为 null- Returns:
- 分页的通知线程列表
-
markRepoNotificationsAsRead
-