You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

notifications.go 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 int64 `json:"id"`
  10. Repository *Repository `json:"repository"`
  11. Subject *NotificationSubject `json:"subject"`
  12. Unread bool `json:"unread"`
  13. Pinned bool `json:"pinned"`
  14. UpdatedAt time.Time `json:"updated_at"`
  15. URL string `json:"url"`
  16. }
  17. // NotificationSubject contains the notification subject (Issue/Pull/Commit)
  18. type NotificationSubject struct {
  19. Title string `json:"title"`
  20. URL string `json:"url"`
  21. LatestCommentURL string `json:"latest_comment_url"`
  22. HTMLURL string `json:"html_url"`
  23. LatestCommentHTMLURL string `json:"latest_comment_html_url"`
  24. Type NotifySubjectType `json:"type" binding:"In(Issue,Pull,Commit,Repository)"`
  25. State StateType `json:"state"`
  26. }
  27. // NotificationCount number of unread notifications
  28. type NotificationCount struct {
  29. New int64 `json:"new"`
  30. }
  31. // NotifySubjectType represent type of notification subject
  32. type NotifySubjectType string
  33. const (
  34. // NotifySubjectIssue an issue is subject of an notification
  35. NotifySubjectIssue NotifySubjectType = "Issue"
  36. // NotifySubjectPull an pull is subject of an notification
  37. NotifySubjectPull NotifySubjectType = "Pull"
  38. // NotifySubjectCommit an commit is subject of an notification
  39. NotifySubjectCommit NotifySubjectType = "Commit"
  40. // NotifySubjectRepository an repository is subject of an notification
  41. NotifySubjectRepository NotifySubjectType = "Repository"
  42. )