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 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 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"` }
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 Embedded ¶
type Embedded struct {
Items []Item `json:"items"`
}
Embedded items in the API request
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
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 Config WallabagConfig
Config 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) UnmarshalJSON ¶
func (t *WallabagTime) UnmarshalJSON(buf []byte) (err error)
UnmarshalJSON parses the custom date format wallabag returns