Documentation
¶
Overview ¶
Package client exposes helpers for robot to authenticated webhook header and payload from GitHub/GitCode/Gitee
Package client unified interface for GitCode OpenAPI ¶
Package client unified interface for Gitee OpenAPI ¶
Package client unified interface for GitHub OpenAPI ¶
Package client exposes helpers for robot to define request pool ¶
Package client exposes helpers for robot to use interface ¶
Package client exposes helpers for robot to define business parameters ¶
Package client exposes helpers for robot to orchestrated webhook header and payload from GitHub/GitCode/Gitee
Package client exposes helpers for robot to get the CLA signature of the committer ¶
Package client exposes helpers for robot to get the SIG information of the community
Index ¶
- Constants
- Variables
- func ParseSigInfo(list []SigInfo, org, repo string)
- func ReadPayload(w http.ResponseWriter, r *http.Request) (*bytes.Buffer, error)
- func SetCommunityName(name string)
- func SetSigInfoBaseURL(uri string)
- type Authenticate
- type Authentication
- type Branch
- type BranchAttr
- type CLASignature
- type Client
- type Commit
- type CommitDetail
- type CommitFile
- type CommitPatch
- type CustomRole
- type Dataset
- type GenericEvent
- type Issue
- type PRComment
- type PRCommit
- type PullRequest
- type PullRequestOperationLog
- type RepoContent
- type RepoFileManage
- type Repository
- type RepositoryInfo
- type RepositoryRequest
- type SigInfo
- type User
- type UserInfo
Constants ¶
View Source
const ( ErrorMessageReadRequestBodyFail = "Failed to read request body" HeaderUserAgent = "User-Agent" UserAgentGithub = "GitHub-Hookshot" UserAgentGitCode = "git-gitcode-hook" UserAgentGitee = "git-oschina-hook" HeaderContentTypeName = "Content-Type" HeaderContentTypeJsonValue = "application/json" )
View Source
const ( EventStateOpened = "opened" EventStateClosed = "closed" EventActionOpen = "open" EventActionReopen = "reopen" EventActionUpdate = "update" EventActionDetailSourceUpdateGitCode = "source update" EventActionDetailLabelUpdateGitCode = "update label" EventActionDetailPRUpdate = "mr update" EventActionDetailPRLinkingUpdateGitCode = "update link issue" )
View Source
const ( EventStateOpen = "open" EventActionDetailSourceUpdateGitee = "source_branch_changed" EventActionDetailLabelUpdateGitee = "update_label" EventActionDetailPRLinkingUpdateGitee = "update_link_issue" )
View Source
const ( HeaderRobotChain = "Robot-Chain" HeaderRobotChainAuthed = "Request-Authenticated" CommentOnIssue = "Issue" CommentOnPR = "MergeRequest" )
View Source
const ( Read = "read" Write = "write" Admin = "admin" CLASignStateYes = "yes" CLASignStateNo = "no" CLASignStateUnknown = "unknown" )
View Source
const ( CommunityOpenGauss = "opengauss" CommunityOpenFuyao = "openfuyao" CommunityOpenUBMC = "openubmc" )
Variables ¶
View Source
var ( ErrorMessageRequestMethodNoSupport = http.StatusText(http.StatusMethodNotAllowed) ErrorMessageRequestContentTypeNoSupported = http.StatusText(http.StatusUnsupportedMediaType) )
Functions ¶
func ParseSigInfo ¶
func ReadPayload ¶
func SetCommunityName ¶ added in v0.2.0
func SetCommunityName(name string)
func SetSigInfoBaseURL ¶ added in v0.2.0
func SetSigInfoBaseURL(uri string)
Types ¶
type Authenticate ¶
type Authentication ¶
type Authentication struct { Secret []byte // contains filtered or unexported fields }
func (*Authentication) CheckRequest ¶
func (a *Authentication) CheckRequest(w http.ResponseWriter, r *http.Request) error
func (*Authentication) DoAuthentication ¶
func (a *Authentication) DoAuthentication(w http.ResponseWriter, r *http.Request) (*bytes.Buffer, string, string, error)
func (*Authentication) Validate ¶
func (a *Authentication) Validate() error
type BranchAttr ¶
type CLASignature ¶ added in v0.2.0
type Client ¶
type Client interface { ListRepoAllMember(org, repo string) (result []User, success bool) ListOrgMember(org, role string) (result []User, success bool) ListSigInfo(org, repo string) (result []SigInfo, success bool) ListPullRequestComments(org, repo, number string) (result []PRComment, success bool) ListPullRequestOperationLogs(org, repo, number string) (result []PullRequestOperationLog, success bool) ListOrgRepo(org, repo string) (result []Repository, success bool) ListFileOwner(repo, version string) (result []RepoFileManage, retVersion string, success bool) GetIssue(org, repo, number string) (result Issue, success bool) GetIssueLinkedPRNumber(org, repo, number string) (num int, success bool) GetPullRequestCommits(org, repo, number string) (result []PRCommit, success bool) GetPathContent(org, repo, path, ref string) (result RepoContent, success bool) GetPullRequestChanges(org, repo, number string) (result []CommitFile, success bool) GetPullRequestLabels(org, repo, number string) (result []string, success bool) GetIssueLabels(org, issueID string) (result []string, success bool) GetRepoIssueLabels(org, repo string) (result []string, success bool) GetRepoWithBranch(org, repo, branch string) (result Branch, success bool) GetPRLinkedIssue(org, repo, number string) (result []Issue, success bool) GetUserByUsername(username string) (result User, success bool) GetRepoCustomRoles(org, repo string) (result []CustomRole, success bool) GetRepoAllBranch(org, repo string) (result []Branch, success bool) GetRepoTrees(org, repo, sha, recursive string) (result []RepoContent, success bool) GetRepoFileList(org, repo, refName, fileName string) (result []string, success bool) GetBranchHeadCommit(org, repo, branch string) (result Commit, success bool) GetPullRequest(org, repo, number string) (result PullRequest, success bool) CreateRepoIssueLabel(org, repo, name, color string) (success bool) CreatePRComment(org, repo, number, comment string) (success bool) CreateIssueComment(org, repo, number, comment string) (success bool) AddOrgMember(org, username, permission, roleID string) (success bool) AddIssueLabels(org, repo, number string, labels []string) (success bool) AddPRLabels(org, repo, number string, labels []string) (success bool) CreateOrgRepo(org, repo, description, branch, public string) (success bool) CreateRepoBranch(org, repo, createFrom, branch string) (success bool) CreateProtectedBranch(org, repo, branch string) (success bool) UpdateIssue(org, repo, number string, data Issue) (success bool) UpdatePR(org, repo, number, state string) (success bool) MergePullRequest(org, repo, number, mergeMethod string) (success bool, err error) UpdatePRSetting(org, repo string) (success bool) UpdateRepoBaseSetting(org, repo, newPath, description, defaultBranch, public string) (success bool) RemoveOrgMember(org, username string) (success bool) RemoveIssueLabels(org, repo, number string, labels []string) (success bool) RemovePRLabels(org, repo, number string, labels []string) (success bool) DeleteRepoIssueLabel(org, repo, name string) (success bool) DeletePRComment(org, repo, commentID string) (success bool) CheckPermission(org, repo, username string) (pass, success bool) CheckCLASignature(urlStr string) (signState string, success bool) CheckCLAResult(urlStr string) (signStatus CLASignature, success bool) CheckRepoMemberPermission(org, repo, username string) (pass, success bool) CheckSigPermission(org, repo, username string) (pass, success bool) CheckIfPRCreateEvent(evt *GenericEvent) (yes bool) CheckIfIssueCreateEvent(evt *GenericEvent) (yes bool) CheckIfPRSourceCodeUpdateEvent(evt *GenericEvent) (yes bool) CheckIfPRReopenEvent(evt *GenericEvent) (yes bool) CheckIfPRLabelsUpdateEvent(evt *GenericEvent) (yes bool) CheckIfPRSelfUpdateEvent(evt *GenericEvent) (yes bool) CheckIfPRLinkIssueUpdateEvent(evt *GenericEvent) (yes bool) }
type Commit ¶
type Commit struct { ID string Title string Message string SHA string Detail CommitDetail }
type CommitDetail ¶
type CommitFile ¶ added in v0.2.0
type CommitPatch ¶ added in v0.2.0
type CustomRole ¶
type Dataset ¶
type Dataset struct { StatusCode int `json:"code"` Message string `json:"msg"` Version string `json:"version,omitempty"` Data []SigInfo `json:"data,omitempty"` File []RepoFileManage `json:"file,omitempty"` }
type GenericEvent ¶
type GenericEvent struct { EventType *string `json:"eventType" log:"event-type"` EventGUID *string `json:"eventGUID" log:"event-guid"` Action *string `json:"action" log:"action"` ActionDetail *string `json:"actionDetail" log:"action-detail"` Org *string `json:"org" log:"org"` Repo *string `json:"repo" log:"repo"` HtmlURL *string `json:"htmlURL" log:"html-url"` Base *string `json:"base"` Head *string `json:"head"` State *string `json:"state" log:"state"` ID *string `json:"id" log:"id"` // issues or pull requests id Number *string `json:"number" log:"number"` // issues or pull requests number Author *string `json:"author"` CommentID *string `json:"commentID" log:"comment-id"` CommentKind *string `json:"commentKind" log:"comment-kind"` Comment *string `json:"comment" log:"comment"` Commenter *string `json:"commenter" log:"commenter"` CreateTime *string `json:"createTime" log:"create-time"` UpdateTime *string `json:"updateTime" log:"update-time"` RepoVisibility *string `json:"repoVisibility"` // contains filtered or unexported fields }
func NewGenericEvent ¶
func NewGenericEvent(w http.ResponseWriter, r *http.Request, l *logrus.Entry) *GenericEvent
func (*GenericEvent) CollectLoggingFields ¶
func (e *GenericEvent) CollectLoggingFields() *map[string]interface{}
func (*GenericEvent) GetMetaPayload ¶ added in v0.2.0
func (e *GenericEvent) GetMetaPayload() *bytes.Buffer
type PullRequest ¶
type PullRequest struct { Number *string State *string Title *string Body *string URL *string Assignees []string Testers []string MilestoneNumber *int Head *string Base *string AssigneeNumber *int TesterNumber *int AssigneesAccept []string TestersAccept []string AssigneesPass *bool TestersPass *bool MergeAble *bool Draft *bool Labels []string }
type PullRequestOperationLog ¶ added in v0.2.0
type RepoContent ¶ added in v0.2.0
type RepoFileManage ¶
type Repository ¶
type Repository struct { Name string `yaml:"name,omitempty" json:"name,omitempty"` Description string `yaml:"description,omitempty" json:"description,omitempty"` Type string `yaml:"type,omitempty" json:"type,omitempty"` Upstream string `yaml:"upstream,omitempty" json:"upstream,omitempty"` Platform string `yaml:"platform,omitempty" json:"platform,omitempty"` Branches []*BranchAttr `yaml:"branches,omitempty" json:"branches,omitempty"` FilesManage []*RepoFileManage `yaml:"files,omitempty" json:"files,omitempty"` }
type RepositoryInfo ¶
type RepositoryInfo struct { Committers []*UserInfo `yaml:"committers,omitempty" json:"committers,omitempty"` RepositoryList []string `yaml:"repo,omitempty" json:"repo,omitempty"` RepoDetail *Repository `yaml:"-" json:"repo_detail,omitempty"` }
type RepositoryRequest ¶
type SigInfo ¶ added in v0.2.0
type SigInfo struct { SigName string `json:"sig_name,omitempty"` Maintainers []string `json:"maintainers,omitempty"` Committers []string `json:"committers,omitempty"` RepositoryList []string `json:"repos,omitempty"` RepositoryInfo []*RepositoryInfo `json:"repositories,omitempty"` }
type UserInfo ¶
type UserInfo struct { GiteeID string `yaml:"gitee_id,omitempty" json:"gitee_id,omitempty"` GitCodeID string `yaml:"gitcode_id,omitempty" json:"gitcode_id,omitempty"` Name string `yaml:"name,omitempty" json:"name,omitempty"` Organization string `yaml:"organization,omitempty" json:"organization,omitempty"` Email string `yaml:"email,omitempty" json:"email,omitempty"` }
Click to show internal directories.
Click to hide internal directories.