Documentation ¶
Index ¶
- Constants
- func APICall(apiURL string, httpMethod string, postData []byte) ([]byte, error)
- func AddEntryTags(entry int, tags ...string) error
- func DeleteEntryTag(entry int, tag int) error
- func ExportEntry(bodyByteGetterFunc BodyByteGetter, articleID int, format string) ([]byte, error)
- func GetAuthTokenHeader() (string, error)
- func GetEntriesExists(bodyByteGetterFunc BodyByteGetter, urls []string) (map[string]bool, error)
- func GetNumberOfArchivedArticles() (int, error)
- func GetNumberOfStarredArticles() (int, error)
- func GetNumberOfTotalArticles() (int, error)
- func PostEntry(url, title, tags string, starred, archive int) error
- func ReadConfig(configJSON string) (err error)
- func SetConfig(wbgConfig WallabagConfig)
- func Version(bodyStringGetterFunc BodyStringGetter) (string, error)
- type Annotation
- type Annotations
- type BodyByteGetter
- type BodyStringGetter
- type Configuration
- type Embedded
- type Entries
- type Information
- type Item
- type Link
- type Links
- type LoggedInUser
- 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 AddEntryTags ¶
AddEntryTags add tags to an entry
func DeleteEntryTag ¶
DeleteEntryTag removes a tag from an entry
func ExportEntry ¶
func ExportEntry(bodyByteGetterFunc BodyByteGetter, articleID int, format string) ([]byte, error)
ExportEntry queries the API to retrieve a single entry in a predefined format according to the API request /entries/ID/export.FORMAT
func GetAuthTokenHeader ¶
GetAuthTokenHeader will make sure there's a working token and return a valid string to be used as an Authentication: header
func GetEntriesExists ¶
func GetEntriesExists(bodyByteGetterFunc BodyByteGetter, urls []string) (map[string]bool, error)
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 ¶
GetNumberOfArchivedArticles returns the number of archived articles in wallabag
func GetNumberOfStarredArticles ¶
GetNumberOfStarredArticles returns the number of starred articles in wallabag (including unread and archived starred ones)
func GetNumberOfTotalArticles ¶
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 Version ¶
func Version(bodyStringGetterFunc BodyStringGetter) (string, error)
Version returns the version of the configured wallabag instance
Types ¶
type Annotation ¶
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"` User string `json:"user"` // User is only present in the GET entries call, but not in the GET anntotations/id call }
Annotation represents one annotation made to an article
type Annotations ¶
type Annotations struct { Rows []Annotation `json:"rows"` Total int `json:"total"` }
Annotations represents an annotation result API call for an article
func GetAnnotations ¶
func GetAnnotations(bodyByteGetterFunc BodyByteGetter, articleID int) (Annotations, error)
GetAnnotations queries the API for all annotations of an article according to /api/annotations/ID
type BodyByteGetter ¶
BodyByteGetter represents a function returning the body of an HTTP response as byte array
type BodyStringGetter ¶
BodyStringGetter represents a function returning the body of an HTTP response as string
type Configuration ¶
type Configuration struct { ID int `json:"id"` ItemsPerPage int `json:"items_per_page"` Language string `json:"language"` FeedToken string `json:"feed_token"` FeedLimit int `json:"feed_limit"` ReadingSpeed float64 `json:"reading_speed"` ActionMarkAsRead int `json:"action_mark_as_read"` ListMode int `json:"list_mode"` DisplayThumbnails int `json:"display_thumbnails"` }
Configuration represents the object being returned from the API request /config
func Config ¶
func Config(bodyByteGetterFunc BodyByteGetter) (Configuration, error)
Config returns the config of the configured wallabag instance
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 GetEntries ¶
func GetEntries(bodyByteGetterFunc BodyByteGetter, archive int, starred int, sort string, order string, page int, perPage int, tags string, since int, public int, detail string, domain_name string) (Entries, error)
GetEntries queries the API for articles according to the API request /entries
type Information ¶
type Information struct { Appname string `json:"appname"` Version string `json:"version"` AllowedRegistration bool `json:"allowed_registration"` }
Information represents the object being returned from the API request /info
func Info ¶
func Info(bodyByteGetterFunc BodyByteGetter) (Information, error)
Info returns the info of the configured wallabag instance
type Item ¶
type Item struct { Links Links `json:"_links"` Annotations []Annotation `json:"annotations"` ArchivedAt *WallabagTime `json:"archived_at"` CreatedAt *WallabagTime `json:"created_at"` Content string `json:"content"` DomainName string `json:"domain_name"` GivenURL string `json:"given_url"` HashedGivenURL string `json:"hashed_given_url"` HashedURL string `json:"hashed_url"` ID int `json:"id"` IsArchived int `json:"is_archived"` IsPublic bool `json:"is_public"` IsStarred int `json:"is_starred"` Language string `json:"language"` Mimetype string `json:"mimetype"` OriginURL string `json:"origin_url"` PreviewPicture string `json:"preview_picture"` PublishedAt *WallabagTime `json:"published_at"` PublishedBy []string `json:"published_by"` ReadingTime int `json:"reading_time"` StarredAt *WallabagTime `json:"starred_at"` Tags []Tag `json:"tags"` Title string `json:"title"` UID string `json:"uid"` UpdatedAt *WallabagTime `json:"updated_at"` URL string `json:"url"` UserEmail string `json:"user_email"` UserID int `json:"user_id"` UserName string `json:"user_name"` }
Item represents individual items in API responses
func GetAllEntries ¶
GetAllEntries calls GetEntries with no parameters, thus using the default values of the API request /entries and returning all articles as []wallabago.Item
func GetAllEntriesWithAnnotations ¶
GetAllEntriesWithAnnotations calls GetEntries with the since, sort and order parameter only
func GetAllEntriesWithAnnotationsSince ¶
GetAllEntriesWithAnnotationsSince calls GetEntries with the since parameter only
type LoggedInUser ¶
type LoggedInUser struct { ID int `json:"id"` UserName string `json:"username"` Email string `json:"email"` CreatedAt *WallabagTime `json:"created_at"` UpdatedAt *WallabagTime `json:"updated_at"` }
LoggedInUser represents the object being returned from the API request /user
func User ¶
func User(bodyByteGetterFunc BodyByteGetter) (LoggedInUser, error)
User returns the user info of the logged in user of the configured wallabag instance
type Range ¶
type Range struct { End string `json:"end"` EndOffset interface{} `json:"endOffset"` Start string `json:"start"` StartOffset interface{} `json:"startOffset"` }
Range represents the text borders of an annotation
type Tag ¶
Tag represents one tag with its properties
func GetTags ¶
func GetTags(bodyByteGetterFunc BodyByteGetter) ([]Tag, error)
GetTags queries the API for all tags in wallabag /tags
func GetTagsOfEntry ¶
func GetTagsOfEntry(bodyByteGetterFunc BodyByteGetter, articleID int) ([]Tag, error)
GetTagsOfEntry queries the API for the tags of an article /entries/ID
type Token ¶
type Token struct { AccessToken string ExpirationTime time.Time TokenType string Scope string RefreshToken string }
Token represents the object being returned from the oauth process at the API containing the access token, expire time (after converting it from the number of seconds the token is valid to the point in time where it will expires), 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 LibConfig WallabagConfig
LibConfig containing all data to access wallabag API
func NewWallabagConfig ¶
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) Equal ¶
func (t1 *WallabagTime) Equal(t2 *WallabagTime) bool
Equal compares the year, month, day, hours, minutes and seconds of the given WallabagTimes
func (*WallabagTime) MarshalJSON ¶
func (t *WallabagTime) MarshalJSON() ([]byte, error)
MarshalJSON converts the given time according to custom wallabag time format for saving as JSON
func (*WallabagTime) UnmarshalJSON ¶
func (t *WallabagTime) UnmarshalJSON(buf []byte) (err error)
UnmarshalJSON parses the custom date format wallabag returns