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

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