bitclient

package module
v0.0.0-...-5a652a9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2019 License: MIT Imports: 3 Imported by: 0

README

BitClient

BitClient is a Golang Api client for Atlassian Bitbucket REST api (v1.0).

Overview

This library allow you to call Bitbucket api endpoint from you go programs, converting json responses to Go structs (see types.go for the complete list).

It's currently integrated in a command line utility BitAdmin, aimed to ease and speed up administration of Bitbucket repositories.

Installation

Make sure you have a working Go environment. Go version 1.2+ is supported. See the install instructions for Go.

To install bitclient, simply run:

$ go get github.com/daeMOn63/bitclient

Dependencies are managed using Dep. Make sure to follow the installation instructions to setup dep on your workstation.

To install the dependencies, run from the project root:

$ dep ensure

Getting started

The following sample will connect to the bitbucket api and retrieve a list of all projects.

package main
import (
    "fmt"
    "os"
    "github.com/daeMOn63/bitclient"
)

func main() {
    client := bitclient.NewBitClient("https://bitbucket.org/", "<username>", "<password>")

    requestParams := bitclient.PagedRequest{
        Limit: 10,
        Start: 0,
    }

    projectsResponse, err := client.GetProjects(requestParams)

    if err != nil {
        fmt.Println(err)
        os.Exit(1)
    }

    for _, project := range projectsResponse.Values {
        fmt.Printf("Project : %d - %s\n", project.Id, project.Key)
    }
}

Supported versions

The library is currently developed according to the documentation of Atlassian Bitbucket v4.13.1 Other versions have not been tested yet.

Documentation

Index

Constants

View Source
const (
	REPO_READ     = "REPO_READ"
	REPO_WRITE    = "REPO_WRITE"
	REPO_ADMIN    = "REPO_ADMIN"
	PROJECT_READ  = "PROJECT_READ"
	PROJECT_WRITE = "PROJECT_WRITE"
)
View Source
const BASE_URI = "/rest/api/1.0"

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	User     User
	Role     string
	Approved bool
	Status   string
}

type BitClient

type BitClient struct {
	// contains filtered or unexported fields
}

func NewBitClient

func NewBitClient(url string, username string, password string) *BitClient

func (*BitClient) CloneRepositoryGroupPermissions

func (bc *BitClient) CloneRepositoryGroupPermissions(sourceProjectKey, sourceRepositorySlug, targetProjectKey, targetRepositorySlug string) error

func (*BitClient) CloneRepositoryMasterBranchRestrictions

func (bc *BitClient) CloneRepositoryMasterBranchRestrictions(sourceProjectKey, sourceRepositorySlug, targetProjectKey, targetRepositorySlug string) error

func (*BitClient) CloneRepositoryUserPermissions

func (bc *BitClient) CloneRepositoryUserPermissions(sourceProjectKey, sourceRepositorySlug, targetProjectKey, targetRepositorySlug string) error

func (*BitClient) CreatePullRequest

func (bc *BitClient) CreatePullRequest(projectKey string, repositorySlug string, params CreatePullRequestParams) (IdResponse, error)

func (*BitClient) CreatePullRequestComment

func (bc *BitClient) CreatePullRequestComment(projectKey, repositorySlug, prId string, params CreatePullRequestCommentParams) (IdResponse, error)

func (*BitClient) CreateRepository

func (bc *BitClient) CreateRepository(projectKey string, params CreateRepositoryRequest) (Repository, error)

func (*BitClient) CreateRepositoryDefaultReviewers

func (bc *BitClient) CreateRepositoryDefaultReviewers(projectKey, repositorySlug string, params DefaultReviewers) (DefaultReviewers, error)

func (*BitClient) CreateTag

func (bc *BitClient) CreateTag(projectKey string, repositorySlug string, params CreateTagRequest) (Tag, error)

func (*BitClient) CreateUser

func (bc *BitClient) CreateUser(params CreateUserRequest) error

func (*BitClient) DeleteUser

func (bc *BitClient) DeleteUser(params DeleteUserRequest) (DetailedUser, error)

func (*BitClient) DisableHook

func (bc *BitClient) DisableHook(projectKey, repositorySlug, hookKey string) error

func (*BitClient) DoDeleteUrl

func (bc *BitClient) DoDeleteUrl(uri string, params interface{}, rData interface{}) (*http.Response, error)

