vcsclient

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: Apache-2.0 Imports: 30 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureReposClient added in v1.4.0

type AzureReposClient struct {
	// contains filtered or unexported fields
}

Azure Devops API version 6

func NewAzureReposClient added in v1.4.0

func NewAzureReposClient(vcsInfo VcsInfo, logger vcsutils.Log) (*AzureReposClient, error)

NewAzureReposClient create a new AzureReposClient

func (*AzureReposClient) AddPullRequestComment added in v1.4.0

func (client *AzureReposClient) AddPullRequestComment(ctx context.Context, _, repository, content string, pullRequestID int) error

AddPullRequestComment on Azure Repos

func (*AzureReposClient) AddPullRequestReviewComments added in v1.14.0

func (client *AzureReposClient) AddPullRequestReviewComments(ctx context.Context, _, repository string, pullRequestID int, comments ...PullRequestComment) error

AddPullRequestReviewComments on Azure Repos

func (*AzureReposClient) AddSshKeyToRepository added in v1.4.0

func (client *AzureReposClient) AddSshKeyToRepository(ctx context.Context, owner, repository, keyName, publicKey string, permission Permission) error

AddSshKeyToRepository on Azure Repos

func (*AzureReposClient) CreateLabel added in v1.4.0

func (client *AzureReposClient) CreateLabel(ctx context.Context, owner, repository string, labelInfo LabelInfo) error

CreateLabel on Azure Repos

func (*AzureReposClient) CreatePullRequest added in v1.4.0

func (client *AzureReposClient) CreatePullRequest(ctx context.Context, _, repository, sourceBranch, targetBranch, title, description string) error

CreatePullRequest on Azure Repos

func (*AzureReposClient) CreateWebhook added in v1.4.0

func (client *AzureReposClient) CreateWebhook(ctx context.Context, owner, repository, branch, payloadURL string, webhookEvents ...vcsutils.WebhookEvent) (string, string, error)

CreateWebhook on Azure Repos

func (*AzureReposClient) DeletePullRequestComment added in v1.12.0

func (client *AzureReposClient) DeletePullRequestComment(ctx context.Context, _, repository string, pullRequestID, commentID int) error

DeletePullRequestComment on Azure Repos

func (*AzureReposClient) DeletePullRequestReviewComments added in v1.14.0

func (client *AzureReposClient) DeletePullRequestReviewComments(ctx context.Context, owner, repository string, pullRequestID int, comments ...CommentInfo) error

DeletePullRequestReviewComments on Azure Repos

func (*AzureReposClient) DeleteWebhook added in v1.4.0

func (client *AzureReposClient) DeleteWebhook(ctx context.Context, owner, repository, webhookID string) error

DeleteWebhook on Azure Repos

func (*AzureReposClient) DownloadFileFromRepo added in v1.5.2

func (client *AzureReposClient) DownloadFileFromRepo(ctx context.Context, owner, repository, branch, path string) ([]byte, int, error)

DownloadFileFromRepo on Azure Repos

func (*AzureReposClient) DownloadRepository added in v1.4.0

func (client *AzureReposClient) DownloadRepository(ctx context.Context, owner, repository, branch, localPath string) (err error)

DownloadRepository on Azure Repos

func (*AzureReposClient) GetCommitBySha added in v1.4.0

func (client *AzureReposClient) GetCommitBySha(ctx context.Context, owner, repository, sha string) (CommitInfo, error)

GetCommitBySha on Azure Repos

func (*AzureReposClient) GetCommitStatuses added in v1.7.0

func (client *AzureReposClient) GetCommitStatuses(ctx context.Context, owner, repository, ref string) (status []CommitStatusInfo, err error)

GetCommitStatuses on Azure Repos

func (*AzureReposClient) GetCommits added in v1.13.0

func (client *AzureReposClient) GetCommits(ctx context.Context, _, repository, branch string) ([]CommitInfo, error)

GetCommits on Azure Repos

func (*AzureReposClient) GetLabel added in v1.4.0

func (client *AzureReposClient) GetLabel(ctx context.Context, owner, repository, name string) (*LabelInfo, error)

GetLabel on Azure Repos

func (*AzureReposClient) GetLatestCommit added in v1.4.0

func (client *AzureReposClient) GetLatestCommit(ctx context.Context, _, repository, branch string) (CommitInfo, error)

GetLatestCommit on Azure Repos

func (*AzureReposClient) GetModifiedFiles added in v1.6.0

func (client *AzureReposClient) GetModifiedFiles(ctx context.Context, _, repository, refBefore, refAfter string) ([]string, error)

func (*AzureReposClient) GetPullRequestByID added in v1.10.0

func (client *AzureReposClient) GetPullRequestByID(ctx context.Context, owner, repository string, pullRequestId int) (pullRequestInfo PullRequestInfo, err error)

GetPullRequestById in Azure Repos

func (*AzureReposClient) GetPullRequestCommentSizeLimit added in v1.15.0

func (client *AzureReposClient) GetPullRequestCommentSizeLimit() int

func (*AzureReposClient) GetPullRequestDetailsSizeLimit added in v1.15.0

func (client *AzureReposClient) GetPullRequestDetailsSizeLimit() int

func (*AzureReposClient) GetRepositoryEnvironmentInfo added in v1.5.5

func (client *AzureReposClient) GetRepositoryEnvironmentInfo(ctx context.Context, owner, repository, name string) (RepositoryEnvironmentInfo, error)

GetRepositoryEnvironmentInfo on GitLab

func (*AzureReposClient) GetRepositoryInfo added in v1.4.0

func (client *AzureReposClient) GetRepositoryInfo(ctx context.Context, owner, repository string) (RepositoryInfo, error)

GetRepositoryInfo on Azure Repos

func (*AzureReposClient) ListBranches added in v1.4.0

func (client *AzureReposClient) ListBranches(ctx context.Context, _, repository string) ([]string, error)

ListBranches on Azure Repos

func (*AzureReposClient) ListOpenPullRequests added in v1.4.0

func (client *AzureReposClient) ListOpenPullRequests(ctx context.Context, owner, repository string) ([]PullRequestInfo, error)

ListOpenPullRequests on Azure Repos

func (*AzureReposClient) ListOpenPullRequestsWithBody added in v1.9.0

func (client *AzureReposClient) ListOpenPullRequestsWithBody(ctx context.Context, owner, repository string) ([]PullRequestInfo, error)

ListOpenPullRequestsWithBody on Azure Repos

func (*AzureReposClient) ListPullRequestComments added in v1.4.0

func (client *AzureReposClient) ListPullRequestComments(ctx context.Context, _, repository string, pullRequestID int) ([]CommentInfo, error)

ListPullRequestComments on Azure Repos

func (*AzureReposClient) ListPullRequestLabels added in v1.4.0

func (client *AzureReposClient) ListPullRequestLabels(ctx context.Context, owner, repository string, pullRequestID int) ([]string, error)

ListPullRequestLabels on Azure Repos

func (*AzureReposClient) ListPullRequestReviewComments added in v1.14.0

func (client *AzureReposClient) ListPullRequestReviewComments(ctx context.Context, owner, repository string, pullRequestID int) ([]CommentInfo, error)

ListPullRequestReviewComments on Azure Repos

func (*AzureReposClient) ListRepositories added in v1.4.0

func (client *AzureReposClient) ListRepositories(ctx context.Context) (map[string][]string, error)

ListRepositories on Azure Repos

func (*AzureReposClient) SetCommitStatus added in v1.4.0

func (client *AzureReposClient) SetCommitStatus(ctx context.Context, commitStatus CommitStatus, owner, repository, ref, title, description, detailsURL string) error

