 
 (defn users
   []
-  (find-all-docs "user"))
+  (find-docs "user"))
 
 (defn user
   [id]


;; Docker user

(defn docker-users
  []
  (find-all-docs "dockeruser"))

(defn docker-user
  [id]
  (get-doc id))

(defn docker-user-by-name
  [username]
  (find-doc {:username {"$eq" username}} "dockeruser"))

(defn create-docker-user
  [docker-user]
  (create-doc docker-user))

(defn delete-docker-user
  [docker-user]
  (delete-doc docker-user))

;; Registry

(defn registries
  []
  (find-all-docs "registry"))

(defn registry
  [id]
  (get-doc id))

(defn registry-by-name
  [name]
  (find-doc {:name {"$eq" name}} "registry"))

(defn create-registry
  [registry]

                 :query-params params}]
    (execute @(http/delete url options))))

(defn get-doc
  [id]
  (try
    (get (str "/swarmpit/" id))
    (catch Exception _)))

(defn create-doc
  [doc]
  (post "/swarmpit" doc))

(defn find-docs
  ([type]
   (find-docs nil type))
  ([query type]
   (->> {:selector (merge query {:type {"$eq" type}})}
        (post "/swarmpit/_find")
        :docs)))

(defn find-doc
  [query type]
  (first (find-docs query type)))

(defn delete-doc
  [doc]
  (let [url (str "/swarmpit/" (:_id doc))]
    (delete url {:rev (:_rev doc)})))

(defn update-doc
  ([doc delta]
   (let [url (str "/swarmpit/" (:_id doc))]
     (put url (merge doc delta))))
