2019-05-11 13:21:34 +03:00
// Copyright 2016 The Gogs Authors. All rights reserved.
2022-11-27 21:20:29 +03:00
// SPDX-License-Identifier: MIT
2019-05-11 13:21:34 +03:00
package structs
2020-02-13 02:19:35 +03:00
import (
"time"
)
2019-05-11 13:21:34 +03:00
// Branch represents a repository branch
type Branch struct {
2020-02-13 02:19:35 +03:00
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 {
2023-01-16 11:00:22 +03:00
// Deprecated: true
2020-11-28 22:30:46 +03:00
BranchName string ` json:"branch_name" `
2023-01-16 11:00:22 +03:00
RuleName string ` json:"rule_name" `
2024-11-27 07:41:06 +03:00
Priority int64 ` json:"priority" `
2020-11-28 22:30:46 +03:00
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" `
2024-07-05 21:21:56 +03:00
EnableForcePush bool ` json:"enable_force_push" `
EnableForcePushAllowlist bool ` json:"enable_force_push_allowlist" `
ForcePushAllowlistUsernames [ ] string ` json:"force_push_allowlist_usernames" `
ForcePushAllowlistTeams [ ] string ` json:"force_push_allowlist_teams" `
ForcePushAllowlistDeployKeys bool ` json:"force_push_allowlist_deploy_keys" `
2020-11-28 22:30:46 +03:00
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" `
2024-01-15 10:20:01 +03:00
IgnoreStaleApprovals bool ` json:"ignore_stale_approvals" `
2020-11-28 22:30:46 +03:00
RequireSignedCommits bool ` json:"require_signed_commits" `
ProtectedFilePatterns string ` json:"protected_file_patterns" `
2021-09-11 17:21:17 +03:00
UnprotectedFilePatterns string ` json:"unprotected_file_patterns" `
2024-10-23 07:39:43 +03:00
BlockAdminMergeOverride bool ` json:"block_admin_merge_override" `
2020-02-13 02:19:35 +03:00
// 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 {
2023-01-16 11:00:22 +03:00
// Deprecated: true
2020-11-28 22:30:46 +03:00
BranchName string ` json:"branch_name" `
2023-01-16 11:00:22 +03:00
RuleName string ` json:"rule_name" `
2024-11-27 07:41:06 +03:00
Priority int64 ` json:"priority" `
2020-11-28 22:30:46 +03:00
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" `
2024-07-05 21:21:56 +03:00
EnableForcePush bool ` json:"enable_force_push" `
EnableForcePushAllowlist bool ` json:"enable_force_push_allowlist" `
ForcePushAllowlistUsernames [ ] string ` json:"force_push_allowlist_usernames" `
ForcePushAllowlistTeams [ ] string ` json:"force_push_allowlist_teams" `
ForcePushAllowlistDeployKeys bool ` json:"force_push_allowlist_deploy_keys" `
2020-11-28 22:30:46 +03:00
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" `
2024-01-15 10:20:01 +03:00
IgnoreStaleApprovals bool ` json:"ignore_stale_approvals" `
2020-11-28 22:30:46 +03:00
RequireSignedCommits bool ` json:"require_signed_commits" `
ProtectedFilePatterns string ` json:"protected_file_patterns" `
2021-09-11 17:21:17 +03:00
UnprotectedFilePatterns string ` json:"unprotected_file_patterns" `
2024-10-23 07:39:43 +03:00
BlockAdminMergeOverride bool ` json:"block_admin_merge_override" `
2020-02-13 02:19:35 +03:00
}
// EditBranchProtectionOption options for editing a branch protection
type EditBranchProtectionOption struct {
2024-11-27 07:41:06 +03:00
Priority * int64 ` json:"priority" `
2020-11-28 22:30:46 +03:00
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" `
2024-07-05 21:21:56 +03:00
EnableForcePush * bool ` json:"enable_force_push" `
EnableForcePushAllowlist * bool ` json:"enable_force_push_allowlist" `
ForcePushAllowlistUsernames [ ] string ` json:"force_push_allowlist_usernames" `
ForcePushAllowlistTeams [ ] string ` json:"force_push_allowlist_teams" `
ForcePushAllowlistDeployKeys * bool ` json:"force_push_allowlist_deploy_keys" `
2020-11-28 22:30:46 +03:00
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" `
2024-01-15 10:20:01 +03:00
IgnoreStaleApprovals * bool ` json:"ignore_stale_approvals" `
2020-11-28 22:30:46 +03:00
RequireSignedCommits * bool ` json:"require_signed_commits" `
ProtectedFilePatterns * string ` json:"protected_file_patterns" `
2021-09-11 17:21:17 +03:00
UnprotectedFilePatterns * string ` json:"unprotected_file_patterns" `
2024-10-23 07:39:43 +03:00
BlockAdminMergeOverride * bool ` json:"block_admin_merge_override" `
2019-05-11 13:21:34 +03:00
}
2024-11-27 07:41:06 +03:00
// UpdateBranchProtectionPriories a list to update the branch protection rule priorities
type UpdateBranchProtectionPriories struct {
IDs [ ] int64 ` json:"ids" `
}