diff options
Diffstat (limited to 'oneliners.api-client.lisp')
-rw-r--r-- | oneliners.api-client.lisp | 70 |
1 files changed, 56 insertions, 14 deletions
diff --git a/oneliners.api-client.lisp b/oneliners.api-client.lisp index 8d43eae..d66ce65 100644 --- a/oneliners.api-client.lisp +++ b/oneliners.api-client.lisp @@ -89,11 +89,17 @@ Result](#search-result) object." LAZYBONES-CLIENT.SHARED:*HEADERS*))) -(DEFUN PATCH--FLAG-ONELINER (ONELINER) +(DEFUN PATCH--FLAG-ONELINER (ONELINER &KEY TOKEN) "Flag the oneliner for review. Open to anyone." (LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING (APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* - (FORMAT NIL "/flag/~a" ONELINER) NIL))) + (FORMAT NIL "/flag/~a" ONELINER) + (WHEN (OR TOKEN) + (LIST "?" + (IF TOKEN + (CONCATENATE 'STRING (SYMBOL-NAME 'TOKEN) "=" + (FORMAT NIL "~a" TOKEN)) + "")))))) (IF LAZYBONES-CLIENT.SHARED:*BODY* (DEXADOR:PATCH LAZYBONES-CLIENT.SHARED::REQ-STRING :CONTENT LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR @@ -104,11 +110,17 @@ Result](#search-result) object." LAZYBONES-CLIENT.SHARED:*HEADERS*)))) -(DEFUN PATCH--EDIT-ONELINER (ONELINER) +(DEFUN PATCH--EDIT-ONELINER (ONELINER &KEY TOKEN) "Edit the fields of a oneliner." (LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING (APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* - (FORMAT NIL "/edit/~a" ONELINER) NIL))) + (FORMAT NIL "/edit/~a" ONELINER) + (WHEN (OR TOKEN) + (LIST "?" + (IF TOKEN + (CONCATENATE 'STRING (SYMBOL-NAME 'TOKEN) "=" + (FORMAT NIL "~a" TOKEN)) + "")))))) (IF LAZYBONES-CLIENT.SHARED:*BODY* (DEXADOR:PATCH LAZYBONES-CLIENT.SHARED::REQ-STRING :CONTENT LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR @@ -119,11 +131,17 @@ Result](#search-result) object." LAZYBONES-CLIENT.SHARED:*HEADERS*)))) -(DEFUN PATCH--UNLOCK-ONELINER (ONELINER) +(DEFUN PATCH--UNLOCK-ONELINER (ONELINER &KEY TOKEN) "Unlocks a oneliner." (LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING (APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* - (FORMAT NIL "/unlock/~a" ONELINER) NIL))) + (FORMAT NIL "/unlock/~a" ONELINER) + (WHEN (OR TOKEN) + (LIST "?" + (IF TOKEN + (CONCATENATE 'STRING (SYMBOL-NAME 'TOKEN) "=" + (FORMAT NIL "~a" TOKEN)) + "")))))) (IF LAZYBONES-CLIENT.SHARED:*BODY* (DEXADOR:PATCH LAZYBONES-CLIENT.SHARED::REQ-STRING :CONTENT LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR @@ -134,11 +152,17 @@ Result](#search-result) object." LAZYBONES-CLIENT.SHARED:*HEADERS*)))) -(DEFUN PATCH--LOCK-ONELINER (ONELINER) +(DEFUN PATCH--LOCK-ONELINER (ONELINER &KEY TOKEN) "Locks a oneliner. Locked oneliners cannot be edited or flagged." (LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING (APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* - (FORMAT NIL "/lock/~a" ONELINER) NIL))) + (FORMAT NIL "/lock/~a" ONELINER) + (WHEN (OR TOKEN) + (LIST "?" + (IF TOKEN + (CONCATENATE 'STRING (SYMBOL-NAME 'TOKEN) "=" + (FORMAT NIL "~a" TOKEN)) + "")))))) (IF LAZYBONES-CLIENT.SHARED:*BODY* (DEXADOR:PATCH LAZYBONES-CLIENT.SHARED::REQ-STRING :CONTENT LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR @@ -149,11 +173,17 @@ Result](#search-result) object." LAZYBONES-CLIENT.SHARED:*HEADERS*)))) -(DEFUN POST--ADD-ONELINER () +(DEFUN POST--ADD-ONELINER (&KEY TOKEN) "Make a new [oneliner](#oneliner)." (LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING (APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* - (FORMAT NIL "/add-oneliner") NIL))) + (FORMAT NIL "/add-oneliner") + (WHEN (OR TOKEN) + (LIST "?" + (IF TOKEN + (CONCATENATE 'STRING (SYMBOL-NAME 'TOKEN) "=" + (FORMAT NIL "~a" TOKEN)) + "")))))) (IF LAZYBONES-CLIENT.SHARED:*BODY* (DEXADOR:POST LAZYBONES-CLIENT.SHARED::REQ-STRING :CONTENT LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR @@ -164,11 +194,17 @@ Result](#search-result) object." LAZYBONES-CLIENT.SHARED:*HEADERS*)))) -(DEFUN POST--MAKE-INVITE () +(DEFUN POST--MAKE-INVITE (&KEY TOKEN) "On success, return an object containing a new [invite token](#invite-token)." (LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING (APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* - (FORMAT NIL "/make-invite") NIL))) + (FORMAT NIL "/make-invite") + (WHEN (OR TOKEN) + (LIST "?" + (IF TOKEN + (CONCATENATE 'STRING (SYMBOL-NAME 'TOKEN) "=" + (FORMAT NIL "~a" TOKEN)) + "")))))) (IF LAZYBONES-CLIENT.SHARED:*BODY* (DEXADOR:POST LAZYBONES-CLIENT.SHARED::REQ-STRING :CONTENT LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR @@ -179,13 +215,19 @@ Result](#search-result) object." LAZYBONES-CLIENT.SHARED:*HEADERS*)))) -(DEFUN POST--REVOKE-CONTRIBUTOR (CONTRIBUTOR) +(DEFUN POST--REVOKE-CONTRIBUTOR (CONTRIBUTOR &KEY TOKEN) "A contributor can revoke their own access (if for some reason their API key ends up out of their control), or an admin can revoke anybody's access token, forcing the to re-authenticate." (LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING (APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* - (FORMAT NIL "/revoke/~a" CONTRIBUTOR) NIL))) + (FORMAT NIL "/revoke/~a" CONTRIBUTOR) + (WHEN (OR TOKEN) + (LIST "?" + (IF TOKEN + (CONCATENATE 'STRING (SYMBOL-NAME 'TOKEN) "=" + (FORMAT NIL "~a" TOKEN)) + "")))))) (IF LAZYBONES-CLIENT.SHARED:*BODY* (DEXADOR:POST LAZYBONES-CLIENT.SHARED::REQ-STRING :CONTENT LAZYBONES-CLIENT.SHARED:*BODY* :COOKIE-JAR |