document

package
v0.5.0-beta Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToXML

func ToXML(generator XmlGenerator, feed Feed) (string, error)

Types

type AtomAuthor

type AtomAuthor struct {
	XMLName xml.Name `xml:"author"`
	AtomPerson
}

type AtomContent

type AtomContent struct {
	XMLName xml.Name `xml:"content"`
	Content string   `xml:",chardata"`
	Type    string   `xml:"type,attr"`
}

type AtomEntry

type AtomEntry struct {
	XMLName xml.Name `xml:"entry"`
	Xmlns   string   `xml:"xmlns,attr,omitempty"`

	Title   string `xml:"title"` // required
	Links   []AtomLink
	Updated string `xml:"updated"` // required
	Id      string `xml:"id"`      // required
	Content *AtomContent
	Summary *AtomSummary // required if content has src or content is base64
}

type AtomFeed

type AtomFeed struct {
	XMLName xml.Name `xml:"feed"`
	Xmlns   string   `xml:"xmlns,attr"`

	Title     string `xml:"title"` // required
	Link      []AtomLink
	Updated   string         `xml:"updated"` // required
	Id        string         `xml:"id"`      // required
	Author    *AtomAuthor    `xml:"author,omitempty"`
	Generator *AtomGenerator `xml:"generator,omitempty"`
	Entries   []*AtomEntry   `xml:"entry"`
}

type AtomGenerator

type AtomGenerator struct {
	XMLName xml.Name `xml:"generator"`
	Value   string   `xml:",chardata"`
	URI     string   `xml:"uri,attr"`
	Version string   `xml:"version,attr,omitempty"`
}
type AtomLink struct {
	//Atom 1.0 <link rel="enclosure" title="MP3" href="http://www.example.org/myaudiofile.mp3" />
	XMLName xml.Name `xml:"link"`
	Href    string   `xml:"href,attr"`
	Rel     string   `xml:"rel,attr,omitempty"`
}

type AtomPerson

type AtomPerson struct {
	Name  string `xml:"name,omitempty"`
	Email string `xml:"email,omitempty"`
}

type AtomSummary

type AtomSummary struct {
	XMLName xml.Name `xml:"summary"`
	Content string   `xml:",chardata"`
	Type    string   `xml:"type,attr"`
}

type AtomXmlGenerator

type AtomXmlGenerator struct{}

func (*AtomXmlGenerator) Generate

func (a *AtomXmlGenerator) Generate(f Feed) interface{}

type Author

type Author struct {
	Name, Email string
}

type Feed

type Feed struct {
	Title       string
	Link        *Link
	Description string
	Author      *Author
	Updated     time.Time
	Created     time.Time
	Id          string
	Generator   *Generator
	Items       []*Item
}

type Generator

type Generator struct {
	Value, URI, Version string
}

type Item

type Item struct {
	Title       string
	Link        *Link
	Author      *Author
	Description string // used as description in rss, summary in atom
	Id          string // used as guid in rss, id in atom
	Updated     string
	Created     string
	Content     string
}
type Link struct {
	Href, Rel string
}

type Server

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

func NewDocumentAPIServer

func NewDocumentAPIServer(ctrl controller.Controller) *Server

func (*Server) Atom

func (f *Server) Atom(gCtx *gin.Context)

func (*Server) Query

func (f *Server) Query(gCtx *gin.Context)

func (*Server) Summary

func (f *Server) Summary(gCtx *gin.Context)

type XmlGenerator

type XmlGenerator interface {
	Generate(f Feed) interface{}
}

func NewAtomGenerator

func NewAtomGenerator() XmlGenerator

Jump to

Keyboard shortcuts

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