github.com/daeMOn63/bitclient@v0.0.0-20190425080230-bfee94efac35/types.go (about)

     1  package bitclient
     2  
     3  const (
     4  	REPO_READ     = "REPO_READ"
     5  	REPO_WRITE    = "REPO_WRITE"
     6  	REPO_ADMIN    = "REPO_ADMIN"
     7  	PROJECT_READ  = "PROJECT_READ"
     8  	PROJECT_WRITE = "PROJECT_WRITE"
     9  )
    10  
    11  type Link map[string]string
    12  type Links map[string][]Link
    13  
    14  type Error struct {
    15  	Context       string
    16  	Message       string
    17  	ExceptionName string
    18  }
    19  
    20  type Project struct {
    21  	Key         string `json:"key,omitempty"`
    22  	Id          uint   `json:"id,omitempty"`
    23  	Name        string `json:"name,omitempty"`
    24  	Description string `json:"description,omitempty"`
    25  	Public      bool   `json:"public,omitempty"`
    26  	Type        string `json:"type,omitempty"`
    27  	Links       Links  `json:"links,omitempty"`
    28  }
    29  
    30  type Repository struct {
    31  	Slug          string
    32  	Id            uint
    33  	Name          string
    34  	ScmId         string
    35  	State         string
    36  	StatusMessage string
    37  	Forkable      bool
    38  	Project       Project
    39  	Public        bool
    40  	Links         Links
    41  }
    42  
    43  type User struct {
    44  	Name         string `json:"name,omitempty"`
    45  	EmailAddress string `json:"emailAddress,omitempty"`
    46  	Id           uint   `json:"id,omitempty"`
    47  	DisplayName  string `json:"displayName,omitempty"`
    48  	Active       bool   `json:"active,omitempty"`
    49  	Slug         string `json:"slug,omitempty"`
    50  	Type         string `json:"type,omitempty"`
    51  }
    52  
    53  type DetailedUser struct {
    54  	User                        User
    55  	DirectoryName               string
    56  	Deletable                   bool
    57  	LastAuthenticationTimestamp uint
    58  	MutableDetails              bool
    59  	MutableGroups               bool
    60  }
    61  
    62  type Group struct {
    63  	Name      string
    64  	Deletable bool
    65  }
    66  
    67  type Tag struct {
    68  	Id              string
    69  	DisplayId       string
    70  	Type            string
    71  	LatestCommit    string
    72  	LatestChangeset string
    73  	Hash            string
    74  }
    75  
    76  type RefChange struct {
    77  	Ref      Ref
    78  	RefId    string
    79  	FromHash string
    80  	ToHash   string
    81  	Type     string
    82  }
    83  
    84  type Ref struct {
    85  	Id        string
    86  	DisplayId string
    87  	Type      string
    88  }
    89  
    90  type PullRequestSuggestion struct {
    91  	ChangeTime uint
    92  	RefChange  RefChange
    93  	Repository Repository
    94  	FromRef    Ref
    95  	ToRef      Ref
    96  }
    97  
    98  type Author struct {
    99  	User     User
   100  	Role     string
   101  	Approved bool
   102  	Status   string
   103  }
   104  
   105  type Participant struct {
   106  	User               User
   107  	LastReviewedCommit string
   108  	Role               string
   109  	Approved           bool
   110  	Status             string
   111  }
   112  
   113  type PullRequest struct {
   114  	Id           uint
   115  	Version      uint
   116  	Title        string
   117  	Description  string
   118  	State        string
   119  	Open         bool
   120  	Closed       bool
   121  	CreatedDate  uint
   122  	UpdatedDate  uint
   123  	FromRef      Ref
   124  	ToRef        Ref
   125  	Locked       bool
   126  	Author       Author
   127  	Reviewers    []Participant
   128  	Participants []Participant
   129  	Links        Links
   130  }
   131  
   132  type SonarSettings struct {
   133  	Project       SonarSettingsProject       `json:"project,omitempty"`
   134  	Issues        SonarSettingsIssues        `json:"issues,omitempty"`
   135  	DuplicateCode SonarSettingsDuplicateCode `json:"duplicateCode,omitempty"`
   136  	TestCoverage  SonarSettingsTestCoverage  `json:"testCoverage,omitempty"`
   137  	Statistics    SonarSettingsStatistics    `json:"statistics,omitempty"`
   138  	MergeChecks   SonarSettingsMergeChecks   `json:"mergeChecks,omitempty"`
   139  	Provisioning  SonarSettingsProvisioning  `json:"provisioning,omitempty"`
   140  }
   141  
   142  type SonarSettingsProject struct {
   143  	SonarEnabled                 bool   `json:"sonarEnabled,omitempty"`
   144  	ServerConfigId               int    `json:"serverConfigId,omitempty"`
   145  	MasterProjectKey             string `json:"masterProjectKey,omitempty"`
   146  	ProjectBaseKey               string `json:"projectBaseKey,omitempty"`
   147  	AnalysisMode                 string `json:"analysisMode,omitempty"`
   148  	BuildType                    string `json:"buildType,omitempty"`
   149  	IllegalBranchCharReplacement string `json:"illegalBranchCharReplacement,omitempty"`
   150  	BranchPrefix                 string `json:"branchPrefix,omitempty"`
   151  	PullRequestBranch            string `json:"pullRequestBranch,omitempty"`
   152  	ShowIssuesInSource           bool   `json:"showIssuesInSource,omitempty"`
   153  	ShowOnlyNewOrChangedLines    bool   `json:"showOnlyNewOrChangedLines,omitempty"`
   154  	ProjectCleanupEnabled        bool   `json:"projectCleanupEnabled,omitempty"`
   155  	ForkCleanupEnabled           bool   `json:"forkCleanupEnabled,omitempty"`
   156  	MatchingBranchesRegex        string `json:"matchingBranchesRegex,omitempty"`
   157  	IncrementalModeForMatches    string `json:"incrementalModeForMatches,omitempty"`
   158  	UseSonarBranchFeature        bool   `json:"useSonarBranchFeature,omitempty"`
   159  }
   160  
   161  type SonarSettingsIssues struct {
   162  	ShowSonarIssues        bool   `json:"showOnlyNewIssues,omitempty"`
   163  	ShowOnlyNewIssues      bool   `json:"showOnlyNewIssues,omitempty"`
   164  	SonarIssuesMinSeverity string `json:"showOnlyNewIssues,omitempty"`
   165  }
   166  
   167  type SonarSettingsDuplicateCode struct {
   168  	ShowDuplicateCode bool `json:"showDuplicateCode,omitempty"`
   169  }
   170  
   171  type SonarSettingsTestCoverage struct {
   172  	ShowCoverage bool   `json:"showCoverage,omitempty"`
   173  	CoverageType string `json:"coverageType,omitempty"`
   174  }
   175  
   176  type SonarSettingsStatistics struct {
   177  	ShowStatistics           bool `json:"showStatistics,omitempty"`
   178  	CollapsedByDefault       bool `json:"collapsedByDefault,omitempty"`
   179  	ShowQualityGates         bool `json:"showQualityGates,omitempty"`
   180  	ShowBehindCommitsWarning bool `json:"showBehindCommitsWarning,omitempty"`
   181  }
   182  
   183  type SonarSettingsMergeChecks struct {
   184  	MergeChecksEnabled       bool   `json:"mergeChecksEnabled,omitempty"`
   185  	QualityGatesEnabled      bool   `json:"qualityGatesEnabled,omitempty"`
   186  	TechnicalDebtMaxIncrease int    `json:"technicalDebtMaxIncrease,omitempty"`
   187  	SonarIssuesMaxNew        int    `json:"sonarIssuesMaxNew,omitempty"`
   188  	SonarIssueTypeMaxNew     string `json:"sonarIssueTypeMaxNew,omitempty"`
   189  	DuplicateCodeMaxIncrease int    `json:"duplicateCodeMaxIncrease,omitempty"`
   190  	CoverageMinPercentage    int    `json:"coverageMinPercentage,omitempty"`
   191  }
   192  
   193  type SonarSettingsProvisioning struct {
   194  	QualityProfileProvisioningEnabled bool `json:"qualityProfileProvisioningEnabled,omitempty"`
   195  	PropertiesProvisioningEnabled     bool `json:"propertiesProvisioningEnabled,omitempty"`
   196  }
   197  
   198  type UserPermission struct {
   199  	User       User
   200  	Permission string `json:"permission,omitempty"`
   201  }
   202  
   203  type GroupPermission struct {
   204  	Group      Group
   205  	Permission string `json:"permission,omitempty"`
   206  }
   207  
   208  type BranchRestriction struct {
   209  	Id      int      `json:"id,omitempty"`
   210  	Type    string   `json:"type,omitempty"`
   211  	Matcher Matcher  `json:"matcher,omitempty"`
   212  	Users   []User   `json:"users,omitempty"`
   213  	Groups  []string `json:"groups,omitempty"`
   214  }
   215  
   216  type Matcher struct {
   217  	Id        string      `json:"id,omitempty"`
   218  	DisplayId string      `json:"displayId,omitempty"`
   219  	Active    bool        `json:"active,omitempty"`
   220  	Type      MatcherType `json:"type,omitempty"`
   221  }
   222  
   223  type MatcherType struct {
   224  	Id   string `json:"id,omitempty"`
   225  	Name string `json:"name,omitempty"`
   226  }
   227  
   228  type PullRequestSettings struct {
   229  	MergeConfig              PullRequestMergeConfig `json:"mergeConfig,omitempty"`
   230  	RequiredAllApprovers     bool                   `json:"requiredAllApprovers,omitempty"`
   231  	RequiredAllTasksComplete bool                   `json:"requiredAllTasksComplete,omitempty"`
   232  	RequiredApprovers        uint                   `json:"requiredApprovers,omitempty"`
   233  	RequiredSuccessfulBuilds uint                   `json:"requiredSuccessfulBuilds,omitempty"`
   234  	UnapproveOnUpdate        bool                   `json:"unapproveOnUpdate,omitempty"`
   235  }
   236  
   237  type PullRequestMergeConfig struct {
   238  	DefaultStrategy PullRequestStrategy   `json:"defaultStrategy,omitempty"`
   239  	Strategies      []PullRequestStrategy `json:"strategies,omitempty"`
   240  	Type            string                `json:"type,omitempty"`
   241  }
   242  
   243  type PullRequestStrategy struct {
   244  	Description string `json:"description,omitempty"`
   245  	Enabled     bool   `json:"enabled,omitempty"`
   246  	Flag        string `json:"flag,omitempty"`
   247  	Id          string `json:"id,omitempty"`
   248  	Name        string `json:"name,omitempty"`
   249  }
   250  
   251  type BranchingModel struct {
   252  	Development BranchingModelBranch `json:"development,omitempty"`
   253  	Production  BranchingModelBranch `json:"production,omitempty"`
   254  	Types       []BranchingModelType `json:"types,omitempty"`
   255  }
   256  
   257  type BranchingModelBranch struct {
   258  	RefId      string `json:"refId,omitempty"`
   259  	UseDefault bool   `json:"useDefault,omitempty"`
   260  }
   261  
   262  type BranchingModelType struct {
   263  	Id          string `json:"id,omitempty"`
   264  	DisplayName string `json:"displayName,omitempty"`
   265  	Enabled     bool   `json:"enabled,omitempty"`
   266  	Prefix      string `json:"prefix,omitempty"`
   267  }
   268  
   269  type Hook struct {
   270  	Details    HookDetails `json:"details,omitempty"`
   271  	Enabled    bool        `json:"enabled,omitempty"`
   272  	Configured bool        `json:"configured,omitempty"`
   273  }
   274  
   275  type HookDetails struct {
   276  	Key           string `json:"key,omitempty"`
   277  	Name          string `json:"name,omitempty"`
   278  	Type          string `json:"type,omitempty"`
   279  	Description   string `json:"description,omitempty"`
   280  	Version       string `json:"version,omitempty"`
   281  	ConfigFormKey string `json:"configFormKey,omitempty"`
   282  }
   283  
   284  type DefaultReviewers struct {
   285  	Id                int        `json:"id,omitempty"`
   286  	Repository        Repository `json:"repository,omitempty"`
   287  	FromRefMatcher    Matcher    `json:"fromRefMatcher,omitempty"`
   288  	ToRefMatcher      Matcher    `json:"toRefMatcher,omitempty"`
   289  	Reviewers         []User     `json:"reviewers,omitempty"`
   290  	RequiredApprovals int        `json:"requiredApprovals,omitempty"`
   291  }
   292  
   293  // YaccHookSettings define the settings of the YACC hook
   294  type YaccHookSettings struct {
   295  	RequireMatchingAuthorEmail     bool   `json:"requireMatchingAuthorEmail,omitempty"`
   296  	RequireMatchingAuthorName      bool   `json:"requireMatchingAuthorName,omitempty"`
   297  	CommitterEmailRegex            string `json:"committerEmailRegex,omitempty"`
   298  	CommitMessageRegex             string `json:"commitMessageRegex,omitempty"`
   299  	RequireJiraIssue               bool   `json:"requireJiraIssue,omitempty"`
   300  	IgnoreUnknownIssueProjectKeys  bool   `json:"ignoreUnknownIssueProjectKeys,omitempty"`
   301  	IssueJqlMatcher                string `json:"issueJqlMatcher,omitempty"`
   302  	BranchNameRegex                string `json:"branchNameRegex,omitempty"`
   303  	ErrorMessageHeader             string `json:"errorMessageHeader,omitempty"`
   304  	ErrorMessageCommiterEmail      string `json:"errorMessage.COMMITER_EMAIL,omitempty"`
   305  	ErrorMessageCommiterEmailRegex string `json:"errorMessage.COMMITER_EMAIL_REGEX,omitempty"`
   306  	ErrorMessageCommiterName       string `json:"errorMessage.COMMITER_NAME,omitempty"`
   307  	ErrorMessageCommitRegex        string `json:"errorMessage.COMMIT_REGEX,omitempty"`
   308  	ErrorMessageIssueJQL           string `json:"errorMessage.ISSUE_JQL,omitempty"`
   309  	ErrorMessageBranchName         string `json:"errorMessage.BRANCH_NAME,omitempty"`
   310  	ErrorMessageFooter             string `json:"errorMessageFooter,omitempty"`
   311  	ExcludeMergeCommits            bool   `json:"excludeMergeCommits,omitempty"`
   312  	ExcludeByRegex                 string `json:"excludeByRegex,omitempty"`
   313  	ExcludeBranchRegex             string `json:"excludeBranchRegex,omitempty"`
   314  	ExcludeServiceUserCommits      bool   `json:"excludeServiceUserCommits,omitempty"`
   315  	ExcludeUsers                   string `json:"excludeUsers,omitempty"`
   316  }