Documentation
¶
Overview ¶
Package gitlab implements the GitLab Provider for the git-platform-sdk.
It builds on top of the official gitlab-org/api/client-go SDK and adds transport-layer cross-cutting behavior (auth, retry, hooks, logging) provided by the parent project's transport package.
Index ¶
- func New(cfg provider.Config) (provider.Provider, error)
- type Provider
- func (p *Provider) CloseCR(ctx context.Context, owner, repo string, number int) (*provider.ChangeRequest, error)
- func (p *Provider) CompareCommits(ctx context.Context, owner, repo, base, head string) (*provider.CompareResult, error)
- func (p *Provider) CreateBranch(ctx context.Context, owner, repo, branch, ref string) (*provider.PlatformBranch, error)
- func (p *Provider) CreateCR(ctx context.Context, opts provider.CreateCROptions) (*provider.ChangeRequest, error)
- func (p *Provider) CreateCommitStatus(ctx context.Context, owner, repo, sha string, ...) error
- func (p *Provider) CreateDiscussion(ctx context.Context, owner, repo string, number int, ...) (string, error)
- func (p *Provider) CreateFile(ctx context.Context, owner, repo string, opts provider.FileOptions) (*provider.FileResult, error)
- func (p *Provider) CreateNote(ctx context.Context, owner, repo string, number int, body string) (string, error)
- func (p *Provider) CreateRelease(ctx context.Context, owner, repo string, opts provider.CreateReleaseOptions) (*provider.ReleaseInfo, error)
- func (p *Provider) CreateRepo(ctx context.Context, owner string, opts provider.CreateRepoOptions) (*provider.PlatformRepo, error)
- func (p *Provider) CreateReview(ctx context.Context, owner, repo string, number int, ...) (*provider.ReviewResult, error)
- func (p *Provider) CreateWebhook(ctx context.Context, opts provider.CreateWebhookOptions) (*provider.PlatformWebhook, error)
- func (p *Provider) DeleteBranch(ctx context.Context, owner, repo, branch string) error
- func (p *Provider) DeleteFile(ctx context.Context, owner, repo string, opts provider.FileDeleteOptions) (*provider.FileResult, error)
- func (p *Provider) DeleteNote(ctx context.Context, owner, repo string, number int, noteID string) error
- func (p *Provider) DeleteRepo(ctx context.Context, owner, repo string) error
- func (p *Provider) DeleteWebhook(ctx context.Context, owner, repo string, webhookID int64) error
- func (p *Provider) ForkRepo(ctx context.Context, owner, repo string, opts provider.ForkRepoOptions) (*provider.PlatformRepo, error)
- func (p *Provider) GetArchive(ctx context.Context, owner, repo, ref, format string) ([]byte, error)
- func (p *Provider) GetCR(ctx context.Context, owner, repo string, number int) (*provider.ChangeRequest, error)
- func (p *Provider) GetCRDiff(ctx context.Context, owner, repo string, number int) (*provider.MergeDiff, error)
- func (p *Provider) GetCRFiles(ctx context.Context, owner, repo string, number int) ([]*provider.ChangedFile, error)
- func (p *Provider) GetCommit(ctx context.Context, owner, repo, sha string) (*provider.CommitInfo, error)
- func (p *Provider) GetFileContent(ctx context.Context, owner, repo, path, ref string) (string, error)
- func (p *Provider) GetRepo(ctx context.Context, owner, repo string) (*provider.PlatformRepo, error)
- func (p *Provider) ListBranches(ctx context.Context, owner, repo string) ([]*provider.PlatformBranch, error)
- func (p *Provider) ListCRComments(ctx context.Context, owner, repo string, number int) ([]*provider.CRComment, error)
- func (p *Provider) ListCRCommits(ctx context.Context, owner, repo string, number int) ([]*provider.CRCommit, error)
- func (p *Provider) ListCRs(ctx context.Context, opts provider.ListCROptions) ([]*provider.ChangeRequest, int, error)
- func (p *Provider) ListCommits(ctx context.Context, owner, repo string, opts provider.ListCommitsOptions) ([]*provider.CommitInfo, error)
- func (p *Provider) ListReleases(ctx context.Context, owner, repo string) ([]*provider.ReleaseInfo, error)
- func (p *Provider) ListRepos(ctx context.Context, opts provider.ListRepoOptions) ([]*provider.PlatformRepo, error)
- func (p *Provider) ListTags(ctx context.Context, owner, repo string) ([]*provider.TagInfo, error)
- func (p *Provider) ListWebhooks(ctx context.Context, owner, repo string) ([]*provider.PlatformWebhook, error)
- func (p *Provider) MergeCR(ctx context.Context, owner, repo string, number int, ...) (*provider.ChangeRequest, error)
- func (p *Provider) ParseWebhookEvent(r *http.Request, secret string) (*provider.NormalizedEvent, error)
- func (p *Provider) Platform() provider.Platform
- func (p *Provider) ReopenCR(ctx context.Context, owner, repo string, number int) (*provider.ChangeRequest, error)
- func (p *Provider) TestConnection(ctx context.Context) (*provider.TestConnectionResult, error)
- func (p *Provider) UpdateCR(ctx context.Context, owner, repo string, number int, ...) (*provider.ChangeRequest, error)
- func (p *Provider) UpdateCRLabels(ctx context.Context, owner, repo string, number int, labels []string) error
- func (p *Provider) UpdateFile(ctx context.Context, owner, repo string, opts provider.FileOptions) (*provider.FileResult, error)
- func (p *Provider) UpdateRepo(ctx context.Context, owner, repo string, opts provider.UpdateRepoOptions) (*provider.PlatformRepo, error)
- func (p *Provider) ValidateWebhookSignature(r *http.Request, secret string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is the GitLab implementation of provider.Provider.
func (*Provider) CloseCR ¶
func (p *Provider) CloseCR(ctx context.Context, owner, repo string, number int) (*provider.ChangeRequest, error)
CloseCR implements provider.ChangeRequestManager.
func (*Provider) CompareCommits ¶
func (p *Provider) CompareCommits(ctx context.Context, owner, repo, base, head string) (*provider.CompareResult, error)
CompareCommits implements provider.CommitManager.
func (*Provider) CreateBranch ¶
func (p *Provider) CreateBranch(ctx context.Context, owner, repo, branch, ref string) (*provider.PlatformBranch, error)
CreateBranch implements provider.BranchManager.
func (*Provider) CreateCR ¶
func (p *Provider) CreateCR(ctx context.Context, opts provider.CreateCROptions) (*provider.ChangeRequest, error)
CreateCR implements provider.ChangeRequestManager.
func (*Provider) CreateCommitStatus ¶
func (p *Provider) CreateCommitStatus(ctx context.Context, owner, repo, sha string, opts provider.CommitStatusOptions) error
CreateCommitStatus implements provider.CommitManager.
func (*Provider) CreateDiscussion ¶
func (p *Provider) CreateDiscussion(ctx context.Context, owner, repo string, number int, opts provider.DiscussionOptions) (string, error)
CreateDiscussion implements provider.DiffManager.
func (*Provider) CreateFile ¶
func (p *Provider) CreateFile(ctx context.Context, owner, repo string, opts provider.FileOptions) (*provider.FileResult, error)
CreateFile implements provider.FileManager.
func (*Provider) CreateNote ¶
func (p *Provider) CreateNote(ctx context.Context, owner, repo string, number int, body string) (string, error)
CreateNote implements provider.DiffManager.
func (*Provider) CreateRelease ¶
func (p *Provider) CreateRelease(ctx context.Context, owner, repo string, opts provider.CreateReleaseOptions) (*provider.ReleaseInfo, error)
CreateRelease implements provider.ReleaseManager.
func (*Provider) CreateRepo ¶
func (p *Provider) CreateRepo(ctx context.Context, owner string, opts provider.CreateRepoOptions) (*provider.PlatformRepo, error)
CreateRepo implements provider.RepoManager.
func (*Provider) CreateReview ¶
func (p *Provider) CreateReview(ctx context.Context, owner, repo string, number int, opts provider.CreateReviewOptions) (*provider.ReviewResult, error)
CreateReview implements provider.DiffManager.
GitLab has no native "review" object. We approximate one by:
- Posting the summary body as a Note (if non-empty).
- Posting each inline comment as a Discussion.
- Setting a commit status with the verdict (if CommitID is set).
The returned ID is a synthetic identifier; the Comments slice reports the per-comment discussion IDs and any errors.
func (*Provider) CreateWebhook ¶
func (p *Provider) CreateWebhook(ctx context.Context, opts provider.CreateWebhookOptions) (*provider.PlatformWebhook, error)
CreateWebhook implements provider.WebhookManager.
func (*Provider) DeleteBranch ¶
DeleteBranch implements provider.BranchManager.
func (*Provider) DeleteFile ¶
func (p *Provider) DeleteFile(ctx context.Context, owner, repo string, opts provider.FileDeleteOptions) (*provider.FileResult, error)
DeleteFile implements provider.FileManager.
func (*Provider) DeleteNote ¶
func (p *Provider) DeleteNote(ctx context.Context, owner, repo string, number int, noteID string) error
DeleteNote implements provider.DiffManager.
func (*Provider) DeleteRepo ¶
DeleteRepo implements provider.RepoManager.
func (*Provider) DeleteWebhook ¶
DeleteWebhook implements provider.WebhookManager.
func (*Provider) ForkRepo ¶
func (p *Provider) ForkRepo(ctx context.Context, owner, repo string, opts provider.ForkRepoOptions) (*provider.PlatformRepo, error)
ForkRepo implements provider.RepoManager.
func (*Provider) GetArchive ¶
GetArchive implements provider.ReleaseManager.
func (*Provider) GetCR ¶
func (p *Provider) GetCR(ctx context.Context, owner, repo string, number int) (*provider.ChangeRequest, error)
GetCR implements provider.ChangeRequestManager.
func (*Provider) GetCRDiff ¶
func (p *Provider) GetCRDiff(ctx context.Context, owner, repo string, number int) (*provider.MergeDiff, error)
GetCRDiff implements provider.DiffManager.
func (*Provider) GetCRFiles ¶
func (p *Provider) GetCRFiles(ctx context.Context, owner, repo string, number int) ([]*provider.ChangedFile, error)
GetCRFiles implements provider.DiffManager.
func (*Provider) GetCommit ¶
func (p *Provider) GetCommit(ctx context.Context, owner, repo, sha string) (*provider.CommitInfo, error)
GetCommit implements provider.CommitManager.
func (*Provider) GetFileContent ¶
func (p *Provider) GetFileContent(ctx context.Context, owner, repo, path, ref string) (string, error)
GetFileContent implements provider.FileManager.
func (*Provider) ListBranches ¶
func (p *Provider) ListBranches(ctx context.Context, owner, repo string) ([]*provider.PlatformBranch, error)
ListBranches implements provider.BranchManager.
func (*Provider) ListCRComments ¶
func (p *Provider) ListCRComments(ctx context.Context, owner, repo string, number int) ([]*provider.CRComment, error)
ListCRComments implements provider.ChangeRequestManager.
func (*Provider) ListCRCommits ¶
func (p *Provider) ListCRCommits(ctx context.Context, owner, repo string, number int) ([]*provider.CRCommit, error)
ListCRCommits implements provider.ChangeRequestManager.
func (*Provider) ListCRs ¶
func (p *Provider) ListCRs(ctx context.Context, opts provider.ListCROptions) ([]*provider.ChangeRequest, int, error)
ListCRs implements provider.ChangeRequestManager.
func (*Provider) ListCommits ¶
func (p *Provider) ListCommits(ctx context.Context, owner, repo string, opts provider.ListCommitsOptions) ([]*provider.CommitInfo, error)
ListCommits implements provider.CommitManager.
func (*Provider) ListReleases ¶
func (p *Provider) ListReleases(ctx context.Context, owner, repo string) ([]*provider.ReleaseInfo, error)
ListReleases implements provider.ReleaseManager.
func (*Provider) ListRepos ¶
func (p *Provider) ListRepos(ctx context.Context, opts provider.ListRepoOptions) ([]*provider.PlatformRepo, error)
ListRepos implements provider.RepoManager.
func (*Provider) ListWebhooks ¶
func (p *Provider) ListWebhooks(ctx context.Context, owner, repo string) ([]*provider.PlatformWebhook, error)
ListWebhooks implements provider.WebhookManager.
func (*Provider) MergeCR ¶
func (p *Provider) MergeCR(ctx context.Context, owner, repo string, number int, opts provider.MergeCROptions) (*provider.ChangeRequest, error)
MergeCR implements provider.ChangeRequestManager.
func (*Provider) ParseWebhookEvent ¶
func (p *Provider) ParseWebhookEvent(r *http.Request, secret string) (*provider.NormalizedEvent, error)
ParseWebhookEvent implements provider.WebhookManager.
func (*Provider) ReopenCR ¶
func (p *Provider) ReopenCR(ctx context.Context, owner, repo string, number int) (*provider.ChangeRequest, error)
ReopenCR implements provider.ChangeRequestManager.
func (*Provider) TestConnection ¶
TestConnection implements provider.Provider.
func (*Provider) UpdateCR ¶
func (p *Provider) UpdateCR(ctx context.Context, owner, repo string, number int, opts provider.UpdateCROptions) (*provider.ChangeRequest, error)
UpdateCR implements provider.ChangeRequestManager.
func (*Provider) UpdateCRLabels ¶
func (p *Provider) UpdateCRLabels(ctx context.Context, owner, repo string, number int, labels []string) error
UpdateCRLabels implements provider.ChangeRequestManager.
func (*Provider) UpdateFile ¶
func (p *Provider) UpdateFile(ctx context.Context, owner, repo string, opts provider.FileOptions) (*provider.FileResult, error)
UpdateFile implements provider.FileManager.
func (*Provider) UpdateRepo ¶
func (p *Provider) UpdateRepo(ctx context.Context, owner, repo string, opts provider.UpdateRepoOptions) (*provider.PlatformRepo, error)
UpdateRepo implements provider.RepoManager.