Add name calls

This commit is contained in:
Jaidyn Levesque 2019-06-18 02:57:12 -05:00
parent 7f7dd859d1
commit 813e780f83
2 changed files with 34 additions and 0 deletions

View File

@ -665,6 +665,35 @@
;; —————————————————————————————————————
;; NAME CALLS
;; STRING [:BOOLEAN :STRING :BOOLEAN :STRING] → ALIST || (NIL STRING)
(defun name-publish (ipfs-path &key (resolve 'T) (lifetime "24h")
(allow-offline 'T) (ttl nil))
"Publish an IPNS name-- associate it with an IPFS path.
/ipns/docs.ipfs.io/reference/api/http/#api-v0-name-publish"
(bind-api-alist
(ipfs-call "name/publish" `(("arg" ,ipfs-path)("resolve" ,resolve)
("lifetime" ,lifetime)
("allow-offline" ,allow-offline)
,(if ttl (list "ttl" ttl))))))
;; STRING → ALIST || (NIL STRING)
(defun name-pubsub-cancel (name)
"Cancel subscription to a name.
/ipns/docs.ipfs.io/reference/api/http/#api-v0-name-pubsub-cancel"
(bind-api-alist (ipfs-call "name/pubsub/cancel" `(("arg" ,name)))))
;; NIL → ALIST || (NIL STRING)
(defun name-pubsub-state ()
"Query the state of IPNS pubsub.
/ipns/docs.ipfs.io/reference/api/http/#api-v0-name-pubsub-state"
(bind-api-alist (ipfs-call "name/pubsub/state" '())))
;; —————————————————————————————————————
;; PUBSUB CALLS

View File

@ -94,6 +94,11 @@
:log-ls
:log-tail
;; name calls
:name-publish
:name-pubsub-cancel
:name-pubsub-state
;; pubsub calls
:pubsub-sub
:pubsub-sub-process