本站源代码
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.

116 lines
3.1KB

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