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

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

[elpa] externals/plz-event-source 436a615c64 05/22: Rename buffer and ht


From: ELPA Syncer
Subject: [elpa] externals/plz-event-source 436a615c64 05/22: Rename buffer and http event source
Date: Wed, 1 May 2024 09:58:48 -0400 (EDT)

branch: externals/plz-event-source
commit 436a615c6469a9dcb8cc6bec71b0e06b3639c91d
Author: Roman Scherer <roman@burningswell.com>
Commit: Roman Scherer <roman@burningswell.com>

    Rename buffer and http event source
---
 plz-event-source.el            | 16 ++++++++--------
 tests/test-plz-event-source.el |  4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/plz-event-source.el b/plz-event-source.el
index 4f2cad0d23..9ab285378a 100644
--- a/plz-event-source.el
+++ b/plz-event-source.el
@@ -312,7 +312,7 @@
 
 ;; Buffer event source
 
-(defclass plz-buffer-event-source (plz-event-source)
+(defclass plz-event-source-buffer (plz-event-source)
   ((buffer
     :initarg :buffer
     :documentation "The event source buffer."
@@ -323,7 +323,7 @@
     :type (or null plz-event-source-parser)))
   "A server sent event source using curl for HTTP.")
 
-(cl-defmethod plz-event-source-insert ((source plz-buffer-event-source) data)
+(cl-defmethod plz-event-source-insert ((source plz-event-source-buffer) data)
   "Insert DATA into the event SOURCE buffer, parse and dispatch events."
   (with-slots (parser) source
     (plz-event-source-parser-insert parser data)
@@ -338,7 +338,7 @@
     (re-search-forward plz-http-end-of-headers-regexp nil t)
     (point)))
 
-(cl-defmethod plz-event-source-open ((source plz-buffer-event-source))
+(cl-defmethod plz-event-source-open ((source plz-event-source-buffer))
   "Open a connection to the URL of the event SOURCE."
   (with-slots (buffer errors options ready-state parser) source
     (with-current-buffer (get-buffer-create buffer)
@@ -351,7 +351,7 @@
         (plz-event-source-dispatch-event source event)
         source))))
 
-(cl-defmethod plz-event-source-close ((source plz-buffer-event-source))
+(cl-defmethod plz-event-source-close ((source plz-event-source-buffer))
   "Close the connection of the event SOURCE."
   (with-slots (buffer ready-state) source
     (let ((event (plz-event-source-event :type 'close)))
@@ -359,7 +359,7 @@
       (plz-event-source-dispatch-event source event)
       source)))
 
-(defclass plz-http-event-source (plz-event-source)
+(defclass plz-event-source-http (plz-event-source)
   ((process
     :initarg :process
     :documentation "The process of the event source."
@@ -376,7 +376,7 @@
     (let ((media-type (plz-media-type:text/event-stream :events handlers)))
       (cons (cons 'text/event-stream media-type) plz-media-types))))
 
-(cl-defmethod plz-event-source-open ((source plz-http-event-source))
+(cl-defmethod plz-event-source-open ((source plz-event-source-http))
   "Open a connection to the URL of the event SOURCE."
   (with-slots (errors options process ready-state response url) source
     (setf ready-state 'connecting)
@@ -395,7 +395,7 @@
                                (setf ready-state 'closed))))
     source))
 
-(cl-defmethod plz-event-source-close ((source plz-http-event-source))
+(cl-defmethod plz-event-source-close ((source plz-event-source-http))
   "Close the connection of the event SOURCE."
   (with-slots (process ready-state) source
     (delete-process process)
@@ -438,7 +438,7 @@ callbacks will always be set to nil.")
                       :status (plz-response-status chunk)
                       :headers (plz-response-headers chunk)))
            (source (plz-event-source-open
-                    (plz-buffer-event-source
+                    (plz-event-source-buffer
                      :buffer (buffer-name (process-buffer process))
                      :handlers (seq-map
                                 (lambda (pair)
diff --git a/tests/test-plz-event-source.el b/tests/test-plz-event-source.el
index f455877aee..752f29575f 100644
--- a/tests/test-plz-event-source.el
+++ b/tests/test-plz-event-source.el
@@ -188,7 +188,7 @@
                      :data "This is the second message, it\nhas two lines."
                      :origin (buffer-name)))
            (all-events) (close-events) (error-events) (message-events) 
(open-events)
-           (source (plz-buffer-event-source
+           (source (plz-event-source-buffer
                     :buffer (buffer-name)
                     :handlers `((open . ,(lambda (source event)
                                            (push event open-events)
@@ -239,7 +239,7 @@
 (ert-deftest test-plz-event-source-http-event-source ()
   (plz-event-source-test-with-mock-response (plz-event-source-test-response 
"text/event-stream/openai-hello.txt")
     (let* ((all-events) (close-events) (error-events) (message-events) 
(open-events)
-           (source (plz-http-event-source
+           (source (plz-event-source-http
                     :url "https://api.openai.com/v1/chat/completions";
                     :options `((body . ,(json-encode
                                          '(("model" . "gpt-3.5-turbo")



reply via email to

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