metadata

package
v0.20260317.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package metadata provides utilities for fetching server metadata (GitHub stars) from external APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

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

Fetcher retrieves metadata from external APIs.

func NewFetcher

func NewFetcher(client HTTPClient, githubToken string) *Fetcher

NewFetcher creates a new Fetcher with the given HTTP client and optional GitHub token.

func (*Fetcher) FetchStars

func (f *Fetcher) FetchStars(ctx context.Context, repoURL string) (int, error)

FetchStars returns the stargazers_count for a GitHub repository. The repoURL should be a GitHub repository URL like "https://github.com/owner/repo". Returns (0, nil) if the URL is empty or not a GitHub URL.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is an interface for making HTTP requests, enabling testability.

Jump to

Keyboard shortcuts

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