diff options
-rw-r--r-- | oneliners.api-client.lisp | 67 | ||||
-rw-r--r-- | src/lib.lisp | 6 |
2 files changed, 23 insertions, 50 deletions
diff --git a/oneliners.api-client.lisp b/oneliners.api-client.lisp index 19ca89f..b011457 100644 --- a/oneliners.api-client.lisp +++ b/oneliners.api-client.lisp @@ -5,9 +5,8 @@ (defpackage #:ONELINERS.API-CLIENT (:use :cl :lazybones-client.shared) (:export #:*host* #:*body* #:*headers* #:*cookies* #:request-with - #:PUT--ONELINER-ENTRY-FLAG -#:GET--ONELINERS -#:GET--ONELIERS + #:GET--ONELINERS +#:PUT--ONELINER-ENTRY-FLAG #:PATCH--ONELINER-ENTRY-EDIT #:PUT--ONELINER-ONELINER-LOCKED #:POST--ONELINER @@ -63,31 +62,6 @@ COOKIES should be an instance of CL-COOKIE:COOKIE-JAR. Defaults to (dex:response-body ,http-error-var))))))) -(DEFUN PUT--ONELINER-ENTRY-FLAG (ENTRY &KEY TOKEN VALUE) - "Flag the oneliner for review." - (LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING - (APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* - (FORMAT NIL "/oneliner/~a/flag" ENTRY) - (WHEN (OR TOKEN VALUE) - (LIST "?" - (IF TOKEN - (CONCATENATE 'STRING (SYMBOL-NAME 'TOKEN) "=" - (FORMAT NIL "~a" TOKEN)) - "") - (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*)))) - - (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 @@ -114,30 +88,29 @@ Result](#search-result) object." LAZYBONES-CLIENT.SHARED:*HEADERS*))) -(DEFUN GET--ONELIERS (&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 PUT--ONELINER-ENTRY-FLAG (ENTRY &KEY TOKEN VALUE) + "Flag the oneliner for review." (LET ((LAZYBONES-CLIENT.SHARED::REQ-STRING (APPLY #'CONCATENATE 'STRING LAZYBONES-CLIENT.SHARED:*HOST* - (FORMAT NIL "/oneliers") - (WHEN (OR TAGS LIMIT NOTFLAGGED) + (FORMAT NIL "/oneliner/~a/flag" ENTRY) + (WHEN (OR TOKEN VALUE) (LIST "?" - (IF TAGS - (CONCATENATE 'STRING (SYMBOL-NAME 'TAGS) "=" - (FORMAT NIL "~a" TAGS)) - "") - (IF LIMIT - (CONCATENATE 'STRING "&" (SYMBOL-NAME 'LIMIT) "=" - (FORMAT NIL "~a" LIMIT)) + (IF TOKEN + (CONCATENATE 'STRING (SYMBOL-NAME 'TOKEN) "=" + (FORMAT NIL "~a" TOKEN)) "") - (IF NOTFLAGGED - (CONCATENATE 'STRING "&" (SYMBOL-NAME 'NOTFLAGGED) - "=" (FORMAT NIL "~a" NOTFLAGGED)) + (IF VALUE + (CONCATENATE 'STRING "&" (SYMBOL-NAME 'VALUE) "=" + (FORMAT NIL "~a" VALUE)) "")))))) - (DEXADOR:GET LAZYBONES-CLIENT.SHARED::REQ-STRING :COOKIE-JAR - LAZYBONES-CLIENT.SHARED:*COOKIES* :HEADERS - LAZYBONES-CLIENT.SHARED:*HEADERS*))) + (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 PATCH--ONELINER-ENTRY-EDIT (ENTRY &KEY TOKEN) diff --git a/src/lib.lisp b/src/lib.lisp index c6801df..300d6d5 100644 --- a/src/lib.lisp +++ b/src/lib.lisp @@ -150,13 +150,13 @@ the directories that appear in the value of that variable." (prompt "Brief Description: ")) (tags (append init-tags - (when (y-or-n-p "Add tags in addition to: ~{~a ~}?" init-tags) - (ppcre:split " +" (prompt "(e.g. foo bar goo): "))))) + (ppcre:split " +" + (prompt (format nil "Additional Tags? [~{~a ~}]" init-tags))))) (explanation (when (y-or-n-p "Provide an explanation?") (string-from-editor))) (runstyle - (if (y-or-n-p "Is GUI, TUI, or requires further input?") + (if (y-or-n-p "Does this oneliner invoke a GUI, a TUI, or will it require user input?") "MANUAL" "AUTO"))) (api:request-with |