[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 927b74f 1/4: Excorporate: Add an operation arity function
From: |
Thomas Fitzsimmons |
Subject: |
[elpa] master 927b74f 1/4: Excorporate: Add an operation arity function |
Date: |
Wed, 30 Sep 2020 23:08:58 -0400 (EDT) |
branch: master
commit 927b74f1d9a7e25f5bea278b608bded8dcd629a3
Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Commit: Thomas Fitzsimmons <fitzsim@fitzsim.org>
Excorporate: Add an operation arity function
* packages/excorporate/excorporate.texi (API Usage): Document
exco-operation-arity-nils.
* packages/excorporate/excorporate.el (exco-operation-arity-nils):
New function.
(exco-calendar-item-meeting-create): Call
exco-operation-arity-nils.
(exco-calendar-item-meeting-reply): Likewise.
(exco-calendar-item-meeting-cancel): Likewise.
(exco-get-meetings-for-day): Likewise.
---
packages/excorporate/excorporate.el | 39 +++++++++++------------------------
packages/excorporate/excorporate.texi | 17 ++++++---------
2 files changed, 18 insertions(+), 38 deletions(-)
diff --git a/packages/excorporate/excorporate.el
b/packages/excorporate/excorporate.el
index b9d1748..724e72c 100644
--- a/packages/excorporate/excorporate.el
+++ b/packages/excorporate/excorporate.el
@@ -692,6 +692,14 @@ Return a structure, or nil, suitable for splicing into
(list (cons (if required 'RequiredAttendees 'OptionalAttendees)
(nreverse attendee-list))))))
+(defun exco-operation-arity-nils (identifier operation)
+ "Return a list of nil arguments for OPERATION.
+IDENTIFIER is the connection for which to look up OPERATION."
+ (let* ((wsdl (exco--with-fsm identifier
+ (plist-get (fsm-get-state-data fsm) :service-wsdl)))
+ (arity (soap-operation-arity wsdl "ExchangeServicePort" operation)))
+ (make-list arity nil)))
+
(defun exco-calendar-item-meeting-create (identifier
subject body start end location
main-invitees optional-invitees
@@ -725,12 +733,7 @@ creation."
,@(exco--create-attendee-structure main-invitees t)
,@(exco--create-attendee-structure optional-invitees nil))))
;; Empty arguments.
- ,@(let* ((wsdl (exco--with-fsm identifier
- (plist-get (fsm-get-state-data fsm) :service-wsdl)))
- (arity (soap-operation-arity wsdl
- "ExchangeServicePort"
- "CreateItem")))
- (make-list (- arity 1) nil)))
+ ,@(cdr (exco-operation-arity-nils identifier "CreateItem")))
callback))
(defun exco-calendar-item-meeting-reply (identifier
@@ -759,13 +762,7 @@ RESPONSE, the server's response to the meeting
cancellation."
(ReferenceItemId ,@(cdr item-identifier))
,@(when message (list `(Body (BodyType . "Text") ,message))))))
;; Empty arguments.
- ,@(let* ((wsdl (exco--with-fsm identifier
- (plist-get (fsm-get-state-data fsm)
- :service-wsdl)))
- (arity (soap-operation-arity wsdl
- "ExchangeServicePort"
- "CreateItem")))
- (make-list (- arity 1) nil)))
+ ,@(cdr (exco-operation-arity-nils identifier "CreateItem")))
callback)))
(defun exco-calendar-item-meeting-cancel (identifier
@@ -786,13 +783,7 @@ server's response to the meeting cancellation."
(ReferenceItemId ,@(cdr item-identifier))
(NewBodyContent (BodyType . "Text") ,message))))
;; Empty arguments.
- ,@(let* ((wsdl (exco--with-fsm identifier
- (plist-get (fsm-get-state-data fsm)
- :service-wsdl)))
- (arity (soap-operation-arity wsdl
- "ExchangeServicePort"
- "CreateItem")))
- (make-list (- arity 1) nil)))
+ ,@(cdr (exco-operation-arity-nils identifier "CreateItem")))
callback))
(defun exco-calendar-item-appointment-create (identifier
@@ -1070,13 +1061,7 @@ arguments, IDENTIFIER and the server's response."
(ParentFolderIds
(DistinguishedFolderId (Id . "calendar"))))
;; Empty arguments.
- ,@(let* ((wsdl (exco--with-fsm identifier
- (plist-get (fsm-get-state-data fsm)
- :service-wsdl)))
- (arity (soap-operation-arity wsdl
- "ExchangeServicePort"
- "FindItem")))
- (make-list (- arity 1) nil)))
+ ,@(cdr (exco-operation-arity-nils identifier "FindItem")))
callback)))
(defun exco-connection-iterate (initialize-function
diff --git a/packages/excorporate/excorporate.texi
b/packages/excorporate/excorporate.texi
index 1154547..4067a10 100644
--- a/packages/excorporate/excorporate.texi
+++ b/packages/excorporate/excorporate.texi
@@ -567,11 +567,11 @@ hacker2@@gnu.org, in the Eastern Time time zone.
@noindent
This example shows how to create a recurrence in the ``Eastern Standard
-Time'' time zone. The spliced-in code fragment shows how to query how
-many @code{nil} arguments should be specified for the @code{CreateItem}
-operation. Arguments other than the first (``request'') argument may be
-needed in the future to use more complicated server functionality, but
-for now they can all be left @code{nil}.
+Time'' time zone. The @{exco-operation-arity-nils} call returns the
+number of arguments (all @code{nil}) that the @code{CreateItem}
+operation takes. Arguments other than the first (``request'') argument
+may be needed in the future to use more complicated server
+functionality, but for now they can all be left @code{nil}.
@example
@group
@@ -598,12 +598,7 @@ for now they can all be left @code{nil}.
(StartDate . "2020-09-25-04:00")
(NumberOfOccurrences . 4))))))
;; Empty arguments.
- ,@@(let* ((wsdl (exco--with-fsm (car exco--connection-identifiers)
- (plist-get (fsm-get-state-data fsm) :service-wsdl)))
- (arity (soap-operation-arity wsdl
- "ExchangeServicePort"
- "CreateItem")))
- (make-list (- arity 1) nil)))
+ ,@@(cdr (exco-operation-arity-nils identifier "CreateItem")))
(lambda (identifier response)
(message "%S: %S" identifier response)))
@result{}