Documentation ¶
Overview ¶
Package client implements a client library for the Miniflux REST API.
Examples ¶
This code snippet fetch the list of users:
import ( miniflux "miniflux.app/client" ) client := miniflux.New("https://api.example.org", "admin", "secret") users, err := client.Users() if err != nil { fmt.Println(err) return } fmt.Println(users, err)
This one discover subscriptions on a website:
subscriptions, err := client.Discover("https://example.org/") if err != nil { fmt.Println(err) return } fmt.Println(subscriptions)
Index ¶
- Constants
- Variables
- type Categories
- type Category
- type Client
- func (c *Client) Categories() (Categories, error)
- func (c *Client) CategoryEntries(categoryID int64, filter *Filter) (*EntryResultSet, error)
- func (c *Client) CategoryEntry(categoryID, entryID int64) (*Entry, error)
- func (c *Client) CategoryFeeds(categoryID int64) (Feeds, error)
- func (c *Client) CreateCategory(title string) (*Category, error)
- func (c *Client) CreateFeed(feedCreationRequest *FeedCreationRequest) (int64, error)
- func (c *Client) CreateUser(username, password string, isAdmin bool) (*User, error)
- func (c *Client) DeleteCategory(categoryID int64) error
- func (c *Client) DeleteFeed(feedID int64) error
- func (c *Client) DeleteUser(userID int64) error
- func (c *Client) Discover(url string) (Subscriptions, error)
- func (c *Client) Entries(filter *Filter) (*EntryResultSet, error)
- func (c *Client) Entry(entryID int64) (*Entry, error)
- func (c *Client) Export() ([]byte, error)
- func (c *Client) Feed(feedID int64) (*Feed, error)
- func (c *Client) FeedEntries(feedID int64, filter *Filter) (*EntryResultSet, error)
- func (c *Client) FeedEntry(feedID, entryID int64) (*Entry, error)
- func (c *Client) FeedIcon(feedID int64) (*FeedIcon, error)
- func (c *Client) Feeds() (Feeds, error)
- func (c *Client) FetchCounters() (*FeedCounters, error)
- func (c *Client) Import(f io.ReadCloser) error
- func (c *Client) MarkAllAsRead(userID int64) error
- func (c *Client) MarkCategoryAsRead(categoryID int64) error
- func (c *Client) MarkFeedAsRead(feedID int64) error
- func (c *Client) Me() (*User, error)
- func (c *Client) RefreshAllFeeds() error
- func (c *Client) RefreshCategory(categoryID int64) error
- func (c *Client) RefreshFeed(feedID int64) error
- func (c *Client) ToggleBookmark(entryID int64) error
- func (c *Client) UpdateCategory(categoryID int64, title string) (*Category, error)
- func (c *Client) UpdateEntries(entryIDs []int64, status string) error
- func (c *Client) UpdateFeed(feedID int64, feedChanges *FeedModificationRequest) (*Feed, error)
- func (c *Client) UpdateUser(userID int64, userChanges *UserModificationRequest) (*User, error)
- func (c *Client) UserByID(userID int64) (*User, error)
- func (c *Client) UserByUsername(username string) (*User, error)
- func (c *Client) Users() (Users, error)
- type Enclosure
- type Enclosures
- type Entries
- type Entry
- type EntryResultSet
- type Feed
- type FeedCounters
- type FeedCreationRequest
- type FeedIcon
- type FeedModificationRequest
- type Feeds
- type Filter
- type Subscription
- type Subscriptions
- type User
- type UserCreationRequest
- type UserModificationRequest
- type Users
Constants ¶
const ( EntryStatusUnread = "unread" EntryStatusRead = "read" EntryStatusRemoved = "removed" )
Entry statuses.
const ( FilterNotStarred = "0" FilterOnlyStarred = "1" )
Variables ¶
var ( ErrNotAuthorized = errors.New("miniflux: unauthorized (bad credentials)") ErrForbidden = errors.New("miniflux: access forbidden") ErrServerError = errors.New("miniflux: internal server error") ErrNotFound = errors.New("miniflux: resource not found") )
List of exposed errors.
Functions ¶
This section is empty.
Types ¶
type Category ¶
type Category struct { ID int64 `json:"id,omitempty"` Title string `json:"title,omitempty"` UserID int64 `json:"user_id,omitempty"` }
Category represents a feed category.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client holds API procedure calls.
func (*Client) Categories ¶
func (c *Client) Categories() (Categories, error)
Categories gets the list of categories.
func (*Client) CategoryEntries ¶
func (c *Client) CategoryEntries(categoryID int64, filter *Filter) (*EntryResultSet, error)
CategoryEntries fetch entries of a category.
func (*Client) CategoryEntry ¶
CategoryEntry gets a single category entry.
func (*Client) CategoryFeeds ¶
CategoryFeeds gets feeds of a category.
func (*Client) CreateCategory ¶
CreateCategory creates a new category.
func (*Client) CreateFeed ¶
func (c *Client) CreateFeed(feedCreationRequest *FeedCreationRequest) (int64, error)
CreateFeed creates a new feed.
func (*Client) CreateUser ¶
CreateUser creates a new user in the system.
func (*Client) DeleteCategory ¶
DeleteCategory removes a category.
func (*Client) DeleteFeed ¶
DeleteFeed removes a feed.
func (*Client) DeleteUser ¶
DeleteUser removes a user from the system.
func (*Client) Discover ¶
func (c *Client) Discover(url string) (Subscriptions, error)
Discover try to find subscriptions from a website.
func (*Client) Entries ¶
func (c *Client) Entries(filter *Filter) (*EntryResultSet, error)
Entries fetch entries.
func (*Client) FeedEntries ¶
func (c *Client) FeedEntries(feedID int64, filter *Filter) (*EntryResultSet, error)
FeedEntries fetch feed entries.
func (*Client) FetchCounters ¶
func (c *Client) FetchCounters() (*FeedCounters, error)
FetchCounters
func (*Client) MarkAllAsRead ¶
MarkAllAsRead marks all unread entries as read for a given user.
func (*Client) MarkCategoryAsRead ¶
MarkCategoryAsRead marks all unread entries in a category as read.
func (*Client) MarkFeedAsRead ¶
MarkFeedAsRead marks all unread entries of the feed as read.
func (*Client) RefreshAllFeeds ¶
RefreshAllFeeds refreshes all feeds.
func (*Client) RefreshCategory ¶
RefreshCategory refreshes a category.
func (*Client) RefreshFeed ¶
RefreshFeed refreshes a feed.
func (*Client) ToggleBookmark ¶
ToggleBookmark toggles entry bookmark value.
func (*Client) UpdateCategory ¶
UpdateCategory updates a category.
func (*Client) UpdateEntries ¶
UpdateEntries updates the status of a list of entries.
func (*Client) UpdateFeed ¶
func (c *Client) UpdateFeed(feedID int64, feedChanges *FeedModificationRequest) (*Feed, error)
UpdateFeed updates a feed.
func (*Client) UpdateUser ¶
func (c *Client) UpdateUser(userID int64, userChanges *UserModificationRequest) (*User, error)
UpdateUser updates a user in the system.
func (*Client) UserByUsername ¶
UserByUsername returns a single user.
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 int `json:"size"` }
Enclosure represents an attachment.
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"` Starred bool `json:"starred"` ReadingTime int `json:"reading_time"` Enclosures Enclosures `json:"enclosures,omitempty"` Feed *Feed `json:"feed,omitempty"` Tags []string `json:"tags"` }
Entry represents a subscription item in the system.
type EntryResultSet ¶
EntryResultSet represents the response when fetching entries.
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,omitempty"` EtagHeader string `json:"etag_header,omitempty"` LastModifiedHeader string `json:"last_modified_header,omitempty"` ParsingErrorMsg string `json:"parsing_error_message,omitempty"` ParsingErrorCount int `json:"parsing_error_count,omitempty"` Disabled bool `json:"disabled"` 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"` Crawler bool `json:"crawler"` UserAgent string `json:"user_agent"` Cookie string `json:"cookie"` Username string `json:"username"` Password string `json:"password"` Category *Category `json:"category,omitempty"` HideGlobally bool `json:"hide_globally"` }
Feed represents a Miniflux feed.
type FeedCounters ¶
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"` 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"` }
FeedCreationRequest represents the request to create a feed.
type FeedIcon ¶
type FeedIcon struct { ID int64 `json:"id"` MimeType string `json:"mime_type"` Data string `json:"data"` }
FeedIcon represents the feed icon.
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"` 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"` 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.
type Filter ¶
type Filter struct { Status string Offset int Limit int Order string Direction string Starred string Before int64 After int64 BeforeEntryID int64 AfterEntryID int64 Search string CategoryID int64 FeedID int64 Statuses []string }
Filter is used to filter entries.
type Subscription ¶
type Subscription struct { Title string `json:"title"` URL string `json:"url"` Type string `json:"type"` }
Subscription represents a feed subscription.
func (Subscription) String ¶
func (s Subscription) String() string
type Subscriptions ¶
type Subscriptions []*Subscription
Subscriptions represents a list of subscriptions.
type User ¶
type User struct { ID int64 `json:"id"` Username string `json:"username"` Password string `json:"password,omitempty"` 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"` 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.
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"` 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"` 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.