From 351049310fc93ea3da47efaa6f905414017b35fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=9E=E3=83=AA=E3=82=A6=E3=82=B9?= Date: Wed, 4 Jan 2023 21:41:41 -0500 Subject: [PATCH] Updated systems to include list.Item funcs --- system/discourse/discourse.go | 18 ++++++++++++++++++ system/hackernews/hackernews.go | 17 +++++++++++++++++ system/lemmy/lemmy.go | 18 ++++++++++++++++++ system/system.go | 4 ++++ 4 files changed, 57 insertions(+) diff --git a/system/discourse/discourse.go b/system/discourse/discourse.go index 550d9dd..7c612ff 100644 --- a/system/discourse/discourse.go +++ b/system/discourse/discourse.go @@ -2,6 +2,7 @@ package discourse import ( "context" + "fmt" "net/http" "strconv" "time" @@ -63,6 +64,23 @@ func (sys *System) GetCapabilities() []adapter.Capability { return caps } +func (sys *System) FilterValue() string { + return fmt.Sprintf( + "Discourse %s", + sys.config["url"], + ) +} + +func (sys *System) Title() string { + return sys.config["url"].(string) +} + +func (sys *System) Description() string { + return fmt.Sprintf( + "Discourse", + ) +} + func (sys *System) Load() error { url := sys.config["url"] if url == nil { diff --git a/system/hackernews/hackernews.go b/system/hackernews/hackernews.go index f3b7700..04a9203 100644 --- a/system/hackernews/hackernews.go +++ b/system/hackernews/hackernews.go @@ -3,6 +3,7 @@ package hackernews import ( "context" "errors" + "fmt" "strconv" "time" @@ -62,6 +63,22 @@ func (sys *System) GetCapabilities() []adapter.Capability { return caps } +func (sys *System) FilterValue() string { + return fmt.Sprintf( + "Hacker News https://news.ycombinator.com", + ) +} + +func (sys *System) Title() string { + return "https://news.ycombinator.com" +} + +func (sys *System) Description() string { + return fmt.Sprintf( + "Hacker News", + ) +} + func (sys *System) Load() error { sys.client = hn.NewClient() return nil diff --git a/system/lemmy/lemmy.go b/system/lemmy/lemmy.go index d2bf318..ab95d02 100644 --- a/system/lemmy/lemmy.go +++ b/system/lemmy/lemmy.go @@ -2,6 +2,7 @@ package lemmy import ( "context" + "fmt" "strconv" "time" @@ -62,6 +63,23 @@ func (sys *System) GetCapabilities() []adapter.Capability { return caps } +func (sys *System) FilterValue() string { + return fmt.Sprintf( + "Lemmy %s", + sys.config["url"], + ) +} + +func (sys *System) Title() string { + return sys.config["url"].(string) +} + +func (sys *System) Description() string { + return fmt.Sprintf( + "Lemmy", + ) +} + func (sys *System) Load() error { var err error diff --git a/system/system.go b/system/system.go index 3df4bde..b319742 100644 --- a/system/system.go +++ b/system/system.go @@ -20,6 +20,10 @@ type System interface { SetLogger(logger *zap.SugaredLogger) GetCapabilities() []adapter.Capability + FilterValue() string + Title() string + Description() string + Connect(sysURL string) error Load() error