Skip to content

Instantly share code, notes, and snippets.

@bamboo
Created June 14, 2011 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bamboo/1025495 to your computer and use it in GitHub Desktop.
Save bamboo/1025495 to your computer and use it in GitHub Desktop.
interacting with fogbugz using clojure
(ns fogbugz
(:use [clojure.xml :as xml]))
(def *base-url* "https://intra.unity3d.com/fogbugz/api.asp?")
(defn query-string-from-map [m]
(apply str (interpose "&" (for [[key value] m] (str (name key) "=" value)))))
(defn rest-call [args]
(let [query-string (query-string-from-map args)]
(xml/parse (str *base-url* query-string))))
(defn rest-call-with-response [args]
(let [response (rest-call args)]
(-> response :content first :content)))
(defn logon [email password]
(let [response (rest-call-with-response {:cmd "logon" :email email :password password})
token (first response)]
token))
(defn release-notes-for [token version]
(let [response (rest-call-with-response {:token token :cmd "search" :q (str "fixfor:" version " and status:closed") :cols "sReleaseNotes"})
bugs (map :content response)]
bugs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment