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

types

package
v1.11.5 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIProvider

type APIProvider string

APIProvider represents an LLM provider

const (
	APIProviderOpenAI    APIProvider = "openai"
	APIProviderAnthropic APIProvider = "anthropic"
	APIProviderGemini    APIProvider = "gemini"
	APIProviderOllama    APIProvider = "ollama"
	APIProviderMiniMax   APIProvider = "minimax"
)

type AuthMethod

type AuthMethod string

AuthMethod represents the authentication method used

const (
	AuthMethodAPIKey AuthMethod = "api_key"
	AuthMethodOAuth  AuthMethod = "oauth"
)

type Config

type Config struct {
	DefaultAuth string                    `json:"default_auth"`
	Providers   map[string]ProviderConfig `json:"providers"`
}

Config represents auth configuration

type Credentials

type Credentials struct {
	Provider   string            `json:"provider"`
	AuthMethod AuthMethod        `json:"auth_method"`
	APIKey     string            `json:"api_key,omitempty"`
	TokenRef   string            `json:"token_ref,omitempty"`
	OAuth      *OAuthCredentials `json:"oauth,omitempty"`
	// Token holds the live OAuth token data (access, refresh, expiry).
	// Populated when AuthMethod == AuthMethodOAuth.
	Token     *Token    `json:"token,omitempty"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

Credentials represents authentication credentials

type OAuthCredentials

type OAuthCredentials struct {
	BaseURL        string   `json:"base_url"`
	ClientID       string   `json:"client_id"`
	ClientSecret   string   `json:"client_secret,omitempty"`
	AuthURL        string   `json:"auth_url"`
	TokenURL       string   `json:"token_url"`
	Scopes         []string `json:"scopes"`
	DeviceAuthURL  string   `json:"device_auth_url,omitempty"`
	DeviceTokenURL string   `json:"device_token_url,omitempty"`
}

OAuthCredentials holds OAuth-specific configuration

type ProviderConfig

type ProviderConfig struct {
	AuthMethod AuthMethod        `json:"auth_method"`
	APIKey     string            `json:"api_key"`
	OAuth      *OAuthCredentials `json:"oauth"`
}

ProviderConfig holds configuration for a specific provider

type Token

type Token struct {
	AccessToken  string    `json:"access_token"`
	RefreshToken string    `json:"refresh_token,omitempty"`
	IDToken      string    `json:"id_token,omitempty"`
	TokenType    TokenType `json:"token_type"`
	ExpiresAt    time.Time `json:"expires_at"`
	Scope        string    `json:"scope,omitempty"`
	AccountID    string    `json:"account_id,omitempty"`
	WorkspaceID  string    `json:"workspace_id,omitempty"`
}

Token represents an OAuth token

func (*Token) IsExpired

func (t *Token) IsExpired(within time.Duration) bool

IsExpired returns true if the token is expired or will expire within the given duration

func (*Token) NeedsRefresh

func (t *Token) NeedsRefresh() bool

NeedsRefresh returns true if the token should be refreshed

type TokenType

type TokenType string

TokenType represents the type of OAuth token

const (
	TokenTypeAccess  TokenType = "access_token"
	TokenTypeRefresh TokenType = "refresh_token"
)

Jump to

Keyboard shortcuts

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