repository

package
v0.0.0-...-8010d25 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	Name    string
	Content []byte
}

type GitHubApi

type GitHubApi struct {
	// contains filtered or unexported fields
}

func NewGitHubApi

func NewGitHubApi(token, repoOwner, repoName, branch string) (*GitHubApi, error)

func (*GitHubApi) AutoCreateRepository

func (a *GitHubApi) AutoCreateRepository(owner, repoName string, isPrivate bool) (string, error)

func (*GitHubApi) CheckTokenIfExpired

func (a *GitHubApi) CheckTokenIfExpired() bool

func (*GitHubApi) DeleteAllFiles

func (a *GitHubApi) DeleteAllFiles(owner, repoName, branch string) error

func (*GitHubApi) DeleteFiles

func (a *GitHubApi) DeleteFiles(owner, repoName, branch string, folderPaths ...string) error

func (*GitHubApi) GetBranch

func (a *GitHubApi) GetBranch() (branch string)

func (*GitHubApi) GetFile

func (a *GitHubApi) GetFile(owner, repoName, filePath, ref string) (*File, error)

func (*GitHubApi) GetLatestCommitHash

func (a *GitHubApi) GetLatestCommitHash(owner, repoName, filePath, ref string) (string, error)

func (*GitHubApi) GetRepoApiDomain

func (a *GitHubApi) GetRepoApiDomain() (domain string)

func (*GitHubApi) GetRepoBranches

func (a *GitHubApi) GetRepoBranches() ([]string, error)

func (*GitHubApi) GetRepoDefaultBranch

func (a *GitHubApi) GetRepoDefaultBranch() (string, error)

func (*GitHubApi) GetRepoName

func (a *GitHubApi) GetRepoName() (repoName string)

func (*GitHubApi) GetRepoOwner

func (a *GitHubApi) GetRepoOwner() (repoOwner string)

func (*GitHubApi) GetRepositoryArchive

func (a *GitHubApi) GetRepositoryArchive(owner, repoName, ref string) ([]byte, error)

func (*GitHubApi) GetRepositoryPrivacy

func (a *GitHubApi) GetRepositoryPrivacy(owner, repoName string) (bool, error)

func (*GitHubApi) GetToken

func (a *GitHubApi) GetToken() (token string)

func (*GitHubApi) GetTokenOwner

func (a *GitHubApi) GetTokenOwner() (tokenOwner string)

func (*GitHubApi) ParseFileUrl

func (a *GitHubApi) ParseFileUrl(url string) (filePid, owner, repoName string, err error)

func (*GitHubApi) PushFilesToRepository

func (a *GitHubApi) PushFilesToRepository(files map[string][]byte, owner, repoName, branch, commitMessage string) error

func (*GitHubApi) UpdateBranch

func (a *GitHubApi) UpdateBranch(branch string)

func (*GitHubApi) ValidateRepoBranch

func (a *GitHubApi) ValidateRepoBranch(branch string) (bool, error)

type GitLabApi

type GitLabApi struct {
	// contains filtered or unexported fields
}

func NewGitLabApi

func NewGitLabApi(domain, token, repoOwner, repoName, branch string) (*GitLabApi, error)

func (*GitLabApi) AutoCreateRepository

func (a *GitLabApi) AutoCreateRepository(owner, repoName string, isPrivate bool) (string, error)

func (*GitLabApi) CheckTokenIfExpired

func (a *GitLabApi) CheckTokenIfExpired() bool

func (*GitLabApi) DeleteAllFiles

func (a *GitLabApi) DeleteAllFiles(owner, repoName, branch string) error

func (*GitLabApi) DeleteFiles

func (a *GitLabApi) DeleteFiles(owner, repoName, branch string, filePaths ...string) error

func (*GitLabApi) GetBranch

func (a *GitLabApi) GetBranch() (branch string)

func (*GitLabApi) GetFile

func (a *GitLabApi) GetFile(owner, repoName, filePath, ref string) (*File, error)