SetCommitStatus on Azure Repos

func (*AzureReposClient) TestConnection added in v1.4.0

func (client *AzureReposClient) TestConnection(ctx context.Context) error

TestConnection on Azure Repos

func (*AzureReposClient) UnlabelPullRequest added in v1.4.0

func (client *AzureReposClient) UnlabelPullRequest(ctx context.Context, owner, repository, name string, pullRequestID int) error

UnlabelPullRequest on Azure Repos

func (*AzureReposClient) UpdatePullRequest added in v1.8.0

func (client *AzureReposClient) UpdatePullRequest(ctx context.Context, _, repository, title, body, targetBranchName string, prId int, state vcsutils.PullRequestState) error

UpdatePullRequest on Azure Repos

func (*AzureReposClient) UpdateWebhook added in v1.4.0

func (client *AzureReposClient) UpdateWebhook(ctx context.Context, owner, repository, branch, payloadURL, token, webhookID string, webhookEvents ...vcsutils.WebhookEvent) error

UpdateWebhook on Azure Repos

func (*AzureReposClient) UploadCodeScanning added in v1.4.0

func (client *AzureReposClient) UploadCodeScanning(ctx context.Context, owner, repository, branch, scanResults string) (string, error)

UploadCodeScanning on Azure Repos

type BitbucketCloudClient

type BitbucketCloudClient struct {
	// contains filtered or unexported fields
}

BitbucketCloudClient API version 2.0

func NewBitbucketCloudClient

func NewBitbucketCloudClient(vcsInfo VcsInfo, logger vcsutils.Log) (*BitbucketCloudClient, error)

NewBitbucketCloudClient create a new BitbucketCloudClient

func (*BitbucketCloudClient) AddPullRequestComment added in v1.1.0

func (client *BitbucketCloudClient) AddPullRequestComment(ctx context.Context, owner, repository, content string, pullRequestID int) error

AddPullRequestComment on Bitbucket cloud

func (*BitbucketCloudClient) AddPullRequestReviewComments added in v1.14.0

func (client *BitbucketCloudClient) AddPullRequestReviewComments(_ context.Context, _, _ string, _ int, _ ...PullRequestComment) error

AddPullRequestReviewComments on Bitbucket cloud

func (*BitbucketCloudClient) AddSshKeyToRepository added in v1.1.0

func (client *BitbucketCloudClient) AddSshKeyToRepository(ctx context.Context, owner, repository, keyName, publicKey string, _ Permission) (err error)

AddSshKeyToRepository on Bitbucket cloud, the deploy-key is always read-only.

func (*BitbucketCloudClient) CreateLabel added in v1.1.0

func (client *BitbucketCloudClient) CreateLabel(ctx context.Context, owner, repository string, labelInfo LabelInfo) error

CreateLabel on Bitbucket cloud

func (*BitbucketCloudClient) CreatePullRequest

func (client *BitbucketCloudClient) CreatePullRequest(ctx context.Context, owner, repository, sourceBranch,
	targetBranch, title, description string) error

CreatePullRequest on Bitbucket cloud

func (*BitbucketCloudClient) CreateWebhook

func (client *BitbucketCloudClient) CreateWebhook(ctx context.Context, owner, repository, _, payloadURL string,
	webhookEvents ...vcsutils.WebhookEvent) (string, string, error)

CreateWebhook on Bitbucket cloud

func (*BitbucketCloudClient) DeletePullRequestComment added in v1.12.0

func (client *BitbucketCloudClient) DeletePullRequestComment(_ context.Context, _, _ string, _, _ int) error

DeletePullRequestComment on Bitbucket cloud

func (*BitbucketCloudClient) DeletePullRequestReviewComments added in v1.14.0

func (client *BitbucketCloudClient) DeletePullRequestReviewComments(_ context.Context, _, _ string, _ int, _ ...CommentInfo) error

DeletePullRequestReviewComments on Bitbucket cloud

func (*BitbucketCloudClient) DeleteWebhook

func (client *BitbucketCloudClient) DeleteWebhook(ctx context.Context, owner, repository, webhookID string) error

DeleteWebhook on Bitbucket cloud

func (*BitbucketCloudClient) DownloadFileFromRepo added in v1.5.2

func (client *BitbucketCloudClient) DownloadFileFromRepo(ctx context.Context, owner, repository, branch, path string) ([]byte, int, error)

DownloadFileFromRepo on Bitbucket cloud

func (*BitbucketCloudClient) DownloadRepository

func (client *BitbucketCloudClient) DownloadRepository(ctx context.Context, owner, repository, branch,
	localPath string) error

DownloadRepository on Bitbucket cloud

func (*BitbucketCloudClient) GetCommitBySha added in v1.1.0

func (client *BitbucketCloudClient) GetCommitBySha(ctx context.Context, owner, repository, sha string) (CommitInfo, error)

GetCommitBySha on Bitbucket cloud

func (*BitbucketCloudClient) GetCommitStatuses added in v1.7.0

func (client *BitbucketCloudClient) GetCommitStatuses(ctx context.Context, owner, repository, ref string) (status []CommitStatusInfo, err error)

GetCommitStatuses on Bitbucket cloud

func (*BitbucketCloudClient) GetCommits added in v1.13.0

func (client *BitbucketCloudClient) GetCommits(_ context.Context, _, _, _ string) ([]CommitInfo, error)

GetCommits on Bitbucket Cloud

func (*BitbucketCloudClient) GetLabel added in v1.1.0

func (client *BitbucketCloudClient) GetLabel(ctx context.Context, owner, repository, name string) (*LabelInfo, error)

GetLabel on Bitbucket cloud

func (*BitbucketCloudClient) GetLatestCommit added in v1.1.0

func (client *BitbucketCloudClient) GetLatestCommit(ctx context.Context, owner, repository, branch string) (CommitInfo, error)

GetLatestCommit on Bitbucket cloud

func (*BitbucketCloudClient) GetModifiedFiles added in v1.6.0

func (client *BitbucketCloudClient) GetModifiedFiles(ctx context.Context, owner, repository, refBefore, refAfter string) ([]string, error)

func (*BitbucketCloudClient) GetPullRequestByID added in v1.10.0

func (client *BitbucketCloudClient) GetPullRequestByID(ctx context.Context, owner, repository string, pullRequestId int) (pullRequestInfo PullRequestInfo, err error)

func (*BitbucketCloudClient) GetPullRequestCommentSizeLimit added in v1.15.0

func (client *BitbucketCloudClient) GetPullRequestCommentSizeLimit() int

func (*BitbucketCloudClient) GetPullRequestDetailsSizeLimit added in v1.15.0

func (client *BitbucketCloudClient) GetPullRequestDetailsSizeLimit() int

func (*BitbucketCloudClient) GetRepositoryEnvironmentInfo added in v1.5.5

func (client *BitbucketCloudClient) GetRepositoryEnvironmentInfo(ctx context.Context, owner, repository, name string) (RepositoryEnvironmentInfo, error)

GetRepositoryEnvironmentInfo on Bitbucket cloud

func (*BitbucketCloudClient) GetRepositoryInfo added in v1.1.0

func (client *BitbucketCloudClient) GetRepositoryInfo(ctx context.Context, owner, repository string) (RepositoryInfo, error)

GetRepositoryInfo on Bitbucket cloud

func (*BitbucketCloudClient) ListBranches

func (client *BitbucketCloudClient) ListBranches(ctx context.Context, owner, repository string) ([]string, error)

ListBranches on Bitbucket cloud

func (*BitbucketCloudClient) ListOpenPullRequests added in v1.2.0

