feeds

package
v0.0.0-...-5f552c9 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Author

type Author struct {
	Name  string `xml:"name" yaml:"name"`
	Email string `xml:"email" yaml:"email"`
}

Author struct

type Category

type Category struct {
	Term  string `xml:"term,attr" yaml:"term"`
	Label string `xml:"label,attr" yaml:"label"`
}

Category struct

type Entry

type Entry struct {
	ID                                string     `xml:"id" yaml:"id"`
	Title                             string     `xml:"title,omitempty" yaml:"title"`
	Content                           string     `xml:"content,omitempty" yaml:"content"`
	Summary                           string     `xml:"summary,omitempty" yaml:"summary"`
	Link                              []Link     `xml:"link" yaml:"link"`
	Rights                            string     `xml:"rights,omitempty" yaml:"rights"`
	Updated                           *string    `xml:"updated" yaml:"updated,omitempty"`
	Polygon                           string     `xml:"georss:polygon,omitempty" yaml:"polygon"`
	Category                          []Category `xml:"category" yaml:"category"`
	SpatialDatasetIdentifierCode      string     `xml:"inspire_dls:spatial_dataset_identifier_code,omitempty" yaml:"spatial_dataset_identifier_code"`
	SpatialDatasetIdentifierNamespace string     `xml:"inspire_dls:spatial_dataset_identifier_namespace,omitempty" yaml:"spatial_dataset_identifier_namespace"`
}

Entry struct

type Feed

type Feed struct {
	XMLName       xml.Name `xml:"feed"`
	XMLStylesheet *string  `yaml:"stylesheet"`
	Xmlns         string   `xml:"xmlns,attr" yaml:"xmlns"`                             //"http://www.w3.org/2005/Atom"
	Georss        string   `xml:"xmlns:georss,attr,omitempty" yaml:"georss"`           //"http://www.georss.org/georss"
	InspireDls    string   `xml:"xmlns:inspire_dls,attr,omitempty" yaml:"inspire_dls"` //"http://inspire.ec.europa.eu/schemas/inspire_dls/1.0"
	Lang          *string  `xml:"xml:lang,attr,omitempty" yaml:"lang"`

	ID       string `xml:"id" yaml:"id"`
	Title    string `xml:"title" yaml:"title"`
	Subtitle string `xml:"subtitle" yaml:"subtitle"`

	// Placeholder Links, need to be moved to []Link and deleted
	Self        *Link `xml:"self,omitempty" yaml:"self"`
	Describedby *Link `xml:"describedby,omitempty" yaml:"describedby"`
	Search      *Link `xml:"search,omitempty" yaml:"search"`
	Up          *Link `xml:"up,omitempty" yaml:"up"`

	Link []Link `xml:"link" yaml:"link"`

	Rights  string  `xml:"rights" yaml:"rights"`
	Updated *string `xml:"updated" yaml:"updated,omitempty"`
	Author  Author  `xml:"author" yaml:"author"`
	Entry   []Entry `xml:"entry" yaml:"entry"`
}

Feed struct

func GetDefaultFeedProperties

func GetDefaultFeedProperties() Feed

GetDefaultFeedProperties returns mandatory/static ServiceFeed properties

func ProcessFeeds

func ProcessFeeds(fs Feeds) []Feed

ProcessFeed func

func (*Feed) GenerateATOM

func (f *Feed) GenerateATOM() []byte

GenerateATOM function build a ATOM feed from the configuration

func (*Feed) GetFileName

func (f *Feed) GetFileName() (string, error)

GetFileName function extracts a filename based on the ID element of the Feed struct TG Requirement 9 - Technical Guidance Download Services v3.1 The 'id' element of a feed shall contain an HTTP URI which dereferences to the feed

func (*Feed) StyleSheet

func (f *Feed) StyleSheet() []byte

StyleSheet function returns a xml-stylesheet header if available

func (*Feed) Valid

func (f *Feed) Valid() error

Valid function that validates the Feed based on TG Requirements For now a simple validation

func (*Feed) WriteATOM

func (f *Feed) WriteATOM(filename string)

WriteATOM function writes the ATOM feed to file

type Feeds

type Feeds struct {
	Feeds []Feed `yaml:"feeds"`
}

Feeds struct

type Link struct {
	Href     string  `xml:"href,attr" yaml:"href"`
	Data     *string `yaml:"data"`
	Rel      string  `xml:"rel,attr,omitempty" yaml:"rel"`
	Type     string  `xml:"type,attr,omitempty" yaml:"type"`
	Hreflang *string `xml:"hreflang,attr,omitempty" yaml:"hreflang"`
	Length   string  `xml:"length,attr,omitempty" yaml:"length"`
	Title    string  `xml:"title,attr,omitempty" yaml:"title"`
	Time     *string `xml:"time,attr,omitempty" yaml:"time"`
	Bbox     *string `xml:"bbox,attr,omitempty" yaml:"bbox"`
}

Link struct

func DescribedBy

func DescribedBy(l Link) Link

DescribedBy returns a Link containing a mandatory DescribedBy element TG Requirement 6 - Technical Guidance Download Services v3.1

func Search(l Link) Link

Search returns a Link containing a Search element (which is mandatory for Service Feeds) TG Requirement 8 - Technical Guidance Download Services v3.1

func Self

func Self(l Link) Link

Self returns a Link containing a mandatory Self element TG Requirement 7 - Technical Guidance Download Services v3.1

func Up

func Up(l Link) Link

Up returns a Link containing a Up element (which is recommended) TG Recommendation 9 - Technical Guidance Download Services v3.1

func (*Link) SetHrefLang

func (l *Link) SetHrefLang(lang string) Link

SetHrefLang function assigns a default Lang is none is given

Jump to

Keyboard shortcuts

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