feed

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Feed

type Feed struct {
	// Content is the raw feed content.
	Content []byte
	// Format is the format of the feed.
	Format config.FeedFormat
	// SyncedAt is the time the feed was last syncedm
	SyncedAt time.Time
}

Feed represents a feed of mods.

type Generator

type Generator interface {
	// GetFeed generates a feed of mods based on the given options.
	GetFeed(context.Context, GeneratorOptions) (*Feed, error)
}

Generator is an interface for generating feeds of mods.

func NewGenerator

func NewGenerator(fetcher mods.Fetcher, defaults GeneratorOptions) Generator

NewGenerator creates a new feed generator using the given fetcher and default options.

type GeneratorOptions

type GeneratorOptions struct {
	// MaxItems is the maximum number of items to include in the feed.
	MaxItems int
	// Sort is the field to sort the feed by.
	Sort string
	// Tags are the tags to filter the feed by.
	Tags []string
	// Platform is the platform to filter the feed by.
	Platform config.Platform
	// FetchInterval is the interval to fetch mods at.
	FetchInterval time.Duration
	// Format is the format to render the feed in.
	Format config.FeedFormat
}

GeneratorOptions are the options for generating a feed.

func OptionsFromQuery

func OptionsFromQuery(u *url.URL) GeneratorOptions

OptionsFromQuery parses the query parameters from a URL into a GeneratorOptions struct.

func (GeneratorOptions) GetSort

func (g GeneratorOptions) GetSort() string

func (GeneratorOptions) Merge

Merge merges the given GeneratorOptions into the current options and returns a new copy.

Jump to

Keyboard shortcuts

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