func (*BitClient) DoGet

func (bc *BitClient) DoGet(uri string, params interface{}, rData interface{}) (*http.Response, error)

func (*BitClient) DoPost

func (bc *BitClient) DoPost(uri string, data interface{}, rData interface{}) (*http.Response, error)

func (*BitClient) DoPostUrl

func (bc *BitClient) DoPostUrl(uri string, params interface{}, rData interface{}) (*http.Response, error)

func (*BitClient) DoPut

func (bc *BitClient) DoPut(uri string, data interface{}, rData interface{}) (*http.Response, error)

func (*BitClient) DoPutUrl

func (bc *BitClient) DoPutUrl(uri string, data interface{}, rData interface{}) (*http.Response, error)

func (*BitClient) EnableHook

func (bc *BitClient) EnableHook(projectKey, repositorySlug, hookKey string, hookSettings interface{}) error

func (*BitClient) GetBranchingModel

func (bc *BitClient) GetBranchingModel(projectKey, repositorySlug string) (BranchingModel, error)

Those branchmodel/configuration calls are not officially documented. Thanks to this comment for detailing usage: https://jira.atlassian.com/browse/BSERV-5411?focusedCommentId=1517096&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-1517096

func (*BitClient) GetGroupUsersNonMember

func (bc *BitClient) GetGroupUsersNonMember(params GetGroupUsersNonMemberRequest) (GetGroupUsersNonMemberResponse, error)

func (*BitClient) GetHooks

func (bc *BitClient) GetHooks(projectKey, repositorySlug string, params GetHooksRequest) (GetHooksResponse, error)

func (*BitClient) GetInboxPullRequests

func (bc *BitClient) GetInboxPullRequests(params GetInboxPullRequestsRequest) (GetInboxPullRequestsResponse, error)

func (*BitClient) GetInboxPullRequestsCount

func (bc *BitClient) GetInboxPullRequestsCount() (GetInboxPullRequestsCountResponse, error)

func (*BitClient) GetMyPullRequestSuggestions

func (*BitClient) GetMyPullRequests

func (bc *BitClient) GetMyPullRequests(params GetMyPullRequestsRequest) (GetMyPullRequestsResponse, error)

func (*BitClient) GetProjectGroupPermission

func (bc *BitClient) GetProjectGroupPermission(projectKey string, params GetProjectGroupPermissionRequest) (GetProjectGroupPermissionResponse, error)

func (*BitClient) GetProjectUserPermission

func (bc *BitClient) GetProjectUserPermission(projectKey string, params GetProjectUserPermissionRequest) (GetProjectUserPermissionResponse, error)

func (*BitClient) GetProjects

func (bc *BitClient) GetProjects(params PagedRequest) (GetProjectsResponse, error)

func (*BitClient) GetPullRequestSettings

func (bc *BitClient) GetPullRequestSettings(projectKey string, repositorySlug string) (PullRequestSettings, error)

func (*BitClient) GetPullRequests

func (bc *BitClient) GetPullRequests(projectKey string, repositorySlug string, params GetPullRequestsRequest) (GetPullRequestsResponse, error)

GetPullRequests lists the pull requests from given repository

func (*BitClient) GetRepositories

func (bc *BitClient) GetRepositories(projectKey string, params PagedRequest) (GetRepositoriesResponse, error)

func (*BitClient) GetRepositoryBranchRestrictions

func (bc *BitClient) GetRepositoryBranchRestrictions(projectKey, repositorySlug string, params GetRepositoryBranchRestrictionRequest) ([]BranchRestriction, error)

func (*BitClient) GetRepositoryDefaultReviewers

func (bc *BitClient) GetRepositoryDefaultReviewers(projectKey, repositorySlug string) ([]DefaultReviewers, error)

func (*BitClient) GetRepositoryGroupPermission

func (bc *BitClient) GetRepositoryGroupPermission(projectKey string, repositorySlug string, params GetRepositoryGroupPermissionRequest) (GetRepositoryGroupPermissionResponse, error)

func (*BitClient) GetRepositoryUserPermission

func (bc *BitClient) GetRepositoryUserPermission(projectKey string, repositorySlug string, params GetRepositoryUserPermissionRequest) (GetRepositoryUserPermissionResponse, error)

func (*BitClient) GetSonarSettings

func (bc *BitClient) GetSonarSettings(projectKey string, repositorySlug string) (SonarSettings, error)

