miniflux/integration/integration.go
Frédéric Guillot 1d8193b892 Add logger
2017-12-15 18:55:57 -08:00

31 lines
1 KiB
Go

// 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 (
"github.com/miniflux/miniflux/integration/instapaper"
"github.com/miniflux/miniflux/integration/pinboard"
"github.com/miniflux/miniflux/logger"
"github.com/miniflux/miniflux/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 {
logger.Error("[Pinboard] %v", err)
}
}
if integration.InstapaperEnabled {
client := instapaper.NewClient(integration.InstapaperUsername, integration.InstapaperPassword)
err := client.AddURL(entry.URL, entry.Title)
if err != nil {
logger.Error("[Instapaper] %v", err)
}
}
}