Help us shape the future of Go! Take the 2026 Go Developer Survey

git

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IssueTypeIssue       = IssueType("issue")
	IssueTypePullRequest = IssueType("pull_request")
)

IssueType constants

View Source
const (
	EventTypePullRequest              = EventType("pull_request")
	EventTypePush                     = EventType("push")
	EventTypeIssueComment             = EventType("issue_comment")
	EventTypePullRequestReview        = EventType("pull_request_review")
	EventTypePullRequestReviewComment = EventType("pull_request_review_comment")
)

Event Types

View Source
const (
	PullRequestStateOpen   = PullRequestState("open")
	PullRequestStateClosed = PullRequestState("closed")
)

Pull Request states

View Source
const (
	PullRequestActionReOpen      = PullRequestAction("reopened")
	PullRequestActionOpen        = PullRequestAction("opened")
	PullRequestActionClose       = PullRequestAction("closed")
	PullRequestActionSynchronize = PullRequestAction("synchronize")
)

Pull Request actions

Variables

This section is empty.

Functions

func RequestHTTP added in v0.1.4

func RequestHTTP(method string, uri string, header map[string]string, data interface{}) ([]byte, http.Header, error)

RequestHTTP requests api call

Types

type Base

type Base struct {
	Ref string
}

Base is a reference for base commit

type Client

type Client interface {
	// Webhooks
	ListWebhook() ([]WebhookEntry, error)
	RegisterWebhook(url string) error
	DeleteWebhook(id int) error
	ParseWebhook(http.Header, []byte) (*Webhook, error)

	// Commit Status
	SetCommitStatus(integrationJob *cicdv1.IntegrationJob, context string, state CommitStatusState, description, targetURL string) error

	// Users
	GetUserInfo(user string) (*User, error)
	CanUserWriteToRepo(user User) (bool, error)

	// Comments
	RegisterComment(issueType IssueType, issueNo int, body string) error
}

Client is a git client interface

type Comment added in v0.2.0

type Comment struct {
	Body string

	CreatedAt *metav1.Time
}

Comment is a comment body

type CommitStatusState

type CommitStatusState string

CommitStatusState is a commit status type

type EventType

type EventType string

EventType is a type of webhook event

type Head struct {
	Ref string
	Sha string
}

Head is a reference for head commit

type Issue added in v0.2.0

type Issue struct {
	PullRequest *PullRequest
}

Issue is an issue related to the Comment

type IssueComment added in v0.2.0

type IssueComment struct {
	Comment Comment
	Issue   Issue
	Sender  User
}

IssueComment is a common structure for issue comment

type IssueType added in v0.2.0

type IssueType string

IssueType is a type of the issue

type PullRequest

type PullRequest struct {
	ID     int
	Title  string
	State  PullRequestState
	Action PullRequestAction
	Sender User
	URL    string
	Base   Base
	Head   Head
}

PullRequest is a common structure for pull request events

type PullRequestAction

type PullRequestAction string

PullRequestAction is an action of the pull request event

type PullRequestState

type PullRequestState string

PullRequestState is a state of the pull request

type Push

type Push struct {
	Sender User
	Ref    string
	Sha    string
}

Push is a common structure for push events

type Repository

type Repository struct {
	Name string
	URL  string
}

Repository is a repository of the git

type User added in v0.1.4

type User struct {
	ID    int
	Name  string
	Email string
}

User is who triggered the event

type Webhook

type Webhook struct {
	EventType EventType
	Repo      Repository

	Push         *Push
	PullRequest  *PullRequest
	IssueComment *IssueComment
}

Webhook is a common structure for git webhooks github-specific or gitlab-specific webhook bodies are converted to this structure before being consumed

type WebhookEntry

type WebhookEntry struct {
	ID  int
	URL string
}

WebhookEntry is a body of registered webhook list

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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