git-project-manager/internal/remotes/gitea/gitea.go

31 lines
588 B
Go
Raw Normal View History

2024-01-16 18:23:38 +00:00
package gitearemote
import (
"code.gitea.io/sdk/gitea"
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/remotes/remote"
)
type GiteaRemote struct {
info *remote.RemoteInfo
api *gitea.Client
}
func (r *GiteaRemote) GetInfo() *remote.RemoteInfo {
return r.info
}
func NewGiteaRemote(remoteInfo *remote.RemoteInfo) (*GiteaRemote, error) {
client, err := gitea.NewClient(remoteInfo.Host, gitea.SetContext(remoteInfo.Ctx))
if err != nil {
return nil, err
}
giteaRemote := &GiteaRemote{
info: remoteInfo,
api: client,
}
return giteaRemote, nil
}