aboutsummaryrefslogtreecommitdiff
path: root/oneliners.api-client.lisp
diff options
context:
space:
mode:
authorColin Okay <okay@toyful.space>2022-02-28 11:47:26 -0600
committerColin Okay <okay@toyful.space>2022-02-28 11:47:26 -0600
commit670428d3c4fa8280fb415dad61badd4f283d3a55 (patch)
tree2ad321218ee11da8ac5e9d9e4867c99f9946a8cf /oneliners.api-client.lisp
parent30b5f65fd5c89dda8081058ab62da5e1d78335fe (diff)
new config creation wizard
Diffstat (limited to 'oneliners.api-client.lisp')
-rw-r--r--oneliners.api-client.lisp241
1 files changed, 162 insertions, 79 deletions
diff --git a/oneliners.api-client.lisp b/oneliners.api-client.lisp
index 0ac2940..e8e1d28 100644
--- a/oneliners.api-client.lisp
+++ b/oneliners.api-client.lisp
@@ -5,18 +5,22 @@
(defpackage #:ONELINERS.API-CLIENT
(:use :cl :lazybones-client.shared)
(:export #:*host* #:*body* #:*headers* #:*cookies* #:request-with
- #:GET--ONELINERS-ALL-FLAGGED
-#:GET--ONLINERS-ALL-FLAGGED
-#:GET--ONELINERS
+ #:GET--ONELINERS
+#:GET--ONELINERS-ALL-FLAGGED
+#:GET--ONELINERS-NEWEST
#:PUT--ONELINER-ENTRY-FLAG
#:PATCH--ONELINER-ENTRY-EDIT
#:PUT--ONELINER-ONELINER-LOCKED
#:POST--ONELINER
+#:DELETE--ONELINER-ONELINER
#:POST--INVITE
#:DELETE--ACCESS-ACCESS
#:POST--ACCESS
#:POST--INVITE-REDEEM-CODE
-#:PUT--CONTRIBUTOR-HANDLE-LOCKED))
+#:PUT--CONTRIBUTOR-WHO-SIGNATURE
+#:PUT--CONTRIBUTOR-WHO-PASSWORD
+#:PUT--CONTRIBUTOR-WHO-LOCKED
+#:GET--CONTRIBUTOR-WHO))
(in-package :ONELINERS.API-CLIENT)
@@ -65,29 +69,38 @@ COOKIES should be an instance of CL-COOKIE:COOKIE-JAR. Defaults to
(dex:response-body ,http-error-var)))))))
-(DEFUN GET--ONELINERS-ALL-FLAGGED (&KEY LIMIT)
- "A search endpoint returning all of the flagged oneliners. If LIMIT
- is present, only that many are returned."
+(DEFUN GET--ONELINERS (&KEY TAGS LIMIT NOTFLAGGED)
+ "A search endpoint returning a JSON encoded array of Oneliner
+Entries. TAGS cannot be empty. Returns a [Search
+Result](#search-result) object."
(LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING
(APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* "/api"
- (FORMAT NIL "/oneliners/all-flagged")
- (WHEN (OR LIMIT)
+ (FORMAT NIL "/oneliners")
+ (WHEN (OR TAGS LIMIT NOTFLAGGED)
(LIST "?"
+ (IF TAGS
+ (CONCATENATE 'STRING (SYMBOL-NAME 'TAGS) "="
+ (FORMAT NIL "~a" TAGS))
+ "")
(IF LIMIT
- (CONCATENATE 'STRING (SYMBOL-NAME 'LIMIT) "="
+ (CONCATENATE 'STRING "&" (SYMBOL-NAME 'LIMIT) "="
(FORMAT NIL "~a" LIMIT))
+ "")
+ (IF NOTFLAGGED
+ (CONCATENATE 'STRING "&" (SYMBOL-NAME 'NOTFLAGGED)
+ "=" (FORMAT NIL "~a" NOTFLAGGED))
""))))))
(DEXADOR:GET LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*)))
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*)))
-(DEFUN GET--ONLINERS-ALL-FLAGGED (&KEY LIMIT)
+(DEFUN GET--ONELINERS-ALL-FLAGGED (&KEY LIMIT)
"A search endpoint returning all of the flagged oneliners. If LIMIT
is present, only that many are returned."
(LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING
(APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* "/api"
- (FORMAT NIL "/onliners/all-flagged")
+ (FORMAT NIL "/oneliners/all-flagged")
(WHEN (OR LIMIT)
(LIST "?"
(IF LIMIT
@@ -95,38 +108,28 @@ COOKIES should be an instance of CL-COOKIE:COOKIE-JAR. Defaults to
(FORMAT NIL "~a" LIMIT))
""))))))
(DEXADOR:GET LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*)))
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*)))
-(DEFUN GET--ONELINERS (&KEY TAGS LIMIT NOTFLAGGED)
- "A search endpoint returning a JSON encoded array of Oneliner
-Entries. TAGS cannot be empty. Returns a [Search
-Result](#search-result) object."
+(DEFUN GET--ONELINERS-NEWEST (&KEY LIMIT)
+ "A search endpoint returning the LIMIT newest oneliners."
(LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING
(APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* "/api"
- (FORMAT NIL "/oneliners")
- (WHEN (OR TAGS LIMIT NOTFLAGGED)
+ (FORMAT NIL "/oneliners/newest")
+ (WHEN (OR LIMIT)
(LIST "?"
- (IF TAGS
- (CONCATENATE 'STRING (SYMBOL-NAME 'TAGS) "="
- (FORMAT NIL "~a" TAGS))
- "")
(IF LIMIT
- (CONCATENATE 'STRING "&" (SYMBOL-NAME 'LIMIT) "="
+ (CONCATENATE 'STRING (SYMBOL-NAME 'LIMIT) "="
(FORMAT NIL "~a" LIMIT))
- "")
- (IF NOTFLAGGED
- (CONCATENATE 'STRING "&" (SYMBOL-NAME 'NOTFLAGGED)
- "=" (FORMAT NIL "~a" NOTFLAGGED))
""))))))
(DEXADOR:GET LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*)))
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*)))
(DEFUN PUT--ONELINER-ENTRY-FLAG (ENTRY &KEY TOKEN VALUE)
- "Flag the oneliner for review."
+ "Flag / Unflag the oneliner for review."
(LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING
(APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* "/api"
(FORMAT NIL "/oneliner/~a/flag" ENTRY)
@@ -142,12 +145,12 @@ Result](#search-result) object."
""))))))
(IF LAZYBONES-CLIENT.SHARED:*BODY*
(DEXADOR:PUT LAZYBONES-CLIENT.SHARED::REQ-STRING :CONTENT
- LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*)
+ LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*)
(DEXADOR:PUT LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*))))
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*))))
(DEFUN PATCH--ONELINER-ENTRY-EDIT (ENTRY &KEY TOKEN)
@@ -163,12 +166,12 @@ Result](#search-result) object."
""))))))
(IF LAZYBONES-CLIENT.SHARED:*BODY*
(DEXADOR:PATCH LAZYBONES-CLIENT.SHARED::REQ-STRING :CONTENT
- LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*)
+ LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*)
(DEXADOR:PATCH LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*))))
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*))))
(DEFUN PUT--ONELINER-ONELINER-LOCKED (ONELINER &KEY TOKEN VALUE)
@@ -188,12 +191,12 @@ Result](#search-result) object."
""))))))
(IF LAZYBONES-CLIENT.SHARED:*BODY*
(DEXADOR:PUT LAZYBONES-CLIENT.SHARED::REQ-STRING :CONTENT
- LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*)
+ LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*)
(DEXADOR:PUT LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*))))
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*))))
(DEFUN POST--ONELINER (&KEY TOKEN)
@@ -209,12 +212,28 @@ Result](#search-result) object."
""))))))
(IF LAZYBONES-CLIENT.SHARED:*BODY*
(DEXADOR:POST LAZYBONES-CLIENT.SHARED::REQ-STRING :CONTENT
- LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*)
+ LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*)
(DEXADOR:POST LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*))))
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*))))
+
+
+(DEFUN DELETE--ONELINER-ONELINER (ONELINER &KEY TOKEN)
+ "Delete a oneliner."
+ (LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING
+ (APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* "/api"
+ (FORMAT NIL "/oneliner/~a" ONELINER)
+ (WHEN (OR TOKEN)
+ (LIST "?"
+ (IF TOKEN
+ (CONCATENATE 'STRING (SYMBOL-NAME 'TOKEN) "="
+ (FORMAT NIL "~a" TOKEN))
+ ""))))))
+ (DEXADOR:DELETE LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*)))
(DEFUN POST--INVITE (&KEY TOKEN)
@@ -230,12 +249,12 @@ Result](#search-result) object."
""))))))
(IF LAZYBONES-CLIENT.SHARED:*BODY*
(DEXADOR:POST LAZYBONES-CLIENT.SHARED::REQ-STRING :CONTENT
- LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*)
+ LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*)
(DEXADOR:POST LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*))))
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*))))
(DEFUN DELETE--ACCESS-ACCESS (ACCESS &KEY TOKEN)
@@ -250,8 +269,8 @@ Result](#search-result) object."
(FORMAT NIL "~a" TOKEN))
""))))))
(DEXADOR:DELETE LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*)))
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*)))
(DEFUN POST--ACCESS ()
@@ -261,12 +280,12 @@ Result](#search-result) object."
(FORMAT NIL "/access") NIL)))
(IF LAZYBONES-CLIENT.SHARED:*BODY*
(DEXADOR:POST LAZYBONES-CLIENT.SHARED::REQ-STRING :CONTENT
- LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*)
+ LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*)
(DEXADOR:POST LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*))))
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*))))
(DEFUN POST--INVITE-REDEEM-CODE (CODE)
@@ -276,31 +295,95 @@ Result](#search-result) object."
(FORMAT NIL "/invite/redeem/~a" CODE) NIL)))
(IF LAZYBONES-CLIENT.SHARED:*BODY*
(DEXADOR:POST LAZYBONES-CLIENT.SHARED::REQ-STRING :CONTENT
- LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*)
+ LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*)
(DEXADOR:POST LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*))))
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*))))
-(DEFUN PUT--CONTRIBUTOR-HANDLE-LOCKED (HANDLE &KEY VALUE)
+(DEFUN PUT--CONTRIBUTOR-WHO-SIGNATURE (WHO &KEY TOKEN)
NIL
(LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING
(APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* "/api"
- (FORMAT NIL "/contributor/~a/locked" HANDLE)
- (WHEN (OR VALUE)
+ (FORMAT NIL "/contributor/~a/signature" WHO)
+ (WHEN (OR TOKEN)
+ (LIST "?"
+ (IF TOKEN
+ (CONCATENATE 'STRING (SYMBOL-NAME 'TOKEN) "="
+ (FORMAT NIL "~a" TOKEN))
+ ""))))))
+ (IF LAZYBONES-CLIENT.SHARED:*BODY*
+ (DEXADOR:PUT LAZYBONES-CLIENT.SHARED::REQ-STRING :CONTENT
+ LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*)
+ (DEXADOR:PUT LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*))))
+
+
+(DEFUN PUT--CONTRIBUTOR-WHO-PASSWORD (WHO &KEY VALUE REPEATED TOKEN)
+ NIL
+ (LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING
+ (APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* "/api"
+ (FORMAT NIL "/contributor/~a/password" WHO)
+ (WHEN (OR VALUE REPEATED TOKEN)
(LIST "?"
(IF VALUE
(CONCATENATE 'STRING (SYMBOL-NAME 'VALUE) "="
(FORMAT NIL "~a" VALUE))
+ "")
+ (IF REPEATED
+ (CONCATENATE 'STRING "&" (SYMBOL-NAME 'REPEATED)
+ "=" (FORMAT NIL "~a" REPEATED))
+ "")
+ (IF TOKEN
+ (CONCATENATE 'STRING "&" (SYMBOL-NAME 'TOKEN) "="
+ (FORMAT NIL "~a" TOKEN))
""))))))
(IF LAZYBONES-CLIENT.SHARED:*BODY*
(DEXADOR:PUT LAZYBONES-CLIENT.SHARED::REQ-STRING :CONTENT
- LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*)
+ LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*)
(DEXADOR:PUT LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
- LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
- LAZYBONES-CLIENT.SHARED:*HEADERS*))))
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*))))
+
+
+(DEFUN PUT--CONTRIBUTOR-WHO-LOCKED (WHO &KEY VALUE TOKEN)
+ NIL
+ (LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING
+ (APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* "/api"
+ (FORMAT NIL "/contributor/~a/locked" WHO)
+ (WHEN (OR VALUE TOKEN)
+ (LIST "?"
+ (IF VALUE
+ (CONCATENATE 'STRING (SYMBOL-NAME 'VALUE) "="
+ (FORMAT NIL "~a" VALUE))
+ "")
+ (IF TOKEN
+ (CONCATENATE 'STRING "&" (SYMBOL-NAME 'TOKEN) "="
+ (FORMAT NIL "~a" TOKEN))
+ ""))))))
+ (IF LAZYBONES-CLIENT.SHARED:*BODY*
+ (DEXADOR:PUT LAZYBONES-CLIENT.SHARED::REQ-STRING :CONTENT
+ LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*)
+ (DEXADOR:PUT LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*))))
+
+
+(DEFUN GET--CONTRIBUTOR-WHO (WHO)
+ NIL
+ (LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING
+ (APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* "/api"
+ (FORMAT NIL "/contributor/~a" WHO) NIL)))
+ (DEXADOR:GET LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*)))