model

package
v1.0.46 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const (
	EntryStatusUnread       = "unread"
	EntryStatusRead         = "read"
	EntryStatusRemoved      = "removed"
	DefaultSortingOrder     = "published_at"
	DefaultSortingDirection = "asc"
)

Entry statuses and default sorting order.

View Source
const (
	SchedulerRoundRobin     = "round_robin"
	SchedulerEntryFrequency = "entry_frequency"
	// Default settings for the feed query builder
	DefaultFeedSorting          = "parsing_error_count"
	DefaultFeedSortingDirection = "desc"
)

List of supported schedulers.

Variables

This section is empty.

Functions

func CategoriesSortingOptions

func CategoriesSortingOptions() map[string]string

func HomePages

func HomePages() map[string]string

HomePages returns the list of available home pages.

func OptionalInt

func OptionalInt(value int) *int

OptionalInt populates an optional int field.

func OptionalInt64

func OptionalInt64(value int64) *int64

OptionalInt64 populates an optional int64 field.

func OptionalString

func OptionalString(value string) *string

OptionalString populates an optional string field.

func Themes

func Themes() map[string]string

Themes returns the list of available themes.

Types

type APIKey

type APIKey struct {
	ID          int64
	UserID      int64
	Token       string
	Description string
	LastUsedAt  *time.Time
	CreatedAt   time.Time
}

APIKey represents an application API key.

func NewAPIKey

func NewAPIKey(userID int64, description string) *APIKey

NewAPIKey initializes a new APIKey.

type APIKeys

type APIKeys []*APIKey

APIKeys represents a collection of API Key.

type Categories

type Categories []*Category

Categories represents a list of categories.

type Category

type Category struct {
	ID           int64  `json:"id"`
	Title        string `json:"title"`
	UserID       int64  `json:"user_id"`
	HideGlobally bool   `json:"hide_globally"`
	FeedCount    *int   `json:"feed_count,omitempty"`
	TotalUnread  *int   `json:"total_unread,omitempty"`
}

Category represents a feed category.

func (*Category) String

func (c *Category) String() string

type CategoryRequest

type CategoryRequest struct {
	Title        string `json:"title"`
	HideGlobally string `json:"hide_globally"`
}

CategoryRequest represents the request to create or update a category.

func (*CategoryRequest) Patch

func (cr *CategoryRequest) Patch(category *Category)

Patch updates category fields.

type Enclosure

type Enclosure struct {
	ID               int64  `json:"id"`
	UserID           int64  `json:"user_id"`
	EntryID          int64  `json:"entry_id"`
	URL              string `json:"url"`
	MimeType         string `json:"mime_type"`
	Size             int64  `json:"size"`
	MediaProgression int64  `json:"media_progression"`
}

Enclosure represents an attachment.

func (Enclosure) Html5MimeType

func (e Enclosure) Html5MimeType() string

Html5MimeType will modify the actual MimeType to allow direct playback from HTML5 player for some kind of MimeType

type EnclosureList

type EnclosureList []*Enclosure

EnclosureList represents a list of attachments.

type Entries

type Entries []*Entry

Entries represents a list of entries.

type EntriesStatusUpdateRequest

type EntriesStatusUpdateRequest struct {
	EntryIDs []int64 `json:"entry_ids"`
	Status   string  `json:"status"`
}

EntriesStatusUpdateRequest represents a request to change entries status.

type Entry

type Entry struct {
	ID          int64         `json:"id"`
	UserID      int64         `json:"user_id"`
	FeedID      int64         `json:"feed_id"`
	Status      string        `json:"status"`
	Hash        string        `json:"hash"`
	Title       string        `json:"title"`
	URL         string        `json:"url"`
	CommentsURL string        `json:"comments_url"`
	Date        time.Time     `json:"published_at"`
	CreatedAt   time.Time     `json:"created_at"`
	ChangedAt   time.Time     `json:"changed_at"`
	Content     string        `json:"content"`
	Author      string        `json:"author"`
	ShareCode   string        `json:"share_code"`
	Starred     bool          `json:"starred"`
	ReadingTime int           `json:"reading_time"`
	Enclosures  EnclosureList `json:"enclosures"`
	Feed        *Feed         `json:"feed,omitempty"`
	Tags        []string      `json:"tags"`
}

Entry represents a feed item in the system.

type Feed

