summaryrefslogtreecommitdiff
path: root/internal/types
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-09-21 13:42:36 +0300
committerPaul Buetow <paul@buetow.org>2024-09-21 13:42:36 +0300
commit780ade3dc066afb8a43be824373414f3d316ebd6 (patch)
tree5b2e1f1a478bcc5469e4f0456f13464062c8e2a4 /internal/types
parent5263e61d5667009e7a7ac13014cec73ccbd0e20a (diff)
jo
Diffstat (limited to 'internal/types')
-rw-r--r--internal/types/platformname.go9
-rw-r--r--internal/types/shared.go29
2 files changed, 38 insertions, 0 deletions
diff --git a/internal/types/platformname.go b/internal/types/platformname.go
new file mode 100644
index 0000000..e94d422
--- /dev/null
+++ b/internal/types/platformname.go
@@ -0,0 +1,9 @@
+package types
+
+type PlatformName = string
+
+const (
+ Mastodon PlatformName = "Mastodon"
+ LinkedIn PlatformName = "LinkedIn"
+ Textfile PlatformName = "Textfile"
+)
diff --git a/internal/types/shared.go b/internal/types/shared.go
new file mode 100644
index 0000000..c2d5a65
--- /dev/null
+++ b/internal/types/shared.go
@@ -0,0 +1,29 @@
+package types
+
+import (
+ "fmt"
+ "time"
+)
+
+type UnixEpoch int64
+
+// Tells me whether the entry was Shared to the sm platform named Name
+type Shared struct {
+ Is bool `json:"is,omitempty"`
+ Timestamp UnixEpoch `json:"timestamp,omitempty"`
+}
+
+func newShared(is bool) Shared {
+ return Shared{
+ Is: is,
+ Timestamp: UnixEpoch(time.Now().Unix()),
+ }
+}
+
+func (s Shared) String() string {
+ return fmt.Sprintf("Is:%v;Timestamp:%v", s.Is, s.Timestamp)
+}
+
+func (s Shared) Equals(other Shared) bool {
+ return s.Timestamp == other.Timestamp && s.Is == other.Is
+}