fetch

package
v0.0.0-...-5239448 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderExa        = basefetch.ProviderExa
	ProviderDirect     = basefetch.ProviderDirect
	DefaultTimeoutSecs = basefetch.DefaultTimeoutSecs
	DefaultMaxChars    = basefetch.DefaultMaxChars
)

Variables

View Source
var DefaultFallbackOrder = basefetch.DefaultFallbackOrder

Functions

This section is empty.

Types

type Config

type Config struct {
	Provider  string
	Fallbacks []string

	Exa    ExaConfig
	Direct DirectConfig
}

func ApplyEnvDefaults

func ApplyEnvDefaults(cfg *Config) *Config

func (*Config) WithDefaults

func (c *Config) WithDefaults() *Config

type DirectConfig

type DirectConfig struct {
	Enabled      *bool
	TimeoutSecs  int
	UserAgent    string
	Readability  bool
	MaxChars     int
	MaxRedirects int
	CacheTtlSecs int
}

type ExaConfig

type ExaConfig struct {
	Enabled           *bool
	BaseURL           string
	APIKey            string
	IncludeText       bool
	TextMaxCharacters int
}

type Request

type Request struct {
	URL         string
	ExtractMode string
	MaxChars    int
}

type Response

type Response struct {
	URL           string
	FinalURL      string
	Status        int
	ContentType   string
	ExtractMode   string
	Extractor     string
	Truncated     bool
	Length        int
	RawLength     int
	WrappedLength int
	FetchedAt     string
	TookMs        int64
	Text          string
	Warning       string
	Cached        bool
	Provider      string
	Extras        map[string]any
}

func Fetch

func Fetch(ctx context.Context, req Request, cfg *Config) (*Response, error)

Jump to

Keyboard shortcuts

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