code.gitea.io/gitea@v1.19.3/modules/structs/notifications.go (about) 1 // Copyright 2019 The Gitea Authors. All rights reserved. 2 // SPDX-License-Identifier: MIT 3 4 package structs 5 6 import ( 7 "time" 8 ) 9 10 // NotificationThread expose Notification on API 11 type NotificationThread struct { 12 ID int64 `json:"id"` 13 Repository *Repository `json:"repository"` 14 Subject *NotificationSubject `json:"subject"` 15 Unread bool `json:"unread"` 16 Pinned bool `json:"pinned"` 17 UpdatedAt time.Time `json:"updated_at"` 18 URL string `json:"url"` 19 } 20 21 // NotificationSubject contains the notification subject (Issue/Pull/Commit) 22 type NotificationSubject struct { 23 Title string `json:"title"` 24 URL string `json:"url"` 25 LatestCommentURL string `json:"latest_comment_url"` 26 HTMLURL string `json:"html_url"` 27 LatestCommentHTMLURL string `json:"latest_comment_html_url"` 28 Type NotifySubjectType `json:"type" binding:"In(Issue,Pull,Commit,Repository)"` 29 State StateType `json:"state"` 30 } 31 32 // NotificationCount number of unread notifications 33 type NotificationCount struct { 34 New int64 `json:"new"` 35 } 36 37 // NotifySubjectType represent type of notification subject 38 type NotifySubjectType string 39 40 const ( 41 // NotifySubjectIssue an issue is subject of an notification 42 NotifySubjectIssue NotifySubjectType = "Issue" 43 // NotifySubjectPull an pull is subject of an notification 44 NotifySubjectPull NotifySubjectType = "Pull" 45 // NotifySubjectCommit an commit is subject of an notification 46 NotifySubjectCommit NotifySubjectType = "Commit" 47 // NotifySubjectRepository an repository is subject of an notification 48 NotifySubjectRepository NotifySubjectType = "Repository" 49 )