code.gitea.io/gitea@v1.19.3/modules/structs/repo_branch.go (about)

     1  // Copyright 2016 The Gogs Authors. All rights reserved.
     2  // SPDX-License-Identifier: MIT
     3  
     4  package structs
     5  
     6  import (
     7  	"time"
     8  )
     9  
    10  // Branch represents a repository branch
    11  type Branch struct {
    12  	Name                          string         `json:"name"`
    13  	Commit                        *PayloadCommit `json:"commit"`
    14  	Protected                     bool           `json:"protected"`
    15  	RequiredApprovals             int64          `json:"required_approvals"`
    16  	EnableStatusCheck             bool           `json:"enable_status_check"`
    17  	StatusCheckContexts           []string       `json:"status_check_contexts"`
    18  	UserCanPush                   bool           `json:"user_can_push"`
    19  	UserCanMerge                  bool           `json:"user_can_merge"`
    20  	EffectiveBranchProtectionName string         `json:"effective_branch_protection_name"`
    21  }
    22  
    23  // BranchProtection represents a branch protection for a repository
    24  type BranchProtection struct {
    25  	// Deprecated: true
    26  	BranchName                    string   `json:"branch_name"`
    27  	RuleName                      string   `json:"rule_name"`
    28  	EnablePush                    bool     `json:"enable_push"`
    29  	EnablePushWhitelist           bool     `json:"enable_push_whitelist"`
    30  	PushWhitelistUsernames        []string `json:"push_whitelist_usernames"`
    31  	PushWhitelistTeams            []string `json:"push_whitelist_teams"`
    32  	PushWhitelistDeployKeys       bool     `json:"push_whitelist_deploy_keys"`
    33  	EnableMergeWhitelist          bool     `json:"enable_merge_whitelist"`
    34  	MergeWhitelistUsernames       []string `json:"merge_whitelist_usernames"`
    35  	MergeWhitelistTeams           []string `json:"merge_whitelist_teams"`
    36  	EnableStatusCheck             bool     `json:"enable_status_check"`
    37  	StatusCheckContexts           []string `json:"status_check_contexts"`
    38  	RequiredApprovals             int64    `json:"required_approvals"`
    39  	EnableApprovalsWhitelist      bool     `json:"enable_approvals_whitelist"`
    40  	ApprovalsWhitelistUsernames   []string `json:"approvals_whitelist_username"`
    41  	ApprovalsWhitelistTeams       []string `json:"approvals_whitelist_teams"`
    42  	BlockOnRejectedReviews        bool     `json:"block_on_rejected_reviews"`
    43  	BlockOnOfficialReviewRequests bool     `json:"block_on_official_review_requests"`
    44  	BlockOnOutdatedBranch         bool     `json:"block_on_outdated_branch"`
    45  	DismissStaleApprovals         bool     `json:"dismiss_stale_approvals"`
    46  	RequireSignedCommits          bool     `json:"require_signed_commits"`
    47  	ProtectedFilePatterns         string   `json:"protected_file_patterns"`
    48  	UnprotectedFilePatterns       string   `json:"unprotected_file_patterns"`
    49  	// swagger:strfmt date-time
    50  	Created time.Time `json:"created_at"`
    51  	// swagger:strfmt date-time
    52  	Updated time.Time `json:"updated_at"`
    53  }
    54  
    55  // CreateBranchProtectionOption options for creating a branch protection
    56  type CreateBranchProtectionOption struct {
    57  	// Deprecated: true
    58  	BranchName                    string   `json:"branch_name"`
    59  	RuleName                      string   `json:"rule_name"`
    60  	EnablePush                    bool     `json:"enable_push"`
    61  	EnablePushWhitelist           bool     `json:"enable_push_whitelist"`
    62  	PushWhitelistUsernames        []string `json:"push_whitelist_usernames"`
    63  	PushWhitelistTeams            []string `json:"push_whitelist_teams"`
    64  	PushWhitelistDeployKeys       bool     `json:"push_whitelist_deploy_keys"`
    65  	EnableMergeWhitelist          bool     `json:"enable_merge_whitelist"`
    66  	MergeWhitelistUsernames       []string `json:"merge_whitelist_usernames"`
    67  	MergeWhitelistTeams           []string `json:"merge_whitelist_teams"`
    68  	EnableStatusCheck             bool     `json:"enable_status_check"`
    69  	StatusCheckContexts           []string `json:"status_check_contexts"`
    70  	RequiredApprovals             int64    `json:"required_approvals"`
    71  	EnableApprovalsWhitelist      bool     `json:"enable_approvals_whitelist"`
    72  	ApprovalsWhitelistUsernames   []string `json:"approvals_whitelist_username"`
    73  	ApprovalsWhitelistTeams       []string `json:"approvals_whitelist_teams"`
    74  	BlockOnRejectedReviews        bool     `json:"block_on_rejected_reviews"`
    75  	BlockOnOfficialReviewRequests bool     `json:"block_on_official_review_requests"`
    76  	BlockOnOutdatedBranch         bool     `json:"block_on_outdated_branch"`
    77  	DismissStaleApprovals         bool     `json:"dismiss_stale_approvals"`
    78  	RequireSignedCommits          bool     `json:"require_signed_commits"`
    79  	ProtectedFilePatterns         string   `json:"protected_file_patterns"`
    80  	UnprotectedFilePatterns       string   `json:"unprotected_file_patterns"`
    81  }
    82  
    83  // EditBranchProtectionOption options for editing a branch protection
    84  type EditBranchProtectionOption struct {
    85  	EnablePush                    *bool    `json:"enable_push"`
    86  	EnablePushWhitelist           *bool    `json:"enable_push_whitelist"`
    87  	PushWhitelistUsernames        []string `json:"push_whitelist_usernames"`
    88  	PushWhitelistTeams            []string `json:"push_whitelist_teams"`
    89  	PushWhitelistDeployKeys       *bool    `json:"push_whitelist_deploy_keys"`
    90  	EnableMergeWhitelist          *bool    `json:"enable_merge_whitelist"`
    91  	MergeWhitelistUsernames       []string `json:"merge_whitelist_usernames"`
    92  	MergeWhitelistTeams           []string `json:"merge_whitelist_teams"`
    93  	EnableStatusCheck             *bool    `json:"enable_status_check"`
    94  	StatusCheckContexts           []string `json:"status_check_contexts"`
    95  	RequiredApprovals             *int64   `json:"required_approvals"`
    96  	EnableApprovalsWhitelist      *bool    `json:"enable_approvals_whitelist"`
    97  	ApprovalsWhitelistUsernames   []string `json:"approvals_whitelist_username"`
    98  	ApprovalsWhitelistTeams       []string `json:"approvals_whitelist_teams"`
    99  	BlockOnRejectedReviews        *bool    `json:"block_on_rejected_reviews"`
   100  	BlockOnOfficialReviewRequests *bool    `json:"block_on_official_review_requests"`
   101  	BlockOnOutdatedBranch         *bool    `json:"block_on_outdated_branch"`
   102  	DismissStaleApprovals         *bool    `json:"dismiss_stale_approvals"`
   103  	RequireSignedCommits          *bool    `json:"require_signed_commits"`
   104  	ProtectedFilePatterns         *string  `json:"protected_file_patterns"`
   105  	UnprotectedFilePatterns       *string  `json:"unprotected_file_patterns"`
   106  }