importer

package
v0.0.0-...-60192f8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Overview

Package importer provides the necessary tooling to import bookmarks from various sources.

Index

Constants

This section is empty.

Variables

View Source
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.
)
View Source
var (
	ImportBookmarksTask superbus.Task // ImportBookmarksTask is the bookmark import task.
	ImportExtractTask   superbus.Task // ImportExtractTask is the bookmark extraction task.
)

Functions

func GetTrackID

func GetTrackID(requestID string) string

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

type OptionForm struct {
	*forms.Form
}

OptionForm is the form containing common import options.

func NewOptionForm

func NewOptionForm() *OptionForm

NewOptionForm returns a new OptionForm.

func (*OptionForm) BindAny

func (f *OptionForm) BindAny(contentType string, r *http.Request)

BindAny implements forms.AnyBinder.

Jump to

Keyboard shortcuts

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