Liking cljdoc? Tell your friends :D

swh.api.v1

Minimal client for the Software Heritage Web API (https://archive.softwareheritage.org/api/1/).

Every function takes an optional opts map as last argument: {:base-url "https://archive.softwareheritage.org/api/1" ; default :token "…" ; SWH bearer token (raises rate limits) :timeout-ms 60000 ; per request; default 60 s :keywordize? true ; keyword keys in parsed responses :request f} ; testing hook: replaces the HTTP call

Responses are parsed JSON. HTTP errors throw ex-info with :status and :path in their ex-data; a 429 also carries {:rate-limited true :retry-after <seconds>}.

The X-RateLimit-* headers of a response are exposed as {:rate-limit {:limit <n> :remaining <n> :reset <epoch seconds>}} in the metadata of the result when it is a map or a vector (a nil result carries none), and in the ex-data of HTTP errors. A key is absent when its header is missing or not a number.

Runs on the JVM and Babashka (babashka.http-client and cheshire are built into bb).

Minimal client for the Software Heritage Web API
(https://archive.softwareheritage.org/api/1/).

Every function takes an optional `opts` map as last argument:
  {:base-url    "https://archive.softwareheritage.org/api/1" ; default
   :token       "…"   ; SWH bearer token (raises rate limits)
   :timeout-ms  60000  ; per request; default 60 s
   :keywordize? true  ; keyword keys in parsed responses
   :request     f}     ; testing hook: replaces the HTTP call

Responses are parsed JSON. HTTP errors throw ex-info with :status and
:path in their ex-data; a 429 also carries {:rate-limited true
:retry-after <seconds>}.

The X-RateLimit-* headers of a response are exposed as
{:rate-limit {:limit <n> :remaining <n> :reset <epoch seconds>}}
in the metadata of the result when it is a map or a vector (a nil
result carries none), and in the ex-data of HTTP errors. A key is
absent when its header is missing or not a number.

Runs on the JVM and Babashka (babashka.http-client and cheshire are
built into bb).
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close