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.
Index ¶
Constants ¶
const ( Read = "read" Write = "write" Admin = "admin" CLASignStateYes = "yes" CLASignStateNo = "no" CLASignStateUnknown = "unknown" )
const ( HeaderRobotChain = "Robot-Chain" HeaderRobotChainAuthed = "Request-Authenticated" CommentOnIssue = "Issue" )
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 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) 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) }
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"` 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