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.

issue.go 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. // Copyright 2016 The Gogs 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. // StateType issue state type
  9. type StateType string
  10. const (
  11. // StateOpen pr is opend
  12. StateOpen StateType = "open"
  13. // StateClosed pr is closed
  14. StateClosed StateType = "closed"
  15. // StateAll is all
  16. StateAll StateType = "all"
  17. )
  18. // PullRequestMeta PR info if an issue is a PR
  19. type PullRequestMeta struct {
  20. HasMerged bool `json:"merged"`
  21. Merged *time.Time `json:"merged_at"`
  22. }
  23. // RepositoryMeta basic repository information
  24. type RepositoryMeta struct {
  25. ID int64 `json:"id"`
  26. Name string `json:"name"`
  27. Owner string `json:"owner"`
  28. FullName string `json:"full_name"`
  29. }
  30. // Issue represents an issue in a repository
  31. // swagger:model
  32. type Issue struct {
  33. ID int64 `json:"id"`
  34. URL string `json:"url"`
  35. HTMLURL string `json:"html_url"`
  36. Index int64 `json:"number"`
  37. Poster *User `json:"user"`
  38. OriginalAuthor string `json:"original_author"`
  39. OriginalAuthorID int64 `json:"original_author_id"`
  40. Title string `json:"title"`
  41. Body string `json:"body"`
  42. Labels []*Label `json:"labels"`
  43. Milestone *Milestone `json:"milestone"`
  44. Assignee *User `json:"assignee"`
  45. Assignees []*User `json:"assignees"`
  46. // Whether the issue is open or closed
  47. //
  48. // type: string
  49. // enum: open,closed
  50. State StateType `json:"state"`
  51. IsLocked bool `json:"is_locked"`
  52. Comments int `json:"comments"`
  53. // swagger:strfmt date-time
  54. Created time.Time `json:"created_at"`
  55. // swagger:strfmt date-time
  56. Updated time.Time `json:"updated_at"`
  57. // swagger:strfmt date-time
  58. Closed *time.Time `json:"closed_at"`
  59. // swagger:strfmt date-time
  60. Deadline *time.Time `json:"due_date"`
  61. PullRequest *PullRequestMeta `json:"pull_request"`
  62. Repo *RepositoryMeta `json:"repository"`
  63. }
  64. // ListIssueOption list issue options
  65. type ListIssueOption struct {
  66. Page int
  67. State string
  68. }
  69. // CreateIssueOption options to create one issue
  70. type CreateIssueOption struct {
  71. // required:true
  72. Title string `json:"title" binding:"Required"`
  73. Body string `json:"body"`
  74. // username of assignee
  75. Assignee string `json:"assignee"`
  76. Assignees []string `json:"assignees"`
  77. // swagger:strfmt date-time
  78. Deadline *time.Time `json:"due_date"`
  79. // milestone id
  80. Milestone int64 `json:"milestone"`
  81. // list of label ids
  82. Labels []int64 `json:"labels"`
  83. Closed bool `json:"closed"`
  84. }
  85. // EditIssueOption options for editing an issue
  86. type EditIssueOption struct {
  87. Title string `json:"title"`
  88. Body *string `json:"body"`
  89. Assignee *string `json:"assignee"`
  90. Assignees []string `json:"assignees"`
  91. Milestone *int64 `json:"milestone"`
  92. State *string `json:"state"`
  93. // swagger:strfmt date-time
  94. Deadline *time.Time `json:"due_date"`
  95. RemoveDeadline *bool `json:"unset_due_date"`
  96. }
  97. // EditDeadlineOption options for creating a deadline
  98. type EditDeadlineOption struct {
  99. // required:true
  100. // swagger:strfmt date-time
  101. Deadline *time.Time `json:"due_date"`
  102. }
  103. // IssueDeadline represents an issue deadline
  104. // swagger:model
  105. type IssueDeadline struct {
  106. // swagger:strfmt date-time
  107. Deadline *time.Time `json:"due_date"`
  108. }