func (client *BitbucketCloudClient) ListOpenPullRequests(ctx context.Context, owner, repository string) (res []PullRequestInfo, err error)

ListOpenPullRequests on Bitbucket cloud

func (*BitbucketCloudClient) ListOpenPullRequestsWithBody added in v1.9.0

func (client *BitbucketCloudClient) ListOpenPullRequestsWithBody(ctx context.Context, owner, repository string) (res []PullRequestInfo, err error)

ListOpenPullRequestsWithBody on Bitbucket cloud

func (*BitbucketCloudClient) ListPullRequestComments added in v1.2.0

func (client *BitbucketCloudClient) ListPullRequestComments(ctx context.Context, owner, repository string, pullRequestID int) (res []CommentInfo, err error)

ListPullRequestComments on Bitbucket cloud

func (*BitbucketCloudClient) ListPullRequestLabels added in v1.1.0

func (client *BitbucketCloudClient) ListPullRequestLabels(ctx context.Context, owner, repository string, pullRequestID int) ([]string, error)

ListPullRequestLabels on Bitbucket cloud

func (*BitbucketCloudClient) ListPullRequestReviewComments added in v1.14.0

func (client *BitbucketCloudClient) ListPullRequestReviewComments(_ context.Context, _, _ string, _ int) ([]CommentInfo, error)

ListPullRequestReviewComments on Bitbucket cloud

func (*BitbucketCloudClient) ListRepositories

func (client *BitbucketCloudClient) ListRepositories(ctx context.Context) (map[string][]string, error)

ListRepositories on Bitbucket cloud

func (*BitbucketCloudClient) SetCommitStatus

func (client *BitbucketCloudClient) SetCommitStatus(ctx context.Context, commitStatus CommitStatus, owner, repository,
	ref, title, description, detailsURL string) error

SetCommitStatus on Bitbucket cloud

func (*BitbucketCloudClient) TestConnection

func (client *BitbucketCloudClient) TestConnection(ctx context.Context) error

TestConnection on Bitbucket cloud

func (*BitbucketCloudClient) UnlabelPullRequest added in v1.1.0

func (client *BitbucketCloudClient) UnlabelPullRequest(ctx context.Context, owner, repository, name string, pullRequestID int) error

UnlabelPullRequest on Bitbucket cloud

func (*BitbucketCloudClient) UpdatePullRequest added in v1.8.0

func (client *BitbucketCloudClient) UpdatePullRequest(ctx context.Context, owner, repository, title, body, targetBranchName string, prId int, state vcsutils.PullRequestState) error

UpdatePullRequest on Bitbucket cloud

func (*BitbucketCloudClient) UpdateWebhook

func (client *BitbucketCloudClient) UpdateWebhook(ctx context.Context, owner, repository, _, payloadURL, token,
	webhookID string, webhookEvents ...vcsutils.WebhookEvent) error

UpdateWebhook on Bitbucket cloud

func (*BitbucketCloudClient) UploadCodeScanning added in v1.3.0

func (client *BitbucketCloudClient) UploadCodeScanning(ctx context.Context, owner string, repository string, branch string, scanResults string) (string, error)

UploadCodeScanning on Bitbucket cloud

type BitbucketCommitInfo added in v1.7.1

type BitbucketCommitInfo struct {
	Title       string  `mapstructure:"key"`
	Url         string  `mapstructure:"url"`
	State       string  `mapstructure:"state"`
	Creator     string  `mapstructure:"name"`
	Description string  `mapstructure:"description"`
	CreatedOn   string  `mapstructure:"created_on"`
	UpdatedOn   string  `mapstructure:"updated_on"`
	DateAdded   float64 `mapstructure:"DateAdded"`
}

type BitbucketServerClient

type BitbucketServerClient struct {
	// contains filtered or unexported fields
}

BitbucketServerClient API version 1.0

func NewBitbucketServerClient

func NewBitbucketServerClient(vcsInfo VcsInfo, logger vcsutils.Log) (*BitbucketServerClient, error)

NewBitbucketServerClient create a new BitbucketServerClient

func (*BitbucketServerClient) AddPullRequestComment added in v1.1.0

func (client *BitbucketServerClient) AddPullRequestComment(ctx context.Context, owner, repository, content string, pullRequestID int) error

AddPullRequestComment on Bitbucket server

func (*BitbucketServerClient) AddPullRequestReviewComments added in v1.14.0

func (client *BitbucketServerClient) AddPullRequestReviewComments(ctx context.Context, owner, repository string, pullRequestID int, comments ...PullRequestComment) error

AddPullRequestReviewComments on Bitbucket server

func (*BitbucketServerClient) AddSshKeyToRepository added in v1.1.0

func (client *BitbucketServerClient) AddSshKeyToRepository(ctx context.Context, owner, repository, keyName, publicKey string, permission Permission) (err error)

AddSshKeyToRepository on Bitbucket server

func (*BitbucketServerClient) CreateLabel added in v1.1.0

func (client *BitbucketServerClient) CreateLabel(ctx context.Context, owner, repository string, labelInfo LabelInfo) error

CreateLabel on Bitbucket server

func (*BitbucketServerClient) CreatePullRequest

func (client *BitbucketServerClient) CreatePullRequest(ctx context.Context, owner, repository, sourceBranch, targetBranch,
	title, description string) error

CreatePullRequest on Bitbucket server

func (*BitbucketServerClient) CreateWebhook

func (client *BitbucketServerClient) CreateWebhook(ctx context.Context, owner, repository, _, payloadURL string,
	webhookEvents ...vcsutils.WebhookEvent) (string, string, error)

CreateWebhook on Bitbucket server

func (*BitbucketServerClient) DeletePullRequestComment added in v1.12.0

func (client *BitbucketServerClient) DeletePullRequestComment(ctx context.Context, owner, repository string, pullRequestID, commentID int) error

DeletePullRequestComment on Bitbucket Server

func (*BitbucketServerClient) DeletePullRequestReviewComments added in v1.14.0

func (client *BitbucketServerClient) DeletePullRequestReviewComments(ctx context.Context, owner, repository string, pullRequestID int, comments ...CommentInfo) error

DeletePullRequestReviewComments on Bitbucket server

func (*BitbucketServerClient) DeleteWebhook

func (client *BitbucketServerClient) DeleteWebhook(ctx context.Context, owner, repository, webhookID string) error

DeleteWebhook on Bitbucket server

func (*BitbucketServerClient) DownloadFileFromRepo added in v1.5.2

func (client *BitbucketServerClient) DownloadFileFromRepo(ctx context.Context, owner, repository, branch, path string) ([]byte, int, error)

DownloadFileFromRepo on Bitbucket server

func (*BitbucketServerClient) DownloadRepository

func (client *BitbucketServerClient) DownloadRepository(ctx context.Context, owner, repository, branch, localPath string) error

DownloadRepository on Bitbucket server

func (*BitbucketServerClient) GetCommitBySha added in v1.1.0

func (client *BitbucketServerClient) GetCommitBySha(ctx context.Context, owner, repository, sha string) (CommitInfo, error)

GetCommitBySha on Bitbucket server

func (*BitbucketServerClient) GetCommitStatuses added in v1.7.0

func (client *BitbucketServerClient) GetCommitStatuses(ctx context.Context, owner, repository, ref string) (status []CommitStatusInfo, err error)

GetCommitStatuses on Bitbucket server

func (*BitbucketServerClient) GetCommits added in v1.13.0

func (client *BitbucketServerClient) GetCommits(ctx context.Context, owner, repository, branch string) ([]CommitInfo, error)

GetCommits on Bitbucket server

func (*BitbucketServerClient) GetLabel added in v1.1.0

