atom

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2018 License: MIT Imports: 7 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"`
}

Author represents atom author

type Category

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

Category represents atom category

type Client

type Client struct {
	*http.Client
}

Client wrapped *http.Client and some methods for accessing atom feed are added

func (*Client) GetEntry

func (c *Client) GetEntry(url string) (*Entry, error)

GetEntry gets the blog entry

func (*Client) GetFeed

func (c *Client) GetFeed(url string) (*Feed, error)

GetFeed gets the blog feed

func (*Client) PostEntry

func (c *Client) PostEntry(url string, e *Entry) (*Entry, error)

PostEntry posts the blog entry

func (*Client) PutEntry

func (c *Client) PutEntry(url string, e *Entry) (*Entry, error)

PutEntry puts the blog entry

type Content

type Content struct {
	Type    string `xml:"type,attr,omitempty"`
	Content string `xml:",chardata"`
}

Content represents atom content

type Control

type Control struct {
	Draft string `xml:"http://www.w3.org/2007/app draft"`
}

Control represents atom control

type Entry

type Entry struct {
	XMLName   xml.Name   `xml:"http://www.w3.org/2005/Atom entry"`
	ID        string     `xml:"id,omitempty"`
	Links     Links      `xml:"link"`
	Author    Author     `xml:"author,omitempty"`
	Title     string     `xml:"title"`
	Updated   *time.Time `xml:"updated,omitempty"`
	Published *time.Time `xml:"published,omitempty"`
	Edited    *time.Time `xml:"edited,omitempty"`
	Content   Content    `xml:"content"`
	Category  []Category `xml:"category,omitempty"`
	Control   *Control   `xml:"http://www.w3.org/2007/app control,omitempty"`
	CustomURL string     `xml:"http://www.hatena.ne.jp/info/xmlns#hatenablog custom-url,omitempty"`
}

Entry represents atom entry

func ParseEntry

func ParseEntry(r io.Reader) (*Entry, error)

ParseEntry parses an atom xml from r and returns Entry

type Feed

type Feed struct {
	Links    Links   `xml:"link"`
	Title    string  `xml:"title"`
	Subtitle string  `xml:"subtitle"`
	Entries  []Entry `xml:"entry"`
}

Feed represents atom feed

func Parse

func Parse(r io.Reader) (*Feed, error)

Parse parses an atom xml from r and returns Feed

type Link struct {
	Rel  string `xml:"rel,attr"`
	Href string `xml:"href,attr"`
}

Link represents atom link

type Links []Link

Links represents atom links

func (Links) Find

func (links Links) Find(rel string) *Link

Find finds the Link from links by a specified string argument

Jump to

Keyboard shortcuts

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