func (*BitClient) GetTags

func (bc *BitClient) GetTags(projectKey string, repositorySlug string, params PagedRequest) (GetTagsResponse, error)

func (*BitClient) GetUserGroups

func (bc *BitClient) GetUserGroups(params GetUserGroupsRequest) (GetUserGroupsResponse, error)

func (*BitClient) GetUserGroupsNonMember

func (bc *BitClient) GetUserGroupsNonMember(params GetUserGroupsNonMembersRequest) (GetUserGroupsNonMembersResponse, error)

func (*BitClient) GetUsers

func (bc *BitClient) GetUsers(params PagedRequest) (GetUsersResponse, error)

func (*BitClient) GetYACCHookSettings

func (bc *BitClient) GetYACCHookSettings(projectKey string, repositorySlug string) (YaccHookSettings, error)

GetYACCHookSettings return the YACC hook settings from bitbucket

func (*BitClient) RenameUser

func (bc *BitClient) RenameUser(params RenameUserRequest) (DetailedUser, error)

func (*BitClient) SearchUsers

func (bc *BitClient) SearchUsers(params SearchUsersRequest) (SearchUsersResponse, error)

func (*BitClient) SetBranchingModel

func (bc *BitClient) SetBranchingModel(projectKey, repositorySlug string, settings BranchingModel) error

func (*BitClient) SetPullRequestSettings

func (bc *BitClient) SetPullRequestSettings(projectKey string, repositorySlug string, params PullRequestSettings) error

func (*BitClient) SetRepositoryBranchRestrictions

func (bc *BitClient) SetRepositoryBranchRestrictions(projectKey, repositorySlug string, params SetRepositoryBranchRestrictionsRequest) error

func (*BitClient) SetRepositoryGroupPermission

func (bc *BitClient) SetRepositoryGroupPermission(projectKey string, repositorySlug string, params SetRepositoryGroupPermissionRequest) error

func (*BitClient) SetRepositoryUserPermission

func (bc *BitClient) SetRepositoryUserPermission(projectKey string, repositorySlug string, params SetRepositoryUserPermissionRequest) error

func (*BitClient) SetSonarSettings

func (bc *BitClient) SetSonarSettings(projectKey string, repositorySlug string, settings SonarSettings) error

func (*BitClient) UnsetRepositoryGroupPermission

func (bc *BitClient) UnsetRepositoryGroupPermission(projectKey string, repositorySlug string, params UnsetRepositoryGroupPermissionRequest) error

func (*BitClient) UnsetRepositoryUserPermission

func (bc *BitClient) UnsetRepositoryUserPermission(projectKey string, repositorySlug string, params UnsetRepositoryUserPermissionRequest) error

func (*BitClient) UpdateRepository

func (bc *BitClient) UpdateRepository(projectKey string, repositorySlug string, params UpdateRepositoryRequest) (Repository, error)

func (*BitClient) UpdateRepositoryDefaultReviewers

func (bc *BitClient) UpdateRepositoryDefaultReviewers(projectKey, repositorySlug string, params DefaultReviewers) (DefaultReviewers, error)

func (*BitClient) UpdateUser

func (bc *BitClient) UpdateUser(params UpdateUserRequest) (DetailedUser, error)

func (*BitClient) UpdateUserPassword

func (bc *BitClient) UpdateUserPassword(params UpdateUserPasswordRequest) error

type BranchRef

type BranchRef struct {
	Id         string     `json:"id"`
	Repository Repository `json:"repository"`
}

type BranchRestriction

type BranchRestriction struct {
	Id      int      `json:"id,omitempty"`
	Type    string   `json:"type,omitempty"`
	Matcher Matcher  `json:"matcher,omitempty"`
	Users   []User   `json:"users,omitempty"`
	Groups  []string `json:"groups,omitempty"`
}

type BranchingModel

type BranchingModel struct {
	Development BranchingModelBranch `json:"development,omitempty"`
	Production  BranchingModelBranch `json:"production,omitempty"`
	Types       []BranchingModelType `json:"types,omitempty"`
}

type BranchingModelBranch

type BranchingModelBranch struct {
	RefId      string `json:"refId,omitempty"`
	UseDefault bool   `json:"useDefault,omitempty"`
}

type BranchingModelType

