meyvn.nrepl_middleware.maven.clj Maven / Gradle / Ivy
The newest version!
(ns meyvn.nrepl-middleware.maven
(:require [clj-http.client :as client]
[clojure.string :as str]))
(def api-endpoint "http://search.maven.org/solrsearch/select")
(defn catalog []
(let [resp (-> (client/get api-endpoint {:as :auto
:query-params {:q "g:org.clojure"
:rows 100
:wt "json"}})
:body
:response
:docs)]
(map (comp #(str/replace % ":" "/") :id) resp)))
(defn versions [artifact]
(let [[group-id artifact-id] (str/split artifact #"/" )
resp (-> (client/get api-endpoint {:as :auto
:query-params {:q (str "g:" group-id " AND a:" artifact-id)
:rows 20
:core "gav"
:wt "json"}})
:body
:response
:docs)]
(->> resp
(map (juxt :g :a :v))
(map (fn [[g a v]] (str g "/" a " " v)))
(str/join "\n"))))
© 2015 - 2024 Weber Informatics LLC | Privacy Policy