      `(parse-string (:body (~method ~base ~data)))))
 
 (defn compose-params
-  [& {:keys [ttl prev-value prev-index prev-exists dir val]}]
+  [& {:keys [ttl prev-value prev-index prev-exist dir val]}]
   (cond->
    {}
    val (assoc :value val)


(defn set
  "Sets a vaue to key, optional param :ttl"
  [key val & {:keys [ttl]}]
  (let [params (compose-params :ttl ttl :val val)
        url (str (base-url) "/keys/" key)]
    (get-in (send-json http/put url {:form-params params}) ["node" "value"])))



(defn create-dir
  "Creates a dir"
  [key & {:keys [ttl prev-value prev-index prev-exist]}]
  (let [params (compose-params
                :ttl ttl
                :prev-value prev-value
                :prev-index prev-index
                :prev-exist prev-exist
                :dir true)
        url (str (base-url) "/keys/" key)]
    (get-in (send-json http/put url {:form-params params}) ["node" "key"])))
