news

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Title          string `json:"title"`
	URL            string `json:"url"`
	Excerpt        string `json:"excerpt,omitempty"`
	PublishedAt    string `json:"publishedAt,omitempty"`
	EventStartDate string `json:"eventStartDate,omitempty"`
	EventLocation  string `json:"eventLocation,omitempty"`
}

Item represents a single content item from the product feed.

type Response

type Response struct {
	Blog    *Item `json:"blog"`
	Report  *Item `json:"report"`
	Webinar *Item `json:"webinar"`
	Event   *Item `json:"event"`
}

Response holds the four derived content slots returned by the news service.

type Service

type Service interface {
	Get(ctx context.Context) Response
}

Service fetches and caches the product feed, exposing derived content slots.

func New

func New(client *http.Client, url string, ttl time.Duration) Service

New builds a caching news service. url is the upstream product feed URL; ttl is the cache lifetime. Failed fetches are negatively cached for half the ttl, capped at 30s, so an upstream outage is not re-probed on every request.

Jump to

Keyboard shortcuts

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