[feat] plugins/wallabag: addArticle() method (#4852)

Currently unused, but a prerequisite for dynamically adding links to Wallabag.
pull/4853/head
Frans de Jonge 5 years ago committed by GitHub
parent db5bd8884d
commit 76fd9228d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -526,6 +526,29 @@ function Wallabag:processLocalFiles( mode )
return num_deleted
end
function Wallabag:addArticle(article_url)
logger.dbg("Wallabag: adding article ", article_url)
if not article_url or self:getBearerToken() == false then
return false
end
local body = {
url = article_url,
}
local body_JSON = JSON.encode(body)
local headers = {
["Content-type"] = "application/json",
["Accept"] = "application/json, */*",
["Content-Length"] = tostring(#body_JSON),
["Authorization"] = "Bearer " .. self.access_token,
}
self:callAPI("POST", "/api/entries.json", headers, body_JSON, "")
end
function Wallabag:deleteArticle( path )
logger.dbg("Wallabag: deleting article ", path )
local id = self:getArticleID( path )

Loading…
Cancel
Save