gitlab

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const GitlabApiEndpoint = "https://gitlab.com/api/v4"

Variables

This section is empty.

Functions

func GetNextLink(linkHeader string) string

func SetLogger

func SetLogger(l Logger)

Types

type GitlabGroup

type GitlabGroup struct {
	Id   int    `json:"id"`
	Name string `json:"name"`
}

func (*GitlabGroup) GetEveryProjectsOfGroup

func (g *GitlabGroup) GetEveryProjectsOfGroup() (res []GitlabProject, err error)

GetEveryProjectsOfGroup returns the list of every projects of the group and subgroups

func (*GitlabGroup) GetProjectsLst

func (g *GitlabGroup) GetProjectsLst() (res []GitlabProject, err error)

GetProjectsLst returns the list of projects of the group

func (*GitlabGroup) GetSubgroupsLst

func (g *GitlabGroup) GetSubgroupsLst() (res []GitlabGroup, err error)

GetSubgroupsLst returns the list of subgroups of the group

type GitlabProject

type GitlabProject struct {
	Id           int    `json:"id"`
	Name         string `json:"name"`
	Archived     bool   `json:"archived"`
	ExportStatus string `json:"export_status"`
}

func (*GitlabProject) Export

func (p *GitlabProject) Export(tmpdir string) (err error)

SaveProject saves the project in the given storage

func (*GitlabProject) ExportedArchivePath

func (p *GitlabProject) ExportedArchivePath(tmpdir string) string

type GitlabService

type GitlabService struct {
	// contains filtered or unexported fields
}

func NewGitlabService

func NewGitlabService() *GitlabService

NewRequest returns a new GitlabService

func (*GitlabService) Get

func (r *GitlabService) Get(url string) (*http.Response, error)

Get sends a GET request to the Gitlab API to the given path

func (*GitlabService) GetGroup

func (s *GitlabService) GetGroup(groupID int) (res GitlabGroup, err error)

GetGroup returns the gitlab group from the given ID

func (*GitlabService) GetProject

func (s *GitlabService) GetProject(projectID int) (res GitlabProject, err error)

GetProject returns informations of the project that matches the given ID

func (*GitlabService) Post

func (r *GitlabService) Post(url string) (*http.Response, error)

Post sends a POST request to the Gitlab API to the given path

func (*GitlabService) SetGitlabEndpoint

func (r *GitlabService) SetGitlabEndpoint(gitlabApiEndpoint string)

SetGitlabEndpoint sets the Gitlab API endpoint default: https://gitlab.com/v4/api/

func (*GitlabService) SetHttpClient

func (r *GitlabService) SetHttpClient(httpClient *http.Client)

SetHttpClient sets the http client default: http.Client{}

func (*GitlabService) SetToken

func (r *GitlabService) SetToken(token string)

SetToken sets the Gitlab API token default: GITLAB_TOKEN env variable

type Logger

type Logger interface {
	Debug(msg string, args ...any)
	Warn(msg string, args ...any)
	Error(msg string, args ...any)
	Info(msg string, args ...any)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL