mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
Add Instapaper integration
This commit is contained in:
parent
6f5350a497
commit
ae62e543d3
19 changed files with 191 additions and 51 deletions
32
integration/integration.go
Normal file
32
integration/integration.go
Normal file
|
@ -0,0 +1,32 @@
|
|||
// Copyright 2017 Frédéric Guillot. All rights reserved.
|
||||
// Use of this source code is governed by the Apache 2.0
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package integration
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"github.com/miniflux/miniflux2/integration/instapaper"
|
||||
"github.com/miniflux/miniflux2/integration/pinboard"
|
||||
"github.com/miniflux/miniflux2/model"
|
||||
)
|
||||
|
||||
// SendEntry send the entry to the activated providers.
|
||||
func SendEntry(entry *model.Entry, integration *model.Integration) {
|
||||
if integration.PinboardEnabled {
|
||||
client := pinboard.NewClient(integration.PinboardToken)
|
||||
err := client.AddBookmark(entry.URL, entry.Title, integration.PinboardTags, integration.PinboardMarkAsUnread)
|
||||
if err != nil {
|
||||
log.Println("[Pinboard]", err)
|
||||
}
|
||||
}
|
||||
|
||||
if integration.InstapaperEnabled {
|
||||
client := instapaper.NewClient(integration.InstapaperUsername, integration.InstapaperPassword)
|
||||
err := client.AddURL(entry.URL, entry.Title)
|
||||
if err != nil {
|
||||
log.Println("[Instapaper]", err)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue