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

39 lines
761 B
Go
Raw Normal View History

package gitlabremote
import (
2024-01-16 19:26:56 +00:00
"fmt"
"github.com/xanzy/go-gitlab"
2024-12-19 19:55:49 +00:00
"gitea.libretechconsulting.com/rmcguire/git-project-manager/internal/remotes/info"
)
type GitlabRemote struct {
info *info.RemoteInfo
api *gitlab.Client
}
func (r *GitlabRemote) GetInfo() *info.RemoteInfo {
return r.info
}
func (r *GitlabRemote) GetType() string {
2024-01-17 21:56:41 +00:00
return r.info.Type.String()
}
2024-01-16 19:26:56 +00:00
func (r *GitlabRemote) String() string {
return fmt.Sprintf("GitLab %s (%s), clone proto %s",
r.GetInfo().Name, r.GetInfo().Host, r.GetInfo().CloneProto)
}
func NewGitlabRemote(remoteInfo *info.RemoteInfo) (*GitlabRemote, error) {
api, err := NewGitlabApi(remoteInfo)
if err != nil {
return nil, err
}
gl := &GitlabRemote{
info: remoteInfo,
api: api,
}
return gl, nil
}