From 47c182ff4bfd69ee9cead12b7f95ad7656f99218 Mon Sep 17 00:00:00 2001
From: Akira Tempaku <paku@skyizwhite.dev>
Date: Sun, 20 Apr 2025 22:55:54 +0900
Subject: [PATCH] Return symbols of generated functions

---
 README.md     |  2 +-
 src/main.lisp | 35 ++++++++++++++++++++---------------
 2 files changed, 21 insertions(+), 16 deletions(-)

diff --git a/README.md b/README.md
index 19ff353..6a911c7 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ This will generate the following functions:
 | Function Name | Arguments | Description |
 |---------------|-----------|-------------|
 | `get-article-list` | (&key `query`) | Get a list of articles. |
-| `get-article-list-detail` | (`id`, &key `query`) | Get details of a specific article by ID. |
+| `get-article-detail` | (`id`, &key `query`) | Get details of a specific article by ID. |
 | `create-article` | (`content`, &key `query`) | Create a new article with the given content. |
 | `update-article` | (`id`, `content`) | Update an existing article by its ID with new content. |
 | `delete-article` | (`id`) | Delete an article by its ID. |
diff --git a/src/main.lisp b/src/main.lisp
index 67158ba..746e68d 100644
--- a/src/main.lisp
+++ b/src/main.lisp
@@ -58,30 +58,35 @@
   (and content (stringify (plist-hash-table content))))
 
 (defmacro define-list-client (endpoint)
-  (let ((str-endpoint (string-downcase (string endpoint))))
-    `(progn
-       (defun ,(symbolicate 'get- endpoint '-list) (&key query)
+  (let ((str-endpoint (string-downcase (string endpoint)))
+        (get-list (symbolicate 'get- endpoint '-list))
+        (get-detail (symbolicate 'get- endpoint '-detail))
+        (create (symbolicate 'create- endpoint))
+        (update (symbolicate 'update- endpoint))
+        (delete (symbolicate 'delete- endpoint)))
+    `(list
+       (defun ,get-list (&key query)
          (%request :get ,str-endpoint :query query))
-       (defun ,(symbolicate 'get- endpoint '-list-detail) (id &key query)
+       (defun ,get-detail (id &key query)
          (%request :get ,str-endpoint :path id :query query))
-       (defun ,(symbolicate 'create- endpoint) (content &key query)
+       (defun ,create (content &key query)
          (let ((id (getf content :|id|)))
            (%request (if id :put :post)
                      ,str-endpoint
                      :path id
                      :query query
                      :content (remove-from-plist content :|id|))))
-       (defun ,(symbolicate 'update- endpoint) (id content)
+       (defun ,update (id content)
          (%request :patch ,str-endpoint :path id :content content))
-       (defun ,(symbolicate 'delete- endpoint) (id)
-         (%request :delete ,str-endpoint :path id))
-       nil)))
+       (defun ,delete (id)
+         (%request :delete ,str-endpoint :path id)))))
 
 (defmacro define-object-client (endpoint)
-  (let ((str-endpoint (string-downcase (string endpoint))))
-    `(progn
-       (defun ,(symbolicate 'get- endpoint '-object) (&key query)
+  (let ((str-endpoint (string-downcase (string endpoint)))
+        (get-object (symbolicate 'get- endpoint '-object))
+        (update (symbolicate 'update- endpoint)))
+    `(list
+       (defun ,get-object (&key query)
          (%request :get ,str-endpoint :query query))
-       (defun ,(symbolicate 'update- endpoint) (content)
-         (%request :patch ,str-endpoint :content content))
-       nil)))
+       (defun ,update (content)
+         (%request :patch ,str-endpoint :content content)))))