aboutsummaryrefslogtreecommitdiff
path: root/src/feednim.nim
diff options
context:
space:
mode:
authorJohn Conway <john.a.conway@gmail.com>2019-05-08 10:39:04 +0100
committerJohn Conway <john.a.conway@gmail.com>2019-05-08 10:39:04 +0100
commit5b476f97ecad45e90490d510932fd90b975543bf (patch)
treedde00155c17713a5d58010240ac1cb43ba53888a /src/feednim.nim
parentf45b14403744f99ae265cff2e05e98e74836e501 (diff)
downloadfeed-nim-5b476f97ecad45e90490d510932fd90b975543bf.tar.gz
feed-nim-5b476f97ecad45e90490d510932fd90b975543bf.zip
Fixing imports
Diffstat (limited to 'src/feednim.nim')
-rw-r--r--src/feednim.nim38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/feednim.nim b/src/feednim.nim
index 4b2a270..be9832d 100644
--- a/src/feednim.nim
+++ b/src/feednim.nim
@@ -1,7 +1,33 @@
-# This is just an example to get you started. A typical library package
-# exports the main API in this file. Note that you cannot rename this file
-# but you can remove it if you wish.
+import httpclient
-proc add*(x, y: int): int =
- ## Adds two files together.
- return x + y
+import feednim/atom
+import feednim/rss
+import feednim/jsonfeed
+
+proc loadAtom*(filename: string): Atom = ## Loads the Atom from the given ``filename``.
+ var Atom: string = readFile(filename) # Load the data from the file.
+ return parseAtom(Atom)
+
+
+proc getAtom*(url: string): Atom = ## Gets the Atom over from the specified ``url``.
+ var Atom: string = newHttpClient().getContent(url) # Get the data.
+ return parseAtom(Atom)
+
+
+proc loadRSS*(filename: string): Rss = ## Loads the RSS from the given ``filename``.
+ var rss: string = readFile(filename) # Load the data from the file.
+ return parseRSS(rss)
+
+
+proc getRSS*(url: string): Rss = ## Gets the RSS over from the specified ``url``.
+ var rss: string = newHttpClient().getContent(url) # Get the data.
+ return parseRSS(rss)
+
+proc loadJsonFeed*(filename: string): JsonFeed = ## Loads the JSONFeed from the given ``filename``.
+ var jsonFeed: string = readFile(filename) # Load the data from the file.
+ return parseJSONFeed(jsonFeed)
+
+
+proc getJsonFeed*(url: string): JsonFeed = ## Gets the JSONFeed over from the specified ``url``.
+ var jsonFeed: string = newHttpClient().getContent(url) # Get the data.
+ return parseJSONFeed(jsonFeed) \ No newline at end of file