Begin support for Gitea
This commit is contained in:
30
internal/remotes/gitea/gitea.go
Normal file
30
internal/remotes/gitea/gitea.go
Normal file
@@ -0,0 +1,30 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user