mirror of https://github.com/go-gitea/gitea
Define interfaces syncing new issues/PRs
This commit is contained in:
parent
2399b5900a
commit
6f513103c9
|
@ -7,6 +7,7 @@ package migration
|
|||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/modules/structs"
|
||||
)
|
||||
|
@ -26,6 +27,10 @@ type Downloader interface {
|
|||
GetPullRequests(page, perPage int) ([]*PullRequest, bool, error)
|
||||
GetReviews(reviewable Reviewable) ([]*Review, error)
|
||||
FormatCloneURL(opts MigrateOptions, remoteAddr string) (string, error)
|
||||
|
||||
// For syncing issues and pull requests
|
||||
GetNewIssues(page, perPage int, updatedAfter time.Time) ([]*Issue, bool, error)
|
||||
GetNewPullRequests(page, perPage int, updatedAfter time.Time) ([]*PullRequest, bool, error)
|
||||
}
|
||||
|
||||
// DownloaderFactory defines an interface to match a downloader implementation and create a downloader
|
||||
|
|
|
@ -7,6 +7,7 @@ package migration
|
|||
import (
|
||||
"context"
|
||||
"net/url"
|
||||
"time"
|
||||
)
|
||||
|
||||
// NullDownloader implements a blank downloader
|
||||
|
@ -87,3 +88,13 @@ func (n NullDownloader) FormatCloneURL(opts MigrateOptions, remoteAddr string) (
|
|||
func (n NullDownloader) SupportGetRepoComments() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// GetNewIssues returns new issues updated after the given time according start and limit
|
||||
func (n NullDownloader) GetNewIssues(page, perPage int, updatedAfter time.Time) ([]*Issue, bool, error) {
|
||||
return nil, false, ErrNotSupported{Entity: "Issues"}
|
||||
}
|
||||
|
||||
// GetNewPullRequests returns pull requests after the given time according page and perPage
|
||||
func (n NullDownloader) GetNewPullRequests(page, perPage int, updatedAfter time.Time) ([]*PullRequest, bool, error) {
|
||||
return nil, false, ErrNotSupported{Entity: "PullRequests"}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue