Documentation
¶
Index ¶
- Constants
- func APICall(apiURL string, httpMethod string, postData []byte) []byte
- func GetAuthTokenHeader() string
- func GetEntriesExists(bodyByteGetterFunc BodyByteGetter, urls []string) map[string]bool
- 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 SetConfig(wbgConfig WallabagConfig)
- func Version(bodyStringGetterFunc BodyStringGetter) string
- type Annotation
- type Annotations
- type BodyByteGetter
- type BodyStringGetter
- type Embedded
- type Entries
- type Item
- type Link
- type Links
- type Range
- type Tag
- 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 APICall ¶ added in v1.0.0
APICall authenticates to wallabag instane before issuing the HTTP request
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 GetEntriesExists ¶ added in v1.0.0
func GetEntriesExists(bodyByteGetterFunc BodyByteGetter, urls []string) map[string]bool
GetEntriesExists queries the API for articles according to the API request /entries/exists it checks if the urls in the given array exist returns a map with the URL as key and the result as value
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
func SetConfig ¶ added in v1.0.0
func SetConfig(wbgConfig WallabagConfig)
SetConfig sets global wallabago Config
func Version ¶
func Version(bodyStringGetterFunc BodyStringGetter) string
Version returns the version of the configured wallabag instance
Types ¶
type Annotation ¶ added in v1.0.0
type Annotation struct {
AnnotatorSchemaVersion string `json:"annotator_schema_version"`
CreatedAt WallabagTime `json:"created_at"`
ID int `json:"id"`
Quote string `json:"quote"`
Ranges []Range `json:"ranges"`
Text string `json:"text"`
UpdatedAt WallabagTime `json:"updated_at"`
}
Annotation represents one annotation made to an article
type Annotations ¶ added in v1.0.0
type Annotations struct {
Rows []Annotation `json:"rows"`
Total int `json:"total"`
}
Annotations represents an annotation result API call for an article
func GetAnnotations ¶ added in v1.0.0
func GetAnnotations(bodyByteGetterFunc BodyByteGetter, articleID int) Annotations
GetAnnotations queries the API for all annotations of an article according to /api/annotations/ID
type BodyByteGetter ¶ added in v1.0.0
BodyByteGetter represents a function returning the body of an HTTP response as byte array
type BodyStringGetter ¶ added in v1.0.0
BodyStringGetter represents a function returning the body of an HTTP response as string
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 []Annotation `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 []Tag `json:"tags"`
Title string `json:"title"`
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
func GetEntry ¶ added in v1.0.0
func GetEntry(bodyByteGetterFunc BodyByteGetter, articleID int) Item
GetEntry queries the API for a specific article according to the API request /entries/ID
type Range ¶ added in v1.0.0
type Range struct {
End string `json:"end"`
EndOffset int `json:"endOffset"`
Start string `json:"start"`
StartOffset int `json:"startOffset"`
}
Range represents the text borders of an annotation
type Tag ¶ added in v1.0.0
Tag represents one tag with its properties
func GetTags ¶ added in v1.0.0
func GetTags(bodyByteGetterFunc BodyByteGetter) []Tag
GetTags queries the API for all tags in wallabag /tags
func GetTagsOfEntry ¶ added in v1.0.0
func GetTagsOfEntry(bodyByteGetterFunc BodyByteGetter, articleID int) []Tag
GetTagsOfEntry queries the API for the tags of an article /entries/ID
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
func NewWallabagConfig ¶ added in v1.0.0
func NewWallabagConfig(wallabagURL, clientID, clientSecret, userName, userPassword string) WallabagConfig
NewWallabagConfig initializes a new WallabagConfig
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