(ns ird.pins
"The standard IPFS Pinning Service API (1.0.0) served at /pins — the same
pins as ird.ipfs but with the spec's {:count :results} envelope and
requestid addressing, so standard tooling works:
ipfs pin remote service add ird https://api.ird.ro ird_...
Use ird.ipfs for the richer native API."
(:require
[ird.transport :as transport]))
(defn list-pins
"GET /pins — List pin objects (Pinning Service API).
Optional QUERY keys include :cid, :name, :match, :status, :before,
:after, :limit.
Returns the parsed response map ({:count :results})."
([client] (list-pins client nil))
([client query]
(transport/request client :get "/pins" {:query query})))
(defn add-pin
"POST /pins — Add a pin (Pinning Service API, 202).
BODY keys include :cid, :name, :origins, :meta.
Returns the parsed pin status object."
[client body]
(transport/request client :post "/pins" {:body body}))
(defn get-pin
"GET /pins/{requestid} — Pin object (Pinning Service API).
Returns the parsed pin status object."
[client requestid]
(transport/request client :get (str "/pins/" requestid)))
(defn replace-pin
"POST /pins/{requestid} — Replace a pin (Pinning Service API, 202).
BODY keys include :cid, :name, :origins, :meta.
Returns the parsed pin status object."
[client requestid body]
(transport/request client :post (str "/pins/" requestid) {:body body}))
(defn remove-pin
"DELETE /pins/{requestid} — Remove a pin (Pinning Service API, 202).
Returns the parsed response map."
[client requestid]
(transport/request client :delete (str "/pins/" requestid)))