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

fake

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Users    map[string]*git.User
	Repos    map[string]*Repo
	Branches map[string]*git.Branch
)

Store as global variables - only for testing! test data should be able to be set from the outside

Functions

func DeleteLabel

func DeleteLabel(repoName string, id int, label string) error

DeleteLabel deletes label from a pull request

Types

type Client

type Client struct {
	Repository string
	K8sClient  client.Client
}

Client is a gitlab client struct

func (*Client) CanUserWriteToRepo

func (c *Client) CanUserWriteToRepo(user git.User) (bool, error)

CanUserWriteToRepo decides if the user has write permission on the repo

func (*Client) DeleteLabel

func (c *Client) DeleteLabel(_ git.IssueType, id int, label string) error

DeleteLabel deletes label from the issue id

func (*Client) DeleteWebhook

func (c *Client) DeleteWebhook(id int) error

DeleteWebhook deletes registered webhook

func (*Client) GetBranch

func (c *Client) GetBranch(branch string) (*git.Branch, error)

GetBranch returns branch info

func (*Client) GetPullRequest

func (c *Client) GetPullRequest(id int) (*git.PullRequest, error)

GetPullRequest gets PR given id

func (*Client) GetPullRequestDiff

func (c *Client) GetPullRequestDiff(id int) (*git.Diff, error)

GetPullRequestDiff gets diff of the pull request

func (*Client) GetUserInfo

func (c *Client) GetUserInfo(userName string) (*git.User, error)

GetUserInfo gets a user's information

func (*Client) Init

func (c *Client) Init() error

Init initiates the Client

func (*Client) ListCommitStatuses

func (c *Client) ListCommitStatuses(ref string) ([]git.CommitStatus, error)

ListCommitStatuses lists commit status of the specific commit

func (*Client) ListPullRequestCommits

func (c *Client) ListPullRequestCommits(id int) ([]git.Commit, error)

ListPullRequestCommits lists commits list of a pull request

func (*Client) ListPullRequests

func (c *Client) ListPullRequests(_ bool) ([]git.PullRequest, error)

ListPullRequests gets pull request list

func (*Client) ListWebhook

func (c *Client) ListWebhook() ([]git.WebhookEntry, error)

ListWebhook lists registered webhooks

func (*Client) MergePullRequest

func (c *Client) MergePullRequest(id int, _ string, _ git.MergeMethod, message string) error

MergePullRequest merges a pull request

func (*Client) ParseWebhook

func (c *Client) ParseWebhook(_ http.Header, _ []byte) (*git.Webhook, error)

ParseWebhook parses a webhook body for github

func (*Client) RegisterComment

func (c *Client) RegisterComment(_ git.IssueType, issueNo int, body string) error

RegisterComment registers comment to an issue

func (*Client) RegisterWebhook

func (c *Client) RegisterWebhook(url string) error

RegisterWebhook registers our webhook server to the remote git server

func (*Client) SetCommitStatus

func (c *Client) SetCommitStatus(sha string, status git.CommitStatus) error

SetCommitStatus sets commit status for the specific commit

func (*Client) SetLabel

func (c *Client) SetLabel(_ git.IssueType, id int, label string) error

SetLabel sets label to the issue id

type Repo

type Repo struct {
	Webhooks     map[int]*git.WebhookEntry
	UserCanWrite map[string]bool

	PullRequests       map[int]*git.PullRequest
	PullRequestDiffs   map[int]*git.Diff
	PullRequestCommits map[int][]git.Commit
	Commits            map[string][]git.Commit
	CommitStatuses     map[string][]git.CommitStatus
	Comments           map[int][]git.IssueComment
}

Repo is a repository storage

Jump to

Keyboard shortcuts

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