wallabago

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2017 License: GPL-3.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

wallabago

Go wrapper for the Wallabag API

Project Status

Currently supported wallabag version

2.2.1

Travis CI

Build Status

Go Report Card

Go Report Card Badge

Status of the implementation of the API calls
  • DELETE /annotations/{annotation}.{_format}
  • PUT /annotations/{annotation}.{_format}
  • GET /annotations/{entry}.{_format}
  • POST /annotations/{entry}.{_format}
  • GET /api/entries.{_format}
  • POST /api/entries.{_format}
  • DELETE /api/entries/{entry}.{_format}
  • GET /api/entries/{entry}.{_format}
  • PATCH /api/entries/{entry}.{_format}
  • GET /api/entries/{entry}/tags.{_format}
  • POST /api/entries/{entry}/tags.{_format}
  • DELETE /api/entries/{entry}/tags/{tag}.{_format}
  • GET /api/tags.{_format}
  • DELETE /api/tags/{tag}.{_format}
  • GET /api/version.{_format}

Documentation

Index

Constants

View Source
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

func GetBodyOfAPIURL(url string) []byte

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 PostEntry

func PostEntry(url, title, tags string, starred, archive int)

PostEntry creates a new article in wallabag

func ReadConfig

func ReadConfig(configJSON string) (err error)

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() string

Version returns the version of the configured wallabag instance

Types

type Embedded

type Embedded struct {
	Items []Item `json:"items"`
}

Embedded items in the API request

type Entries

type Entries struct {
	Page      int
	Limit     int
	Pages     int
	Total     int
	NaviLinks Links    `json:"_links"`
	Embedded  Embedded `json:"_embedded"`
}

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

func GetEntries

func GetEntries(archive int, starred int, sort string, order string, page int, perPage int, tags string) Entries

GetEntries queries the API for articles according to the API request /entries

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 Link struct {
	Href string
}

Link object consists of its URL

type Links struct {
	Self  *Link
	First *Link
	Last  *Link
	Next  *Link
}

Links contains four links (self, first, last, next), being part of the Entries object

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

type WallabagTime struct {
	time.Time
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL