gitlab

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package gitlab lists and mirrors repositories from a self-hosted GitLab instance over its REST API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL *url.URL
	Token   string
	HTTP    *http.Client
}

Client lists and mirrors repositories from a self-hosted GitLab instance.

func New

func New(base, token string) (*Client, error)

New builds a Client against the given base URL.

func (*Client) ListRepos

func (c *Client) ListRepos(ctx context.Context, state backup.State) ([]backup.Repo, error)

ListRepos implements backup.Lister by paging through /api/v4/projects. simple=true isn't used here even though it would shrink the payload: it also drops the archived and empty_repo fields from the response, which are exactly the ones this method needs. StateAll makes two passes -- archived=true and archived=false -- since the endpoint has no "give me both" value the way Forgejo's does.

func (*Client) Remote

func (c *Client) Remote(r backup.Repo) backup.Remote

Remote implements backup.Remoter by deriving the clone URL from the configured base URL rather than the API's own http_url_to_repo, which can report a host or port the caller can't actually reach. The oauth2 user with the token as password is GitLab's documented form for authenticating git-http operations with a personal access token.

Jump to

Keyboard shortcuts

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