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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. Comments int `json:"comments"`
  52. // swagger:strfmt date-time
  53. Created time.Time `json:"created_at"`
  54. // swagger:strfmt date-time
  55. Updated time.Time `json:"updated_at"`
  56. // swagger:strfmt date-time
  57. Closed *time.Time `json:"closed_at"`
  58. // swagger:strfmt date-time
  59. Deadline *time.Time `json:"due_date"`
  60. PullRequest *PullRequestMeta `json:"pull_request"`
  61. Repo *RepositoryMeta `json:"repository"`
  62. }
  63. // ListIssueOption list issue options
  64. type ListIssueOption struct {
  65. Page int
  66. State string
  67. }
  68. // CreateIssueOption options to create one issue
  69. type CreateIssueOption struct {
  70. // required:true
  71. Title string `json:"title" binding:"Required"`
  72. Body string `json:"body"`
  73. // username of assignee
  74. Assignee string `json:"assignee"`
  75. Assignees []string `json:"assignees"`
  76. // swagger:strfmt date-time
  77. Deadline *time.Time `json:"due_date"`
  78. // milestone id
  79. Milestone int64 `json:"milestone"`
  80. // list of label ids
  81. Labels []int64 `json:"labels"`
  82. Closed bool `json:"closed"`
  83. }
  84. // EditIssueOption options for editing an issue
  85. type EditIssueOption struct {
  86. Title string `json:"title"`
  87. Body *string `json:"body"`
  88. Assignee *string `json:"assignee"`
  89. Assignees []string `json:"assignees"`
  90. Milestone *int64 `json:"milestone"`
  91. State *string `json:"state"`
  92. // swagger:strfmt date-time
  93. Deadline *time.Time `json:"due_date"`
  94. RemoveDeadline *bool `json:"unset_due_date"`
  95. }
  96. // EditDeadlineOption options for creating a deadline
  97. type EditDeadlineOption struct {
  98. // required:true
  99. // swagger:strfmt date-time
  100. Deadline *time.Time `json:"due_date"`
  101. }
  102. // IssueDeadline represents an issue deadline
  103. // swagger:model
  104. type IssueDeadline struct {
  105. // swagger:strfmt date-time
  106. Deadline *time.Time `json:"due_date"`
  107. }