Browse code

Add name calls

Jaidyn Levesque authored on 2019-06-18 07:57:12
Showing 2 changed files
... ...
@@ -665,6 +665,35 @@
665 665
 
666 666
 
667 667
 
668
+;; —————————————————————————————————————
669
+;; NAME CALLS
670
+
671
+;; STRING [:BOOLEAN :STRING :BOOLEAN :STRING] → ALIST || (NIL STRING)
672
+(defun name-publish (ipfs-path &key (resolve 'T) (lifetime "24h")
673
+			       (allow-offline 'T) (ttl nil))
674
+  "Publish an IPNS name-- associate it with an IPFS path.
675
+   /ipns/docs.ipfs.io/reference/api/http/#api-v0-name-publish"
676
+  (bind-api-alist
677
+    (ipfs-call "name/publish" `(("arg" ,ipfs-path)("resolve" ,resolve)
678
+				("lifetime" ,lifetime)
679
+				("allow-offline" ,allow-offline)
680
+				,(if ttl (list "ttl" ttl))))))
681
+
682
+;; STRING → ALIST || (NIL STRING)
683
+(defun name-pubsub-cancel (name)
684
+  "Cancel subscription to a name.
685
+  /ipns/docs.ipfs.io/reference/api/http/#api-v0-name-pubsub-cancel"
686
+  (bind-api-alist (ipfs-call "name/pubsub/cancel" `(("arg" ,name)))))
687
+
688
+;; NIL → ALIST || (NIL STRING)
689
+(defun name-pubsub-state ()
690
+  "Query the state of IPNS pubsub.
691
+  /ipns/docs.ipfs.io/reference/api/http/#api-v0-name-pubsub-state"
692
+  (bind-api-alist (ipfs-call "name/pubsub/state" '())))
693
+
694
+
695
+
696
+
668 697
 ;; —————————————————————————————————————
669 698
 ;; PUBSUB CALLS
670 699
 
... ...
@@ -94,6 +94,11 @@
94 94
     :log-ls
95 95
     :log-tail
96 96
 
97
+    ;; name calls
98
+    :name-publish
99
+    :name-pubsub-cancel
100
+    :name-pubsub-state
101
+
97 102
     ;; pubsub calls
98 103
     :pubsub-sub
99 104
     :pubsub-sub-process