Move RemoteInfo and CloneProto to info package

This commit is contained in:
2024-01-17 08:13:58 -05:00
parent 1e4e9147f1
commit f33199bd7b
12 changed files with 100 additions and 58 deletions

View File

@ -4,24 +4,28 @@ import (
"fmt"
"code.gitea.io/sdk/gitea"
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/remote"
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/info"
)
type GiteaRemote struct {
info *remote.RemoteInfo
info *info.RemoteInfo
api *gitea.Client
}
func (r *GiteaRemote) GetInfo() *remote.RemoteInfo {
func (r *GiteaRemote) GetInfo() *info.RemoteInfo {
return r.info
}
func (r *GiteaRemote) GetType() string {
return r.info.Type
}
func (r *GiteaRemote) String() string {
return fmt.Sprintf("Gitea %s (%s), clone proto %s",
r.GetInfo().Name, r.GetInfo().Host, r.GetInfo().CloneProto)
}
func NewGiteaRemote(remoteInfo *remote.RemoteInfo) (*GiteaRemote, error) {
func NewGiteaRemote(remoteInfo *info.RemoteInfo) (*GiteaRemote, error) {
client, err := gitea.NewClient(remoteInfo.Host,
gitea.SetContext(remoteInfo.Ctx),
gitea.SetToken(remoteInfo.Token),