Documentation
¶
Overview ¶
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func SetCommunityName(name string)
- func SetSigInfoBaseURL(uri string)
- type Authenticate
- type Authentication
- type Branch
- type BranchAttr
- type CLASignature
- type Client
- type Commit
- type CommitFile
- type CommitPatch
- type Dataset
- type GenericEvent
- type PRComment
- type PRCommit
- type PullRequestOperationLog
- type RepoContent
- type Repository
- type RepositoryInfo
- type SigInfo
- type User
Constants ¶
const ( HeaderRobotChain = "Robot-Chain" HeaderRobotChainAuthed = "Request-Authenticated" CommentOnIssue = "Issue" CommentOnPR = "MergeRequest" )
const ( Read = "read" Write = "write" Admin = "admin" CLASignStateYes = "yes" CLASignStateNo = "no" CLASignStateUnknown = "unknown" )
Variables ¶
This section is empty.
Functions ¶
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
}
func (*Authentication) DoAuthentication ¶
func (a *Authentication) DoAuthentication(w http.ResponseWriter, r *http.Request) (error, *bytes.Buffer, string, string)
type BranchAttr ¶
type CLASignature ¶ added in v0.2.0
type CLASignature struct {
Signed bool `json:"signed"`
}
type Client ¶
type Client interface { CreatePRComment(org, repo, number, comment string) (success bool) CreateIssueComment(org, repo, number, comment string) (success bool) ListRepoAllMember(org, repo string) (result []User, success bool) ListSigAllMember(org, repo string) (result []SigInfo, success bool) CheckPermission(org, repo, username string) (pass, success bool) UpdateIssue(org, repo, number, state string) (success bool) UpdatePR(org, repo, number, state string) (success bool) GetIssueLinkedPRNumber(org, repo, number string) (num int, success bool) CreateRepoIssueLabel(org, repo, name, color string) (success bool) DeleteRepoIssueLabel(org, repo, name string) (success bool) AddIssueLabels(org, repo, number string, labels []string) (success bool) RemoveIssueLabels(org, repo, number string, labels []string) (success bool) AddPRLabels(org, repo, number string, labels []string) (success bool) RemovePRLabels(org, repo, number string, labels []string) (success bool) GetPullRequestCommits(org, repo, number string) (result []PRCommit, success bool) ListPullRequestComments(org, repo, number string) (result []PRComment, success bool) DeletePRComment(org, repo, commentID string) (success bool) CheckCLASignature(urlStr string) (signState string, success bool) CheckIfPRCreateEvent(evt *GenericEvent) (yes bool) CheckIfIssueCreateEvent(evt *GenericEvent) (yes bool) CheckIfPRSourceCodeUpdateEvent(evt *GenericEvent) (yes bool) CheckRepoMemberPermission(org, repo, username string) (pass, success bool) CheckSigPermission(org, repo, username string) (pass, success bool) GetPathContent(org, repo, path, ref string) (result RepoContent, success bool) GetPullRequestChanges(org, repo, number string) (result []CommitFile, success bool) MergePullRequest(org, repo, number, mergeMethod string) (success bool) GetPullRequestLabels(org, repo, number string) (result []string, success bool) ListPullRequestOperationLogs(org, repo, number string) (result []PullRequestOperationLog, success bool) CheckIfPRReopenEvent(evt *GenericEvent) (yes bool) CheckIfPRLabelsUpdateEvent(evt *GenericEvent) (yes 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) }
type CommitFile ¶ added in v0.2.0
type CommitFile struct { SHA *string `json:"sha,omitempty"` Filename *string `json:"filename,omitempty"` Additions *int `json:"additions,omitempty"` Deletions *int `json:"deletions,omitempty"` Changes *int `json:"changes,omitempty"` Status *string `json:"status,omitempty"` Patch *CommitPatch `json:"patch,omitempty"` BlobURL *string `json:"blob_url,omitempty"` RawURL *string `json:"raw_url,omitempty"` ContentsURL *string `json:"contents_url,omitempty"` PreviousFilename *string `json:"previous_filename,omitempty"` }
type CommitPatch ¶ added in v0.2.0
type CommitPatch struct { Diff *string `json:"diff,omitempty"` OldPath *string `json:"old_path,omitempty"` NewPath *string `json:"new_path,omitempty"` NewFile *bool `json:"new_file,omitempty"` RenamedFile *bool `json:"renamed_file,omitempty"` DeletedFile *bool `json:"deleted_file,omitempty"` TooLarge *bool `json:"too_large,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"` // 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 PullRequestOperationLog ¶ added in v0.2.0
type RepoContent ¶ added in v0.2.0
type RepoContent struct { Type *string `json:"type,omitempty"` Target *string `json:"target,omitempty"` Encoding *string `json:"encoding,omitempty"` Size *int64 `json:"size,omitempty"` Name *string `json:"name,omitempty"` Path *string `json:"path,omitempty"` Content *string `json:"content,omitempty"` SHA *string `json:"sha,omitempty"` URL *string `json:"url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` DownloadURL *string `json:"download_url,omitempty"` SubmoduleGitURL *string `json:"submodule_git_url,omitempty"` }
type Repository ¶
type RepositoryInfo ¶
type RepositoryInfo struct { Committers []string `yaml:"committers,omitempty"` RepoDetail *Repository `yaml:"repo_detail,omitempty"` }