31 lines
588 B
Go
31 lines
588 B
Go
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
|
|
}
|