aboutsummaryrefslogtreecommitdiff
path: root/src/lib.lisp
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2022-02-18 17:00:55 -0600
committerColin Okay <okay@toyful.space>2022-02-18 17:00:55 -0600
commit13d628d008584dff9465a9fb48e4e57e74bf7643 (patch)
tree67b930c36320c0438debb5315db3e427bc50a0be /src/lib.lisp
parent4d2afc4e3c6cc5ce5be4f0d421da49ca6cead09a (diff)
working on invite functions
Diffstat (limited to 'src/lib.lisp')
-rw-r--r--src/lib.lisp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lib.lisp b/src/lib.lisp
index 720ff85..a54cf7f 100644
--- a/src/lib.lisp
+++ b/src/lib.lisp
@@ -63,8 +63,28 @@
(when (uiop:file-exists-p (last-search-file))
(nth n (uiop:read-file-form (last-search-file)))))
+(defun make-cookie-from-api-token ()
+ (a:when-let (token (api-token))
+ (let ((cookies (cl-cookie:make-cookie-jar)))
+ (cl-cookie:merge-cookies
+ cookies
+ (list
+ (cl-cookie:make-cookie
+ :name "olauthtoken"
+ :value token
+ :path "/"
+ :domain "localhost")))
+ cookies)))
+
;;; API REQUEST FUNCTIONS
+(defun request-invite-code ()
+ (ensure-config)
+ (api:request-with
+ (:host (host)
+ :cookies (make-cookie-from-api-token))
+ (format t "Invite Code: ~a~%" (getf (jonathan:parse (api:post--make-invite)) :code))))
+
(defun login (user pass)
(ensure-config)
(a:when-let (response (jonathan:parse