gitlab

package
v6.9.4-2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBaseURL      = "https://gitlab.com"
	DefaultCallbackPort = 17171
)

Variables

This section is empty.

Functions

func NormalizeBaseURL

func NormalizeBaseURL(raw string) string

func RedirectURL

func RedirectURL(port int) string

func TokenExpiry

func TokenExpiry(now time.Time, token *TokenResponse) time.Time

Types

type AuthClient

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

func NewAuthClient

func NewAuthClient(cfg *config.Config) *AuthClient

func (*AuthClient) ExchangeCodeForTokens

func (c *AuthClient) ExchangeCodeForTokens(ctx context.Context, baseURL, clientID, clientSecret, redirectURI, code, codeVerifier string) (*TokenResponse, error)

func (*AuthClient) FetchDirectAccess

func (c *AuthClient) FetchDirectAccess(ctx context.Context, baseURL, token string) (*DirectAccessResponse, error)

func (*AuthClient) GenerateAuthURL

func (c *AuthClient) GenerateAuthURL(baseURL, clientID, redirectURI, state string, pkce *PKCECodes) (string, error)

func (*AuthClient) GetCurrentUser

func (c *AuthClient) GetCurrentUser(ctx context.Context, baseURL, token string) (*User, error)

func (*AuthClient) GetPersonalAccessTokenSelf

func (c *AuthClient) GetPersonalAccessTokenSelf(ctx context.Context, baseURL, token string) (*PersonalAccessTokenSelf, error)

func (*AuthClient) RefreshTokens

func (c *AuthClient) RefreshTokens(ctx context.Context, baseURL, clientID, clientSecret, refreshToken string) (*TokenResponse, error)

type DirectAccessResponse

type DirectAccessResponse struct {
	BaseURL      string            `json:"base_url"`
	Token        string            `json:"token"`
	ExpiresAt    int64             `json:"expires_at"`
	Headers      map[string]string `json:"headers"`
	ModelDetails *ModelDetails     `json:"model_details,omitempty"`
}

type DiscoveredModel

type DiscoveredModel struct {
	ModelProvider string
	ModelName     string
}

func ExtractDiscoveredModels

func ExtractDiscoveredModels(metadata map[string]any) []DiscoveredModel

type ModelDetails

type ModelDetails struct {
	ModelProvider string `json:"model_provider"`
	ModelName     string `json:"model_name"`
}

type OAuthResult

type OAuthResult struct {
	Code  string
	State string
	Error string
}

type OAuthServer

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

func NewOAuthServer

func NewOAuthServer(port int) *OAuthServer

func (*OAuthServer) Start

func (s *OAuthServer) Start() error

func (*OAuthServer) Stop

func (s *OAuthServer) Stop(ctx context.Context) error

func (*OAuthServer) WaitForCallback

func (s *OAuthServer) WaitForCallback(timeout time.Duration) (*OAuthResult, error)

type PKCECodes

type PKCECodes struct {
	CodeVerifier  string
	CodeChallenge string
}

func GeneratePKCECodes

func GeneratePKCECodes() (*PKCECodes, error)

type PersonalAccessTokenSelf

type PersonalAccessTokenSelf struct {
	ID     int64    `json:"id"`
	Name   string   `json:"name"`
	Scopes []string `json:"scopes"`
	UserID int64    `json:"user_id"`
}

type TokenResponse

type TokenResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	RefreshToken string `json:"refresh_token"`
	Scope        string `json:"scope"`
	CreatedAt    int64  `json:"created_at"`
	ExpiresIn    int    `json:"expires_in"`
}

type User

type User struct {
	ID          int64  `json:"id"`
	Username    string `json:"username"`
	Name        string `json:"name"`
	Email       string `json:"email"`
	PublicEmail string `json:"public_email"`
}

Jump to

Keyboard shortcuts

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