type BranchingModelType struct {
	Id          string `json:"id,omitempty"`
	DisplayName string `json:"displayName,omitempty"`
	Enabled     bool   `json:"enabled,omitempty"`
	Prefix      string `json:"prefix,omitempty"`
}

type CreatePullRequestCommentParams

type CreatePullRequestCommentParams struct {
	Text   string                                `json:"text"`
	Parent *CreatePullRequestCommentParentParams `json:"parent,omitempty"`
}

type CreatePullRequestCommentParentParams

type CreatePullRequestCommentParentParams struct {
	Id int `json:"id"`
}

type CreatePullRequestParams

type CreatePullRequestParams struct {
	Title             string        `json:"title"`
	Description       string        `json:"description"`
	FromRef           BranchRef     `json:"fromRef"`
	ToRef             BranchRef     `json:"toRef"`
	Reviewers         []Participant `json:"reviewers"`
	CloseSourceBranch bool          `json:"close_source_branch"`
}

type CreateRepositoryRequest

type CreateRepositoryRequest struct {
	Name     string `json:"name"`
	ScmId    string `json:"scmId"`
	Forkable bool   `json:"forkable"`
}

type CreateTagRequest

type CreateTagRequest struct {
	Name       string `json:"name"`
	StartPoint string `json:"startPoint"`
	Message    string `json:"message"`
}

type CreateUserRequest

type CreateUserRequest struct {
	Name              string
	Password          string
	DisplayName       string
	EmailAddress      string
	AddToDefaultGroup bool
	Notify            bool
}

type DefaultReviewers

type DefaultReviewers struct {
	Id                int        `json:"id,omitempty"`
	Repository        Repository `json:"repository,omitempty"`
	FromRefMatcher    Matcher    `json:"fromRefMatcher,omitempty"`
	ToRefMatcher      Matcher    `json:"toRefMatcher,omitempty"`
	Reviewers         []User     `json:"reviewers,omitempty"`
	RequiredApprovals int        `json:"requiredApprovals,omitempty"`
}

type DeleteUserRequest

type DeleteUserRequest struct {
	Name string
}

type DetailedUser

type DetailedUser struct {
	User                        User
	DirectoryName               string
	Deletable                   bool
	LastAuthenticationTimestamp uint
	MutableDetails              bool
	MutableGroups               bool
}

type Error

type Error struct {
	Context       string
	Message       string
	ExceptionName string
}

type ErrorResponse

type ErrorResponse struct {
	Errors []Error
}

type GetGroupUsersNonMemberRequest

type GetGroupUsersNonMemberRequest struct {
	PagedRequest
	Context string
	Filter  string
}

type GetGroupUsersNonMemberResponse

type GetGroupUsersNonMemberResponse struct {
	PagedResponse
	Values []DetailedUser
}

type GetHooksRequest

type GetHooksRequest struct {
	PagedRequest
	Type string
}

type GetHooksResponse

type GetHooksResponse struct {
	PagedResponse
	Values []Hook
}

type GetInboxPullRequestsCountResponse

type GetInboxPullRequestsCountResponse struct {
	Count uint `json:"count"`
}

type GetInboxPullRequestsRequest

type GetInboxPullRequestsRequest struct {
	PagedRequest
	Start uint   `url:"start,omitempty"`
	Limit uint   `url:"limit,omitempty"`
	Role  string `url:"role,omitempty"`
}

type GetInboxPullRequestsResponse

type GetInboxPullRequestsResponse struct {
	PagedResponse
	Values []PullRequest
}

type GetMyPullRequestSuggestionsRequest

type GetMyPullRequestSuggestionsRequest struct {
	PagedRequest
	ChangeSince uint `url:"changeSince,omitempty"`
	Limit       uint `url:"limit,omitempty"`
}

type GetMyPullRequestSuggestionsResponse

type GetMyPullRequestSuggestionsResponse struct {
	PagedResponse
	Values []PullRequestSuggestion
}

type GetMyPullRequestsRequest

type GetMyPullRequestsRequest struct {
	PagedRequest
	State             string `url:"state,omitempty"`
	Role              string `url:"role,omitempty"`
	ParticipantStatus string `url:"participantStatus,omitempty"`
	Order             string `url:"order,omitempty"`
	ClosedSince       string `url:"closedSince,omitempty"`
}

type GetMyPullRequestsResponse

type GetMyPullRequestsResponse struct {
	PagedResponse PagedResponse
	PullRequests  []PullRequest
}