func (client *BitbucketServerClient) GetLabel(ctx context.Context, owner, repository, name string) (*LabelInfo, error)

GetLabel on Bitbucket server

func (*BitbucketServerClient) GetLatestCommit added in v1.1.0

func (client *BitbucketServerClient) GetLatestCommit(ctx context.Context, owner, repository, branch string) (CommitInfo, error)

GetLatestCommit on Bitbucket server

func (*BitbucketServerClient) GetModifiedFiles added in v1.6.0

func (client *BitbucketServerClient) GetModifiedFiles(ctx context.Context, owner, repository, refBefore, refAfter string) ([]string, error)

func (*BitbucketServerClient) GetPullRequestByID added in v1.10.0

func (client *BitbucketServerClient) GetPullRequestByID(ctx context.Context, owner, repository string, pullRequestId int) (pullRequestInfo PullRequestInfo, err error)

GetPullRequestInfoById on bitbucket server

func (*BitbucketServerClient) GetPullRequestCommentSizeLimit added in v1.15.0

func (client *BitbucketServerClient) GetPullRequestCommentSizeLimit() int

func (*BitbucketServerClient) GetPullRequestDetailsSizeLimit added in v1.15.0

func (client *BitbucketServerClient) GetPullRequestDetailsSizeLimit() int

func (*BitbucketServerClient) GetRepositoryEnvironmentInfo added in v1.5.5

func (client *BitbucketServerClient) GetRepositoryEnvironmentInfo(ctx context.Context, owner, repository, name string) (RepositoryEnvironmentInfo, error)

GetRepositoryEnvironmentInfo on Bitbucket server

func (*BitbucketServerClient) GetRepositoryInfo added in v1.1.0

func (client *BitbucketServerClient) GetRepositoryInfo(ctx context.Context, owner, repository string) (RepositoryInfo, error)

GetRepositoryInfo on Bitbucket server

func (*BitbucketServerClient) ListBranches

func (client *BitbucketServerClient) ListBranches(ctx context.Context, owner, repository string) ([]string, error)

ListBranches on Bitbucket server

func (*BitbucketServerClient) ListOpenPullRequests added in v1.2.0

func (client *BitbucketServerClient) ListOpenPullRequests(ctx context.Context, owner, repository string) ([]PullRequestInfo, error)

ListOpenPullRequests on Bitbucket server

func (*BitbucketServerClient) ListOpenPullRequestsWithBody added in v1.9.0

func (client *BitbucketServerClient) ListOpenPullRequestsWithBody(ctx context.Context, owner, repository string) ([]PullRequestInfo, error)

ListOpenPullRequestsWithBody on Bitbucket server

func (*BitbucketServerClient) ListPullRequestComments added in v1.2.0

func (client *BitbucketServerClient) ListPullRequestComments(ctx context.Context, owner, repository string, pullRequestID int) ([]CommentInfo, error)

ListPullRequestComments on Bitbucket server

func (*BitbucketServerClient) ListPullRequestLabels added in v1.1.0

func (client *BitbucketServerClient) ListPullRequestLabels(ctx context.Context, owner, repository string, pullRequestID int) ([]string, error)

ListPullRequestLabels on Bitbucket server

func (*BitbucketServerClient) ListPullRequestReviewComments added in v1.14.0

func (client *BitbucketServerClient) ListPullRequestReviewComments(ctx context.Context, owner, repository string, pullRequestID int) ([]CommentInfo, error)

ListPullRequestReviewComments on Bitbucket server

func (*BitbucketServerClient) ListRepositories

func (client *BitbucketServerClient) ListRepositories(ctx context.Context) (map[string][]string, error)

ListRepositories on Bitbucket server

func (*BitbucketServerClient) SetCommitStatus

func (client *BitbucketServerClient) SetCommitStatus(ctx context.Context, commitStatus CommitStatus, _, _, ref, title,
	description, detailsURL string) error

SetCommitStatus on Bitbucket server

func (*BitbucketServerClient) TestConnection

func (client *BitbucketServerClient) TestConnection(ctx context.Context) error

TestConnection on Bitbucket server

func (*BitbucketServerClient) UnlabelPullRequest added in v1.1.0

func (client *BitbucketServerClient) UnlabelPullRequest(ctx context.Context, owner, repository, name string, pullRequestID int) error

UnlabelPullRequest on Bitbucket server

func (*BitbucketServerClient) UpdatePullRequest added in v1.8.0

func (client *BitbucketServerClient) UpdatePullRequest(ctx context.Context, owner, repository, title, body, targetBranchRef string, prId int, state vcsutils.PullRequestState) (err error)

UpdatePullRequest on bitbucket server Changing targetBranchRef currently not supported.

func (*BitbucketServerClient) UpdateWebhook

func (client *BitbucketServerClient) UpdateWebhook(ctx context.Context, owner, repository, _, payloadURL, token,
	webhookID string, webhookEvents ...vcsutils.WebhookEvent) error

UpdateWebhook on Bitbucket server

func (*BitbucketServerClient) UploadCodeScanning added in v1.3.0

func (client *BitbucketServerClient) UploadCodeScanning(ctx context.Context, owner string, repository string, branch string, scanResults string) (string, error)

type BranchInfo added in v1.2.0

type BranchInfo struct {
	Name       string
	Repository string
	Owner      string
}

type ClientBuilder

type ClientBuilder struct {
	// contains filtered or unexported fields
}

ClientBuilder builds VcsClient

func NewClientBuilder

func NewClientBuilder(vcsProvider vcsutils.VcsProvider) *ClientBuilder

NewClientBuilder creates new ClientBuilder

func (*ClientBuilder) ApiEndpoint

func (builder *ClientBuilder) ApiEndpoint(apiEndpoint string) *ClientBuilder

ApiEndpoint sets the API endpoint

func (*ClientBuilder) Build

func (builder *ClientBuilder) Build() (VcsClient, error)

Build builds the VcsClient

func (*ClientBuilder) Logger

func (builder *ClientBuilder) Logger(logger vcsutils.Log) *ClientBuilder

Logger sets the logger

func (*ClientBuilder) Project added in v1.4.0

func (builder *ClientBuilder) Project(project string) *ClientBuilder

Project sets the project

func (*ClientBuilder) Token

func (builder *ClientBuilder) Token(token string) *ClientBuilder

Token sets the access token

func (*ClientBuilder) Username

func (builder *ClientBuilder) Username(username string) *ClientBuilder

Username sets the username

type CloneInfo added in v1.1.0

type CloneInfo struct {
	// HTTP is a URL string to clone repository using HTTP(S)) protocol.
	HTTP string
	// SSH is a URL string to clone repository using SSH protocol.
	SSH string
}

CloneInfo contains URLs that can be used to clone the repository.

type CommentInfo added in v1.2.0

type CommentInfo struct {
	ID       int64
	ThreadID string
	Content  string
	Created  time.Time
	Version  int
}

type CommitInfo added in v1.1.0

type CommitInfo struct {
	// The SHA-1 hash of the commit
	Hash string
	// The author's name
	AuthorName string
	// The committer's name
	CommitterName string
	// The commit URL
	Url string
	// Seconds from epoch
	Timestamp int64
	// The commit message
	Message string
	// The SHA-1 hashes of the parent commits
	ParentHashes []string
	// The email of the commit author
	AuthorEmail string
}

CommitInfo contains the details of a commit

type CommitStatus

type CommitStatus int

CommitStatus the status of the commit in the VCS

const (
	// Pass means that the commit passed the tests
	Pass CommitStatus = iota
	// Fail means that the commit failed the tests
	Fail
	// Error means that an unexpected error occurred
	Error
	// InProgress means than the status check is in progress
	InProgress
)

