github.com/redhat-appstudio/e2e-tests@v0.0.0-20240520140907-9709f6f59323/pkg/clients/gitlab/client.go (about)

     1  package gitlab
     2  
     3  import (
     4  	gitlabClient "github.com/xanzy/go-gitlab"
     5  )
     6  
     7  const (
     8  	HEADS = "refs/heads/%s"
     9  )
    10  
    11  type GitlabClient struct {
    12  	client *gitlabClient.Client
    13  }
    14  
    15  func NewGitlabClient(accessToken, baseUrl string) (*GitlabClient, error) {
    16  	var err error
    17  	var glc = &GitlabClient{}
    18  	glc.client, err = gitlabClient.NewClient(accessToken, gitlabClient.WithBaseURL(baseUrl))
    19  	if err != nil {
    20  		return nil, err
    21  	}
    22  	return glc, nil
    23  }
    24  
    25  // GetClient returns the underlying gitlab client
    26  func (gc *GitlabClient) GetClient() *gitlabClient.Client {
    27  	return gc.client
    28  }