type GetProjectGroupPermissionRequest

type GetProjectGroupPermissionRequest struct {
	PagedRequest
	Filter string
}

type GetProjectGroupPermissionResponse

type GetProjectGroupPermissionResponse struct {
	PagedResponse
	Values []GroupPermission
}

type GetProjectUserPermissionRequest

type GetProjectUserPermissionRequest struct {
	PagedRequest
	Filter string
}

type GetProjectUserPermissionResponse

type GetProjectUserPermissionResponse struct {
	PagedResponse
	Values []UserPermission
}

type GetProjectsResponse

type GetProjectsResponse struct {
	PagedResponse
	Values []Project
}

type GetPullRequestsRequest

type GetPullRequestsRequest struct {
	PagedRequest
	Direction      string `url:"direction,omitempty"`
	At             string `url:"at,omitempty"`
	State          string `url:"state,omitempty"`
	Order          string `url:"order,omitempty"`
	WithAttributes bool   `url:"withAttributes,omitempty"`
	WithProperties bool   `url:"withProperties,omitempty"`
}

GetPullRequestsRequest defines the available parameters when requesting the list of pull requests from a repository.

type GetPullRequestsResponse

type GetPullRequestsResponse struct {
	PagedResponse
	Values []PullRequest
}

GetPullRequestsResponse holds the API response data

type GetRepositoriesResponse

type GetRepositoriesResponse struct {
	PagedResponse
	Values []Repository
}

type GetRepositoryBranchRestrictionRequest

type GetRepositoryBranchRestrictionRequest struct {
	PagedRequest
	Type        string `url:"type,omitempty"`
	MatcherType string `url:"matcherType,omitempty"`
	MatcherId   string `url:"matcherId,omitempty"`
	Effective   bool   `url:"effective,omitempty"`
}

type GetRepositoryBranchRestrictionResponse

type GetRepositoryBranchRestrictionResponse struct {
	PagedResponse
	Values []BranchRestriction
}

type GetRepositoryGroupPermissionRequest

type GetRepositoryGroupPermissionRequest struct {
	PagedRequest
	Filter string
}

type GetRepositoryGroupPermissionResponse

type GetRepositoryGroupPermissionResponse struct {
	PagedResponse
	Values []GroupPermission
}

type GetRepositoryUserPermissionRequest

type GetRepositoryUserPermissionRequest struct {
	PagedRequest
	Filter string
}

type GetRepositoryUserPermissionResponse

type GetRepositoryUserPermissionResponse struct {
	PagedResponse
	Values []UserPermission
}

type GetTagsResponse

type GetTagsResponse struct {
	PagedResponse
	Values []Tag
}

type GetUserGroupsNonMembersRequest

type GetUserGroupsNonMembersRequest struct {
	PagedRequest
	Context string
	Filter  string
}

type GetUserGroupsNonMembersResponse

type GetUserGroupsNonMembersResponse struct {
	PagedResponse
	Values []Group
}

type GetUserGroupsRequest

type GetUserGroupsRequest struct {
	PagedRequest
	Context string
	Filter  string
}

type GetUserGroupsResponse

type GetUserGroupsResponse struct {
	PagedResponse
	Values []Group
}

type GetUsersResponse

type GetUsersResponse struct {
	PagedResponse
	Values []User
}

type Group

type Group struct {
	Name      string
	Deletable bool
}

type GroupPermission

type GroupPermission struct {
	Group      Group
	Permission string `json:"permission,omitempty"`
}

type Hook

type Hook struct {
	Details    HookDetails `json:"details,omitempty"`
	Enabled    bool        `json:"enabled,omitempty"`
	Configured bool        `json:"configured,omitempty"`
}

type HookDetails

type HookDetails struct {
	Key           string `json:"key,omitempty"`
	Name          string `json:"name,omitempty"`
	Type          string `json:"type,omitempty"`
	Description   string `json:"description,omitempty"`
	Version       string `json:"version,omitempty"`
	ConfigFormKey string `json:"configFormKey,omitempty"`
}

type IdResponse

type IdResponse struct {
	Id int `json:"id"`
}
type Link map[string]string
type Links map[string][]Link

type Matcher

type Matcher struct {
	Id        string      `json:"id,omitempty"`
	DisplayId string      `json:"displayId,omitempty"`
	Active    bool        `json:"active,omitempty"`
	Type      MatcherType `json:"type,omitempty"`
}