func (*GitLabApi) GetLatestCommitHash

func (a *GitLabApi) GetLatestCommitHash(owner, repoName, filePath, ref string) (string, error)

func (*GitLabApi) GetProjectPid

func (a *GitLabApi) GetProjectPid() string

func (*GitLabApi) GetRepoApiDomain

func (a *GitLabApi) GetRepoApiDomain() (domain string)

func (*GitLabApi) GetRepoBranches

func (a *GitLabApi) GetRepoBranches() ([]string, error)

func (*GitLabApi) GetRepoDefaultBranch

func (a *GitLabApi) GetRepoDefaultBranch() (string, error)

func (*GitLabApi) GetRepoName

func (a *GitLabApi) GetRepoName() (repoName string)

func (*GitLabApi) GetRepoOwner

func (a *GitLabApi) GetRepoOwner() (repoOwner string)

func (*GitLabApi) GetRepositoryArchive

func (a *GitLabApi) GetRepositoryArchive(owner, repoName, ref string) ([]byte, error)

func (*GitLabApi) GetRepositoryPrivacy

func (a *GitLabApi) GetRepositoryPrivacy(owner, repoName string) (bool, error)

func (*GitLabApi) GetToken

func (a *GitLabApi) GetToken() (token string)

func (*GitLabApi) GetTokenOwner

func (a *GitLabApi) GetTokenOwner() (tokenOwner string)

func (*GitLabApi) ParseFileUrl

func (a *GitLabApi) ParseFileUrl(url string) (filePid, owner, repoName string, err error)

func (*GitLabApi) PushFilesToRepository

func (a *GitLabApi) PushFilesToRepository(files map[string][]byte, owner, repoName, branch, commitMessage string) error

func (*GitLabApi) UpdateBranch

func (a *GitLabApi) UpdateBranch(branch string)

func (*GitLabApi) ValidateRepoBranch

func (a *GitLabApi) ValidateRepoBranch(branch string) (bool, error)

type IRepository

type IRepository interface {
	GetRepoApiDomain() (domain string)
	GetToken() (token string)
	GetTokenOwner() (tokenOwner string)
	GetRepoOwner() (repoOwner string)
	GetRepoName() (repoName string)
	GetBranch() (branch string)
	UpdateBranch(branch string)

	CheckTokenIfExpired() bool

	GetRepoDefaultBranch() (string, error)
	ValidateRepoBranch(branch string) (bool, error)
	GetRepoBranches() ([]string, error)

	ParseFileUrl(url string) (filePid, owner, repoName string, err error)                               // parse file URL to the key message
	GetFile(owner, repoName, filePid, ref string) (*File, error)                                        // get a file from a repository
	PushFilesToRepository(files map[string][]byte, owner, repoName, branch, commitMessage string) error // push files to the repository
	GetRepositoryArchive(owner, repoName, ref string) ([]byte, error)                                   // obtain the byte of the compressed package, gitlab could not specify ref
	GetLatestCommitHash(owner, repoName, filePid, ref string) (string, error)                           // get the latest commit hash for the specified file
	DeleteFiles(owner, repoName, branch string, folderPaths ...string) error                            // delete root dirs
	DeleteAllFiles(owner, repoName, branch string) error                                                // delete all repo files
	AutoCreateRepository(owner, repoName string, isPrivate bool) (string, error)                        // automatically create repository and return new repository's URL
	GetRepositoryPrivacy(owner, repoName string) (bool, error)                                          // determine if the repository is private
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewRepoManager

func NewRepoManager(daoManager *dao.Manager) (*Manager, error)

func (*Manager) AddClient

func (rm *Manager) AddClient(repositoryModel *model.Repository) (err error)

func (*Manager) DelClient

func (rm *Manager) DelClient(repoId int64)

func (*Manager) GetClient

func (rm *Manager) GetClient(repoId int64) (IRepository, error)

Jump to

Keyboard shortcuts

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