Browse Source

Add function to get a document's content

elexandria
Damien Cassou 3 years ago
parent
commit
b4cd6afe06
No known key found for this signature in database GPG Key ID: A7123815F5DCE914
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      libelcouch.el

+ 13
- 0
libelcouch.el View File

@ -187,5 +187,18 @@ considered to have failed."
:error #'libelcouch--request-error)
nil)
(defun libelcouch-document-content (document function)
"Evaluate FUNCTION with the content of DOCUMENT as parameter."
(request
(url-encode-url (libelcouch-entity-url document))
:timeout libelcouch-timeout
:parser (lambda () (decode-coding-string (buffer-substring-no-properties (point) (point-max)) 'utf-8))
:headers '(("Accept" . "application/json"))
:success (cl-function
(lambda (&key data &allow-other-keys)
(funcall function data)))
:error #'libelcouch--request-error)
nil)
(provide 'libelcouch)
;;; libelcouch.el ends here

Loading…
Cancel
Save