type MatcherType

type MatcherType struct {
	Id   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

type PagedRequest

type PagedRequest struct {
	Limit uint `url:"limit,omitempty"`
	Start uint `url:"start,omitempty"`
}

type PagedResponse

type PagedResponse struct {
	Size       uint `json:"size"`
	Limit      uint `json:"limit"`
	IsLastPage bool `json:"isLastPage"`
	Start      uint `json:"start"`
}

type Participant

type Participant struct {
	User               User `json:"user"`
	LastReviewedCommit string
	Role               string `json:"role,omitempty"`
	Approved           bool
	Status             string
}

type Project

type Project struct {
	Key         string `json:"key,omitempty"`
	Id          uint   `json:"id,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Public      bool   `json:"public,omitempty"`
	Type        string `json:"type,omitempty"`
	Links       Links  `json:"links,omitempty"`
}

type PullRequest

type PullRequest struct {
	Id           uint
	Version      uint
	Title        string
	Description  string
	State        string
	Open         bool
	Closed       bool
	CreatedDate  uint
	UpdatedDate  uint
	FromRef      Ref
	ToRef        Ref
	Locked       bool
	Author       Author
	Reviewers    []Participant
	Participants []Participant
	Links        Links
}

type PullRequestMergeConfig

type PullRequestMergeConfig struct {
	DefaultStrategy PullRequestStrategy   `json:"defaultStrategy,omitempty"`
	Strategies      []PullRequestStrategy `json:"strategies,omitempty"`
	Type            string                `json:"type,omitempty"`
}

type PullRequestSettings

type PullRequestSettings struct {
	MergeConfig              PullRequestMergeConfig `json:"mergeConfig,omitempty"`
	RequiredAllApprovers     bool                   `json:"requiredAllApprovers,omitempty"`
	RequiredAllTasksComplete bool                   `json:"requiredAllTasksComplete,omitempty"`
	RequiredApprovers        uint                   `json:"requiredApprovers,omitempty"`
	RequiredSuccessfulBuilds uint                   `json:"requiredSuccessfulBuilds,omitempty"`
	UnapproveOnUpdate        bool                   `json:"unapproveOnUpdate,omitempty"`
}

type PullRequestStrategy

type PullRequestStrategy struct {
	Description string `json:"description,omitempty"`
	Enabled     bool   `json:"enabled,omitempty"`
	Flag        string `json:"flag,omitempty"`
	Id          string `json:"id,omitempty"`
	Name        string `json:"name,omitempty"`
}

type PullRequestSuggestion

type PullRequestSuggestion struct {
	ChangeTime uint
	RefChange  RefChange
	Repository Repository
	FromRef    Ref
	ToRef      Ref
}

type Ref

type Ref struct {
	Id        string
	DisplayId string
	Type      string
}

type RefChange

type RefChange struct {
	Ref      Ref
	RefId    string
	FromHash string
	ToHash   string
	Type     string
}

type RenameUserRequest

type RenameUserRequest struct {
	Name    string `json:"name"`
	NewName string `json:"newName"`
}

type Repository

type Repository struct {
	Slug          string `json:"slug,omitempty"`
	Id            uint   `json:"id,omitempty"`
	Name          string `json:"name,omitempty"`
	ScmId         string
	State         string
	StatusMessage string
	Forkable      bool
	Project       Project `json:"project,omitempty"`
	Public        bool
	Links         Links
}

type RepositoryDefaultReviewersRequest

type RepositoryDefaultReviewersRequest struct {
	SourceMatcher     Matcher `json:"sourceMatcher,omitempty"`
	TargetMatcher     Matcher `json:"targetMatcher,omitempty"`
	RequiredApprovals int     `json:"requiredApprovals"`
	Reviewers         []User  `json:"reviewers,omitempty"`
}

type RequestError

type RequestError struct {
	Code    int
	Message string
}

func (RequestError) Error

func (r RequestError) Error() string

type SearchUsersRequest

type SearchUsersRequest struct {
	PagedRequest,
	Filter string
}

type SearchUsersResponse

type SearchUsersResponse struct {
	PagedResponse
	Values []DetailedUser
}

type SetRepositoryBranchRestrictionsRequest

type SetRepositoryBranchRestrictionsRequest struct {
	Id      int      `json:"id,omitempty"`
	Type    string   `json:"type,omitempty"`
	Matcher Matcher  `json:"matcher,omitempty"`
	Users   []string `json:"users,omitempty"`
	Groups  []string `json:"groups,omitempty"`
}

type SetRepositoryGroupPermissionRequest

type SetRepositoryGroupPermissionRequest struct {
	Name       string `url:"name"`
	Permission string `url:"permission"`
}

type SetRepositoryUserPermissionRequest

type SetRepositoryUserPermissionRequest struct {
	Username   string `url:"name"`
	Permission string `url:"permission"`
}

type SonarSettings

type SonarSettings struct {
	Project       SonarSettingsProject       `json:"project,omitempty"`
	Issues        SonarSettingsIssues        `json:"issues,omitempty"`
	DuplicateCode SonarSettingsDuplicateCode `json:"duplicateCode,omitempty"`
	TestCoverage  SonarSettingsTestCoverage  `json:"testCoverage,omitempty"`
	Statistics    SonarSettingsStatistics    `json:"statistics,omitempty"`
	MergeChecks   SonarSettingsMergeChecks   `json:"mergeChecks,omitempty"`
	Provisioning  SonarSettingsProvisioning  `json:"provisioning,omitempty"`
}

type SonarSettingsDuplicateCode

type SonarSettingsDuplicateCode struct {
	ShowDuplicateCode bool `json:"showDuplicateCode,omitempty"`
}

type SonarSettingsIssues

type SonarSettingsIssues struct {
	ShowSonarIssues        bool   `json:"showOnlyNewIssues,omitempty"`
	ShowOnlyNewIssues      bool   `json:"showOnlyNewIssues,omitempty"`
	SonarIssuesMinSeverity string `json:"showOnlyNewIssues,omitempty"`
}

type SonarSettingsMergeChecks

type SonarSettingsMergeChecks struct {
	MergeChecksEnabled       bool   `json:"mergeChecksEnabled,omitempty"`
	QualityGatesEnabled      bool   `json:"qualityGatesEnabled,omitempty"`
	TechnicalDebtMaxIncrease int    `json:"technicalDebtMaxIncrease,omitempty"`
	SonarIssuesMaxNew        int    `json:"sonarIssuesMaxNew,omitempty"`
	SonarIssueTypeMaxNew     string `json:"sonarIssueTypeMaxNew,omitempty"`
	DuplicateCodeMaxIncrease int    `json:"duplicateCodeMaxIncrease,omitempty"`
	CoverageMinPercentage    int    `json:"coverageMinPercentage,omitempty"`
}

type SonarSettingsProject

type SonarSettingsProject struct {
	SonarEnabled                 bool   `json:"sonarEnabled,omitempty"`
	ServerConfigId               int    `json:"serverConfigId,omitempty"`
	MasterProjectKey             string `json:"masterProjectKey,omitempty"`
	ProjectBaseKey               string `json:"projectBaseKey,omitempty"`
	AnalysisMode                 string `json:"analysisMode,omitempty"`
	BuildType                    string `json:"buildType,omitempty"`
	IllegalBranchCharReplacement string `json:"illegalBranchCharReplacement,omitempty"`
	BranchPrefix                 string `json:"branchPrefix,omitempty"`
	PullRequestBranch            string `json:"pullRequestBranch,omitempty"`
	ShowIssuesInSource           bool   `json:"showIssuesInSource,omitempty"`
	ShowOnlyNewOrChangedLines    bool   `json:"showOnlyNewOrChangedLines,omitempty"`
	ProjectCleanupEnabled        bool   `json:"projectCleanupEnabled,omitempty"`
	ForkCleanupEnabled           bool   `json:"forkCleanupEnabled,omitempty"`
	MatchingBranchesRegex        string `json:"matchingBranchesRegex,omitempty"`
	IncrementalModeForMatches    string `json:"incrementalModeForMatches,omitempty"`
	UseSonarBranchFeature        bool   `json:"useSonarBranchFeature,omitempty"`
}

type SonarSettingsProvisioning

type SonarSettingsProvisioning struct {
	QualityProfileProvisioningEnabled bool `json:"qualityProfileProvisioningEnabled,omitempty"`
	PropertiesProvisioningEnabled     bool `json:"propertiesProvisioningEnabled,omitempty"`
}

type SonarSettingsStatistics

type SonarSettingsStatistics struct {
	ShowStatistics           bool `json:"showStatistics,omitempty"`
	CollapsedByDefault       bool `json:"collapsedByDefault,omitempty"`
	ShowQualityGates         bool `json:"showQualityGates,omitempty"`
	ShowBehindCommitsWarning bool `json:"showBehindCommitsWarning,omitempty"`
}

type SonarSettingsTestCoverage

type SonarSettingsTestCoverage struct {
	ShowCoverage bool   `json:"showCoverage,omitempty"`
	CoverageType string `json:"coverageType,omitempty"`
}

type Tag

type Tag struct {
	Id              string
	DisplayId       string
	Type            string
	LatestCommit    string
	LatestChangeset string
	Hash            string
}

type UnsetRepositoryGroupPermissionRequest

type UnsetRepositoryGroupPermissionRequest struct {
	Name string `url:"name"`
}

type UnsetRepositoryUserPermissionRequest

type UnsetRepositoryUserPermissionRequest struct {
	Username string `url:"name"`
}

type UpdateRepositoryRequest

type UpdateRepositoryRequest struct {
	Name     string  `json:"name,omitempty"`
	Forkable bool    `json:"forkable,omitempty"`
	Project  Project `json:"project,omitempty"`
	Public   bool    `json:"public,omitempty"`
}

type UpdateUserPasswordRequest

type UpdateUserPasswordRequest struct {
	Password    string `json:"password"`
	NewPassword string `json:"newPassword"`
	Name        string `json:"name"`
}

type UpdateUserRequest

type UpdateUserRequest struct {
	Name        string `json:"name"`
	DisplayName string `jsin:"displayName"`
	Email       string `json:"email"`
}

type User

type User struct {
	Name         string `json:"name,omitempty"`
	EmailAddress string `json:"emailAddress,omitempty"`
	Id           uint   `json:"id,omitempty"`
	DisplayName  string `json:"displayName,omitempty"`
	Active       bool   `json:"active,omitempty"`
	Slug         string `json:"slug,omitempty"`
	Type         string `json:"type,omitempty"`
}

type UserPermission

type UserPermission struct {
	User       User
	Permission string `json:"permission,omitempty"`
}

type YaccHookSettings

type YaccHookSettings struct {
	RequireMatchingAuthorEmail     bool   `json:"requireMatchingAuthorEmail,omitempty"`
	RequireMatchingAuthorName      bool   `json:"requireMatchingAuthorName,omitempty"`
	CommitterEmailRegex            string `json:"committerEmailRegex,omitempty"`
	CommitMessageRegex             string `json:"commitMessageRegex,omitempty"`
	RequireJiraIssue               bool   `json:"requireJiraIssue,omitempty"`
	IgnoreUnknownIssueProjectKeys  bool   `json:"ignoreUnknownIssueProjectKeys,omitempty"`
	IssueJqlMatcher                string `json:"issueJqlMatcher,omitempty"`
	BranchNameRegex                string `json:"branchNameRegex,omitempty"`
	ErrorMessageHeader             string `json:"errorMessageHeader,omitempty"`
	ErrorMessageCommiterEmail      string `json:"errorMessage.COMMITER_EMAIL,omitempty"`
	ErrorMessageCommiterEmailRegex string `json:"errorMessage.COMMITER_EMAIL_REGEX,omitempty"`
	ErrorMessageCommiterName       string `json:"errorMessage.COMMITER_NAME,omitempty"`
	ErrorMessageCommitRegex        string `json:"errorMessage.COMMIT_REGEX,omitempty"`
	ErrorMessageIssueJQL           string `json:"errorMessage.ISSUE_JQL,omitempty"`
	ErrorMessageBranchName         string `json:"errorMessage.BRANCH_NAME,omitempty"`
	ErrorMessageFooter             string `json:"errorMessageFooter,omitempty"`
	ExcludeMergeCommits            bool   `json:"excludeMergeCommits,omitempty"`
	ExcludeByRegex                 string `json:"excludeByRegex,omitempty"`
	ExcludeBranchRegex             string `json:"excludeBranchRegex,omitempty"`
	ExcludeServiceUserCommits      bool   `json:"excludeServiceUserCommits,omitempty"`
	ExcludeUsers                   string `json:"excludeUsers,omitempty"`
}

YaccHookSettings define the settings of the YACC hook

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL