cljs.git

ird-cljs — ClojureScript client for the ird public API on Node.js: .ro domains, DNS, VPS, tunnels, IPFS, P2P apps, and async jobs. Every one of the API's 161 operations is a small documented function returning a core.async channel, verified one-to-one against the OpenAPI spec by the test suite. Source-only; runtime dependencies are ClojureScript and core.async.

Use as a dependency

No registry — add the git URL to your deps.edn and let shadow-cljs read it. Any of its Node targets works (:node-script, :node-library, :esm with :keep-native-requires); so does a vanilla ClojureScript build with :target :nodejs.

;; deps.edn
{:paths ["src"]
 :deps {ro.ird/ird-cljs {:git/url "https://ird.cod-sursa.ro/cljs.git"
                         :git/tag "v0.1.0"
                         :git/sha "cf4fe34"}
        thheller/shadow-cljs {:mvn/version "3.5.0"}}}

;; shadow-cljs.edn  (shadow-cljs 3.5.0 in package.json devDependencies too)
{:deps true
 :builds {:app {:target :node-script :main my.app/main
                :output-to "out/app.js"}}}

That is the latest release. To track the newest commit instead, pin :git/sha "…" (or ask the mirror: git ls-remote https://ird.cod-sursa.ro/cljs.git HEAD). The same coordinates are machine-readable in releases.json.

Clone

git clone https://ird.cod-sursa.ro/cljs.git

browse the source in your browser →

Quickstart

(require '[cljs.core.async :refer [go <!]]
         '[ird.async :refer [<?]]
         '[ird.client :as ird]
         '[ird.domains :as domains]
         '[ird.errors :as err])

(def c (ird/make-client {:api-key (.. js/process -env -IRD_API_KEY)}))

;; every call returns a channel delivering one value:
;; the response map, or an ExceptionInfo
(go (let [r (<! (domains/check c "example.ro"))]
      (if (err/error? r)
        (println "failed:" (ex-message r))
        (println (:status r)))))
;; => registered

;; or let <? throw inside the go block
(go (try (println (:status (<? (domains/check c "example.ro"))))
         (catch :default e (println "failed:" (ex-message e)))))

The full guide — authentication, errors as values, the domain safety gate, pagination, async jobs, IPFS uploads, the p2p mailbox, tests — is in the repo's README.md.

What's inside

License

MIT.