api

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIURL

func APIURL(host string) string

APIURL returns the API base URL for a given host.

func RefreshOAuthTokenIfNeeded added in v0.0.14

func RefreshOAuthTokenIfNeeded(host, currentToken string) string

RefreshOAuthTokenIfNeeded checks if the OAuth token is expired (or about to expire) and refreshes it. Returns the refreshed token on success, or the original token on failure.

func WebURL

func WebURL(host, path string) string

WebURL returns the web URL for a given host and path.

Types

type Client

type Client struct {
	*gitlab.Client
	// contains filtered or unexported fields
}

Client wraps the GitLab API client.

func NewClient

func NewClient(host string) (*Client, error)

NewClient creates a new authenticated GitLab API client. It automatically selects the correct client type based on the stored auth method.

func NewClientFromHosts added in v0.0.9

func NewClientFromHosts() (*Client, error)

NewClientFromHosts creates a client using the first authenticated host found in hosts.json.

func NewClientWithToken

func NewClientWithToken(host, token string) (*Client, error)

NewClientWithToken creates a new GitLab API client with the given token.

func NewOAuthClient added in v0.0.2

func NewOAuthClient(host, token string) (*Client, error)

NewOAuthClient creates a new GitLab API client using an OAuth token.

func (*Client) Host

func (c *Client) Host() string

Host returns the hostname of the GitLab instance.

Jump to

Keyboard shortcuts

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