aboutsummaryrefslogtreecommitdiff
path: root/oneliners.api-client.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'oneliners.api-client.lisp')
-rw-r--r--oneliners.api-client.lisp140
1 files changed, 99 insertions, 41 deletions
diff --git a/oneliners.api-client.lisp b/oneliners.api-client.lisp
index 079f672..0ac2940 100644
--- a/oneliners.api-client.lisp
+++ b/oneliners.api-client.lisp
@@ -5,7 +5,9 @@
(defpackage #:ONELINERS.API-CLIENT
(:use :cl :lazybones-client.shared)
(:export #:*host* #:*body* #:*headers* #:*cookies* #:request-with
- #:GET--ONELINERS
+ #:GET--ONELINERS-ALL-FLAGGED
+#:GET--ONLINERS-ALL-FLAGGED
+#:GET--ONELINERS
#:PUT--ONELINER-ENTRY-FLAG
#:PATCH--ONELINER-ENTRY-EDIT
#:PUT--ONELINER-ONELINER-LOCKED
@@ -13,7 +15,8 @@
#:POST--INVITE
#:DELETE--ACCESS-ACCESS
#:POST--ACCESS
-#:POST--INVITE-REDEEM-CODE))
+#:POST--INVITE-REDEEM-CODE
+#:PUT--CONTRIBUTOR-HANDLE-LOCKED))
(in-package :ONELINERS.API-CLIENT)
@@ -62,6 +65,40 @@ 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."
+ (LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING
+ (APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* "/api"
+ (FORMAT NIL "/oneliners/all-flagged")
+ (WHEN (OR LIMIT)
+ (LIST "?"
+ (IF LIMIT
+ (CONCATENATE 'STRING (SYMBOL-NAME 'LIMIT) "="
+ (FORMAT NIL "~a" LIMIT))
+ ""))))))
+ (DEXADOR:GET LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
+ LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS
+ LAZYBONES-CLIENT.SHARED:*HEADERS*)))
+
+
+(DEFUN GET--ONLINERS-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")
+ (WHEN (OR LIMIT)
+ (LIST "?"
+ (IF LIMIT
+ (CONCATENATE 'STRING (SYMBOL-NAME 'LIMIT) "="
+ (FORMAT NIL "~a" LIMIT))
+ ""))))))
+ (DEXADOR:GET LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR
+ 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
@@ -84,8 +121,8 @@ Result](#search-result) object."
"=" (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)
@@ -105,12 +142,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)
@@ -126,12 +163,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)
@@ -151,12 +188,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)
@@ -172,12 +209,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 POST--INVITE (&KEY TOKEN)
@@ -193,12 +230,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)
@@ -213,8 +250,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 ()
@@ -224,12 +261,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)
@@ -239,10 +276,31 @@ 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)
+ NIL
+ (LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING
+ (APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* "/api"
+ (FORMAT NIL "/contributor/~a/locked" HANDLE)
+ (WHEN (OR VALUE)
+ (LIST "?"
+ (IF VALUE
+ (CONCATENATE 'STRING (SYMBOL-NAME 'VALUE) "="
+ (FORMAT NIL "~a" VALUE))
+ ""))))))
+ (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*))))