Skip to content

Instantly share code, notes, and snippets.

@csaunders
Created September 24, 2011 02:55
Show Gist options
  • Save csaunders/1238896 to your computer and use it in GitHub Desktop.
Save csaunders/1238896 to your computer and use it in GitHub Desktop.
Parsing RTM Responses
(defn get-lists
"Calls the rtm api to retrieve lists, returning the attributes from the xml"
[state]
(if-let [list-xml (xml/to-xml (api/rtm-lists-getList state))]
(for [x (xml-seq list-xml) :when (= :list (:tag x))]
(:attrs x))))
<lists>
<list id="100653" name="Inbox"
deleted="0" locked="1" archived="0" position="-1" smart="0" />
<list id="387549" name="High Priority"
deleted="0" locked="0" archived="0" position="0" smart="1">
<filter>(priority:1)</filter>
</list>
<list id="387546" name="New List"
deleted="0" locked="0" archived="0" position="0" smart="0" />
<list id="100654" name="Personal"
deleted="0" locked="0" archived="0" position="0" smart="0" />
<list id="100655" name="Study"
deleted="0" locked="0" archived="0" position="0" smart="0" />
<list id="100656" name="Work"
deleted="0" locked="0" archived="0" position="0" smart="0" />
<list id="100657" name="Sent"
deleted="0" locked="1" archived="0" position="1" smart="0" />
</lists>
({:id "8019913", :name "Inbox", :deleted "0", :locked "1", :archived "0", :position "-1", :smart "0", :sort_order "0"} {:id "8019914", :name "Personal", :deleted "0", :locked "0", :archived "0", :position "0", :smart "0", :sort_order "0"} {:id "8019915", :name "Study", :deleted "0", :locked "0", :archived "0", :position "0", :smart "0", :sort_order "0"} {:id "8019916", :name "Work", :deleted "0", :locked "0", :archived "0", :position "0", :smart "0", :sort_order "0"} {:id "8019917", :name "Sent", :deleted "0", :locked "1", :archived "0", :position "1", :smart "0", :sort_order "0"} {:id "8019918", :name "All Tasks", :deleted "0", :locked "0", :archived "0", :position "0", :smart "1", :sort_order "0"} {:id "21096155", :name "Chore War", :deleted "0", :locked "0", :archived "0", :position "0", :smart "0", :sort_order "1"})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment