summaryrefslogtreecommitdiffstats
path: root/modules/structs/repo_branch.go
diff options
context:
space:
mode:
authorDaniel Baumann <daniel@debian.org>2024-10-18 20:33:49 +0200
committerDaniel Baumann <daniel@debian.org>2024-10-18 20:33:49 +0200
commitdd136858f1ea40ad3c94191d647487fa4f31926c (patch)
tree58fec94a7b2a12510c9664b21793f1ed560c6518 /modules/structs/repo_branch.go
parentInitial commit. (diff)
downloadforgejo-dd136858f1ea40ad3c94191d647487fa4f31926c.tar.xz
forgejo-dd136858f1ea40ad3c94191d647487fa4f31926c.zip
Adding upstream version 9.0.0.HEADupstream/9.0.0upstreamdebian
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to '')
-rw-r--r--modules/structs/repo_branch.go112
1 files changed, 112 insertions, 0 deletions
diff --git a/modules/structs/repo_branch.go b/modules/structs/repo_branch.go
new file mode 100644
index 0000000..0b3b0bb
--- /dev/null
+++ b/modules/structs/repo_branch.go
@@ -0,0 +1,112 @@
+// Copyright 2016 The Gogs Authors. All rights reserved.
+// SPDX-License-Identifier: MIT
+
+package structs
+
+import (
+ "time"
+)
+
+// Branch represents a repository branch
+type Branch struct {
+ Name string `json:"name"`
+ Commit *PayloadCommit `json:"commit"`
+ Protected bool `json:"protected"`
+ RequiredApprovals int64 `json:"required_approvals"`
+ EnableStatusCheck bool `json:"enable_status_check"`
+ StatusCheckContexts []string `json:"status_check_contexts"`
+ UserCanPush bool `json:"user_can_push"`
+ UserCanMerge bool `json:"user_can_merge"`
+ EffectiveBranchProtectionName string `json:"effective_branch_protection_name"`
+}
+
+// BranchProtection represents a branch protection for a repository
+type BranchProtection struct {
+ // Deprecated: true
+ BranchName string `json:"branch_name"`
+ RuleName string `json:"rule_name"`
+ EnablePush bool `json:"enable_push"`
+ EnablePushWhitelist bool `json:"enable_push_whitelist"`
+ PushWhitelistUsernames []string `json:"push_whitelist_usernames"`
+ PushWhitelistTeams []string `json:"push_whitelist_teams"`
+ PushWhitelistDeployKeys bool `json:"push_whitelist_deploy_keys"`
+ EnableMergeWhitelist bool `json:"enable_merge_whitelist"`
+ MergeWhitelistUsernames []string `json:"merge_whitelist_usernames"`
+ MergeWhitelistTeams []string `json:"merge_whitelist_teams"`
+ EnableStatusCheck bool `json:"enable_status_check"`
+ StatusCheckContexts []string `json:"status_check_contexts"`
+ RequiredApprovals int64 `json:"required_approvals"`
+ EnableApprovalsWhitelist bool `json:"enable_approvals_whitelist"`
+ ApprovalsWhitelistUsernames []string `json:"approvals_whitelist_username"`
+ ApprovalsWhitelistTeams []string `json:"approvals_whitelist_teams"`
+ BlockOnRejectedReviews bool `json:"block_on_rejected_reviews"`
+ BlockOnOfficialReviewRequests bool `json:"block_on_official_review_requests"`
+ BlockOnOutdatedBranch bool `json:"block_on_outdated_branch"`
+ DismissStaleApprovals bool `json:"dismiss_stale_approvals"`
+ IgnoreStaleApprovals bool `json:"ignore_stale_approvals"`
+ RequireSignedCommits bool `json:"require_signed_commits"`
+ ProtectedFilePatterns string `json:"protected_file_patterns"`
+ UnprotectedFilePatterns string `json:"unprotected_file_patterns"`
+ ApplyToAdmins bool `json:"apply_to_admins"`
+ // swagger:strfmt date-time
+ Created time.Time `json:"created_at"`
+ // swagger:strfmt date-time
+ Updated time.Time `json:"updated_at"`
+}
+
+// CreateBranchProtectionOption options for creating a branch protection
+type CreateBranchProtectionOption struct {
+ // Deprecated: true
+ BranchName string `json:"branch_name"`
+ RuleName string `json:"rule_name"`
+ EnablePush bool `json:"enable_push"`
+ EnablePushWhitelist bool `json:"enable_push_whitelist"`
+ PushWhitelistUsernames []string `json:"push_whitelist_usernames"`
+ PushWhitelistTeams []string `json:"push_whitelist_teams"`
+ PushWhitelistDeployKeys bool `json:"push_whitelist_deploy_keys"`
+ EnableMergeWhitelist bool `json:"enable_merge_whitelist"`
+ MergeWhitelistUsernames []string `json:"merge_whitelist_usernames"`
+ MergeWhitelistTeams []string `json:"merge_whitelist_teams"`
+ EnableStatusCheck bool `json:"enable_status_check"`
+ StatusCheckContexts []string `json:"status_check_contexts"`
+ RequiredApprovals int64 `json:"required_approvals"`
+ EnableApprovalsWhitelist bool `json:"enable_approvals_whitelist"`
+ ApprovalsWhitelistUsernames []string `json:"approvals_whitelist_username"`
+ ApprovalsWhitelistTeams []string `json:"approvals_whitelist_teams"`
+ BlockOnRejectedReviews bool `json:"block_on_rejected_reviews"`
+ BlockOnOfficialReviewRequests bool `json:"block_on_official_review_requests"`
+ BlockOnOutdatedBranch bool `json:"block_on_outdated_branch"`
+ DismissStaleApprovals bool `json:"dismiss_stale_approvals"`
+ IgnoreStaleApprovals bool `json:"ignore_stale_approvals"`
+ RequireSignedCommits bool `json:"require_signed_commits"`
+ ProtectedFilePatterns string `json:"protected_file_patterns"`
+ UnprotectedFilePatterns string `json:"unprotected_file_patterns"`
+ ApplyToAdmins bool `json:"apply_to_admins"`
+}
+
+// EditBranchProtectionOption options for editing a branch protection
+type EditBranchProtectionOption struct {
+ EnablePush *bool `json:"enable_push"`
+ EnablePushWhitelist *bool `json:"enable_push_whitelist"`
+ PushWhitelistUsernames []string `json:"push_whitelist_usernames"`
+ PushWhitelistTeams []string `json:"push_whitelist_teams"`
+ PushWhitelistDeployKeys *bool `json:"push_whitelist_deploy_keys"`
+ EnableMergeWhitelist *bool `json:"enable_merge_whitelist"`
+ MergeWhitelistUsernames []string `json:"merge_whitelist_usernames"`
+ MergeWhitelistTeams []string `json:"merge_whitelist_teams"`
+ EnableStatusCheck *bool `json:"enable_status_check"`
+ StatusCheckContexts []string `json:"status_check_contexts"`
+ RequiredApprovals *int64 `json:"required_approvals"`
+ EnableApprovalsWhitelist *bool `json:"enable_approvals_whitelist"`
+ ApprovalsWhitelistUsernames []string `json:"approvals_whitelist_username"`
+ ApprovalsWhitelistTeams []string `json:"approvals_whitelist_teams"`
+ BlockOnRejectedReviews *bool `json:"block_on_rejected_reviews"`
+ BlockOnOfficialReviewRequests *bool `json:"block_on_official_review_requests"`
+ BlockOnOutdatedBranch *bool `json:"block_on_outdated_branch"`
+ DismissStaleApprovals *bool `json:"dismiss_stale_approvals"`
+ IgnoreStaleApprovals *bool `json:"ignore_stale_approvals"`
+ RequireSignedCommits *bool `json:"require_signed_commits"`
+ ProtectedFilePatterns *string `json:"protected_file_patterns"`
+ UnprotectedFilePatterns *string `json:"unprotected_file_patterns"`
+ ApplyToAdmins *bool `json:"apply_to_admins"`
+}