Use jzon instead of jonathan

This commit is contained in:
Akira Tempaku 2025-04-20 22:39:07 +09:00
parent 5448d575ad
commit 9a03693807
Signed by: paku
GPG key ID: 5B4E8402BCC50607
3 changed files with 11 additions and 7 deletions

2
qlfile
View file

@ -1,5 +1,5 @@
ql alexandria ql alexandria
ql dexador ql dexador
ql jonathan ql jzon
ql quri ql quri
ql kebab ql kebab

View file

@ -10,10 +10,10 @@
(:class qlot/source/ql:source-ql (:class qlot/source/ql:source-ql
:initargs (:%version :latest) :initargs (:%version :latest)
:version "ql-2024-10-12")) :version "ql-2024-10-12"))
("jonathan" . ("jzon" .
(:class qlot/source/ql:source-ql (:class qlot/source/ql:source-ql
:initargs (:%version :latest) :initargs (:%version :latest)
:version "ql-2020-09-25")) :version "ql-2024-10-12"))
("quri" . ("quri" .
(:class qlot/source/ql:source-ql (:class qlot/source/ql:source-ql
:initargs (:%version :latest) :initargs (:%version :latest)

View file

@ -3,9 +3,10 @@
(:use #:cl) (:use #:cl)
(:import-from #:alexandria (:import-from #:alexandria
#:remove-from-plist #:remove-from-plist
#:symbolicate) #:symbolicate
(:import-from #:jonathan #:plist-hash-table)
#:to-json (:import-from #:com.inuoe.jzon
#:stringify
#:parse) #:parse)
(:import-from #:dexador (:import-from #:dexador
#:request #:request
@ -34,7 +35,7 @@
:method method :method method
:headers `(("X-MICROCMS-API-KEY" . ,*api-key*) :headers `(("X-MICROCMS-API-KEY" . ,*api-key*)
("Content-Type" . "application/json")) ("Content-Type" . "application/json"))
:content (and content (to-json content)) :content (%build-content content)
:force-binary nil) :force-binary nil)
(format t "microCMS status: ~D~%" status) (format t "microCMS status: ~D~%" status)
(when (and (stringp res-body) (when (and (stringp res-body)
@ -53,6 +54,9 @@
(loop :for (key val) :on query :by #'cddr (loop :for (key val) :on query :by #'cddr
:collect (cons (to-camel-case (symbol-name key)) val))) :collect (cons (to-camel-case (symbol-name key)) val)))
(defun %build-content (content)
(and content (stringify (plist-hash-table content))))
(defmacro define-list-client (endpoint) (defmacro define-list-client (endpoint)
(let ((str-endpoint (string-downcase (string endpoint)))) (let ((str-endpoint (string-downcase (string endpoint))))
`(progn `(progn