miniflux.app: miniflux.app/client Index | Files

package client

import "miniflux.app/client"

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

Package Files

client.go core.go doc.go request.go

Constants

const (
    EntryStatusUnread  = "unread"
    EntryStatusRead    = "read"
    EntryStatusRemoved = "removed"
)

Entry statuses.

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.

type Categories Uses

type Categories []*Category

Categories represents a list of categories.

type Category Uses

type Category struct {
    ID     int64  `json:"id,omitempty"`
    Title  string `json:"title,omitempty"`
    UserID int64  `json:"user_id,omitempty"`
}

Category represents a category in the system.

func (Category) String Uses

func (c Category) String() string

type Client Uses

type Client struct {
    // contains filtered or unexported fields
}

Client holds API procedure calls.

func New Uses

func New(endpoint, username, password string) *Client

New returns a new Miniflux client.

func (*Client) Categories Uses

func (c *Client) Categories() (Categories, error)

Categories gets the list of categories.

func (*Client) CreateCategory Uses

func (c *Client) CreateCategory(title string) (*Category, error)

CreateCategory creates a new category.

func (*Client) CreateFeed Uses

func (c *Client) CreateFeed(url string, categoryID int64) (int64, error)

CreateFeed creates a new feed.

func (*Client) CreateUser Uses

func (c *Client) CreateUser(username, password string, isAdmin bool) (*User, error)

CreateUser creates a new user in the system.

func (*Client) DeleteCategory Uses

func (c *Client) DeleteCategory(categoryID int64) error

DeleteCategory removes a category.

func (*Client) DeleteFeed Uses

func (c *Client) DeleteFeed(feedID int64) error

DeleteFeed removes a feed.

func (*Client) DeleteUser Uses

func (c *Client) DeleteUser(userID int64) error

DeleteUser removes a user from the system.

func (*Client) Discover Uses

func (c *Client) Discover(url string) (Subscriptions, error)

Discover try to find subscriptions from a website.

func (*Client) Entries Uses

func (c *Client) Entries(filter *Filter) (*EntryResultSet, error)

Entries fetch entries.

func (*Client) Entry Uses

func (c *Client) Entry(entryID int64) (*Entry, error)

Entry gets a single entry.

func (*Client) Export Uses

func (c *Client) Export() ([]byte, error)

Export creates OPML file.

func (*Client) Feed Uses

func (c *Client) Feed(feedID int64) (*Feed, error)

Feed gets a feed.

func (*Client) FeedEntries Uses

func (c *Client) FeedEntries(feedID int64, filter *Filter) (*EntryResultSet, error)

FeedEntries fetch feed entries.

func (*Client) FeedEntry Uses

func (c *Client) FeedEntry(feedID, entryID int64) (*Entry, error)

FeedEntry gets a single feed entry.

func (*Client) FeedIcon Uses

func (c *Client) FeedIcon(feedID int64) (*FeedIcon, error)

FeedIcon gets a feed icon.

func (*Client) Feeds Uses

func (c *Client) Feeds() (Feeds, error)

Feeds gets all feeds.

func (*Client) Import Uses

func (c *Client) Import(f io.ReadCloser) error

Import imports an OPML file.

func (*Client) Me Uses

func (c *Client) Me() (*User, error)

Me returns the logged user information.

func (*Client) RefreshFeed Uses

func (c *Client) RefreshFeed(feedID int64) error

RefreshFeed refresh a feed.

func (*Client) ToggleBookmark Uses

func (c *Client) ToggleBookmark(entryID int64) error

ToggleBookmark toggles entry bookmark value.

func (*Client) UpdateCategory Uses

func (c *Client) UpdateCategory(categoryID int64, title string) (*Category, error)

UpdateCategory updates a category.

func (*Client) UpdateEntries Uses

func (c *Client) UpdateEntries(entryIDs []int64, status string) error

UpdateEntries updates the status of a list of entries.

func (*Client) UpdateFeed Uses

func (c *Client) UpdateFeed(feedID int64, feedChanges *FeedModification) (*Feed, error)

UpdateFeed updates a feed.

func (*Client) UpdateUser Uses

func (c *Client) UpdateUser(userID int64, userChanges *UserModification) (*User, error)

UpdateUser updates a user in the system.

func (*Client) UserByID Uses

func (c *Client) UserByID(userID int64) (*User, error)

UserByID returns a single user.

func (*Client) UserByUsername Uses

func (c *Client) UserByUsername(username string) (*User, error)

UserByUsername returns a single user.

func (*Client) Users Uses

func (c *Client) Users() (Users, error)

Users returns all users.

type Enclosure Uses

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 Enclosures Uses

type Enclosures []*Enclosure

Enclosures represents a list of attachments.

type Entries Uses

type Entries []*Entry

Entries represents a list of entries.

type Entry Uses

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"`
    Date       time.Time  `json:"published_at"`
    Content    string     `json:"content"`
    Author     string     `json:"author"`
    Starred    bool       `json:"starred"`
    Enclosures Enclosures `json:"enclosures,omitempty"`
    Feed       *Feed      `json:"feed,omitempty"`
    Category   *Category  `json:"category,omitempty"`
}

Entry represents a subscription item in the system.

type EntryResultSet Uses

type EntryResultSet struct {
    Total   int     `json:"total"`
    Entries Entries `json:"entries"`
}

EntryResultSet represents the response when fetching entries.

type Feed Uses

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"`
    ScraperRules       string    `json:"scraper_rules"`
    RewriteRules       string    `json:"rewrite_rules"`
    Crawler            bool      `json:"crawler"`
    UserAgent          string    `json:"user_agent"`
    Username           string    `json:"username"`
    Password           string    `json:"password"`
    Category           *Category `json:"category,omitempty"`
    Entries            Entries   `json:"entries,omitempty"`
}

Feed represents a Miniflux feed.

type FeedIcon Uses

type FeedIcon struct {
    ID       int64  `json:"id"`
    MimeType string `json:"mime_type"`
    Data     string `json:"data"`
}

FeedIcon represents the feed icon.

type FeedModification Uses

type FeedModification 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"`
    Crawler      *bool   `json:"crawler"`
    UserAgent    *string `json:"user_agent"`
    Username     *string `json:"username"`
    Password     *string `json:"password"`
    CategoryID   *int64  `json:"category_id"`
}

FeedModification represents changes for a feed.

type Feeds Uses

type Feeds []*Feed

Feeds represents a list of feeds.

type Filter Uses

type Filter struct {
    Status        string
    Offset        int
    Limit         int
    Order         string
    Direction     string
    Starred       bool
    Before        int64
    After         int64
    BeforeEntryID int64
    AfterEntryID  int64
    Search        string
}

Filter is used to filter entries.

type Subscription Uses

type Subscription struct {
    Title string `json:"title"`
    URL   string `json:"url"`
    Type  string `json:"type"`
}

Subscription represents a feed subscription.

func (Subscription) String Uses

func (s Subscription) String() string

type Subscriptions Uses

type Subscriptions []*Subscription

Subscriptions represents a list of subscriptions.

type User Uses

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"`
    LastLoginAt    *time.Time        `json:"last_login_at"`
    Extra          map[string]string `json:"extra"`
}

User represents a user in the system.

func (User) String Uses

func (u User) String() string

type UserModification Uses

type UserModification 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"`
}

UserModification is used to update a user.

type Users Uses

type Users []User

Users represents a list of users.

Package client imports 11 packages (graph) and is imported by 1 packages. Updated 2018-10-19. Refresh now. Tools for package owners.