activitystream

package
v0.0.0-...-30adf6a Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2018 License: MIT Imports: 5 Imported by: 3

Documentation

Overview

Package activitystream implements Atom Activity Streams 1.0, as defined in http://activitystrea.ms/specs/atom/1.0/.

Index

Constants

View Source
const (
	ObjectActivity   ObjectType = "http://activitystrea.ms/schema/1.0/activity"
	ObjectNote                  = "http://activitystrea.ms/schema/1.0/note"
	ObjectComment               = "http://activitystrea.ms/schema/1.0/comment"
	ObjectPerson                = "http://activitystrea.ms/schema/1.0/person"
	ObjectCollection            = "http://activitystrea.ms/schema/1.0/collection"
	ObjectGroup                 = "http://activitystrea.ms/schema/1.0/group"
)
View Source
const (
	VerbPost          Verb = "http://activitystrea.ms/schema/1.0/post"
	VerbShare              = "http://activitystrea.ms/schema/1.0/share"
	VerbFavorite           = "http://activitystrea.ms/schema/1.0/favorite"
	VerbUnfavorite         = "http://activitystrea.ms/schema/1.0/unfavorite"
	VerbDelete             = "http://activitystrea.ms/schema/1.0/delete"
	VerbFollow             = "http://activitystrea.ms/schema/1.0/follow"
	VerbRequestFriend      = "http://activitystrea.ms/schema/1.0/request-friend"
	VerbAuthorize          = "http://activitystrea.ms/schema/1.0/authorize"
	VerbReject             = "http://activitystrea.ms/schema/1.0/reject"
	VerbUnfollow           = "http://ostatus.org/schema/1.0/unfollow"
	VerbBlock              = "http://mastodon.social/schema/1.0/block"
	VerbUnblock            = "http://mastodon.social/schema/1.0/unblock"
)
View Source
const (
	CollectionPublic = "http://activityschema.org/collection/public"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	ID        string  `xml:"id"`
	Title     string  `xml:"title"`
	Link      []Link  `xml:"link"`
	Published Time    `xml:"published"`
	Updated   Time    `xml:"updated"`
	Author    *Person `xml:"author"`
	Summary   *Text   `xml:"summary"`
	Content   *Text   `xml:"content"`

	ObjectType ObjectType `xml:"http://activitystrea.ms/spec/1.0/ object-type,omitempty"`
	Verb       Verb       `xml:"http://activitystrea.ms/spec/1.0/ verb,omitempty"`
	Object     *Entry     `xml:"http://activitystrea.ms/spec/1.0/ object"`

	InReplyTo *InReplyTo `xml:"http://purl.org/syndication/thread/1.0 in-reply-to"`
}

An Entry is a feed item.

func (*Entry) WriteTo

func (e *Entry) WriteTo(w io.Writer) error

WriteTo writes the entry to w.

type Feed

type Feed struct {
	XMLName  xml.Name `xml:"http://www.w3.org/2005/Atom feed"`
	ID       string   `xml:"id"`
	Title    string   `xml:"title"`
	Subtitle string   `xml:"subtitle,omitempty"`
	Updated  Time     `xml:"updated"`
	Author   *Person  `xml:"author"`
	Link     []Link   `xml:"link"`
	Entry    []*Entry `xml:"entry"`
}

A Feed is an activity stream feed.

func Get

func Get(url string) (*Feed, error)

Get retrieves a feed located at a given URL.

func Read

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

Read parses a feed from r.

func (*Feed) MediaType

func (feed *Feed) MediaType() string

MediaType returns this feed's media type.

func (*Feed) Topic

func (feed *Feed) Topic() string

Topic returns this feed's topic.

func (*Feed) WriteTo

func (feed *Feed) WriteTo(w io.Writer) error

WriteTo writes the feed to w.

type HTTPError

type HTTPError int

An HTTPError is an HTTP error. Its value is the HTTP status code.

func (HTTPError) Error

func (err HTTPError) Error() string

Error implements error.

type InReplyTo

type InReplyTo struct {
	Ref    string `xml:"ref,attr"`
	Href   string `xml:"href,attr,omitempty"`
	Source string `xml:"source,attr,omitempty"`
	Type   string `xml:"type,attr,omitempty"`
}

InReplyTo is used to indicate that an entry is a response to another resource.

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

	HrefLang string `xml:"hreflang,attr,omitempty"`
	Title    string `xml:"title,attr,omitempty"`
	Length   uint   `xml:"length,attr,omitempty"`

	ObjectType ObjectType `xml:"http://ostatus.org/schema/1.0 object-type,attr,omitempty"`

	MediaWidth  uint `xml:"http://purl.org/syndication/atommedia width,attr,omitempty"`
	MediaHeight uint `xml:"http://purl.org/syndication/atommedia height,attr,omitempty"`
}

A Link provides a relationship between an entry or a person and a URL.

type ObjectType

type ObjectType string

An ObjectType describes the type of an object.

type Person

type Person struct {
	ID      string `xml:"id"`
	URI     string `xml:"uri,omitempty"`
	Name    string `xml:"name"`
	Email   string `xml:"email,omitempty"`
	Summary string `xml:"summary,omitempty"`
	Link    []Link `xml:"link"`

	ObjectType ObjectType `xml:"http://activitystrea.ms/spec/1.0/ object-type,omitempty"`

	PreferredUsername string `xml:"http://portablecontacts.net/spec/1.0 preferredUsername,omitempty"`
	DisplayName       string `xml:"http://portablecontacts.net/spec/1.0 displayName,omitempty"`
	Note              string `xml:"http://portablecontacts.net/spec/1.0 note,omitempty"`
}

A Person is a person.

func (*Person) AccountURI

func (p *Person) AccountURI() string

AccountURI returns this person's acct: URI.

type Text

type Text struct {
	Type string `xml:"type,attr"`
	Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr,omitempty"`
	Body string `xml:",chardata"`
}

A Text has a type and body.

type Time

type Time string

A Time is a formatted time.

func NewTime

func NewTime(t time.Time) Time

NewTime formats a time.

func (Time) Time

func (t Time) Time() (time.Time, error)

Time parses a formatted time.

type Verb

type Verb string

A Verb describes an action.

Jump to

Keyboard shortcuts

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