33 lines
696 B
Go
33 lines
696 B
Go
|
package gitlab
|
||
|
|
||
|
import "github.com/xanzy/go-gitlab"
|
||
|
|
||
|
type Client struct {
|
||
|
gitlab *gitlab.Client
|
||
|
}
|
||
|
|
||
|
type ProjectInfo struct {
|
||
|
Name string `yaml:"name" json:"name"`
|
||
|
Id int `yaml:"id" json:"id"`
|
||
|
Path string `yaml:"path" json:"path"`
|
||
|
URI string `yaml:"uri" json:"uri"`
|
||
|
Description string `yaml:"description" json:"description"`
|
||
|
}
|
||
|
|
||
|
type ProjectAlias struct {
|
||
|
Alias string
|
||
|
ProjectID string
|
||
|
Project *ProjectInfo
|
||
|
}
|
||
|
|
||
|
func NewGitlabClient(host, token string) (*Client, error) {
|
||
|
client, err := gitlab.NewClient(token, gitlab.WithBaseURL(host))
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
gitlabClient := &Client{
|
||
|
gitlab: client,
|
||
|
}
|
||
|
return gitlabClient, nil
|
||
|
}
|