Documentation
¶
Index ¶
- func ParseHook(eventType EventType, payload []byte) (event interface{}, err error)
- type Author
- type BasicUser
- type Branch
- type Changes
- type Client
- func (c *Client) AddProjectHook(owner, repo, hookURL, token string) (*ProjectHook, error)
- func (c *Client) Compare(projectID int, from, to string) ([]*Diff, error)
- func (c *Client) DeleteProjectHook(owner, repo string, id int) error
- func (c *Client) GetFile(owner, repo string, ref, path string) (*File, error)
- func (c *Client) GetLatestCommit(owner, repo, branch, path string, log *zap.SugaredLogger) (*Commit, error)
- func (c *Client) GetLatestPRCommitList(projectID string, pr int, log *zap.SugaredLogger) (*Commit, error)
- func (c *Client) GetRawFile(owner, repo string, sha string, fileName string) ([]byte, error)
- func (c *Client) ListBranches(owner, repo string, log *zap.SugaredLogger) ([]*Branch, error)
- func (c *Client) ListChangedFiles(event *MergeEvent) ([]string, error)
- func (c *Client) ListGroupProjects(namespace, keyword string, log *zap.SugaredLogger) ([]*Project, error)
- func (c *Client) ListNamespaces(keyword string, log *zap.SugaredLogger) ([]*Project, error)
- func (c *Client) ListOpenedProjectMergeRequests(owner, repo, targetBranch string, log *zap.SugaredLogger) ([]*MergeRequest, error)
- func (c *Client) ListProjectHooks(owner, repo string, log *zap.SugaredLogger) ([]*ProjectHook, error)
- func (c *Client) ListTags(owner, repo string, log *zap.SugaredLogger) ([]*Tag, error)
- func (c *Client) ListTree(owner, repo string, ref string, path string) ([]*TreeNode, error)
- type Commit
- type Commits
- type Diff
- type EventType
- type File
- type Hook
- type LastCommit
- type MergeEvent
- type MergeRequest
- type ObjectAttributes
- type Project
- type ProjectEvent
- type ProjectHook
- type ProjectNamespace
- type PushEvent
- type ReleaseNote
- type Repository
- type Tag
- type TreeNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Branch ¶
type Branch struct {
Name string `json:"name"`
Protected bool `json:"protected"`
Merged bool `json:"merged"`
Default bool `json:"default"`
CanPush bool `json:"can_push"`
DevelopersCanPush bool `json:"developers_can_push"`
DevelopersCanMerge bool `json:"developers_can_merge"`
Commit *Commit `json:"commit"`
}
type Client ¶
type Client struct {
*httpclient.Client
Address string
AccessToken string
}
func (*Client) AddProjectHook ¶
func (c *Client) AddProjectHook(owner, repo, hookURL, token string) (*ProjectHook, error)
func (*Client) DeleteProjectHook ¶
func (*Client) GetLatestCommit ¶
func (*Client) GetLatestPRCommitList ¶
func (*Client) GetRawFile ¶
func (*Client) ListBranches ¶
func (*Client) ListChangedFiles ¶
func (c *Client) ListChangedFiles(event *MergeEvent) ([]string, error)
func (*Client) ListGroupProjects ¶
func (*Client) ListNamespaces ¶
func (*Client) ListOpenedProjectMergeRequests ¶
func (c *Client) ListOpenedProjectMergeRequests(owner, repo, targetBranch string, log *zap.SugaredLogger) ([]*MergeRequest, error)
func (*Client) ListProjectHooks ¶
func (c *Client) ListProjectHooks(owner, repo string, log *zap.SugaredLogger) ([]*ProjectHook, error)
type Commit ¶
type Commit struct {
ID string `json:"id"`
ShortID string `json:"short_id"`
Title string `json:"title"`
Message string `json:"message"`
AuthorName string `json:"author_name"`
AuthorEmail string `json:"author_email"`
AuthoredDate *time.Time `json:"authored_date"`
CommitterName string `json:"committer_name"`
CommitterEmail string `json:"committer_email"`
CommittedDate *time.Time `json:"committed_date"`
CreatedAt *time.Time `json:"created_at"`
}
type EventType ¶
type EventType string
EventType represents a ilyshin event type.
const ( EventTypeMergeRequest EventType = "Merge Request Hook" EventTypePush EventType = "Push Hook" EventTypeTagPush EventType = "Tag Push Hook" )
List of available event types.
func HookEventType ¶
HookEventType returns the event type for the given request.
type File ¶
type File struct {
FileName string `json:"file_name"`
FilePath string `json:"file_path"`
Size int `json:"size"`
Encoding string `json:"encoding"`
Content string `json:"content"`
Ref string `json:"ref"`
BlobID string `json:"blob_id"`
CommitID string `json:"commit_id"`
SHA256 string `json:"content_sha256"`
LastCommitID string `json:"last_commit_id"`
}
type Hook ¶
type Hook struct {
URL string `url:"url,omitempty" json:"url,omitempty"`
Name string `url:"name,omitempty" json:"name,omitempty"`
Token string `url:"token,omitempty" json:"token,omitempty"`
PushEvents bool `url:"push_events,omitempty" json:"push_events,omitempty"`
MergeRequestsEvents bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
TagPushEvents bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
EnableSSLVerification bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"`
}
type LastCommit ¶
type MergeEvent ¶
type MergeEvent struct {
ObjectKind string `json:"object_kind"`
Project ProjectEvent `json:"project"`
ObjectAttributes ObjectAttributes `json:"object_attributes"`
}
type MergeRequest ¶
type MergeRequest struct {
ID int `json:"id"`
IID int `json:"iid"`
ProjectID int `json:"project_id"`
Title string `json:"title"`
State string `json:"state"`
CreatedAt *time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"`
SourceBranch string `json:"source_branch"`
TargetBranch string `json:"target_branch"`
SourceProjectID int `json:"source_project_id"`
TargetProjectID int `json:"target_project_id"`
Description string `json:"description"`
Author *BasicUser `json:"author"`
Changes []Changes `json:"changes"`
}
type ObjectAttributes ¶
type ObjectAttributes struct {
ID int `json:"id"`
TargetBranch string `json:"target_branch"`
SourceBranch string `json:"source_branch"`
SourceProjectID int `json:"source_project_id"`
AuthorID int `json:"author_id"`
AssigneeID int `json:"assignee_id"`
AssigneeIDs []int `json:"assignee_ids"`
Title string `json:"title"`
StCommits []*Commit `json:"st_commits"`
MilestoneID int `json:"milestone_id"`
State string `json:"state"`
MergeStatus string `json:"merge_status"`
TargetProjectID int `json:"target_project_id"`
IID int `json:"iid"`
Description string `json:"description"`
Position int `json:"position"`
LockedAt string `json:"locked_at"`
UpdatedByID int `json:"updated_by_id"`
MergeError string `json:"merge_error"`
MergeWhenBuildSucceeds bool `json:"merge_when_build_succeeds"`
MergeUserID int `json:"merge_user_id"`
MergeCommitSHA string `json:"merge_commit_sha"`
DeletedAt string `json:"deleted_at"`
ApprovalsBeforeMerge string `json:"approvals_before_merge"`
RebaseCommitSHA string `json:"rebase_commit_sha"`
InProgressMergeCommitSHA string `json:"in_progress_merge_commit_sha"`
LockVersion int `json:"lock_version"`
TimeEstimate int `json:"time_estimate"`
Target *Repository `json:"target"`
LastCommit LastCommit `json:"last_commit"`
WorkInProgress bool `json:"work_in_progress"`
URL string `json:"url"`
Action string `json:"action"`
OldRev string `json:"oldrev"`
}
type Project ¶
type Project struct {
ID int `json:"id"`
Description string `json:"description"`
Name string `json:"name"`
NameWithNamespace string `json:"name_with_namespace"`
Path string `json:"path"`
PathWithNamespace string `json:"path_with_namespace"`
CreatedAt *time.Time `json:"created_at,omitempty"`
Archived bool `json:"archived"`
DefaultBranch string `json:"default_branch"`
Namespace *ProjectNamespace `json:"namespace"`
}
type ProjectEvent ¶
type ProjectEvent struct {
ID int `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
AvatarURL string `json:"avatar_url"`
GitSSHURL string `json:"git_ssh_url"`
GitHTTPURL string `json:"git_http_url"`
Namespace string `json:"namespace"`
PathWithNamespace string `json:"path_with_namespace"`
DefaultBranch string `json:"default_branch"`
Homepage string `json:"homepage"`
URL string `json:"url"`
SSHURL string `json:"ssh_url"`
HTTPURL string `json:"http_url"`
WebURL string `json:"web_url"`
}
type ProjectHook ¶
type ProjectHook struct {
ID int `json:"id"`
URL string `json:"url"`
ConfidentialNoteEvents bool `json:"confidential_note_events"`
ProjectID int `json:"project_id"`
PushEvents bool `json:"push_events"`
PushEventsBranchFilter string `json:"push_events_branch_filter"`
IssuesEvents bool `json:"issues_events"`
ConfidentialIssuesEvents bool `json:"confidential_issues_events"`
MergeRequestsEvents bool `json:"merge_requests_events"`
TagPushEvents bool `json:"tag_push_events"`
NoteEvents bool `json:"note_events"`
JobEvents bool `json:"job_events"`
PipelineEvents bool `json:"pipeline_events"`
WikiPageEvents bool `json:"wiki_page_events"`
DeploymentEvents bool `json:"deployment_events"`
ReleasesEvents bool `json:"releases_events"`
EnableSSLVerification bool `json:"enable_ssl_verification"`
CreatedAt *time.Time `json:"created_at"`
}
type ProjectNamespace ¶
type PushEvent ¶
type PushEvent struct {
ObjectKind string `json:"object_kind"`
Before string `json:"before"`
After string `json:"after"`
Ref string `json:"ref"`
CheckoutSHA string `json:"checkout_sha"`
UserID int `json:"user_id"`
UserName string `json:"user_name"`
UserUsername string `json:"user_username"`
UserEmail string `json:"user_email"`
UserAvatar string `json:"user_avatar"`
ProjectID int `json:"project_id"`
Project ProjectEvent `json:"project"`
Commits []Commits `json:"commits"`
TotalCommitsCount int `json:"total_commits_count"`
}
type ReleaseNote ¶
type Repository ¶
type Repository struct {
Name string `json:"name"`
Description string `json:"description"`
WebURL string `json:"web_url"`
AvatarURL string `json:"avatar_url"`
GitSSHURL string `json:"git_ssh_url"`
GitHTTPURL string `json:"git_http_url"`
Namespace string `json:"namespace"`
PathWithNamespace string `json:"path_with_namespace"`
DefaultBranch string `json:"default_branch"`
Homepage string `json:"homepage"`
URL string `json:"url"`
SSHURL string `json:"ssh_url"`
HTTPURL string `json:"http_url"`
}
Click to show internal directories.
Click to hide internal directories.