type CommitStatusInfo added in v1.7.0

type CommitStatusInfo struct {
	State         CommitStatus
	Description   string
	DetailsUrl    string
	Creator       string
	CreatedAt     time.Time
	LastUpdatedAt time.Time
}

CommitStatusInfo status which is then reflected in pull requests involving those commits State - One of success, pending, failure, or error Description - Description of the commit status DetailsUrl - The URL for component status link Creator - The creator of the status CreatedAt - Date of status creation LastUpdatedAt - Date of status last update time.

type GitHubClient

type GitHubClient struct {
	// contains filtered or unexported fields
}

GitHubClient API version 3

func NewGitHubClient

func NewGitHubClient(vcsInfo VcsInfo, logger vcsutils.Log) (*GitHubClient, error)

NewGitHubClient create a new GitHubClient

func (*GitHubClient) AddPullRequestComment added in v1.1.0

func (client *GitHubClient) AddPullRequestComment(ctx context.Context, owner, repository, content string, pullRequestID int) error

AddPullRequestComment on GitHub

func (*GitHubClient) AddPullRequestReviewComments added in v1.14.0

func (client *GitHubClient) AddPullRequestReviewComments(ctx context.Context, owner, repository string, pullRequestID int, comments ...PullRequestComment) error

AddPullRequestReviewComments on GitHub

func (*GitHubClient) AddSshKeyToRepository added in v1.1.0

func (client *GitHubClient) AddSshKeyToRepository(ctx context.Context, owner, repository, keyName, publicKey string, permission Permission) error

AddSshKeyToRepository on GitHub

func (*GitHubClient) CreateLabel added in v1.1.0

func (client *GitHubClient) CreateLabel(ctx context.Context, owner, repository string, labelInfo LabelInfo) error

CreateLabel on GitHub

func (*GitHubClient) CreatePullRequest

func (client *GitHubClient) CreatePullRequest(ctx context.Context, owner, repository, sourceBranch, targetBranch, title, description string) error

CreatePullRequest on GitHub

func (*GitHubClient) CreateWebhook

func (client *GitHubClient) CreateWebhook(ctx context.Context, owner, repository, _, payloadURL string,
	webhookEvents ...vcsutils.WebhookEvent) (string, string, error)

CreateWebhook on GitHub

func (*GitHubClient) DeletePullRequestComment added in v1.12.0

func (client *GitHubClient) DeletePullRequestComment(ctx context.Context, owner, repository string, _, commentID int) error

DeletePullRequestComment on GitHub

func (*GitHubClient) DeletePullRequestReviewComments added in v1.14.0

func (client *GitHubClient) DeletePullRequestReviewComments(ctx context.Context, owner, repository string, _ int, comments ...CommentInfo) error

DeletePullRequestReviewComments on GitHub

func (*GitHubClient) DeleteWebhook

func (client *GitHubClient) DeleteWebhook(ctx context.Context, owner, repository, webhookID string) error

DeleteWebhook on GitHub

func (*GitHubClient) DownloadFileFromRepo added in v1.5.2

func (client *GitHubClient) DownloadFileFromRepo(ctx context.Context, owner, repository, branch, path string) (content []byte, statusCode int, err error)

DownloadFileFromRepo on GitHub

func (*GitHubClient) DownloadRepository

func (client *GitHubClient) DownloadRepository(ctx context.Context, owner, repository, branch, localPath string) (err error)

DownloadRepository on GitHub

func (*GitHubClient) GetCommitBySha added in v1.1.0

func (client *GitHubClient) GetCommitBySha(ctx context.Context, owner, repository, sha string) (CommitInfo, error)

GetCommitBySha on GitHub

func (*GitHubClient) GetCommitStatuses added in v1.7.0

func (client *GitHubClient) GetCommitStatuses(ctx context.Context, owner, repository, ref string) (statusInfoList []CommitStatusInfo, err error)

GetCommitStatuses on GitHub

func (*GitHubClient) GetCommits added in v1.13.0

func (client *GitHubClient) GetCommits(ctx context.Context, owner, repository, branch string) ([]CommitInfo, error)

GetCommits on GitHub

func (*GitHubClient) GetLabel added in v1.1.0

func (client *GitHubClient) GetLabel(ctx context.Context, owner, repository, name string) (*LabelInfo, error)

GetLabel on GitHub

func (*GitHubClient) GetLatestCommit added in v1.1.0

func (client *GitHubClient) GetLatestCommit(ctx context.Context, owner, repository, branch string) (CommitInfo, error)

GetLatestCommit on GitHub

func (*GitHubClient) GetModifiedFiles added in v1.6.0

func (client *GitHubClient) GetModifiedFiles(ctx context.Context, owner, repository, refBefore, refAfter string) ([]string, error)

func (*GitHubClient) GetPullRequestByID added in v1.10.0

func (client *GitHubClient) GetPullRequestByID(ctx context.Context, owner, repository string, pullRequestId int) (PullRequestInfo, error)

func (*GitHubClient) GetPullRequestCommentSizeLimit added in v1.15.0

func (client *GitHubClient) GetPullRequestCommentSizeLimit() int

func (*GitHubClient) GetPullRequestDetailsSizeLimit added in v1.15.0

func (client *GitHubClient) GetPullRequestDetailsSizeLimit() int

func (*GitHubClient) GetRepositoryEnvironmentInfo added in v1.5.5

func (client *GitHubClient) GetRepositoryEnvironmentInfo(ctx context.Context, owner, repository, name string) (RepositoryEnvironmentInfo, error)

GetRepositoryEnvironmentInfo on GitHub

func (*GitHubClient) GetRepositoryInfo added in v1.1.0

func (client *GitHubClient) GetRepositoryInfo(ctx context.Context, owner, repository string) (RepositoryInfo, error)

GetRepositoryInfo on GitHub

func (*GitHubClient) ListBranches

func (client *GitHubClient) ListBranches(ctx context.Context, owner, repository string) (branchList []string, err error)

ListBranches on GitHub

func (*GitHubClient) ListOpenPullRequests added in v1.2.0

func (client *GitHubClient) ListOpenPullRequests(ctx context.Context, owner, repository string) ([]PullRequestInfo, error)

ListOpenPullRequests on GitHub

func (*GitHubClient) ListOpenPullRequestsWithBody added in v1.9.0

func (client *GitHubClient) ListOpenPullRequestsWithBody(ctx context.Context, owner, repository string) ([]PullRequestInfo, error)

ListOpenPullRequestsWithBody on GitHub

func (*GitHubClient) ListPullRequestComments added in v1.2.0

func (client *GitHubClient) ListPullRequestComments(ctx context.Context, owner, repository string, pullRequestID int) ([]CommentInfo, error)

ListPullRequestComments on GitHub

func (*GitHubClient) ListPullRequestLabels added in v1.1.0

func (client *GitHubClient) ListPullRequestLabels(ctx context.Context, owner, repository string, pullRequestID int) ([]string, error)

ListPullRequestLabels on GitHub

func (*GitHubClient) ListPullRequestReviewComments added in v1.14.0

func (client *GitHubClient) ListPullRequestReviewComments(ctx context.Context, owner, repository string, pullRequestID int) ([]CommentInfo, error)

ListPullRequestReviewComments on GitHub

func (*GitHubClient) ListRepositories

func (client *GitHubClient) ListRepositories(ctx context.Context) (results map[string][]string, err error)

ListRepositories on GitHub

func (*GitHubClient) SetCommitStatus

