You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

repo_branch.go 5.3 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. DismissStaleApprovals bool `json:"dismiss_stale_approvals"`
  39. RequireSignedCommits bool `json:"require_signed_commits"`
  40. ProtectedFilePatterns string `json:"protected_file_patterns"`
  41. // swagger:strfmt date-time
  42. Created time.Time `json:"created_at"`
  43. // swagger:strfmt date-time
  44. Updated time.Time `json:"updated_at"`
  45. }
  46. // CreateBranchProtectionOption options for creating a branch protection
  47. type CreateBranchProtectionOption struct {
  48. BranchName string `json:"branch_name"`
  49. EnablePush bool `json:"enable_push"`
  50. EnablePushWhitelist bool `json:"enable_push_whitelist"`
  51. PushWhitelistUsernames []string `json:"push_whitelist_usernames"`
  52. PushWhitelistTeams []string `json:"push_whitelist_teams"`
  53. PushWhitelistDeployKeys bool `json:"push_whitelist_deploy_keys"`
  54. EnableMergeWhitelist bool `json:"enable_merge_whitelist"`
  55. MergeWhitelistUsernames []string `json:"merge_whitelist_usernames"`
  56. MergeWhitelistTeams []string `json:"merge_whitelist_teams"`
  57. EnableStatusCheck bool `json:"enable_status_check"`
  58. StatusCheckContexts []string `json:"status_check_contexts"`
  59. RequiredApprovals int64 `json:"required_approvals"`
  60. EnableApprovalsWhitelist bool `json:"enable_approvals_whitelist"`
  61. ApprovalsWhitelistUsernames []string `json:"approvals_whitelist_username"`
  62. ApprovalsWhitelistTeams []string `json:"approvals_whitelist_teams"`
  63. BlockOnRejectedReviews bool `json:"block_on_rejected_reviews"`
  64. DismissStaleApprovals bool `json:"dismiss_stale_approvals"`
  65. RequireSignedCommits bool `json:"require_signed_commits"`
  66. ProtectedFilePatterns string `json:"protected_file_patterns"`
  67. }
  68. // EditBranchProtectionOption options for editing a branch protection
  69. type EditBranchProtectionOption struct {
  70. EnablePush *bool `json:"enable_push"`
  71. EnablePushWhitelist *bool `json:"enable_push_whitelist"`
  72. PushWhitelistUsernames []string `json:"push_whitelist_usernames"`
  73. PushWhitelistTeams []string `json:"push_whitelist_teams"`
  74. PushWhitelistDeployKeys *bool `json:"push_whitelist_deploy_keys"`
  75. EnableMergeWhitelist *bool `json:"enable_merge_whitelist"`
  76. MergeWhitelistUsernames []string `json:"merge_whitelist_usernames"`
  77. MergeWhitelistTeams []string `json:"merge_whitelist_teams"`
  78. EnableStatusCheck *bool `json:"enable_status_check"`
  79. StatusCheckContexts []string `json:"status_check_contexts"`
  80. RequiredApprovals *int64 `json:"required_approvals"`
  81. EnableApprovalsWhitelist *bool `json:"enable_approvals_whitelist"`
  82. ApprovalsWhitelistUsernames []string `json:"approvals_whitelist_username"`
  83. ApprovalsWhitelistTeams []string `json:"approvals_whitelist_teams"`
  84. BlockOnRejectedReviews *bool `json:"block_on_rejected_reviews"`
  85. DismissStaleApprovals *bool `json:"dismiss_stale_approvals"`
  86. RequireSignedCommits *bool `json:"require_signed_commits"`
  87. ProtectedFilePatterns *string `json:"protected_file_patterns"`
  88. }