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.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. Type NotifySubjectType `json:"type" binding:"In(Issue,Pull,Commit)"`
  24. State StateType `json:"state"`
  25. }
  26. // NotificationCount number of unread notifications
  27. type NotificationCount struct {
  28. New int64 `json:"new"`
  29. }
  30. // NotifySubjectType represent type of notification subject
  31. type NotifySubjectType string
  32. const (
  33. // NotifySubjectIssue an issue is subject of an notification
  34. NotifySubjectIssue NotifySubjectType = "Issue"
  35. // NotifySubjectPull an pull is subject of an notification
  36. NotifySubjectPull NotifySubjectType = "Pull"
  37. // NotifySubjectCommit an commit is subject of an notification
  38. NotifySubjectCommit NotifySubjectType = "Commit"
  39. // NotifySubjectRepository an repository is subject of an notification
  40. NotifySubjectRepository NotifySubjectType = "Repository"
  41. )