summaryrefslogtreecommitdiffstats
path: root/schema/schema.go
diff options
context:
space:
mode:
authorsiddharth <s@ricketyspace.net>2021-11-27 18:53:20 -0500
committersiddharth <s@ricketyspace.net>2021-11-27 18:53:20 -0500
commitbbad7a046f33a5081f6bbede0c995bddb97be87d (patch)
tree4b43496d299ad902d638cb8cae6dc9c050f9c810 /schema/schema.go
parentf40528802fa5deba941a04746e70a81f72ccf280 (diff)
add schema package
Diffstat (limited to 'schema/schema.go')
-rw-r--r--schema/schema.go47
1 files changed, 47 insertions, 0 deletions
diff --git a/schema/schema.go b/schema/schema.go
new file mode 100644
index 0000000..44161ce
--- /dev/null
+++ b/schema/schema.go
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: ISC
+// Copyright © 2021 siddharth <s@ricketyspace.net>
+
+package schema
+
+import (
+ "encoding/xml"
+ "time"
+)
+
+// NPR Feed Schema
+type NPRLink struct {
+ XMLName xml.Name `xml:"link"`
+ Url string `xml:",chardata"`
+}
+
+type NPREntry struct {
+ XMLName xml.Name `xml:"item"`
+ Id string `xml:"guid"`
+ Pub string `xml:"pubDate"` // RFC1123Z
+ PubTime time.Time
+ Link NPRLink `xml:"link"`
+}
+
+type NPRFeed struct {
+ XMLName xml.Name `xml:"rss"`
+ Entries []NPREntry `xml:"channel>item"`
+}
+
+// YouTube Feed Schema
+type YouTubeLink struct {
+ XMLName xml.Name `xml:"content"`
+ Url string `xml:"url,attr"`
+}
+
+type YouTubeEntry struct {
+ XMLName xml.Name `xml:"entry"`
+ Id string `xml:"id"`
+ Pub string `xml:"published"` // RFC3339
+ PubTime time.Time
+ Link YouTubeLink `xml:"group>content"`
+}
+
+type YouTubeFeed struct {
+ XMLName xml.Name `xml:"feed"`
+ Entries []YouTubeEntry `xml:"entry"`
+}