Documentation ¶
Index ¶
- Variables
- func DeleteRssSubscription(url string, identifier string)
- func GetSubscriptions(identifier string) []string
- func NewRssSubscription(url string, identifier string)
- func NewTelegramMessage(title string, description string, url string, feedTitle string, ...) string
- func NewTelegramNotificationChannel(identifier string)
- func ProcessChannelEventUntilContextDone(processor func(), ctx context.Context)
- func Run()
- func RunPeriodically(toRun func(), interval time.Duration, wg *sync.WaitGroup, ctx context.Context)
- type Configuration
- type Feed
- type FeedProcessor
- func (feedProcessor *FeedProcessor) Close()
- func (feedProcessor *FeedProcessor) FetchUpdates()
- func (feedProcessor *FeedProcessor) NotifySubscribers(feedProcessorUpdate FeedUpdate)
- func (feedProcessor *FeedProcessor) Run()
- func (feedProcessor *FeedProcessor) Subscribe(observer Observer) bool
- func (feedProcessor *FeedProcessor) SyncUserProcessors()
- func (feedProcessor *FeedProcessor) Unsubscribe(observer Observer)
- type FeedProcessors
- type FeedUpdate
- type FeedUpdateGenerator
- type History
- type NotificationChannel
- type Observable
- type Observer
- type RssFeedUpdateGenerator
- type TelegramBotAPI
- type TelegramNotificationChannel
- type User
- type UserFeed
- type UserProcessor
- func (userProcessor *UserProcessor) Close()
- func (userProcessor *UserProcessor) Id() uint
- func (userProcessor *UserProcessor) Notify(feedProcessorUpdate FeedUpdate)
- func (userProcessor *UserProcessor) NotifySubscribers(feedProcessorUpdate FeedUpdate)
- func (userProcessor *UserProcessor) Run()
- func (userProcessor *UserProcessor) Subscribe(observer Observer) bool
- func (userProcessor *UserProcessor) SyncNotificationChannels()
- func (userProcessor *UserProcessor) Unsubscribe(observer Observer)
Constants ¶
This section is empty.
Variables ¶
View Source
var TelegramBotApiBotOnce = &sync.Once{}
View Source
var TelegramBotApiSingleton *tgbotapi.BotAPI
Telegram Bot api instance should be created only once to avoid duplicate messagees
View Source
var TelegramSendMessageLock = &sync.Mutex{}
Functions ¶
func DeleteRssSubscription ¶
func GetSubscriptions ¶
func NewRssSubscription ¶
func NewTelegramMessage ¶
func NewTelegramNotificationChannel ¶
func NewTelegramNotificationChannel(identifier string)
Types ¶
type Configuration ¶
type FeedProcessor ¶
type FeedProcessor struct {
// contains filtered or unexported fields
}
func (*FeedProcessor) Close ¶
func (feedProcessor *FeedProcessor) Close()
func (*FeedProcessor) FetchUpdates ¶
func (feedProcessor *FeedProcessor) FetchUpdates()
func (*FeedProcessor) NotifySubscribers ¶
func (feedProcessor *FeedProcessor) NotifySubscribers(feedProcessorUpdate FeedUpdate)
func (*FeedProcessor) Run ¶
func (feedProcessor *FeedProcessor) Run()
func (*FeedProcessor) Subscribe ¶
func (feedProcessor *FeedProcessor) Subscribe(observer Observer) bool
func (*FeedProcessor) SyncUserProcessors ¶
func (feedProcessor *FeedProcessor) SyncUserProcessors()
func (*FeedProcessor) Unsubscribe ¶
func (feedProcessor *FeedProcessor) Unsubscribe(observer Observer)
type FeedProcessors ¶
func (*FeedProcessors) Update ¶
func (feedProcessors *FeedProcessors) Update()
type FeedUpdate ¶
type FeedUpdate struct {
// contains filtered or unexported fields
}
A single instance of a feed update, which is generated by the update generator and later passed all the way to the notification channel
func (*FeedUpdate) Hash ¶
func (feedUpdate *FeedUpdate) Hash() string
type FeedUpdateGenerator ¶
type FeedUpdateGenerator interface { Run() UpdatesChannel() chan FeedUpdate Close() }
type NotificationChannel ¶
type Observable ¶
type Observable interface { Subscribe(observer Observer) Unsubscribe(observer Observer) bool NotifySubscribers(feedProcessorUpdate FeedUpdate) }
Abstract observable object interface for observer pattern
type Observer ¶
type Observer interface { Id() uint Notify(feedProcessorUpdate FeedUpdate) }
Abstract observer pattern interface
type RssFeedUpdateGenerator ¶
type RssFeedUpdateGenerator struct { FeedId uint Updates chan FeedUpdate // contains filtered or unexported fields }
Implements FeedUpdateGenerator
func (*RssFeedUpdateGenerator) Close ¶
func (rssFeedUpdateGenerator *RssFeedUpdateGenerator) Close()
func (*RssFeedUpdateGenerator) Run ¶
func (rssFeedUpdateGenerator *RssFeedUpdateGenerator) Run()
func (*RssFeedUpdateGenerator) UpdatesChannel ¶
func (rssFeedUpdateGenerator *RssFeedUpdateGenerator) UpdatesChannel() chan FeedUpdate
type TelegramBotAPI ¶
func (*TelegramBotAPI) HandleUpdates ¶
func (api *TelegramBotAPI) HandleUpdates(ctx context.Context)
func (*TelegramBotAPI) SendMessage ¶
func (api *TelegramBotAPI) SendMessage(idString string, message string) error
func (*TelegramBotAPI) Stop ¶
func (api *TelegramBotAPI) Stop()
type TelegramNotificationChannel ¶
type TelegramNotificationChannel struct {
// contains filtered or unexported fields
}
Concrete observer for updates from user processor
func (*TelegramNotificationChannel) Close ¶
func (notificationChannel *TelegramNotificationChannel) Close()
func (*TelegramNotificationChannel) Id ¶
func (notificationChannel *TelegramNotificationChannel) Id() uint
func (*TelegramNotificationChannel) Notify ¶
func (notificationChannel *TelegramNotificationChannel) Notify(feedProcessorUpdate FeedUpdate)
func (*TelegramNotificationChannel) Run ¶
func (notificationChannel *TelegramNotificationChannel) Run()
type UserProcessor ¶
type UserProcessor struct {
// contains filtered or unexported fields
}
Observer and observable concrete implementation for the user processor. It will listen for the feed updates and once received, will notify all the subscribed notification channels
func (*UserProcessor) Close ¶
func (userProcessor *UserProcessor) Close()
func (*UserProcessor) Id ¶
func (userProcessor *UserProcessor) Id() uint
func (*UserProcessor) Notify ¶
func (userProcessor *UserProcessor) Notify(feedProcessorUpdate FeedUpdate)
func (*UserProcessor) NotifySubscribers ¶
func (userProcessor *UserProcessor) NotifySubscribers(feedProcessorUpdate FeedUpdate)
func (*UserProcessor) Run ¶
func (userProcessor *UserProcessor) Run()
func (*UserProcessor) Subscribe ¶
func (userProcessor *UserProcessor) Subscribe(observer Observer) bool
func (*UserProcessor) SyncNotificationChannels ¶
func (userProcessor *UserProcessor) SyncNotificationChannels()
func (*UserProcessor) Unsubscribe ¶
func (userProcessor *UserProcessor) Unsubscribe(observer Observer)
Click to show internal directories.
Click to hide internal directories.