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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. // Issue represents an issue in a repository
  24. // swagger:model
  25. type Issue struct {
  26. ID int64 `json:"id"`
  27. URL string `json:"url"`
  28. Index int64 `json:"number"`
  29. Poster *User `json:"user"`
  30. Title string `json:"title"`
  31. Body string `json:"body"`
  32. Labels []*Label `json:"labels"`
  33. Milestone *Milestone `json:"milestone"`
  34. Assignee *User `json:"assignee"`
  35. Assignees []*User `json:"assignees"`
  36. // Whether the issue is open or closed
  37. //
  38. // type: string
  39. // enum: open,closed
  40. State StateType `json:"state"`
  41. Comments int `json:"comments"`
  42. // swagger:strfmt date-time
  43. Created time.Time `json:"created_at"`
  44. // swagger:strfmt date-time
  45. Updated time.Time `json:"updated_at"`
  46. // swagger:strfmt date-time
  47. Closed *time.Time `json:"closed_at"`
  48. // swagger:strfmt date-time
  49. Deadline *time.Time `json:"due_date"`
  50. PullRequest *PullRequestMeta `json:"pull_request"`
  51. }
  52. // ListIssueOption list issue options
  53. type ListIssueOption struct {
  54. Page int
  55. State string
  56. }
  57. // CreateIssueOption options to create one issue
  58. type CreateIssueOption struct {
  59. // required:true
  60. Title string `json:"title" binding:"Required"`
  61. Body string `json:"body"`
  62. // username of assignee
  63. Assignee string `json:"assignee"`
  64. Assignees []string `json:"assignees"`
  65. // swagger:strfmt date-time
  66. Deadline *time.Time `json:"due_date"`
  67. // milestone id
  68. Milestone int64 `json:"milestone"`
  69. // list of label ids
  70. Labels []int64 `json:"labels"`
  71. Closed bool `json:"closed"`
  72. }
  73. // EditIssueOption options for editing an issue
  74. type EditIssueOption struct {
  75. Title string `json:"title"`
  76. Body *string `json:"body"`
  77. Assignee *string `json:"assignee"`
  78. Assignees []string `json:"assignees"`
  79. Milestone *int64 `json:"milestone"`
  80. State *string `json:"state"`
  81. // swagger:strfmt date-time
  82. Deadline *time.Time `json:"due_date"`
  83. }
  84. // EditDeadlineOption options for creating a deadline
  85. type EditDeadlineOption struct {
  86. // required:true
  87. // swagger:strfmt date-time
  88. Deadline *time.Time `json:"due_date"`
  89. }
  90. // IssueDeadline represents an issue deadline
  91. // swagger:model
  92. type IssueDeadline struct {
  93. // swagger:strfmt date-time
  94. Deadline *time.Time `json:"due_date"`
  95. }
  96. // EditPriorityOption options for updating priority
  97. type EditPriorityOption struct {
  98. // required:true
  99. Priority int `json:"priority"`
  100. }