Help us shape the future of Go! Take the 2026 Go Developer Survey

gitlab

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package gitlab is the source adapter for GitLab, on gitlab.com or self-managed (R-091). A connection signs in with an OAuth application (device or browser authorization), an access token or deploy token, or a deploy key, and may be limited to one group, nested or not.

Index

Constants

View Source
const (
	TokenTypeAccess = "access_token"
	TokenTypeDeploy = "deploy_token"
)

The token types a token connection takes.

View Source
const DefaultHost = "gitlab.com"

DefaultHost is the host a connection is for when its settings name none.

View Source
const Kind = "gitlab"

Kind is the adapter's kind string.

Variables

This section is empty.

Functions

func Info

func Info() api.KindInfo

Info describes the kind for the console's and the CLI's forms.

Types

type Adapter

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

Adapter is one connection to a GitLab host.

func New

func New() *Adapter

New returns an unconfigured adapter.

func (*Adapter) BeginAuthorization

func (a *Adapter) BeginAuthorization(ctx context.Context, req api.AuthorizationRequest) (api.Authorization, error)

BeginAuthorization starts device authorization (GitLab 17.9 and later) or browser authorization with PKCE.

func (*Adapter) Category

func (a *Adapter) Category() api.Category

func (*Adapter) CompleteAuthorization

func (a *Adapter) CompleteAuthorization(ctx context.Context, req api.AuthorizationCompletion) (api.AuthorizationResult, error)

CompleteAuthorization polls the device code or exchanges the browser's code.

func (*Adapter) Configure

func (a *Adapter) Configure(_ context.Context, raw json.RawMessage) error

Configure reads the connection's settings and credentials.

func (*Adapter) Covers

func (a *Adapter) Covers(repoURL string) int

Covers scores the repository by host and group path.

func (*Adapter) GitCredential

func (a *Adapter) GitCredential(ctx context.Context, repoURL string) (api.GitCredential, error)

GitCredential is the key, the token, or the OAuth access token, refreshed when it has expired.

func (*Adapter) HealthCheck

func (a *Adapter) HealthCheck(context.Context) error

HealthCheck succeeds once configured. Whether the credential still works is learned at the next clone or listing, which reports it (R-146).

func (*Adapter) Kind

func (a *Adapter) Kind() string

func (*Adapter) ListBranches

func (a *Adapter) ListBranches(ctx context.Context, repoURL string) ([]string, error)

ListBranches lists a project's branches.

func (*Adapter) ListRepositories

func (a *Adapter) ListRepositories(ctx context.Context, req api.ListRepositoriesRequest) ([]api.Repository, error)

ListRepositories lists the projects the connection is a member of, or those in its group and the group's subgroups.

func (*Adapter) Refresh

func (a *Adapter) Refresh(ctx context.Context) (map[string]secret.Value, error)

Refresh renews an expired OAuth access token, and returns the tokens to store only when it did. Every other method has nothing to renew.

func (*Adapter) SourceCapabilities

func (a *Adapter) SourceCapabilities() api.SourceCapabilities

Jump to

Keyboard shortcuts

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