Documentation
¶
Index ¶
- Constants
- func GetAuthTokenHeader() string
- func GetBodyOfAPIURL(url string) []byte
- func GetNumberOfArchivedArticles() int
- func GetNumberOfStarredArticles() int
- func GetNumberOfTotalArticles() int
- func PostEntry(url, title, tags string, starred, archive int)
- func ReadConfig(configJSON string) (err error)
- func Version() string
- type Embedded
- type Entries
- type Item
- type Link
- type Links
- type Token
- type WallabagConfig
- type WallabagTime
Constants ¶
const WallabagTimeLayout = "2006-01-02T15:04:05-0700"
WallabagTimeLayout is a variation of RFC3339 but without colons in the timezone delimeter, breaking the RFC
Variables ¶
This section is empty.
Functions ¶
func GetAuthTokenHeader ¶
func GetAuthTokenHeader() string
GetAuthTokenHeader will make sure there's a working token and return a valid string to be used as an Authentication: header
func GetBodyOfAPIURL ¶
GetBodyOfAPIURL will do a simple GET request on the given URL and return the body, with the proper Authorization headers as returned by GetAuthTokenHeader
func GetNumberOfArchivedArticles ¶
func GetNumberOfArchivedArticles() int
GetNumberOfArchivedArticles returns the number of archived articles in wallabag
func GetNumberOfStarredArticles ¶
func GetNumberOfStarredArticles() int
GetNumberOfStarredArticles returns the number of starred articles in wallabag (including unread and archived starred ones)
func GetNumberOfTotalArticles ¶
func GetNumberOfTotalArticles() int
GetNumberOfTotalArticles returns the number of all articles saved in wallabag
func ReadConfig ¶
ReadConfig will read the configuration from the given configJSON file and set the global Config setting with the results of the parsing
Types ¶
type Embedded ¶
type Embedded struct {
Items []Item `json:"items"`
}
Embedded items in the API request
type Entries ¶
Entries represents the object being returned from the API request /entries
func GetAllEntries ¶
func GetAllEntries() Entries
GetAllEntries calls GetEntries with no parameters, thus using the default values of the API request /entries and returning all articles, of course not all at once, but limitted to page through
type Item ¶
type Item struct {
Links Links `json:"_links"`
Annotations []interface{} `json:"annotations"`
CreatedAt WallabagTime `json:"created_at"`
DomainName string `json:"domain_name"`
ID int `json:"id"`
IsArchived int `json:"is_archived"`
IsStarred int `json:"is_starred"`
Mimetype string `json:"mimetype"`
ReadingTime int `json:"reading_time"`
Tags []interface{} `json:"tags"`
UpdatedAt WallabagTime `json:"updated_at"`
UserEmail string `json:"user_email"`
UserID int `json:"user_id"`
UserName string `json:"user_name"`
}
Item represents individual items in API responses
type Token ¶
type Token struct {
AccessToken string `json:"access_token"`
ExpiresIn int `json:"expires_in"`
TokenType string `json:"token_type"`
Scope string
RefreshToken string `json:"refresh_token"`
}
Token represents the object being returned from the oauth process at the API containing the access token, expire time, type of token, scope and a refresh token
type WallabagConfig ¶
type WallabagConfig struct {
WallabagURL string
ClientID string
ClientSecret string
UserName string
UserPassword string
}
WallabagConfig contains all data needed to connect to wallabag API like URL, id and secret of the API client and user name and according password
var Config WallabagConfig
Config containing all data to access wallabag API
type WallabagTime ¶
WallabagTime overrides builtin time to allow for custom time parsing
func (*WallabagTime) UnmarshalJSON ¶
func (t *WallabagTime) UnmarshalJSON(buf []byte) (err error)
UnmarshalJSON parses the custom date format wallabag returns