Browse Source

Add a way to save a document

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

+ 11
- 0
libelcouch.el View File

@ -194,5 +194,16 @@ considered to have failed."
:error #'libelcouch--request-error)
nil)
(defun libelcouch-document-save (document content function)
"Evaluate FUNCTION when CONTENT is saved as new value for DOCUMENT."
(request
(url-encode-url (libelcouch-entity-url document))
:type "PUT"
:headers '(("Content-Type" . "application/json"))
:data (or content (encode-coding-string (buffer-substring-no-properties (point-min) (point-max)) 'utf-8))
:success (cl-function (lambda (&rest _args) (funcall function)))
:error #'libelcouch--request-error)
nil)
(provide 'libelcouch)
;;; libelcouch.el ends here

Loading…
Cancel
Save