gitea源码

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright 2019 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package structs
  4. import (
  5. "time"
  6. )
  7. // NotificationThread expose Notification on API
  8. type NotificationThread struct {
  9. // ID is the unique identifier for the notification thread
  10. ID int64 `json:"id"`
  11. // Repository is the repository associated with the notification
  12. Repository *Repository `json:"repository"`
  13. // Subject contains details about the notification subject
  14. Subject *NotificationSubject `json:"subject"`
  15. // Unread indicates if the notification has been read
  16. Unread bool `json:"unread"`
  17. // Pinned indicates if the notification is pinned
  18. Pinned bool `json:"pinned"`
  19. // UpdatedAt is the time when the notification was last updated
  20. UpdatedAt time.Time `json:"updated_at"`
  21. // URL is the API URL for this notification thread
  22. URL string `json:"url"`
  23. }
  24. // NotificationSubject contains the notification subject (Issue/Pull/Commit)
  25. type NotificationSubject struct {
  26. // Title is the title of the notification subject
  27. Title string `json:"title"`
  28. // URL is the API URL for the notification subject
  29. URL string `json:"url"`
  30. // LatestCommentURL is the API URL for the latest comment
  31. LatestCommentURL string `json:"latest_comment_url"`
  32. // HTMLURL is the web URL for the notification subject
  33. HTMLURL string `json:"html_url"`
  34. // LatestCommentHTMLURL is the web URL for the latest comment
  35. LatestCommentHTMLURL string `json:"latest_comment_html_url"`
  36. // Type indicates the type of the notification subject
  37. Type NotifySubjectType `json:"type" binding:"In(Issue,Pull,Commit,Repository)"`
  38. // State indicates the current state of the notification subject
  39. State StateType `json:"state"`
  40. }
  41. // NotificationCount number of unread notifications
  42. type NotificationCount struct {
  43. // New is the number of unread notifications
  44. New int64 `json:"new"`
  45. }
  46. // NotifySubjectType represent type of notification subject
  47. type NotifySubjectType string
  48. const (
  49. // NotifySubjectIssue an issue is subject of an notification
  50. NotifySubjectIssue NotifySubjectType = "Issue"
  51. // NotifySubjectPull an pull is subject of an notification
  52. NotifySubjectPull NotifySubjectType = "Pull"
  53. // NotifySubjectCommit an commit is subject of an notification
  54. NotifySubjectCommit NotifySubjectType = "Commit"
  55. // NotifySubjectRepository an repository is subject of an notification
  56. NotifySubjectRepository NotifySubjectType = "Repository"
  57. )