Documentation ¶
Overview ¶
Package importer provides the necessary tooling to import bookmarks from various sources.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrIgnore = errors.New("ignore") // ErrIgnore is an error that can be ignored. ErrNoAdapter = errors.New("no adapter") // ErrNoAdapter is returned when an adapter does not exist. )
var ( ImportBookmarksTask superbus.Task // ImportBookmarksTask is the bookmark import task. ImportExtractTask superbus.Task // ImportExtractTask is the bookmark extraction task. )
Functions ¶
func GetTrackID ¶
GetTrackID returns a tracking ID based on the request ID.
Types ¶
type BookmarkEnhancer ¶
type BookmarkEnhancer interface {
Meta() (*BookmarkMeta, error)
}
BookmarkEnhancer describes an item providing more adapter item information.
type BookmarkImporter ¶
type BookmarkImporter interface {
URL() string
}
BookmarkImporter describes a simple adapter item.
type BookmarkMeta ¶
type BookmarkMeta struct { Title string Published time.Time Authors types.Strings Lang string TextDirection string DocumentType string Description string Embed string Labels types.Strings IsArchived bool IsMarked bool Created time.Time }
BookmarkMeta provides an import item extra information.
type BookmarkReadabilityToggler ¶
type BookmarkReadabilityToggler interface {
EnableReadability() bool
}
BookmarkReadabilityToggler describes an item than disable readability.
type BookmarkResourceProvider ¶
type BookmarkResourceProvider interface {
Resources() []tasks.MultipartResource
}
BookmarkResourceProvider describes an item providing attached resources.
type ImportLoader ¶
type ImportLoader interface { Name(forms.Translator) string Form() forms.Binder Params(forms.Binder) ([]byte, error) }
ImportLoader describes an import loader.
func LoadAdapter ¶
func LoadAdapter(name string) ImportLoader
LoadAdapter returns an import loader based on a given name.
type ImportParams ¶
type ImportParams struct { Source string `json:"source"` Data []byte `json:"data"` UserID int `json:"user_id"` RequestID string `json:"request_id"` AllowDuplicates bool `json:"allow_duplicates"` Label string `json:"label"` }
ImportParams contains the ImportBookmarksTask parameters.
type ImportProgress ¶
type ImportProgress struct { Total int64 `json:"total"` Done int64 `json:"done"` Status int `json:"status"` }
ImportProgress contains the import progress information.
func NewImportProgress ¶
func NewImportProgress(trackID string) (p ImportProgress, err error)
NewImportProgress returns an ImportProgress instance based on a trackID. It counts bookmarks with a state not StateLoading.
type ImportWorker ¶
type ImportWorker interface { LoadData([]byte) error Next() (BookmarkImporter, error) }
ImportWorker describes an import worker.
type OptionForm ¶
OptionForm is the form containing common import options.