emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/hyperdrive c15b3ee54c 09/42: Change: Remove :as 'response


From: ELPA Syncer
Subject: [nongnu] elpa/hyperdrive c15b3ee54c 09/42: Change: Remove :as 'response from calls to he/api
Date: Wed, 19 Jun 2024 18:59:59 -0400 (EDT)

branch: elpa/hyperdrive
commit c15b3ee54c04fcc656e610a5e55a53fdd783657e
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>

    Change: Remove :as 'response from calls to he/api
---
 hyperdrive-diff.el |  6 ++----
 hyperdrive-dir.el  |  6 ++----
 hyperdrive-lib.el  | 21 ++++++---------------
 hyperdrive.el      |  2 --
 4 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/hyperdrive-diff.el b/hyperdrive-diff.el
index 2e8361337b..f804b66dca 100644
--- a/hyperdrive-diff.el
+++ b/hyperdrive-diff.el
@@ -103,13 +103,11 @@ This function is intended to diff files, not directories."
                          (kill-buffer old-buffer))
                        (when (buffer-live-p new-buffer)
                          (kill-buffer new-buffer))))))))
-    (he/api 'get old-entry
-      :queue queue :as 'response :else #'ignore
+    (he/api 'get old-entry :queue queue :else #'ignore
       :then (lambda (response)
               (h//fill old-entry (plz-response-headers response))
               (setf old-response response)))
-    (he/api 'get new-entry
-      :queue queue :as 'response :else #'ignore
+    (he/api 'get new-entry :queue queue :else #'ignore
       :then (lambda (response)
               (h//fill new-entry (plz-response-headers response))
               (setf new-response response)))))
diff --git a/hyperdrive-dir.el b/hyperdrive-dir.el
index be619f88ce..c54f19d508 100644
--- a/hyperdrive-dir.el
+++ b/hyperdrive-dir.el
@@ -62,7 +62,7 @@ If THEN, call it in the directory buffer with no arguments."
                   (when-let ((node (h/ewoc-find-node ewoc entry
                                      :predicate #'he/equal-p)))
                     (goto-char (ewoc-location node)))))
-      (he/api 'get directory-entry :as 'response :noquery t
+      (he/api 'get directory-entry :noquery t
         ;; Get "full" listing with metadata
         :headers `(("Accept" . "application/json; metadata=full"))
         :then (lambda (response)
@@ -350,10 +350,8 @@ see Info node `(elisp)Yanking Media'."
                                                        hyperdrive)
                                       :predicate #'h/writablep
                                       :default-path path :latest-version t)))
-      (he/api 'put entry
-        :body-type 'binary
+      (he/api 'put entry :body image :body-type 'binary
         ;; TODO: Pass MIME type in a header? hyper-gateway detects it for us.
-        :body image :as 'response
         :then (lambda (_res) (h/open entry))
         :else (lambda (plz-error)
                 (h/message "Unable to yank media: %S" plz-error)))))
diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index ada75be0ad..2a28d0c482 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -292,7 +292,7 @@ THEN and ELSE are passed to `hyperdrive-api', which see."
     ;; TODO: Investigate whether we should use 'text body type for text 
buffers.
     :body-type 'binary
     ;; TODO: plz accepts buffer as a body, we should refactor calls to 
h//write to pass in a buffer instead of a buffer-string.
-    :body body :as 'response :then then :else else :queue queue))
+    :body body :then then :else else :queue queue))
 
 (cl-defun h//write (url &key body then else queue)
   "Save BODY (a string) to hyperdrive URL.
@@ -685,12 +685,8 @@ the given `plz-queue'"
                     (h/message "hyperdrive-fill: error: %S" plz-error))))))
   (pcase then
     ('sync (condition-case err
-               (h//fill entry
-                        (plz-response-headers
-                         (he/api 'head entry
-                           :as 'response
-                           :then 'sync
-                           :noquery t)))
+               (h//fill entry (plz-response-headers
+                               (he/api 'head entry :then 'sync :noquery t)))
              (plz-error
               (pcase (plz-response-status (plz-error-response (caddr err)))
                 ;; FIXME: If plz-error is a curl-error, this block will fail.
@@ -700,7 +696,6 @@ the given `plz-queue'"
               (signal (car err) (cdr err)))))
     (_ (he/api 'head entry
          :queue queue
-         :as 'response
          :then (lambda (response)
                  (funcall then (h//fill entry (plz-response-headers 
response))))
          :else (lambda (&rest args)
@@ -808,8 +803,7 @@ entry as a side-effect."
   "Synchronously fill the latest version slot in HYPERDRIVE.
 Returns the latest version number."
   (pcase-let (((cl-struct plz-response headers)
-               (he/api 'head (he/create :hyperdrive hyperdrive :path "/")
-                 :as 'response)))
+               (he/api 'head (he/create :hyperdrive hyperdrive :path "/"))))
     (h//fill-latest-version hyperdrive headers)))
 
 (defun h//fill-latest-version (hyperdrive headers)
@@ -951,7 +945,6 @@ Once all requests return, call FINALLY with no arguments."
                    (cl-return))
                  (he/api 'head prev-entry
                    :queue nonexistent-queue
-                   :as 'response
                    :then (pcase-lambda ((cl-struct plz-response (headers (map 
etag))))
                            (pcase-let* ((range-start (string-to-number etag))
                                         ((map :existsp) (map-elt 
copy-entry-version-ranges range-start)))
@@ -975,7 +968,6 @@ Once all requests return, call FINALLY with no arguments."
              (cl-decf total-requests-limit)
              (he/api 'head copy-entry
                :queue fill-entry-queue
-               :as 'response
                :then (pcase-lambda ((cl-struct plz-response (headers (map 
etag))))
                        (pcase-let* ((range-start (string-to-number etag))
                                     ((map :existsp)
@@ -1012,7 +1004,7 @@ HYPERDRIVE's public metadata file."
                      ;; TODO: Refactor to use :as 'response-with-buffer and 
call h/fill
                      (pcase-let
                          (((cl-struct plz-response headers body)
-                           (he/api 'get entry :as 'response :noquery t)))
+                           (he/api 'get entry :noquery t)))
                        (h//fill entry headers)
                        (with-temp-buffer
                          (insert body)
@@ -1040,7 +1032,6 @@ HYPERDRIVE's public metadata file."
 Call ELSE if request fails."
   (declare (indent defun))
   (he/api 'delete (he/create :hyperdrive hyperdrive)
-    :as 'response
     :then (lambda (response)
             (h/persist hyperdrive :purge t)
             (h/purge-version-ranges hyperdrive)
@@ -1404,7 +1395,7 @@ If then, then call THEN with no arguments.  Default 
handler."
       (((cl-struct plz-response headers body)
         ;; TODO: Handle errors
         ;; TODO: When plz adds :as 'response-with-buffer, use that.
-        (he/api 'get entry :noquery t :as 'response))
+        (he/api 'get entry :noquery t))
        ;; Filling entry is necessary in order to update hyperdrive disk-usage.
        (_ (h//fill entry headers))
        ((cl-struct hyperdrive-entry hyperdrive version etc) entry)
diff --git a/hyperdrive.el b/hyperdrive.el
index 62ab08ccfc..c8b66c0a12 100644
--- a/hyperdrive.el
+++ b/hyperdrive.el
@@ -198,7 +198,6 @@ modified; file blobs may be recoverable from other peers."
           (h//format-entry entry)))
     (he/api 'post entry
       :headers '(("Cache-Control" . "no-store"))
-      :as 'response
       :else (lambda (err)
               (h/error "Unable to clear cache for `%s': %S" (he/url entry) 
err))
       :then (lambda (response)
@@ -429,7 +428,6 @@ directory.  Otherwise, or with universal prefix argument
              :else (lambda (plz-error)
                      (h/message "Unable to delete `%s': %S" description 
plz-error))))))
   (he/api 'delete entry
-    :as 'response
     :then (lambda (response)
             (pcase-let* (((cl-struct plz-response headers) response)
                          ((map etag) headers)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]