func (client *GitHubClient) SetCommitStatus(ctx context.Context, commitStatus CommitStatus, owner, repository, ref,
	title, description, detailsURL string) error

SetCommitStatus on GitHub

func (*GitHubClient) TestConnection

func (client *GitHubClient) TestConnection(ctx context.Context) error

TestConnection on GitHub

func (*GitHubClient) UnlabelPullRequest added in v1.1.0

func (client *GitHubClient) UnlabelPullRequest(ctx context.Context, owner, repository, name string, pullRequestID int) error

UnlabelPullRequest on GitHub

func (*GitHubClient) UpdatePullRequest added in v1.8.0

func (client *GitHubClient) UpdatePullRequest(ctx context.Context, owner, repository, title, body, targetBranchName string, id int, state vcsutils.PullRequestState) error

UpdatePullRequest on GitHub

func (*GitHubClient) UpdateWebhook

func (client *GitHubClient) UpdateWebhook(ctx context.Context, owner, repository, _, payloadURL, token,
	webhookID string, webhookEvents ...vcsutils.WebhookEvent) error

UpdateWebhook on GitHub

func (*GitHubClient) UploadCodeScanning added in v1.3.0

func (client *GitHubClient) UploadCodeScanning(ctx context.Context, owner, repository, branch, sarifContent string) (id string, err error)

UploadCodeScanning to GitHub Security tab

type GitHubRateLimitExecutionHandler added in v1.14.3

type GitHubRateLimitExecutionHandler func() (*github.Response, error)

type GitHubRateLimitRetryExecutor added in v1.14.3

type GitHubRateLimitRetryExecutor struct {
	vcsutils.RetryExecutor
	GitHubRateLimitExecutionHandler
}

func (*GitHubRateLimitRetryExecutor) Execute added in v1.14.3

func (ghe *GitHubRateLimitRetryExecutor) Execute() error

type GitLabClient

type GitLabClient struct {
	// contains filtered or unexported fields
}

GitLabClient API version 4

func NewGitLabClient

func NewGitLabClient(vcsInfo VcsInfo, logger vcsutils.Log) (*GitLabClient, error)

NewGitLabClient create a new GitLabClient

func (*GitLabClient) AddPullRequestComment added in v1.1.0

func (client *GitLabClient) AddPullRequestComment(ctx context.Context, owner, repository, content string, pullRequestID int) error

AddPullRequestComment on GitLab

func (*GitLabClient) AddPullRequestReviewComments added in v1.14.0

func (client *GitLabClient) AddPullRequestReviewComments(ctx context.Context, owner, repository string, pullRequestID int, comments ...PullRequestComment) error

AddPullRequestReviewComments adds comments to a pull request on GitLab.

func (*GitLabClient) AddSshKeyToRepository added in v1.1.0

func (client *GitLabClient) AddSshKeyToRepository(ctx context.Context, owner, repository, keyName, publicKey string, permission Permission) error

AddSshKeyToRepository on GitLab

func (*GitLabClient) CreateLabel added in v1.1.0

func (client *GitLabClient) CreateLabel(ctx context.Context, owner, repository string, labelInfo LabelInfo) error

CreateLabel on GitLab

func (*GitLabClient) CreatePullRequest

func (client *GitLabClient) CreatePullRequest(ctx context.Context, owner, repository, sourceBranch, targetBranch,
	title, description string) error

CreatePullRequest on GitLab

func (*GitLabClient) CreateWebhook

func (client *GitLabClient) CreateWebhook(ctx context.Context, owner, repository, branch, payloadURL string,
	webhookEvents ...vcsutils.WebhookEvent) (string, string, error)

CreateWebhook on GitLab

func (*GitLabClient) DeletePullRequestComment added in v1.12.0

func (client *GitLabClient) DeletePullRequestComment(ctx context.Context, owner, repository string, pullRequestID, commentID int) error

DeletePullRequestComment on GitLab

func (*GitLabClient) DeletePullRequestReviewComments added in v1.14.0

func (client *GitLabClient) DeletePullRequestReviewComments(ctx context.Context, owner, repository string, pullRequestID int, comments ...CommentInfo) error

DeletePullRequestReviewComment on GitLab

func (*GitLabClient) DeleteWebhook

func (client *GitLabClient) DeleteWebhook(ctx context.Context, owner, repository, webhookID string) error

DeleteWebhook on GitLab

func (*GitLabClient) DownloadFileFromRepo added in v1.5.2

func (client *GitLabClient) DownloadFileFromRepo(_ context.Context, owner, repository, branch, path string) ([]byte, int, error)

DownloadFileFromRepo on GitLab

func (*GitLabClient) DownloadRepository

func (client *GitLabClient) DownloadRepository(ctx context.Context, owner, repository, branch, localPath string) error

DownloadRepository on GitLab

func (*GitLabClient) GetCommitBySha added in v1.1.0

func (client *GitLabClient) GetCommitBySha(ctx context.Context, owner, repository, sha string) (CommitInfo, error)

GetCommitBySha on GitLab

func (*GitLabClient) GetCommitStatuses added in v1.7.0

func (client *GitLabClient) GetCommitStatuses(ctx context.Context, _, repository, ref string) (status []CommitStatusInfo, err error)

GetCommitStatuses on GitLab

func (*GitLabClient) GetCommits added in v1.13.0

func (client *GitLabClient) GetCommits(ctx context.Context, owner, repository, branch string) ([]CommitInfo, error)

GetCommits on GitLab

func (*GitLabClient) GetLabel added in v1.1.0

func (client *GitLabClient) GetLabel(ctx context.Context, owner, repository, name string) (*LabelInfo, error)

GetLabel on GitLub

func (*GitLabClient) GetLatestCommit added in v1.1.0

func (client *GitLabClient) GetLatestCommit(ctx context.Context, owner, repository, branch string) (CommitInfo, error)

GetLatestCommit on GitLab

func (*GitLabClient) GetModifiedFiles added in v1.6.0

func (client *GitLabClient) GetModifiedFiles(_ context.Context, owner, repository, refBefore, refAfter string) ([]string, error)

func (*GitLabClient) GetPullRequestByID added in v1.10.0

func (client *GitLabClient) GetPullRequestByID(_ context.Context, owner, repository string, pullRequestId int) (pullRequestInfo PullRequestInfo, err error)

GetPullRequestInfoById on GitLab

func (*GitLabClient) GetPullRequestCommentSizeLimit added in v1.15.0

func (client *GitLabClient) GetPullRequestCommentSizeLimit() int

func (*GitLabClient) GetPullRequestDetailsSizeLimit added in v1.15.0

func (client *GitLabClient) GetPullRequestDetailsSizeLimit() int

func (*GitLabClient) GetRepositoryEnvironmentInfo added in v1.5.5

func (client *GitLabClient) GetRepositoryEnvironmentInfo(_ context.Context, _, _, _ string) (RepositoryEnvironmentInfo, error)

GetRepositoryEnvironmentInfo on GitLab

func (*GitLabClient) GetRepositoryInfo added in v1.1.0

func (client *GitLabClient) GetRepositoryInfo(ctx context.Context, owner, repository string) (RepositoryInfo, error)

GetRepositoryInfo on GitLab

func (*GitLabClient) ListBranches

func (client *GitLabClient) ListBranches(ctx context.Context, owner, repository string) ([]string, error)

ListBranches on GitLab

func (*GitLabClient) ListOpenPullRequests added in v1.2.0

func (client *GitLabClient) ListOpenPullRequests(ctx context.Context, owner, repository string) ([]PullRequestInfo, error)

ListOpenPullRequests on GitLab

func (*GitLabClient) ListOpenPullRequestsWithBody added in v1.9.0

