diff options
author | Frédéric Guillot <fred@miniflux.net> | 2017-12-02 21:12:03 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2017-12-02 21:12:03 -0800 |
commit | ae62e543d3a1173cd39f1910cb67c95a56a7a6a4 (patch) | |
tree | e086a53f0ad609b648e523dc5198a4d48430ab91 /integration/integration.go | |
parent | 6f5350a4978c7ef6fa68e526ec8a2ba917d33953 (diff) |
Add Instapaper integration
Diffstat (limited to 'integration/integration.go')
-rw-r--r-- | integration/integration.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/integration/integration.go b/integration/integration.go new file mode 100644 index 0000000..074ce6d --- /dev/null +++ b/integration/integration.go @@ -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) + } + } +} |