Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

repo_branch.go 5.0KB

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