func (client *GitLabClient) ListOpenPullRequestsWithBody(ctx context.Context, owner, repository string) ([]PullRequestInfo, error)

ListOpenPullRequestsWithBody on GitLab

func (*GitLabClient) ListPullRequestComments added in v1.2.0

func (client *GitLabClient) ListPullRequestComments(ctx context.Context, owner, repository string, pullRequestID int) ([]CommentInfo, error)

ListPullRequestComments on GitLab

func (*GitLabClient) ListPullRequestLabels added in v1.1.0

func (client *GitLabClient) ListPullRequestLabels(ctx context.Context, owner, repository string, pullRequestID int) ([]string, error)

ListPullRequestLabels on GitLab

func (*GitLabClient) ListPullRequestReviewComments added in v1.14.0

func (client *GitLabClient) ListPullRequestReviewComments(ctx context.Context, owner, repository string, pullRequestID int) ([]CommentInfo, error)

ListPullRequestReviewComments on GitLab

func (*GitLabClient) ListRepositories

func (client *GitLabClient) ListRepositories(ctx context.Context) (map[string][]string, error)

ListRepositories on GitLab

func (*GitLabClient) SetCommitStatus

func (client *GitLabClient) SetCommitStatus(ctx context.Context, commitStatus CommitStatus, owner, repository, ref,
	title, description, detailsURL string) error

SetCommitStatus on GitLab

func (*GitLabClient) TestConnection

func (client *GitLabClient) TestConnection(ctx context.Context) error

TestConnection on GitLab

func (*GitLabClient) UnlabelPullRequest added in v1.1.0

func (client *GitLabClient) UnlabelPullRequest(ctx context.Context, owner, repository, label string, pullRequestID int) error

UnlabelPullRequest on GitLab

func (*GitLabClient) UpdatePullRequest added in v1.8.0

func (client *GitLabClient) UpdatePullRequest(ctx context.Context, owner, repository, title, body, targetBranchName string, prId int, state vcsutils.PullRequestState) error

UpdatePullRequest on GitLab

func (*GitLabClient) UpdateWebhook

func (client *GitLabClient) UpdateWebhook(ctx context.Context, owner, repository, branch, payloadURL, token,
	webhookID string, webhookEvents ...vcsutils.WebhookEvent) error

UpdateWebhook on GitLab

func (*GitLabClient) UploadCodeScanning added in v1.3.0

func (client *GitLabClient) UploadCodeScanning(_ context.Context, _ string, _ string, _ string, _ string) (string, error)

UploadCodeScanning on GitLab

type LabelInfo added in v1.1.0

type LabelInfo struct {
	Name        string
	Description string
	// Label color is a hexadecimal color code, for example: 4AB548
	Color string
}

LabelInfo contains a label information

type Permission added in v1.1.0

type Permission int

Permission the ssh key permission on the VCS repository

const (
	// Read permission
	Read Permission = iota
	// ReadWrite is either read and write permission
	ReadWrite
)

type PullRequestComment added in v1.14.0

type PullRequestComment struct {
	CommentInfo
	PullRequestDiff
}

PullRequestInfo contains the details of a pull request comment content - the content of the pull request comment PullRequestDiff - the content of the pull request diff

type PullRequestDiff added in v1.14.0

type PullRequestDiff struct {
	OriginalFilePath    string
	OriginalStartLine   int
	OriginalEndLine     int
	OriginalStartColumn int
	OriginalEndColumn   int
	NewFilePath         string
	NewStartLine        int
	NewEndLine          int
	NewStartColumn      int
	NewEndColumn        int
}

PullRequestDiff contains the details of the pull request diff OriginalFilePath - the original file path OriginalStartLine - the original start line number OriginalEndLine - the original end line number originalStartColum - the original start column number OriginalEndColumn - the original end column number NewFilePath - the new file path NewStartLine - the new start line number NewEndLine - the new end line number NewStartColumn - the new start column number NewEndColumn - the new end column number

type PullRequestInfo added in v1.2.0

type PullRequestInfo struct {
	ID     int64
	Body   string
	URL    string
	Source BranchInfo
	Target BranchInfo
}

type RepositoryEnvironmentInfo added in v1.5.5

type RepositoryEnvironmentInfo struct {
	Name      string
	Url       string
	Reviewers []string
}

RepositoryEnvironmentInfo is the environment details configured for a repository

type RepositoryInfo added in v1.1.0

type RepositoryInfo struct {
	CloneInfo            CloneInfo
	RepositoryVisibility RepositoryVisibility
}

RepositoryInfo contains general information about the repository.

type RepositoryVisibility added in v1.5.5

type RepositoryVisibility int

RepositoryVisibility the visibility level of the repository

const (
	// Open to public
	Public RepositoryVisibility = iota
	// Open to organization
	Internal
	// Open to user
	Private
)

type VcsClient

