summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaidyn Levesque <jadedctrl@teknik.io>2019-06-18 17:18:08 +0000
committerJaidyn Levesque <jadedctrl@teknik.io>2019-06-18 17:18:08 +0000
commit47be6a3f8c3788aef7d18d4904e74f291c6d9492 (patch)
tree6ff34c7f1eee0fec96dfdbfc49deffd7e2754e34
parenta86e0e015f5878bcb1a46f5ae340563d4199a2bc (diff)
downloadcl-ipfs-api2-47be6a3f8c3788aef7d18d4904e74f291c6d9492.tar.bz2
cl-ipfs-api2-47be6a3f8c3788aef7d18d4904e74f291c6d9492.zip
Add pin calls
-rw-r--r--main.lisp41
-rw-r--r--package.lisp7
2 files changed, 48 insertions, 0 deletions
diff --git a/main.lisp b/main.lisp
index 7fde225..1535464 100644
--- a/main.lisp
+++ b/main.lisp
@@ -852,6 +852,47 @@
;; —————————————————————————————————————
+;; PIN CALLS
+
+;; STRING [:BOOLEAN] → ALIST || (NIL STRING)
+(defun pin-add (path &key (recursive 'T))
+ "Pin an object to local storage.
+ /ipns/docs.ipfs.io/reference/api/http/#api-v0-pin-add"
+ (bind-api-alist
+ (ipfs-call "pin/add" `(("arg" ,path)("recursive" ,recursive)))))
+
+;; [:STRING :STRING] → ALIST || (NIL STRING)
+(defun pin-ls (&key (path nil) (type "all"))
+ "List objects pinned to local storage.
+ /ipns/docs.ipfs.io/reference/api/http/#api-v0-pin-ls"
+ (bind-api-alist
+ (ipfs-call "pin/ls" `(,(when path `("arg" ,path)) ("type" ,type)))))
+
+;; STRING [:BOOLEAN] → ALIAS || (NIL STRING)
+(defun pin-rm (path &key (recursive 'T))
+ "Remove pinned objects from local storage.
+ /ipns/docs.ipfs.io/reference/api/http/#api-v0-pin-rm"
+ (bind-api-alist
+ (ipfs-call "pin/rm" `(("arg" ,path)("recursive" ,recursive)))))
+
+;; STRING STRING [:BOOLEAN] → ALIST || (NIL STRING)
+(defun pin-update (old-path new-path &key (unpin 'T))
+ "Update a recursive pin.
+ /ipns/docs.ipfs.io/reference/api/http/#api-v0-pin-update"
+ (bind-api-alist
+ (ipfs-call "pin/update"
+ `(("arg" ,old-path)("arg" ,new-path)("unpin" ,unpin)))))
+
+;; NIL → ALIST || (NIL STRING)
+(defun pin-verify ()
+ "Verify that recursive pins are complete.
+ /ipns/docs.ipfs.io/reference/api/http/#api-v0-pin-verify"
+ (bind-api-alist (ipfs-call "pin/verify" '())))
+
+
+
+
+;; —————————————————————————————————————
;; PUBSUB CALLS
;; STRING [:STRING] → PROCESS-INFO-STREAM
diff --git a/package.lisp b/package.lisp
index 6234bba..97f1545 100644
--- a/package.lisp
+++ b/package.lisp
@@ -119,6 +119,13 @@
:p2p-stream-close
:p2p-stream-ls
+ ;; pin calls
+ :pin-add
+ :pin-ls
+ :pin-rm
+ :pin-update
+ :pin-verify
+
;; pubsub calls
:pubsub-sub
:pubsub-sub-process