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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. // Copyright 2016 The Gogs Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package structs
  4. import (
  5. "time"
  6. )
  7. // PullRequest represents a pull request
  8. type PullRequest struct {
  9. ID int64 `json:"id"`
  10. URL string `json:"url"`
  11. Index int64 `json:"number"`
  12. Poster *User `json:"user"`
  13. Title string `json:"title"`
  14. Body string `json:"body"`
  15. Labels []*Label `json:"labels"`
  16. Milestone *Milestone `json:"milestone"`
  17. Assignee *User `json:"assignee"`
  18. Assignees []*User `json:"assignees"`
  19. RequestedReviewers []*User `json:"requested_reviewers"`
  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. PinOrder int `json:"pin_order"`
  45. }
  46. // PRBranchInfo information about a branch
  47. type PRBranchInfo struct {
  48. Name string `json:"label"`
  49. Ref string `json:"ref"`
  50. Sha string `json:"sha"`
  51. RepoID int64 `json:"repo_id"`
  52. Repository *Repository `json:"repo"`
  53. }
  54. // ListPullRequestsOptions options for listing pull requests
  55. type ListPullRequestsOptions struct {
  56. Page int `json:"page"`
  57. State string `json:"state"`
  58. }
  59. // CreatePullRequestOption options when creating a pull request
  60. type CreatePullRequestOption struct {
  61. Head string `json:"head" binding:"Required"`
  62. Base string `json:"base" binding:"Required"`
  63. Title string `json:"title" binding:"Required"`
  64. Body string `json:"body"`
  65. Assignee string `json:"assignee"`
  66. Assignees []string `json:"assignees"`
  67. Milestone int64 `json:"milestone"`
  68. Labels []int64 `json:"labels"`
  69. // swagger:strfmt date-time
  70. Deadline *time.Time `json:"due_date"`
  71. }
  72. // EditPullRequestOption options when modify pull request
  73. type EditPullRequestOption struct {
  74. Title string `json:"title"`
  75. Body string `json:"body"`
  76. Base string `json:"base"`
  77. Assignee string `json:"assignee"`
  78. Assignees []string `json:"assignees"`
  79. Milestone int64 `json:"milestone"`
  80. Labels []int64 `json:"labels"`
  81. State *string `json:"state"`
  82. // swagger:strfmt date-time
  83. Deadline *time.Time `json:"due_date"`
  84. RemoveDeadline *bool `json:"unset_due_date"`
  85. AllowMaintainerEdit *bool `json:"allow_maintainer_edit"`
  86. }
  87. // ChangedFile store information about files affected by the pull request
  88. type ChangedFile struct {
  89. Filename string `json:"filename"`
  90. PreviousFilename string `json:"previous_filename,omitempty"`
  91. Status string `json:"status"`
  92. Additions int `json:"additions"`
  93. Deletions int `json:"deletions"`
  94. Changes int `json:"changes"`
  95. HTMLURL string `json:"html_url,omitempty"`
  96. ContentsURL string `json:"contents_url,omitempty"`
  97. RawURL string `json:"raw_url,omitempty"`
  98. }