summaryrefslogtreecommitdiff
path: root/granolin.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'granolin.lisp')
-rw-r--r--granolin.lisp32
1 files changed, 0 insertions, 32 deletions
diff --git a/granolin.lisp b/granolin.lisp
index 3445bff..be252c4 100644
--- a/granolin.lisp
+++ b/granolin.lisp
@@ -125,33 +125,6 @@
;;; Utilities for working with parsed JSON data
-(defmacro getob (ob key &rest keys)
- "OB should be a nested PLIST, KEYS are lists of keys into that PLIST. Gets the
- result of nested GETF calls into the list. This form is SETF-able."
- (let ((form `(getf ,ob ,key)))
- (dolist (k keys)
- (setf form `(getf ,form ,k)))
- form))
-
-(defmacro def-json-wrap (name &rest field-specs)
- "Defines a struct named the value of NAME, a symbol, with a single slot called
- DATA. DATA holds a PLIST as returned by JONATHAN:PARSE.
-
- Each FIELD-SPEC is a list of the form (METHOD-NAME KEY1 ... KEYN)
-
- For each FIELD-SPEC, a method called METHOD-NAME will be defined as a reader
- that accesses a value, the path to which is formed of the KEY values.
-
- E.g. If a JSON value `ob` has a descendent at `ob.x.y.z` then the FIELD-SPEC
- could be (get-z :|x| :|y| :|z|)
- "
- `(progn
- (defstruct ,name data)
- ,@(loop :for (method . keys) :in field-specs :collect
- `(defmethod ,method ((ob ,name))
- (with-slots (data) ob
- (getob data ,@keys))))))
-
(def-json-wrap login-response
(user-id :|user_id|)
(access-token :|access_token|))
@@ -172,11 +145,6 @@
(msg-type :|content| :|msgtype|)
(msg-body :|content| :|body|))
-(defmacro def-timeline-event-pred (name etype mtype)
- `(defun ,name (event)
- (and (equal ,etype (getob event :|type|))
- (equal ,mtype (getob event :|content| :|msgtype|)))))
-
(defstruct (text-message-event (:include timeline-event)))
(def-timeline-event-pred text-message-event-p* "m.room.message" "m.text")