type Feed struct {
	ID                          int64     `json:"id"`
	UserID                      int64     `json:"user_id"`
	FeedURL                     string    `json:"feed_url"`
	SiteURL                     string    `json:"site_url"`
	Title                       string    `json:"title"`
	CheckedAt                   time.Time `json:"checked_at"`
	NextCheckAt                 time.Time `json:"next_check_at"`
	EtagHeader                  string    `json:"etag_header"`
	LastModifiedHeader          string    `json:"last_modified_header"`
	ParsingErrorMsg             string    `json:"parsing_error_message"`
	ParsingErrorCount           int       `json:"parsing_error_count"`
	ScraperRules                string    `json:"scraper_rules"`
	RewriteRules                string    `json:"rewrite_rules"`
	Crawler                     bool      `json:"crawler"`
	BlocklistRules              string    `json:"blocklist_rules"`
	KeeplistRules               string    `json:"keeplist_rules"`
	UrlRewriteRules             string    `json:"urlrewrite_rules"`
	UserAgent                   string    `json:"user_agent"`
	Cookie                      string    `json:"cookie"`
	Username                    string    `json:"username"`
	Password                    string    `json:"password"`
	Disabled                    bool      `json:"disabled"`
	NoMediaPlayer               bool      `json:"no_media_player"`
	IgnoreHTTPCache             bool      `json:"ignore_http_cache"`
	AllowSelfSignedCertificates bool      `json:"allow_self_signed_certificates"`
	FetchViaProxy               bool      `json:"fetch_via_proxy"`
	Category                    *Category `json:"category,omitempty"`
	Entries                     Entries   `json:"entries,omitempty"`
	IconURL                     string    `json:"icon_url"`
	Icon                        *FeedIcon `json:"icon"`
	HideGlobally                bool      `json:"hide_globally"`
	UnreadCount                 int       `json:"-"`
	ReadCount                   int       `json:"-"`
}

Feed represents a feed in the application.

func (*Feed) CheckedNow

func (f *Feed) CheckedNow()

CheckedNow set attribute values when the feed is refreshed.

func (*Feed) ResetErrorCounter

func (f *Feed) ResetErrorCounter()

ResetErrorCounter removes all previous errors.

func (*Feed) ScheduleNextCheck

func (f *Feed) ScheduleNextCheck(weeklyCount int)

ScheduleNextCheck set "next_check_at" of a feed based on the scheduler selected from the configuration.

func (*Feed) String

func (f *Feed) String() string

func (*Feed) WithCategoryID

func (f *Feed) WithCategoryID(categoryID int64)

WithCategoryID initializes the category attribute of the feed.

func (*Feed) WithClientResponse

func (f *Feed) WithClientResponse(response *client.Response)

WithClientResponse updates feed attributes from an HTTP request.

func (*Feed) WithError

func (f *Feed) WithError(message string)

WithError adds a new error message and increment the error counter.

type FeedCounters

type FeedCounters struct {
	ReadCounters   map[int64]int `json:"reads"`
	UnreadCounters map[int64]int `json:"unreads"`
}

type FeedCreationRequest

type FeedCreationRequest struct {
	FeedURL                     string `json:"feed_url"`
	CategoryID                  int64  `json:"category_id"`
	UserAgent                   string `json:"user_agent"`
	Cookie                      string `json:"cookie"`
	Username                    string `json:"username"`
	Password                    string `json:"password"`
	Crawler                     bool   `json:"crawler"`
	Disabled                    bool   `json:"disabled"`
	NoMediaPlayer               bool   `json:"no_media_player"`
	IgnoreHTTPCache             bool   `json:"ignore_http_cache"`
	AllowSelfSignedCertificates bool   `json:"allow_self_signed_certificates"`
	FetchViaProxy               bool   `json:"fetch_via_proxy"`
	ScraperRules                string `json:"scraper_rules"`
	RewriteRules                string `json:"rewrite_rules"`
	BlocklistRules              string `json:"blocklist_rules"`
	KeeplistRules               string `json:"keeplist_rules"`
	HideGlobally                bool   `json:"hide_globally"`
	UrlRewriteRules             string `json:"urlrewrite_rules"`
}

FeedCreationRequest represents the request to create a feed.

type FeedIcon

type FeedIcon struct {
	FeedID int64 `json:"feed_id"`
	IconID int64 `json:"icon_id"`
}

FeedIcon is a junction table between feeds and icons.

type FeedModificationRequest

