git-project-manager/internal/remotes/gitlab/gitlab.go
2024-12-19 14:55:49 -05:00

39 lines
761 B
Go

package gitlabremote
import (
"fmt"
"github.com/xanzy/go-gitlab"
"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 {
return r.info.Type.String()
}
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
}