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.

repo_branch.go 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. // Branch represents a repository branch
  9. type Branch struct {
  10. Name string `json:"name"`
  11. Commit *PayloadCommit `json:"commit"`
  12. Protected bool `json:"protected"`
  13. RequiredApprovals int64 `json:"required_approvals"`
  14. EnableStatusCheck bool `json:"enable_status_check"`
  15. StatusCheckContexts []string `json:"status_check_contexts"`
  16. UserCanPush bool `json:"user_can_push"`
  17. UserCanMerge bool `json:"user_can_merge"`
  18. EffectiveBranchProtectionName string `json:"effective_branch_protection_name"`
  19. }
  20. // BranchProtection represents a branch protection for a repository
  21. type BranchProtection struct {
  22. BranchName string `json:"branch_name"`
  23. EnablePush bool `json:"enable_push"`
  24. EnablePushWhitelist bool `json:"enable_push_whitelist"`
  25. PushWhitelistUsernames []string `json:"push_whitelist_usernames"`
  26. PushWhitelistTeams []string `json:"push_whitelist_teams"`
  27. PushWhitelistDeployKeys bool `json:"push_whitelist_deploy_keys"`
  28. EnableMergeWhitelist bool `json:"enable_merge_whitelist"`
  29. MergeWhitelistUsernames []string `json:"merge_whitelist_usernames"`
  30. MergeWhitelistTeams []string `json:"merge_whitelist_teams"`
  31. EnableStatusCheck bool `json:"enable_status_check"`
  32. StatusCheckContexts []string `json:"status_check_contexts"`
  33. RequiredApprovals int64 `json:"required_approvals"`
  34. EnableApprovalsWhitelist bool `json:"enable_approvals_whitelist"`
  35. ApprovalsWhitelistUsernames []string `json:"approvals_whitelist_username"`
  36. ApprovalsWhitelistTeams []string `json:"approvals_whitelist_teams"`
  37. BlockOnRejectedReviews bool `json:"block_on_rejected_reviews"`
  38. BlockOnOfficialReviewRequests bool `json:"block_on_official_review_requests"`
  39. BlockOnOutdatedBranch bool `json:"block_on_outdated_branch"`
  40. DismissStaleApprovals bool `json:"dismiss_stale_approvals"`
  41. RequireSignedCommits bool `json:"require_signed_commits"`
  42. ProtectedFilePatterns string `json:"protected_file_patterns"`
  43. // swagger:strfmt date-time
  44. Created time.Time `json:"created_at"`
  45. // swagger:strfmt date-time
  46. Updated time.Time `json:"updated_at"`
  47. }
  48. // CreateBranchProtectionOption options for creating a branch protection
  49. type CreateBranchProtectionOption struct {
  50. BranchName string `json:"branch_name"`
  51. EnablePush bool `json:"enable_push"`
  52. EnablePushWhitelist bool `json:"enable_push_whitelist"`
  53. PushWhitelistUsernames []string `json:"push_whitelist_usernames"`
  54. PushWhitelistTeams []string `json:"push_whitelist_teams"`
  55. PushWhitelistDeployKeys bool `json:"push_whitelist_deploy_keys"`
  56. EnableMergeWhitelist bool `json:"enable_merge_whitelist"`
  57. MergeWhitelistUsernames []string `json:"merge_whitelist_usernames"`
  58. MergeWhitelistTeams []string `json:"merge_whitelist_teams"`
  59. EnableStatusCheck bool `json:"enable_status_check"`
  60. StatusCheckContexts []string `json:"status_check_contexts"`
  61. RequiredApprovals int64 `json:"required_approvals"`
  62. EnableApprovalsWhitelist bool `json:"enable_approvals_whitelist"`
  63. ApprovalsWhitelistUsernames []string `json:"approvals_whitelist_username"`
  64. ApprovalsWhitelistTeams []string `json:"approvals_whitelist_teams"`
  65. BlockOnRejectedReviews bool `json:"block_on_rejected_reviews"`
  66. BlockOnOfficialReviewRequests bool `json:"block_on_official_review_requests"`
  67. BlockOnOutdatedBranch bool `json:"block_on_outdated_branch"`
  68. DismissStaleApprovals bool `json:"dismiss_stale_approvals"`
  69. RequireSignedCommits bool `json:"require_signed_commits"`
  70. ProtectedFilePatterns string `json:"protected_file_patterns"`
  71. }
  72. // EditBranchProtectionOption options for editing a branch protection
  73. type EditBranchProtectionOption struct {
  74. EnablePush *bool `json:"enable_push"`
  75. EnablePushWhitelist *bool `json:"enable_push_whitelist"`
  76. PushWhitelistUsernames []string `json:"push_whitelist_usernames"`
  77. PushWhitelistTeams []string `json:"push_whitelist_teams"`
  78. PushWhitelistDeployKeys *bool `json:"push_whitelist_deploy_keys"`
  79. EnableMergeWhitelist *bool `json:"enable_merge_whitelist"`
  80. MergeWhitelistUsernames []string `json:"merge_whitelist_usernames"`
  81. MergeWhitelistTeams []string `json:"merge_whitelist_teams"`
  82. EnableStatusCheck *bool `json:"enable_status_check"`
  83. StatusCheckContexts []string `json:"status_check_contexts"`
  84. RequiredApprovals *int64 `json:"required_approvals"`
  85. EnableApprovalsWhitelist *bool `json:"enable_approvals_whitelist"`
  86. ApprovalsWhitelistUsernames []string `json:"approvals_whitelist_username"`
  87. ApprovalsWhitelistTeams []string `json:"approvals_whitelist_teams"`
  88. BlockOnRejectedReviews *bool `json:"block_on_rejected_reviews"`
  89. BlockOnOfficialReviewRequests *bool `json:"block_on_official_review_requests"`
  90. BlockOnOutdatedBranch *bool `json:"block_on_outdated_branch"`
  91. DismissStaleApprovals *bool `json:"dismiss_stale_approvals"`
  92. RequireSignedCommits *bool `json:"require_signed_commits"`
  93. ProtectedFilePatterns *string `json:"protected_file_patterns"`
  94. }