type FeedModificationRequest struct {
	FeedURL                     *string `json:"feed_url"`
	SiteURL                     *string `json:"site_url"`
	Title                       *string `json:"title"`
	ScraperRules                *string `json:"scraper_rules"`
	RewriteRules                *string `json:"rewrite_rules"`
	BlocklistRules              *string `json:"blocklist_rules"`
	KeeplistRules               *string `json:"keeplist_rules"`
	UrlRewriteRules             *string `json:"urlrewrite_rules"`
	Crawler                     *bool   `json:"crawler"`
	UserAgent                   *string `json:"user_agent"`
	Cookie                      *string `json:"cookie"`
	Username                    *string `json:"username"`
	Password                    *string `json:"password"`
	CategoryID                  *int64  `json:"category_id"`
	Disabled                    *bool   `json:"disabled"`
	NoMediaPlayer               *bool   `json:"no_media_player"`
	IgnoreHTTPCache             *bool   `json:"ignore_http_cache"`
	AllowSelfSignedCertificates *bool   `json:"allow_self_signed_certificates"`
	FetchViaProxy               *bool   `json:"fetch_via_proxy"`
	HideGlobally                *bool   `json:"hide_globally"`
}

FeedModificationRequest represents the request to update a feed.

func (*FeedModificationRequest) Patch

func (f *FeedModificationRequest) Patch(feed *Feed)

Patch updates a feed with modified values.

type Feeds

type Feeds []*Feed

Feeds is a list of feed

type Icon

type Icon struct {
	ID       int64  `json:"id"`
	Hash     string `json:"hash"`
	MimeType string `json:"mime_type"`
	Content  []byte `json:"content"`
}

Icon represents a website icon (favicon)

func (*Icon) DataURL

func (i *Icon) DataURL() string

DataURL returns the data URL of the icon.

type Icons

type Icons []*Icon

Icons represents a list of icons.

type Integration

type Integration struct {
	UserID               int64
	PinboardEnabled      bool
	PinboardToken        string
	PinboardTags         string
	PinboardMarkAsUnread bool
	InstapaperEnabled    bool
	InstapaperUsername   string
	InstapaperPassword   string
	FeverEnabled         bool
	FeverUsername        string
	FeverToken           string
	GoogleReaderEnabled  bool
	GoogleReaderUsername string
	GoogleReaderPassword string
	WallabagEnabled      bool
	WallabagOnlyURL      bool
	WallabagURL          string
	WallabagClientID     string
	WallabagClientSecret string
	WallabagUsername     string
	WallabagPassword     string
	NunuxKeeperEnabled   bool
	NunuxKeeperURL       string
	NunuxKeeperAPIKey    string
	NotionEnabled        bool
	NotionToken          string
	NotionPageID         string
	EspialEnabled        bool
	EspialURL            string
	EspialAPIKey         string
	EspialTags           string
	PocketEnabled        bool
	PocketAccessToken    string
	PocketConsumerKey    string
	TelegramBotEnabled   bool
	TelegramBotToken     string
	TelegramBotChatID    string
	LinkdingEnabled      bool
	LinkdingURL          string
	LinkdingAPIKey       string
	LinkdingTags         string
	LinkdingMarkAsUnread bool
	MatrixBotEnabled     bool
	MatrixBotUser        string
	MatrixBotPassword    string
	MatrixBotURL         string
	MatrixBotChatID      string
}

Integration represents user integration settings.

type Job

type Job struct {
	UserID int64
	FeedID int64
}

Job represents a payload sent to the processing queue.

type JobList

type JobList []Job

JobList represents a list of jobs.

type Session

type Session struct {
	ID   string
	Data *SessionData
}

Session represents a session in the system.

func (*Session) String

func (s *Session) String() string

type SessionData

type SessionData struct {
	CSRF               string `json:"csrf"`
	OAuth2State        string `json:"oauth2_state"`
	FlashMessage       string `json:"flash_message"`
	FlashErrorMessage  string `json:"flash_error_message"`
	Language           string `json:"language"`
	Theme              string `json:"theme"`
	PocketRequestToken string `json:"pocket_request_token"`
}

SessionData represents the data attached to the session.

func (*SessionData) Scan

func (s *SessionData) Scan(src interface{}) error

Scan converts raw JSON data.

func (SessionData) String

func (s SessionData) String() string

func (SessionData) Value

func (s SessionData) Value() (driver.Value, error)

Value converts the session data to JSON.

type SubscriptionDiscoveryRequest

type SubscriptionDiscoveryRequest struct {
	URL                         string `json:"url"`
	UserAgent                   string `json:"user_agent"`
	Cookie                      string `json:"cookie"`
	Username                    string `json:"username"`
	Password                    string `json:"password"`
	FetchViaProxy               bool   `json:"fetch_via_proxy"`
	AllowSelfSignedCertificates bool   `json:"allow_self_signed_certificates"`
}

