base

package
v1.10.0-dev Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	IssueIndex  int64
	PosterName  string
	PosterEmail string
	Created     time.Time
	Content     string
	Reactions   *Reactions
}

Comment is a standard comment information

type Downloader

type Downloader interface {
	GetRepoInfo() (*Repository, 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, error)
}

Downloader downloads the site repo informations

type DownloaderFactory

type DownloaderFactory interface {
	Match(opts MigrateOptions) (bool, error)
	New(opts MigrateOptions) (Downloader, error)
}

DownloaderFactory defines an interface to match a downloader implementation and create a downloader

type Issue

type Issue struct {
	Number      int64
	PosterName  string
	PosterEmail string
	Title       string
	Content     string
	Milestone   string
	State       string // closed, open
	IsLocked    bool
	Created     time.Time
	Closed      *time.Time
	Labels      []*Label
	Reactions   *Reactions
}

Issue is a standard issue information

type Label

type Label struct {
	Name        string
	Color       string
	Description string
}

Label defines a standard label informations

type MigrateOptions

type MigrateOptions struct {
	RemoteURL    string
	AuthUsername string
	AuthPassword string
	Name         string
	Description  string

	Wiki              bool
	Issues            bool
	Milestones        bool
	Labels            bool
	Releases          bool
	Comments          bool
	PullRequests      bool
	Private           bool
	Mirror            bool
	IgnoreIssueAuthor bool // if true will not add original author information before issues or comments content.
}

MigrateOptions defines the way a repository gets migrated

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
	Title          string
	PosterName     string
	PosterEmail    string
	Content        string
	Milestone      string
	State          string
	Created        time.Time
	Closed         *time.Time
	Labels         []*Label
	PatchURL       string
	Merged         bool
	MergedTime     *time.Time
	MergeCommitSHA string
	Head           PullRequestBranch
	Base           PullRequestBranch
	Assignee       string
	Assignees      []string
	IsLocked       bool
}

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 Reactions

type Reactions struct {
	TotalCount int
	PlusOne    int
	MinusOne   int
	Laugh      int
	Confused   int
	Heart      int
	Hooray     int
}

Reactions represents a summary of reactions.

type Release

type Release struct {
	TagName         string
	TargetCommitish string
	Name            string
	Body            string
	Draft           bool
	Prerelease      bool
	Assets          []ReleaseAsset
	Created         time.Time
	Published       time.Time
}

Release represents a release

type ReleaseAsset

type ReleaseAsset struct {
	URL           string
	Name          string
	ContentType   *string
	Size          *int
	DownloadCount *int
	Created       time.Time
	Updated       time.Time
}

ReleaseAsset represents a release asset

type Repository

type Repository struct {
	Name         string
	Owner        string
	IsPrivate    bool
	IsMirror     bool
	Description  string
	AuthUsername string
	AuthPassword string
	CloneURL     string
}

Repository defines a standard repository information

type Uploader

type Uploader interface {
	MaxBatchInsertSize(tp string) int
	CreateRepo(repo *Repository, opts MigrateOptions) error
	CreateMilestones(milestones ...*Milestone) error
	CreateReleases(releases ...*Release) error
	CreateLabels(labels ...*Label) error
	CreateIssues(issues ...*Issue) error
	CreateComments(comments ...*Comment) error
	CreatePullRequests(prs ...*PullRequest) error
	Rollback() error
}

Uploader uploads all the informations of one repository

Jump to

Keyboard shortcuts

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