client

package
v0.1.6-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

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

View Source
const (
	Read  = "read"
	Write = "write"
	Admin = "admin"
)

Variables

This section is empty.

Functions

func SetCLABaseURL

func SetCLABaseURL(uri string)

func SetCommunityName added in v0.2.0

func SetCommunityName(name string)

func SetDatasetBaseURL

func SetDatasetBaseURL(uri string)

Types

type Authenticate

type Authenticate interface {
	Auth(w http.ResponseWriter, r *http.Request) (error, bool)
	GetPayload() *bytes.Buffer
	GetEventType() string
	GetEventGUID() string
}

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)
	GetRepoAllMember(org, repo string) (result []User, success bool)
	CheckPermission(org, repo, username, permission 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)
}

func NewClient

func NewClient(token []byte, logger *logrus.Entry) Client

NewClient 通过 token 请求每个代码平台的接口,来确定使用哪个平台的 OpenAPI。也有可能返回 nil

type GenericEvent

type GenericEvent struct {
	EventType   *string `log:"event-type"`
	EventGUID   *string `log:"event-guid"`
	Action      *string
	Org         *string `log:"org"`
	Repo        *string `log:"repo"`
	HtmlURL     *string
	Base        *string
	Head        *string
	State       *string
	Number      *string `log:"number"` // issues or pull requests number
	Author      *string
	CommentID   *string
	CommentOfPR *bool `log:"comment-of-pr"`
	Comment     *string
	Commenter   *string
	Labels      []*string
	// 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) ConvertFromBytes

func (e *GenericEvent) ConvertFromBytes(buf *bytes.Buffer) error

func (*GenericEvent) ConvertToBytes

func (e *GenericEvent) ConvertToBytes() ([]byte, error)

type SigInfo added in v0.2.0

type SigInfo struct {
	SigName     string   `json:"sig_name"`
	Maintainers []string `json:"maintainers"`
	Committers  []string `json:"committers"`
}

type User added in v0.2.0

type User struct {
	UserName   string
	NickName   string
	Role       string
	Permission string
}

Jump to

Keyboard shortcuts

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