type VcsClient interface {
	// TestConnection Returns nil if connection and authorization established successfully
	TestConnection(ctx context.Context) error

	// ListRepositories Returns a map between all accessible owners to their list of repositories
	ListRepositories(ctx context.Context) (map[string][]string, error)

	// ListBranches Lists all branches under the input repository
	// owner      - User or organization
	// repository - VCS repository name
	ListBranches(ctx context.Context, owner, repository string) ([]string, error)

	// CreateWebhook Creates a webhook
	// owner         - User or organization
	// repository    - VCS repository name
	// branch        - VCS branch name
	// payloadURL    - URL to send the payload when a webhook event occurs
	// webhookEvents - The event type
	// Return the webhook ID, token and an error, if occurred
	CreateWebhook(ctx context.Context, owner, repository, branch, payloadURL string, webhookEvents ...vcsutils.WebhookEvent) (string, string, error)

	// UpdateWebhook Updates a webhook
	// owner         - User or organization
	// repository    - VCS repository name
	// branch        - VCS branch name
	// payloadURL    - URL to send the payload when a webhook event occurs
	// token         - A token used to validate identity of the incoming webhook
	// webhookID     - The webhook ID returned from a previous CreateWebhook command
	// webhookEvents - The event type
	UpdateWebhook(ctx context.Context, owner, repository, branch, payloadURL, token, webhookID string, webhookEvents ...vcsutils.WebhookEvent) error

	// DeleteWebhook Deletes a webhook
	// owner        - User or organization
	// repository   - VCS repository name
	// webhookID    - The webhook ID returned from a previous CreateWebhook command
	DeleteWebhook(ctx context.Context, owner, repository, webhookID string) error

	// SetCommitStatus Sets commit status
	// commitStatus - One of Pass, Fail, Error, or InProgress
	// owner        - User or organization
	// repository   - VCS repository name
	// ref          - SHA, a branch name, or a tag name.
	// title        - Title of the commit status
	// description  - Description of the commit status
	// detailsUrl   - The URL for component status link
	SetCommitStatus(ctx context.Context, commitStatus CommitStatus, owner, repository, ref, title, description, detailsURL string) error

	// GetCommitStatuses Gets all statuses for a specific commit
	// owner        - User or organization
	// repository   - VCS repository name
	// ref          - SHA, a branch name, or a tag name.
	GetCommitStatuses(ctx context.Context, owner, repository, ref string) (status []CommitStatusInfo, err error)

	// DownloadRepository Downloads and extracts a VCS repository
	// owner      - User or organization
	// repository - VCS repository name
	// branch     - VCS branch name
	// localPath  - Local file system path
	DownloadRepository(ctx context.Context, owner, repository, branch, localPath string) error

	// CreatePullRequest Creates a pull request between 2 different branches in the same repository
	// owner        - User or organization
	// repository   - VCS repository name
	// sourceBranch - Source branch
	// targetBranch - Target branch
	// title        - Pull request title
	// description  - Pull request description
	CreatePullRequest(ctx context.Context, owner, repository, sourceBranch, targetBranch, title, description string) error

	// UpdatePullRequest Updates pull requests metadata
	// owner        		    - User or organization
	// repository    		    - VCS repository name
	// title         	        - Pull request title
	// body                     - Pull request body or description
	// targetBranchName         - Name of the pull request target branch name,For non-change, pass an empty string.
	// prId				        - Pull request ID
	// state				    - Pull request state
	UpdatePullRequest(ctx context.Context, owner, repository, title, body, targetBranchName string, prId int, state vcsutils.PullRequestState) error

	// AddPullRequestComment Adds a new comment on the requested pull request
	// owner          - User or organization
	// repository     - VCS repository name
	// content        - The new comment content
	// pullRequestID  - Pull request ID
	AddPullRequestComment(ctx context.Context, owner, repository, content string, pullRequestID int) error

	// AddPullRequestReviewComments Adds a new review comment on the requested pull request
	// owner          - User or organization
	// repository     - VCS repository name
	// pullRequestID  - Pull request ID
	// comment        - The new comment details defined in PullRequestComment
	AddPullRequestReviewComments(ctx context.Context, owner, repository string, pullRequestID int, comments ...PullRequestComment) error

	// ListPullRequestReviewComments Gets all pull request review comments
	// owner          - User or organization
	// repository     - VCS repository name
	// pullRequestID  - Pull request ID
	ListPullRequestReviewComments(ctx context.Context, owner, repository string, pullRequestID int) ([]CommentInfo, error)

	// DeletePullRequestReviewComments Gets all comments assigned to a pull request.
	// owner          - User or organization
	// repository     - VCS repository name
	// pullRequestID  - Pull request ID
	// commentID 	  - The ID of the comment
	DeletePullRequestReviewComments(ctx context.Context, owner, repository string, pullRequestID int, comments ...CommentInfo) error

	// ListPullRequestComments Gets all comments assigned to a pull request.
	// owner          - User or organization
	// repository     - VCS repository name
	// pullRequestID  - Pull request ID
	ListPullRequestComments(ctx context.Context, owner, repository string, pullRequestID int) ([]CommentInfo, error)

	// DeletePullRequestComment deleted a specific comment in a pull request.
	// owner          - User or organization
	// repository     - VCS repository name
	// pullRequestID  - Pull request ID
	// commentID 	  - The ID of the comment
	DeletePullRequestComment(ctx context.Context, owner, repository string, pullRequestID, commentID int) error

	// ListOpenPullRequestsWithBody Gets all open pull requests ids and the pull request body.
	// owner          - User or organization
	// repository     - VCS repository name
	ListOpenPullRequestsWithBody(ctx context.Context, owner, repository string) ([]PullRequestInfo, error)

	// ListOpenPullRequests Gets all open pull requests ids.
	// owner          - User or organization
	// repository     - VCS repository name
	ListOpenPullRequests(ctx context.Context, owner, repository string) ([]PullRequestInfo, error)

	// GetPullRequestByID Gets pull request info by ID.
	// owner          - User or organization
	// repository     - VCS repository name
	// pullRequestId  - ID of the pull request
	GetPullRequestByID(ctx context.Context, owner, repository string, pullRequestId int) (PullRequestInfo, error)

	// GetLatestCommit Gets the most recent commit of a branch
	// owner      - User or organization
	// repository - VCS repository name
	// branch     - The name of the branch
	GetLatestCommit(ctx context.Context, owner, repository, branch string) (CommitInfo, error)

	// GetCommits Gets the most recent commit of a branch
	// owner      - User or organization
	// repository - VCS repository name
	// branch     - The name of the branch
	GetCommits(ctx context.Context, owner, repository, branch string) ([]CommitInfo, error)

	// AddSshKeyToRepository Adds a public ssh key to a repository
	// owner      - User or organization
	// repository - VCS repository name
	// keyName    - Name of the key
	// publicKey  - SSH public key
	// permission - Access permission of the key: read or readWrite
	AddSshKeyToRepository(ctx context.Context, owner, repository, keyName, publicKey string, permission Permission) error

	// GetRepositoryInfo Returns information about repository.
	// owner      - User or organization
	// repository - VCS repository name
	GetRepositoryInfo(ctx context.Context, owner, repository string) (RepositoryInfo, error)

	// GetCommitBySha Gets the commit by its SHA
	// owner      - User or organization
	// repository - VCS repository name
	// sha        - The commit hash
	GetCommitBySha(ctx context.Context, owner, repository, sha string) (CommitInfo, error)

	// CreateLabel Creates a label in repository
	// owner      - User or organization
	// repository - VCS repository name
	// labelInfo  - The label info
	CreateLabel(ctx context.Context, owner, repository string, labelInfo LabelInfo) error

	// GetLabel Gets a label related to a repository. Returns (nil, nil) if label doesn't exist.
	// owner      - User or organization
	// repository - VCS repository name
	// name       - Label name
	GetLabel(ctx context.Context, owner, repository, name string) (*LabelInfo, error)

	// ListPullRequestLabels Gets all labels assigned to a pull request.
	// owner         - User or organization
	// repository    - VCS repository name
	// pullRequestID - Pull request ID
	ListPullRequestLabels(ctx context.Context, owner, repository string, pullRequestID int) ([]string, error)

	// UnlabelPullRequest Removes a label from a pull request
	// owner         - User or organization
	// repository    - VCS repository name
	// name          - Label name
	// pullRequestID - Pull request ID
	UnlabelPullRequest(ctx context.Context, owner, repository, name string, pullRequestID int) error

	// UploadCodeScanning Upload Scanning Analysis uploads a scanning analysis file to the relevant git provider
	// owner         - User or organization
	// repository    - VCS repository name
	// branch        - The name of the branch
	// scan          - Code scanning analysis
	UploadCodeScanning(ctx context.Context, owner, repository, branch, scanResults string) (string, error)

	// DownloadFileFromRepo Downloads a file from path in a repository
	// owner         - User or organization
	// repository    - VCS repository name
	// branch        - The name of the branch
	// path          - The path to the requested file
	DownloadFileFromRepo(ctx context.Context, owner, repository, branch, path string) ([]byte, int, error)

	// GetRepositoryEnvironmentInfo Gets the environment info configured for a repository
	// owner         - User or organization
	// repository    - VCS repository name
	// name          - The environment name
	GetRepositoryEnvironmentInfo(ctx context.Context, owner, repository, name string) (RepositoryEnvironmentInfo, error)

	// GetModifiedFiles returns list of file names modified between two VCS references
	// owner         - User or organization
	// repository    - VCS repository name
	// refBefore     - A VCS reference: commit SHA, branch name, tag name
	// refAfter      - A VCS reference: commit SHA, branch name, tag name
	GetModifiedFiles(ctx context.Context, owner, repository, refBefore, refAfter string) ([]string, error)

	// GetPullRequestCommentSizeLimit returns the maximum size of a pull request comment
	GetPullRequestCommentSizeLimit() int

	// GetPullRequestDetailsSizeLimit returns the maximum size of a pull request details
	GetPullRequestDetailsSizeLimit() int
}

VcsClient is a base class of all Vcs clients - GitHub, GitLab, Bitbucket server and cloud clients

type VcsInfo

type VcsInfo struct {
	APIEndpoint string
	Username    string
	Token       string
	// Project name is relevant for Azure Repos
	Project string
}

VcsInfo is the connection details of the VcsClient to communicate with the server

Jump to

Keyboard shortcuts

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