package gitearemote import ( "fmt" "code.gitea.io/sdk/gitea" "gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/info" ) type GiteaRemote struct { info *info.RemoteInfo api *gitea.Client } func (r *GiteaRemote) GetInfo() *info.RemoteInfo { return r.info } func (r *GiteaRemote) GetType() string { return r.info.Type.String() } 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 *info.RemoteInfo) (*GiteaRemote, error) { client, err := gitea.NewClient(remoteInfo.Host, gitea.SetContext(remoteInfo.Context()), gitea.SetToken(remoteInfo.Token), ) if err != nil { return nil, err } giteaRemote := &GiteaRemote{ info: remoteInfo, api: client, } return giteaRemote, nil }