SubscriptionDiscoveryRequest represents a request to discover subscriptions.

type User

type User struct {
	ID                     int64      `json:"id"`
	Username               string     `json:"username"`
	Password               string     `json:"-"`
	IsAdmin                bool       `json:"is_admin"`
	Theme                  string     `json:"theme"`
	Language               string     `json:"language"`
	Timezone               string     `json:"timezone"`
	EntryDirection         string     `json:"entry_sorting_direction"`
	EntryOrder             string     `json:"entry_sorting_order"`
	Stylesheet             string     `json:"stylesheet"`
	GoogleID               string     `json:"google_id"`
	OpenIDConnectID        string     `json:"openid_connect_id"`
	EntriesPerPage         int        `json:"entries_per_page"`
	KeyboardShortcuts      bool       `json:"keyboard_shortcuts"`
	ShowReadingTime        bool       `json:"show_reading_time"`
	EntrySwipe             bool       `json:"entry_swipe"`
	GestureNav             string     `json:"gesture_nav"`
	LastLoginAt            *time.Time `json:"last_login_at"`
	DisplayMode            string     `json:"display_mode"`
	DefaultReadingSpeed    int        `json:"default_reading_speed"`
	CJKReadingSpeed        int        `json:"cjk_reading_speed"`
	DefaultHomePage        string     `json:"default_home_page"`
	CategoriesSortingOrder string     `json:"categories_sorting_order"`
	MarkReadOnView         bool       `json:"mark_read_on_view"`
}

User represents a user in the system.

func (*User) UseTimezone

func (u *User) UseTimezone(tz string)

UseTimezone converts last login date to the given timezone.

type UserCreationRequest

type UserCreationRequest struct {
	Username        string `json:"username"`
	Password        string `json:"password"`
	IsAdmin         bool   `json:"is_admin"`
	GoogleID        string `json:"google_id"`
	OpenIDConnectID string `json:"openid_connect_id"`
}

UserCreationRequest represents the request to create a user.

type UserModificationRequest

type UserModificationRequest struct {
	Username               *string `json:"username"`
	Password               *string `json:"password"`
	Theme                  *string `json:"theme"`
	Language               *string `json:"language"`
	Timezone               *string `json:"timezone"`
	EntryDirection         *string `json:"entry_sorting_direction"`
	EntryOrder             *string `json:"entry_sorting_order"`
	Stylesheet             *string `json:"stylesheet"`
	GoogleID               *string `json:"google_id"`
	OpenIDConnectID        *string `json:"openid_connect_id"`
	EntriesPerPage         *int    `json:"entries_per_page"`
	IsAdmin                *bool   `json:"is_admin"`
	KeyboardShortcuts      *bool   `json:"keyboard_shortcuts"`
	ShowReadingTime        *bool   `json:"show_reading_time"`
	EntrySwipe             *bool   `json:"entry_swipe"`
	GestureNav             *string `json:"gesture_nav"`
	DisplayMode            *string `json:"display_mode"`
	DefaultReadingSpeed    *int    `json:"default_reading_speed"`
	CJKReadingSpeed        *int    `json:"cjk_reading_speed"`
	DefaultHomePage        *string `json:"default_home_page"`
	CategoriesSortingOrder *string `json:"categories_sorting_order"`
	MarkReadOnView         *bool   `json:"mark_read_on_view"`
}

UserModificationRequest represents the request to update a user.

func (*UserModificationRequest) Patch

func (u *UserModificationRequest) Patch(user *User)

Patch updates the User object with the modification request.

type UserSession

type UserSession struct {
	ID        int64
	UserID    int64
	Token     string
	CreatedAt time.Time
	UserAgent string
	IP        string
}

UserSession represents a user session in the system.

func (*UserSession) String

func (u *UserSession) String() string

func (*UserSession) UseTimezone

func (u *UserSession) UseTimezone(tz string)

UseTimezone converts creation date to the given timezone.

type UserSessions

type UserSessions []*UserSession

UserSessions represents a list of sessions.

func (UserSessions) UseTimezone

func (u UserSessions) UseTimezone(tz string)

UseTimezone converts creation date of all sessions to the given timezone.

type Users

type Users []*User

Users represents a list of users.

func (Users) UseTimezone

func (u Users) UseTimezone(tz string)

UseTimezone converts last login timestamp of all users to the given timezone.

Jump to

Keyboard shortcuts

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