gitlab_mr.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package model
  2. const (
  3. // MRActionOpen ...
  4. MRActionOpen = "open"
  5. // MRActionReopen ...
  6. MRActionReopen = "reopen"
  7. // MRActionMerge ...
  8. MRActionMerge = "merge"
  9. )
  10. const (
  11. // MRStateOpened ...
  12. MRStateOpened = "opened"
  13. // MRStateClosed ...
  14. MRStateClosed = "closed"
  15. // MRStateMerged ...
  16. MRStateMerged = "merged"
  17. )
  18. const (
  19. // MRMergeOK ...
  20. MRMergeOK = "can_be_merged"
  21. // MRMergeFailed ...
  22. MRMergeFailed = "cannot_be_merged"
  23. // MRMergeUnchecked ...
  24. MRMergeUnchecked = "unchecked"
  25. )
  26. // HookMR def
  27. type HookMR struct {
  28. ObjectKind string `json:"object_kind"`
  29. Project *Project `json:"project"`
  30. User *User `json:"user"`
  31. ObjectAttributes *MergeRequest `json:"object_attributes"`
  32. Assignee *User `json:"assignee"`
  33. }
  34. // MergeRequest struct
  35. type MergeRequest struct {
  36. ID int64 `json:"id"`
  37. TargetBranch string `json:"target_branch"`
  38. SourceBranch string `json:"source_branch"`
  39. SourceProjectID int64 `json:"source_project_id"`
  40. AuthorID int64 `json:"author_id"`
  41. AssigneeID int64 `json:"assignee_id"`
  42. Title string `json:"title"`
  43. CreateAt string `json:"created_at"`
  44. UpdateAt string `json:"updated_at"`
  45. STCommits int64 `json:"st_commits"`
  46. STDiffs int64 `json:"st_diffs"`
  47. MilestoneID int64 `json:"milestone_id"`
  48. State string `json:"state"`
  49. MergeStatus string `json:"merge_status"`
  50. TargetProjectID int64 `json:"target_project_id"`
  51. IID int64 `json:"iid"`
  52. Description string `json:"description"`
  53. Source *Project `json:"source"`
  54. Target *Project `json:"target"`
  55. LastCommit *Commit `json:"last_commit"`
  56. WorkInProgress bool `json:"work_in_progress"`
  57. URL string `json:"url"`
  58. Action string `json:"action"` // "open","update","close"
  59. Sha string `json:"sha"`
  60. }
  61. // MRRecord def
  62. type MRRecord struct {
  63. ProjectID int `json:"pid"`
  64. MRID int `json:"mrid"`
  65. LastCommit string `json:"lc"`
  66. Mail bool `json:"mail"` // 是否发送过邮件
  67. NoteID int `json:"note"`
  68. Report struct {
  69. TimeSpend int64 `json:"rts"`
  70. MergeFlag bool `json:"rmf"`
  71. BuildFlag bool `json:"rbf"`
  72. StaticCheckFlag bool `json:"rsf"`
  73. VetFlag bool `json:"rvf"`
  74. LintFlag bool `json:"rlf"`
  75. RuleFlag bool `json:"rrf"`
  76. } `json:"report"`
  77. Rider struct {
  78. BuildID int64 `json:"ribi"`
  79. BuildFlag bool `json:"ribf"`
  80. BuildCommit string `json:"ribc"`
  81. DeployID int64 `json:"ridi"`
  82. DeployFlag bool `json:"ridf"`
  83. DeployCommit string `json:"ridc"`
  84. } `json:"rider"`
  85. Reviwers []Reviewer `json:"mus"`
  86. ReviewNotify struct {
  87. Reviewer []string `json:"rnr"`
  88. Assign string `json:"rna"`
  89. } `json:"rn"`
  90. }
  91. // Reviewer struct
  92. type Reviewer struct {
  93. Name string `json:"mun"`
  94. CommitID string `json:"muci"`
  95. }
  96. const (
  97. // MRTypeCommon iota
  98. MRTypeCommon = iota
  99. // MRTypeBiz ...
  100. MRTypeBiz
  101. // MRTypeRevert ...
  102. MRTypeRevert
  103. // MRTypeInvalid ...
  104. MRTypeInvalid
  105. )