openapi

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GovernmentPressFeeds = []string{
	"https://www.whitehouse.gov/feed/",
	"https://www.gov.uk/government/announcements.atom",
	"https://news.gc.ca/web/fd-en.do?format=rss",
	"https://ec.europa.eu/commission/presscorner/home/en",
}

GovernmentPressFeeds is a curated set of RSS feeds for legal, public, API-free press releases.

Functions

This section is empty.

Types

type Client

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

Client is Aether's internal aggregator for all OpenAPI integrations.

The Client is intentionally simple: it wraps the shared internal HTTP fetcher. Actual service logic (Wikipedia, HN, GitHub, etc.) lives in separate files within this package.

The design allows:

  • zero-copy reuse of Aether’s HTTP/cache/robots pipeline
  • strong isolation between integrations
  • safe concurrent usage across goroutines

OpenAPI Client is safe for concurrent use.

func New

func New(cfg *config.Config, logger log.Logger, httpClient *httpclient.Client) *Client

New constructs a new OpenAPI client from the shared internal HTTP client.

This constructor is invoked by aether.NewClient and must receive the same httpclient.Client instance that the rest of Aether uses to ensure consistent caching, User-Agent identity, and robots.txt behavior.

cfg and logger are passed through without modification so that all OpenAPI integrations use the same configuration and logging preferences.

func (*Client) GitHubReadme

func (c *Client) GitHubReadme(ctx context.Context, owner, repo, ref string) (*GitHubReadme, error)

GitHubReadme fetches the README.md file for the given repository. ref may be empty, in which case \"main\" is assumed.

func (*Client) GovernmentPress

func (c *Client) GovernmentPress(ctx context.Context, limit int) ([]PressRelease, error)

GovernmentPress retrieves recent press releases from major agencies.

func (*Client) HackerNewsTopStories

func (c *Client) HackerNewsTopStories(ctx context.Context, limit int) ([]HNStory, error)

HackerNewsTopStories retrieves the top N Hacker News stories. limit is clamped to a sensible maximum to avoid excessive calls.

func (*Client) WeatherAt

func (c *Client) WeatherAt(ctx context.Context, lat, lon float64, hours int) ([]Weather, error)

WeatherAt retrieves normalized weather data for latitude/longitude.

func (*Client) WhiteHouseRecentPosts

func (c *Client) WhiteHouseRecentPosts(ctx context.Context, limit int) ([]WhiteHousePost, error)

WhiteHouseRecentPosts retrieves the latest N posts from whitehouse.gov using the WP JSON API.

func (*Client) WikidataLookup

func (c *Client) WikidataLookup(ctx context.Context, name string) (*WikidataEntity, error)

WikidataLookup searches Wikidata for the best entity match using SPARQL.

func (*Client) WikipediaSummary

func (c *Client) WikipediaSummary(ctx context.Context, title string) (*WikiSummary, error)

WikipediaSummary fetches a summary for the given title from the English Wikipedia REST API.

Title is automatically URL-escaped and may contain spaces.

type GitHubReadme

type GitHubReadme struct {
	Owner   string
	Repo    string
	Ref     string
	URL     string
	Content string
}

GitHubReadme represents a normalized GitHub README document.

type HNStory

type HNStory struct {
	ID           int64
	Title        string
	URL          string
	Author       string
	Score        int
	Time         time.Time
	CommentCount int
}

HNStory represents a normalized Hacker News story.

type PressRelease

type PressRelease struct {
	Title   string
	URL     string
	Source  string
	Snippet string
	Date    time.Time
}

PressRelease represents a normalized government press item.

type Weather

type Weather struct {
	Time        time.Time
	Temperature float64
	Humidity    float64
	WindSpeed   float64
	Summary     string
}

Weather represents a normalized hourly weather entry.

type WhiteHousePost

type WhiteHousePost struct {
	ID      int64
	Title   string
	URL     string
	Date    time.Time
	Excerpt string
}

WhiteHousePost represents a normalized White House post.

type WikiSummary

type WikiSummary struct {
	Title       string
	Description string
	Extract     string
	URL         string
	Language    string
}

WikiSummary is the internal Wikipedia summary representation.

type WikidataEntity

type WikidataEntity struct {
	ID          string
	Title       string
	Description string
	URL         string
}

WikidataEntity is the normalized Wikidata entity info.

Jump to

Keyboard shortcuts

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