internal

package
v0.0.0-...-d6e144f Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const NotFoundError = "not found"

Variables

This section is empty.

Functions

func DeleteAuthToken

func DeleteAuthToken() error

func GetAuthToken

func GetAuthToken() (string, bool)

func SaveAuthToken

func SaveAuthToken(token string) error

Types

type ApiFetcher

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

func NewGitHubAPIFetcher

func NewGitHubAPIFetcher(client *github.Client) *ApiFetcher

func (*ApiFetcher) Fetch

func (f *ApiFetcher) Fetch(target GitHubTarget, path string) ([]byte, error)

type GitHubContentFetcher

type GitHubContentFetcher interface {
	Fetch(target GitHubTarget, path string) ([]byte, error)
}

type GitHubHandler

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

func NewGitHubHandler

func NewGitHubHandler(
	fetcher GitHubContentFetcher,
) *GitHubHandler

func (*GitHubHandler) AddRootSite

func (h *GitHubHandler) AddRootSite(target GitHubTarget) *GitHubHandler

func (*GitHubHandler) AddSite

func (h *GitHubHandler) AddSite(route string, target GitHubTarget) *GitHubHandler

func (*GitHubHandler) ServeHTTP

func (h *GitHubHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type GitHubTarget

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

func InferTargetFromUrl

func InferTargetFromUrl(githubUrl string) (GitHubTarget, error)

InferTargetFromUrl will take a valid GitHub URL and create a GitHubTarget object from it. A GitHub URL will take the form "https://github.com/{owner}/{repo}/(tree/<ref>)?/(<path>/<to>/<root>)?", where: - "tree/<ref>" is optional, if not present it defaults to the default branch of the repo - "<ref>" can either be a commit hash or branch - "<path>/<to>/<root>" is optional - If "<path>/<to>/<root>" is present, then "tree/<ref>" MUST be present

Jump to

Keyboard shortcuts

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