Documentation ¶
Index ¶
- Constants
- type AssetDownloader
- type Comment
- type Downloader
- type DownloaderFactory
- type Issue
- type Label
- type MigrateOptions
- type Milestone
- type PullRequest
- type PullRequestBranch
- type Reaction
- type Release
- type ReleaseAsset
- type Repository
- type RetryDownloader
- func (d *RetryDownloader) GetComments(issueNumber int64) ([]*Comment, error)
- func (d *RetryDownloader) GetIssues(page, perPage int) ([]*Issue, bool, error)
- func (d *RetryDownloader) GetLabels() ([]*Label, error)
- func (d *RetryDownloader) GetMilestones() ([]*Milestone, error)
- func (d *RetryDownloader) GetPullRequests(page, perPage int) ([]*PullRequest, bool, error)
- func (d *RetryDownloader) GetReleases() ([]*Release, error)
- func (d *RetryDownloader) GetRepoInfo() (*Repository, error)
- func (d *RetryDownloader) GetReviews(pullRequestNumber int64) ([]*Review, error)
- func (d *RetryDownloader) GetTopics() ([]string, error)
- func (d *RetryDownloader) SetContext(ctx context.Context)
- type Review
- type ReviewComment
- type Uploader
Constants ¶
const ( ReviewStatePending = "PENDING" ReviewStateApproved = "APPROVED" ReviewStateChangesRequested = "CHANGES_REQUESTED" ReviewStateCommented = "COMMENTED" )
enumerate all review states
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetDownloader ¶ added in v1.13.0
type AssetDownloader interface {
GetAsset(relTag string, relID, id int64) (io.ReadCloser, error)
}
AssetDownloader downloads an asset (attachment) for a release
type Comment ¶
type Comment struct { IssueIndex int64 PosterID int64 PosterName string PosterEmail string Created time.Time Updated time.Time Content string Reactions []*Reaction }
Comment is a standard comment information
type Downloader ¶
type Downloader interface { AssetDownloader SetContext(context.Context) GetRepoInfo() (*Repository, error) GetTopics() ([]string, error) GetMilestones() ([]*Milestone, error) GetReleases() ([]*Release, error) GetLabels() ([]*Label, error) GetIssues(page, perPage int) ([]*Issue, bool, error) GetComments(issueNumber int64) ([]*Comment, error) GetPullRequests(page, perPage int) ([]*PullRequest, bool, error) GetReviews(pullRequestNumber int64) ([]*Review, error) }
Downloader downloads the site repo informations
type DownloaderFactory ¶
type DownloaderFactory interface { New(ctx context.Context, opts MigrateOptions) (Downloader, error) GitServiceType() structs.GitServiceType }
DownloaderFactory defines an interface to match a downloader implementation and create a downloader
type Issue ¶
type Issue struct { Number int64 PosterID int64 PosterName string PosterEmail string Title string Content string Milestone string State string // closed, open IsLocked bool Created time.Time Updated time.Time Closed *time.Time Labels []*Label Reactions []*Reaction Assignees []string }
Issue is a standard issue information
type MigrateOptions ¶
type MigrateOptions struct { // required: true CloneAddr string `json:"clone_addr" binding:"Required"` AuthUsername string `json:"auth_username"` AuthPassword string `json:"auth_password"` AuthToken string `json:"auth_token"` // required: true UID int `json:"uid" binding:"Required"` // required: true RepoName string `json:"repo_name" binding:"Required"` Mirror bool `json:"mirror"` Private bool `json:"private"` Description string `json:"description"` OriginalURL string GitServiceType structs.GitServiceType Wiki bool Issues bool Milestones bool Labels bool Releases bool Comments bool PullRequests bool MigrateToRepoID int64 }
MigrateOptions defines the way a repository gets migrated this is for internal usage by migrations module and func who interact with it
type Milestone ¶
type Milestone struct { Title string Description string Deadline *time.Time Created time.Time Updated *time.Time Closed *time.Time State string }
Milestone defines a standard milestone
type PullRequest ¶
type PullRequest struct { Number int64 OriginalNumber int64 Title string PosterName string PosterID int64 PosterEmail string Content string Milestone string State string Created time.Time Updated time.Time Closed *time.Time Labels []*Label PatchURL string Merged bool MergedTime *time.Time MergeCommitSHA string Head PullRequestBranch Base PullRequestBranch Assignees []string IsLocked bool Reactions []*Reaction }
PullRequest defines a standard pull request information
func (*PullRequest) IsForkPullRequest ¶
func (p *PullRequest) IsForkPullRequest() bool
IsForkPullRequest returns true if the pull request from a forked repository but not the same repository
type PullRequestBranch ¶
type PullRequestBranch struct { CloneURL string Ref string SHA string RepoName string OwnerName string }
PullRequestBranch represents a pull request branch
func (PullRequestBranch) RepoPath ¶
func (p PullRequestBranch) RepoPath() string
RepoPath returns pull request repo path
type Release ¶
type Release struct { TagName string TargetCommitish string Name string Body string Draft bool Prerelease bool PublisherID int64 PublisherName string PublisherEmail string Assets []ReleaseAsset Created time.Time Published time.Time }
Release represents a release
type ReleaseAsset ¶
type ReleaseAsset struct { ID int64 Name string ContentType *string Size *int DownloadCount *int Created time.Time Updated time.Time DownloadURL *string }
ReleaseAsset represents a release asset
type Repository ¶
type Repository struct { Name string Owner string IsPrivate bool IsMirror bool Description string CloneURL string OriginalURL string DefaultBranch string }
Repository defines a standard repository information
type RetryDownloader ¶ added in v1.11.0
type RetryDownloader struct { Downloader RetryTimes int // the total execute times RetryDelay int // time to delay seconds // contains filtered or unexported fields }
RetryDownloader retry the downloads
func NewRetryDownloader ¶ added in v1.11.0
func NewRetryDownloader(ctx context.Context, downloader Downloader, retryTimes, retryDelay int) *RetryDownloader
NewRetryDownloader creates a retry downloader
func (*RetryDownloader) GetComments ¶ added in v1.11.0
func (d *RetryDownloader) GetComments(issueNumber int64) ([]*Comment, error)
GetComments returns a repository's comments with retry
func (*RetryDownloader) GetIssues ¶ added in v1.11.0
func (d *RetryDownloader) GetIssues(page, perPage int) ([]*Issue, bool, error)
GetIssues returns a repository's issues with retry
func (*RetryDownloader) GetLabels ¶ added in v1.11.0
func (d *RetryDownloader) GetLabels() ([]*Label, error)
GetLabels returns a repository's labels with retry
func (*RetryDownloader) GetMilestones ¶ added in v1.11.0
func (d *RetryDownloader) GetMilestones() ([]*Milestone, error)
GetMilestones returns a repository's milestones with retry
func (*RetryDownloader) GetPullRequests ¶ added in v1.11.0
func (d *RetryDownloader) GetPullRequests(page, perPage int) ([]*PullRequest, bool, error)
GetPullRequests returns a repository's pull requests with retry
func (*RetryDownloader) GetReleases ¶ added in v1.11.0
func (d *RetryDownloader) GetReleases() ([]*Release, error)
GetReleases returns a repository's releases with retry
func (*RetryDownloader) GetRepoInfo ¶ added in v1.11.0
func (d *RetryDownloader) GetRepoInfo() (*Repository, error)
GetRepoInfo returns a repository information with retry
func (*RetryDownloader) GetReviews ¶ added in v1.12.0
func (d *RetryDownloader) GetReviews(pullRequestNumber int64) ([]*Review, error)
GetReviews returns pull requests reviews
func (*RetryDownloader) GetTopics ¶ added in v1.11.0
func (d *RetryDownloader) GetTopics() ([]string, error)
GetTopics returns a repository's topics with retry
func (*RetryDownloader) SetContext ¶ added in v1.11.0
func (d *RetryDownloader) SetContext(ctx context.Context)
SetContext set context
type Review ¶ added in v1.12.0
type Review struct { ID int64 IssueIndex int64 ReviewerID int64 ReviewerName string Official bool CommitID string Content string CreatedAt time.Time State string // PENDING, APPROVED, REQUEST_CHANGES, or COMMENT Comments []*ReviewComment }
Review is a standard review information
type ReviewComment ¶ added in v1.12.0
type ReviewComment struct { ID int64 InReplyTo int64 Content string TreePath string DiffHunk string Position int Line int CommitID string PosterID int64 Reactions []*Reaction CreatedAt time.Time UpdatedAt time.Time }
ReviewComment represents a review comment
type Uploader ¶
type Uploader interface { MaxBatchInsertSize(tp string) int CreateRepo(repo *Repository, opts MigrateOptions) error CreateTopics(topic ...string) error CreateMilestones(milestones ...*Milestone) error CreateReleases(downloader Downloader, releases ...*Release) error SyncTags() error CreateLabels(labels ...*Label) error CreateIssues(issues ...*Issue) error CreateComments(comments ...*Comment) error CreatePullRequests(prs ...*PullRequest) error CreateReviews(reviews ...*Review) error Rollback() error Close() }
Uploader uploads all the informations of one repository