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.

pull.go 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. // PullRequest represents a pull request
  9. type PullRequest struct {
  10. ID int64 `json:"id"`
  11. URL string `json:"url"`
  12. Index int64 `json:"number"`
  13. Poster *User `json:"user"`
  14. Title string `json:"title"`
  15. Body string `json:"body"`
  16. Labels []*Label `json:"labels"`
  17. Milestone *Milestone `json:"milestone"`
  18. Assignee *User `json:"assignee"`
  19. Assignees []*User `json:"assignees"`
  20. State StateType `json:"state"`
  21. IsLocked bool `json:"is_locked"`
  22. Comments int `json:"comments"`
  23. HTMLURL string `json:"html_url"`
  24. DiffURL string `json:"diff_url"`
  25. PatchURL string `json:"patch_url"`
  26. Mergeable bool `json:"mergeable"`
  27. HasMerged bool `json:"merged"`
  28. // swagger:strfmt date-time
  29. Merged *time.Time `json:"merged_at"`
  30. MergedCommitID *string `json:"merge_commit_sha"`
  31. MergedBy *User `json:"merged_by"`
  32. AllowMaintainerEdit bool `json:"allow_maintainer_edit"`
  33. Base *PRBranchInfo `json:"base"`
  34. Head *PRBranchInfo `json:"head"`
  35. MergeBase string `json:"merge_base"`
  36. // swagger:strfmt date-time
  37. Deadline *time.Time `json:"due_date"`
  38. // swagger:strfmt date-time
  39. Created *time.Time `json:"created_at"`
  40. // swagger:strfmt date-time
  41. Updated *time.Time `json:"updated_at"`
  42. // swagger:strfmt date-time
  43. Closed *time.Time `json:"closed_at"`
  44. }
  45. // PRBranchInfo information about a branch
  46. type PRBranchInfo struct {
  47. Name string `json:"label"`
  48. Ref string `json:"ref"`
  49. Sha string `json:"sha"`
  50. RepoID int64 `json:"repo_id"`
  51. Repository *Repository `json:"repo"`
  52. }
  53. // ListPullRequestsOptions options for listing pull requests
  54. type ListPullRequestsOptions struct {
  55. Page int `json:"page"`
  56. State string `json:"state"`
  57. }
  58. // CreatePullRequestOption options when creating a pull request
  59. type CreatePullRequestOption struct {
  60. Head string `json:"head" binding:"Required"`
  61. Base string `json:"base" binding:"Required"`
  62. Title string `json:"title" binding:"Required"`
  63. Body string `json:"body"`
  64. Assignee string `json:"assignee"`
  65. Assignees []string `json:"assignees"`
  66. Milestone int64 `json:"milestone"`
  67. Labels []int64 `json:"labels"`
  68. // swagger:strfmt date-time
  69. Deadline *time.Time `json:"due_date"`
  70. }
  71. // EditPullRequestOption options when modify pull request
  72. type EditPullRequestOption struct {
  73. Title string `json:"title"`
  74. Body string `json:"body"`
  75. Base string `json:"base"`
  76. Assignee string `json:"assignee"`
  77. Assignees []string `json:"assignees"`
  78. Milestone int64 `json:"milestone"`
  79. Labels []int64 `json:"labels"`
  80. State *string `json:"state"`
  81. // swagger:strfmt date-time
  82. Deadline *time.Time `json:"due_date"`
  83. RemoveDeadline *bool `json:"unset_due_date"`
  84. AllowMaintainerEdit *bool `json:"allow_maintainer_edit"`
  85. }
  86. // ChangedFile store information about files affected by the pull request
  87. type ChangedFile struct {
  88. Filename string `json:"filename"`
  89. PreviousFilename string `json:"previous_filename,omitempty"`
  90. Status string `json:"status"`
  91. Additions int `json:"additions"`
  92. Deletions int `json:"deletions"`
  93. Changes int `json:"changes"`
  94. HTMLURL string `json:"html_url,omitempty"`
  95. ContentsURL string `json:"contents_url,omitempty"`
  96. RawURL string `json:"raw_url,omitempty"`
  97. }