Documentation ¶
Index ¶
- func ValidateSignature(payload []byte, signature string, secretKey []byte) error
- type GiteaClient
- func (c *GiteaClient) CreateComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, comment string, ...) error
- func (c *GiteaClient) DiscardReviews(repo models.Repo, pull models.PullRequest) error
- func (c *GiteaClient) GetCloneURL(logger logging.SimpleLogging, _ models.VCSHostType, repo string) (string, error)
- func (c *GiteaClient) GetFileContent(logger logging.SimpleLogging, pull models.PullRequest, fileName string) (bool, []byte, error)
- func (c *GiteaClient) GetModifiedFiles(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
- func (c *GiteaClient) GetPullLabels(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
- func (c *GiteaClient) GetPullRequest(logger logging.SimpleLogging, repo models.Repo, pullNum int) (*gitea.PullRequest, error)
- func (c *GiteaClient) GetTeamNamesForUser(repo models.Repo, user models.User) ([]string, error)
- func (c *GiteaClient) HidePrevCommandComments(logger logging.SimpleLogging, repo models.Repo, pullNum int, command string, ...) error
- func (c *GiteaClient) MarkdownPullLink(pull models.PullRequest) (string, error)
- func (c *GiteaClient) MergePull(logger logging.SimpleLogging, pull models.PullRequest, ...) error
- func (c *GiteaClient) PullIsApproved(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) (models.ApprovalStatus, error)
- func (c *GiteaClient) PullIsMergeable(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, ...) (bool, error)
- func (c *GiteaClient) ReactToComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, commentID int64, ...) error
- func (c *GiteaClient) SupportsSingleFileDownload(repo models.Repo) bool
- func (c *GiteaClient) UpdateStatus(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, ...) error
- type GiteaIssueCommentPayload
- type GiteaPRReviewSummary
- type GiteaPullGetter
- type GiteaReview
- type GiteaWebhookPayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GiteaClient ¶
type GiteaClient struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(baseURL string, username string, token string, pagesize int, logger logging.SimpleLogging) (*GiteaClient, error)
NewClient builds a client that makes API calls to Gitea. httpClient is the client to use to make the requests, username and password are used as basic auth in the requests, baseURL is the API's baseURL, ex. https://corp.com:7990. Don't include the API version, ex. '/1.0'.
func (*GiteaClient) CreateComment ¶
func (c *GiteaClient) CreateComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, comment string, command string) error
CreateComment creates a comment on the merge request. As far as we're aware, Gitea has no built in max comment length right now.
func (*GiteaClient) DiscardReviews ¶
func (c *GiteaClient) DiscardReviews(repo models.Repo, pull models.PullRequest) error
DiscardReviews discards / dismisses all pull request reviews
func (*GiteaClient) GetCloneURL ¶
func (c *GiteaClient) GetCloneURL(logger logging.SimpleLogging, _ models.VCSHostType, repo string) (string, error)
GetCloneURL returns the clone URL of the repo
func (*GiteaClient) GetFileContent ¶
func (c *GiteaClient) GetFileContent(logger logging.SimpleLogging, pull models.PullRequest, fileName string) (bool, []byte, error)
GetFileContent a repository file content from VCS (which support fetch a single file from repository) The first return value indicates whether the repo contains a file or not if BaseRepo had a file, its content will placed on the second return value
func (*GiteaClient) GetModifiedFiles ¶
func (c *GiteaClient) GetModifiedFiles(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
GetModifiedFiles returns the names of files that were modified in the merge request relative to the repo root, e.g. parent/child/file.txt.
func (*GiteaClient) GetPullLabels ¶
func (c *GiteaClient) GetPullLabels(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) ([]string, error)
GetPullLabels returns the labels of a pull request
func (*GiteaClient) GetPullRequest ¶
func (c *GiteaClient) GetPullRequest(logger logging.SimpleLogging, repo models.Repo, pullNum int) (*gitea.PullRequest, error)
func (*GiteaClient) GetTeamNamesForUser ¶
GetTeamNamesForUser returns the names of the teams or groups that the user belongs to (in the organization the repository belongs to).
func (*GiteaClient) HidePrevCommandComments ¶
func (c *GiteaClient) HidePrevCommandComments(logger logging.SimpleLogging, repo models.Repo, pullNum int, command string, dir string) error
HidePrevCommandComments hides the previous command comments from the pull request.
func (*GiteaClient) MarkdownPullLink ¶
func (c *GiteaClient) MarkdownPullLink(pull models.PullRequest) (string, error)
MarkdownPullLink specifies the string used in a pull request comment to reference another pull request.
func (*GiteaClient) MergePull ¶
func (c *GiteaClient) MergePull(logger logging.SimpleLogging, pull models.PullRequest, pullOptions models.PullRequestOptions) error
func (*GiteaClient) PullIsApproved ¶
func (c *GiteaClient) PullIsApproved(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest) (models.ApprovalStatus, error)
PullIsApproved returns ApprovalStatus with IsApproved set to true if the pull request has a review that approved the PR.
func (*GiteaClient) PullIsMergeable ¶
func (c *GiteaClient) PullIsMergeable(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, _ string, _ []string) (bool, error)
PullIsMergeable returns true if the pull request is mergeable
func (*GiteaClient) ReactToComment ¶
func (c *GiteaClient) ReactToComment(logger logging.SimpleLogging, repo models.Repo, pullNum int, commentID int64, reaction string) error
ReactToComment adds a reaction to a comment.
func (*GiteaClient) SupportsSingleFileDownload ¶
func (c *GiteaClient) SupportsSingleFileDownload(repo models.Repo) bool
SupportsSingleFileDownload returns true if the VCS supports downloading a single file
func (*GiteaClient) UpdateStatus ¶
func (c *GiteaClient) UpdateStatus(logger logging.SimpleLogging, repo models.Repo, pull models.PullRequest, state models.CommitStatus, src string, description string, url string) error
UpdateStatus updates the commit status to state for pull. src is the source of this status. This should be relatively static across runs, ex. atlantis/plan or atlantis/apply. description is a description of this particular status update and can change across runs. url is an optional link that users should click on for more information about this status.
type GiteaPRReviewSummary ¶
type GiteaPRReviewSummary struct {
Reviews []GiteaReview
}
type GiteaPullGetter ¶
type GiteaReview ¶
type GiteaWebhookPayload ¶
type GiteaWebhookPayload struct { Action string `json:"action"` Number int `json:"number"` PullRequest gitea.PullRequest `json:"pull_request"` }