 
 (defn set
   "Sets a vaue to key, optional param :ttl"
-  [key val & {:keys [ttl]}]
-  (let [params (compose-params :ttl ttl :val val)
+  [key val & {:keys [ttl prev-value prev-index prev-exist]}]
+  (let
+      [params (compose-params
+                :ttl ttl
+                :val val
+                :prev-value prev-value
+                :prev-index prev-index
+                :prev-exist prev-exist)
         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-exists]}]
  (let [params (compose-params
                :ttl ttl
                :prev-value prev-value
                :prev-index prev-index
                :prev-exists prev-exists
                :dir true)
        url (str (base-url) "/keys/" key)]
    (get-in (send-json http/put url {:form-params params}) ["node" "key"])))

     `(parse-string (:body (~method ~base ~data)))))

(defn compose-params
  [& {:keys [ttl prev-value prev-index prev-exist dir val]}]
  (cond->
   {}
   val (assoc :value val)
