[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7ba2f5c 08/11: Excorporate: Add support for synchronous op
From: |
Thomas Fitzsimmons |
Subject: |
[elpa] master 7ba2f5c 08/11: Excorporate: Add support for synchronous operations |
Date: |
Wed, 23 Sep 2020 21:50:10 -0400 (EDT) |
branch: master
commit 7ba2f5c33c480845a8717e023a3a989b14c127d0
Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Commit: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Excorporate: Add support for synchronous operations
* packages/excorporate/excorporate.el (exco--fsm): Support
synchronous finite state machine calls in :retrieving-data state.
(exco-operate): Throw error if callback argument is nil.
(exco-operate-synchronously): New function.
---
packages/excorporate/excorporate.el | 33 ++++++++++++++++++++++++---------
1 file changed, 24 insertions(+), 9 deletions(-)
diff --git a/packages/excorporate/excorporate.el
b/packages/excorporate/excorporate.el
index 25f2b5c..a478262 100644
--- a/packages/excorporate/excorporate.el
+++ b/packages/excorporate/excorporate.el
@@ -560,20 +560,26 @@ the FSM should transition to on success."
(list state-data nil))
(define-state exco--fsm :retrieving-data
- (_fsm state-data event _callback)
+ (_fsm state-data event fsm-result-callback)
(let* ((identifier (plist-get state-data :identifier))
(wsdl (plist-get state-data :service-wsdl))
(name (pop event))
(arguments (pop event))
(callback (pop event)))
- (apply #'soap-invoke-async
- (lambda (response)
- (funcall callback identifier response))
- nil
- wsdl
- "ExchangeServicePort"
- name
- arguments))
+ (if callback
+ ;; exco-operate.
+ (apply #'soap-invoke-async
+ (lambda (response)
+ (funcall callback identifier response))
+ nil
+ wsdl
+ "ExchangeServicePort"
+ name
+ arguments)
+ ;; exco-operate-synchronously.
+ (funcall
+ fsm-result-callback
+ (apply #'soap-invoke wsdl "ExchangeServicePort" name arguments))))
(list :retrieving-data state-data nil))
(defun exco--ensure-connection ()
@@ -631,10 +637,19 @@ use the `cdr' of the pair as the service URL."
IDENTIFIER is the connection identifier. Execute operation NAME
with ARGUMENTS then call CALLBACK with two arguments, IDENTIFIER
and the server's response."
+ (when (null callback) (error "CALLBACK cannot be nil"))
(exco--with-fsm identifier
(fsm-send fsm (list name arguments callback)))
nil)
+(defun exco-operate-synchronously (identifier name arguments)
+ "Execute a service operation synchronously.
+IDENTIFIER is the connection identifier. Execute operation NAME
+with ARGUMENTS then call CALLBACK with two arguments, IDENTIFIER
+and the server's response."
+ (exco--with-fsm identifier
+ (fsm-call fsm (list name arguments))))
+
(defun exco-server-version (identifier)
"Return the server version for connection IDENTIFIER, as a string.
Examples are \"Exchange2010\", \"Exchange2010_SP1\",
- [elpa] master updated (3e43a84 -> fdfd986), Thomas Fitzsimmons, 2020/09/23
- [elpa] master 784e3fe 02/11: Excorporate: Support appointment deletion, Thomas Fitzsimmons, 2020/09/23
- [elpa] master 1435365 06/11: Excorporate: Add appointment deletion in Org buffer, Thomas Fitzsimmons, 2020/09/23
- [elpa] master ea318ec 07/11: Excorporate: Support appointment creation, Thomas Fitzsimmons, 2020/09/23
- [elpa] master 42d696c 01/11: Excorporate: Add an item iteration macro, Thomas Fitzsimmons, 2020/09/23
- [elpa] master b3e2449 03/11: Excorporate: Avoid trailing newline in Org buffer, Thomas Fitzsimmons, 2020/09/23
- [elpa] master 08ff756 04/11: Excorporate: Change identifier format in Org buffer, Thomas Fitzsimmons, 2020/09/23
- [elpa] master 5ea2897 05/11: Excorporate: Add item identifiers to Org buffer, Thomas Fitzsimmons, 2020/09/23
- [elpa] master 7ba2f5c 08/11: Excorporate: Add support for synchronous operations,
Thomas Fitzsimmons <=
- [elpa] master a9e135d 09/11: Excorporate: Provide organizer to iterators, Thomas Fitzsimmons, 2020/09/23
- [elpa] master 027a95b 10/11: Excorporate: Support creating and cancelling meetings, Thomas Fitzsimmons, 2020/09/23
- [elpa] master fdfd986 11/11: Excorporate: Support cancelling meetings in Org buffer, Thomas Fitzsimmons, 2020/09/23