mention

package
v0.0.0-...-0134328 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MENTIONS         ds.Kind = "Mentions"
	WEB_MENTION_SENT ds.Kind = "WebMentionSent"
	THUMBNAIL        ds.Kind = "Thumbnail"
)
View Source
const (
	GOOD_STATE      = "good"
	UNTRIAGED_STATE = "untriaged"
	SPAM_STATE      = "spam"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Mention

type Mention struct {
	Source string
	Target string
	State  string
	TS     time.Time

	// Metadata found when validating. We might display this.
	Title     string    `datastore:",noindex"`
	Author    string    `datastore:",noindex"`
	AuthorURL string    `datastore:",noindex"`
	Published time.Time `datastore:",noindex"`
	Thumbnail string    `datastore:",noindex"`
	URL       string    `datastore:",noindex"`
}

func New

func New(source, target string) *Mention

func (*Mention) FastValidate

func (m *Mention) FastValidate(validTargets []string) error

type MentionSlice

type MentionSlice []*Mention

func (MentionSlice) Len

func (p MentionSlice) Len() int

func (MentionSlice) Less

func (p MentionSlice) Less(i, j int) bool

func (MentionSlice) Swap

func (p MentionSlice) Swap(i, j int)

type MentionWithKey

type MentionWithKey struct {
	Mention
	Key string
}

type Mentions

type Mentions struct {
	DS *ds.DS
	// contains filtered or unexported fields
}

func NewMentions

func NewMentions(ctx context.Context, project, ns string, log slog.Logger) (*Mentions, error)

func (*Mentions) GetAll

func (m *Mentions) GetAll(ctx context.Context, target string) []*Mention

func (*Mentions) GetGood

func (m *Mentions) GetGood(ctx context.Context, target string) []*Mention

func (*Mentions) GetQueued

func (m *Mentions) GetQueued(ctx context.Context) []*Mention

func (*Mentions) GetThumbnail

func (m *Mentions) GetThumbnail(ctx context.Context, id string) ([]byte, error)

func (*Mentions) GetTriage

func (m *Mentions) GetTriage(ctx context.Context, limit, offset int) []*MentionWithKey

func (*Mentions) ParseMicroformats

func (m *Mentions) ParseMicroformats(mention *Mention, r io.Reader, urlToImageReader UrlToImageReader)

func (*Mentions) Put

func (m *Mentions) Put(ctx context.Context, mention *Mention) error

func (*Mentions) SlowValidate

func (m *Mentions) SlowValidate(mention *Mention, c *http.Client) error

func (*Mentions) UpdateState

func (m *Mentions) UpdateState(ctx context.Context, encodedKey, state string) error

func (*Mentions) VerifyQueuedMentions

func (m *Mentions) VerifyQueuedMentions(c *http.Client)

type Thumbnail

type Thumbnail struct {
	PNG []byte `datastore:",noindex"`
}

type UrlToImageReader

type UrlToImageReader func(url string) (io.ReadCloser, error)

func MakeUrlToImageReader

func MakeUrlToImageReader(c *http.Client) UrlToImageReader

type WebMentionSent

type WebMentionSent struct {
	TS time.Time
}

Jump to

Keyboard shortcuts

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