source

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapClientAuth

func WrapClientAuth(client *http.Client, auth config.AuthConfig) *http.Client

WrapClientAuth returns a new *http.Client whose transport injects auth headers. If auth.TokenEnv, auth.UsernameEnv, and auth.PasswordEnv are all empty, the original client is returned unchanged.

Types

type AzureDevOpsProvider

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

AzureDevOpsProvider fetches documentation from an Azure DevOps Git repository.

func NewAzureDevOpsProvider

func NewAzureDevOpsProvider(cfg config.ResolvedSource, client *http.Client) *AzureDevOpsProvider

NewAzureDevOpsProvider constructs an AzureDevOpsProvider with authentication applied.

func (*AzureDevOpsProvider) Fetch

func (p *AzureDevOpsProvider) Fetch(ctx context.Context, sha string, paths []string, destDir string) error

Fetch downloads the zip archive for sha and extracts only files whose paths match one of the given path prefixes into destDir.

API: GET /{org}/{project}/_apis/git/repositories/{repo}/items

?path=/&$format=zip&versionDescriptor.version={sha}&versionDescriptor.versionType=commit&api-version=7.0

func (*AzureDevOpsProvider) Resolve

func (p *AzureDevOpsProvider) Resolve(ctx context.Context, ref string) (string, error)

Resolve converts a branch or tag name into the full commit SHA of its tip.

API: GET /{org}/{project}/_apis/git/repositories/{repo}/commits

?searchCriteria.itemVersion.version={ref}&$top=1&api-version=7.0

type ConfluenceProvider

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

ConfluenceProvider fetches documentation from a Confluence instance.

func NewConfluenceProvider

func NewConfluenceProvider(cfg config.ResolvedSource, page config.PageConfig, client *http.Client) *ConfluenceProvider

NewConfluenceProvider constructs a ConfluenceProvider with authentication applied.

func (*ConfluenceProvider) Fetch

func (p *ConfluenceProvider) Fetch(ctx context.Context, _ string, _ []string, destDir string) error

Fetch re-fetches the page tree with body content and writes each page as a markdown file under destDir.

func (*ConfluenceProvider) Resolve

func (p *ConfluenceProvider) Resolve(ctx context.Context, ref string) (string, error)

Resolve fetches the page tree rooted at ref (a page ID) and returns a stable hash derived from each page's ID and version number.

type FetchResult

type FetchResult struct {
	Source     string
	SHA        string
	Updated    bool
	ChunkCount int
}

FetchResult summarises the outcome of a FetchSource call.

type Fetcher

type Fetcher struct {
	Force bool
	// contains filtered or unexported fields
}

Fetcher orchestrates the pipeline: resolve → cache-check → download → index.

func NewFetcher

func NewFetcher(store *index.Store, dataDir string) *Fetcher

NewFetcher creates a Fetcher that uses store for persistence and dataDir for the raw file cache.

func (*Fetcher) FetchSource

func (f *Fetcher) FetchSource(ctx context.Context, cfg config.ResolvedSource, ref config.RefConfig, page config.PageConfig, libName string, prov Provider) (*FetchResult, error)

FetchSource executes the full fetch pipeline for a single source+ref (or source+page for confluence).

type GitHubProvider

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

GitHubProvider fetches documentation from a GitHub repository.

func NewGitHubProvider

func NewGitHubProvider(cfg config.ResolvedSource, client *http.Client) *GitHubProvider

NewGitHubProvider constructs a GitHubProvider with authentication applied.

func (*GitHubProvider) Fetch

func (p *GitHubProvider) Fetch(ctx context.Context, sha string, paths []string, destDir string) error

Fetch downloads the tarball for sha and extracts only files whose paths match one of the given path prefixes into destDir.

func (*GitHubProvider) Resolve

func (p *GitHubProvider) Resolve(ctx context.Context, ref string) (string, error)

Resolve converts a symbolic ref to a concrete identifier.

  • "latest" → the tag_name of the latest GitHub release
  • anything else → the full commit SHA for that ref

type Provider

type Provider interface {
	Resolve(ctx context.Context, ref string) (string, error)
	Fetch(ctx context.Context, sha string, paths []string, destDir string) error
}

Provider is the interface that all source providers must implement.

func NewProvider

func NewProvider(src config.ResolvedSource, ref config.RefConfig, page config.PageConfig, client *http.Client) (Provider, error)

NewProvider constructs the appropriate Provider for cfg.

Jump to

Keyboard shortcuts

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