Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Factory ¶
type Factory func(token, baseURL string) (VCSProvider, error)
Factory creates a VCSProvider from a token and base URL.
type FileDiff ¶
type FileDiff struct {
OldPath string
NewPath string
Diff string
NewFile bool
RenamedFile bool
DeletedFile bool
AMode string
BMode string
}
FileDiff represents a single file's diff in a merge/pull request.
type InlineComment ¶
type InlineComment struct {
FilePath string
OldPath string
NewLine int64
OldLine int64
Body string
}
InlineComment holds data for posting an inline comment on a diff.
type MRDiscussion ¶ added in v0.0.7
type MRDiscussion struct {
ID string
Notes []MRDiscussionNote
}
MRDiscussion represents one MR discussion thread.
type MRDiscussionNote ¶ added in v0.0.7
type MRDiscussionNote struct {
ID int64
Author string
Body string
FilePath string
Line int
Resolved bool
Resolvable bool
}
MRDiscussionNote represents one note in an MR discussion.
type MergeRequest ¶
type MergeRequest struct {
IID int64
Title string
Description string
Author string
SourceBranch string
TargetBranch string
State string
WebURL string
DiffRefs DiffRefs
}
MergeRequest holds platform-agnostic merge/pull request metadata.
type ProviderInfo ¶
ProviderInfo describes a VCS provider.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is a thread-safe store of VCS provider factories.
func (*Registry) Get ¶
func (r *Registry) Get(name string, token, baseURL string) (VCSProvider, error)
Get creates a VCS provider instance by name.
type VCSProvider ¶
type VCSProvider interface {
Info() ProviderInfo
FetchMR(ctx context.Context, projectID string, mrIID int64) (*MergeRequest, error)
FetchMRDiffs(ctx context.Context, projectID string, mrIID int64) ([]FileDiff, error)
FetchMRRawDiff(ctx context.Context, projectID string, mrIID int64) (string, error)
ListMRDiscussions(ctx context.Context, projectID string, mrIID int64) ([]MRDiscussion, error)
ListMRNotes(ctx context.Context, projectID string, mrIID int64) ([]MRNote, error)
ListOpenMRs(ctx context.Context, projectID string) ([]*MergeRequest, error)
PostSummaryNote(ctx context.Context, projectID string, mrIID int64, body string) error
PostInlineComment(ctx context.Context, projectID string, mrIID int64, refs DiffRefs, comment InlineComment) error
ReplyToMRDiscussion(ctx context.Context, projectID string, mrIID int64, discussionID, body string) error
FormatSuggestionBlock(suggestion string) string
Validate() error
}
VCSProvider abstracts version control system operations (GitLab, GitHub, etc.).
Click to show internal directories.
Click to hide internal directories.