Function: verb-restclient--import
verb-restclient--import is a natively compiled function defined in
verb-restclient.el.
Signature
(verb-restclient--import VALIDATOR)
Documentation
Import restclient.el requests from current buffer to Verb format.
VALIDATOR is a function that validates each request body. Return a buffer with the imported results.
Source Code
;; Defined in /nix/store/8jnfn8w2mxcxbr2crbklcnija9m0zlkq-emacs-packages-deps/share/emacs/site-lisp/elpa/verb-20260818.1921/verb-restclient.el
(defun verb-restclient--import (validator)
"Import restclient.el requests from current buffer to Verb format.
VALIDATOR is a function that validates each request body.
Return a buffer with the imported results."
(let ((name (buffer-name))
(requests (verb-restclient--parse (current-buffer)))
(i 1)
comments body valid)
(with-current-buffer (get-buffer-create
(generate-new-buffer-name "*restclient.el Import*"))
(insert (format "* Imported from %s (restclient.el) :verb:\n" name))
(insert
"# NOTE: Some imported requests may not be correctly formatted.\n"
"# It's recommended to go over all of them carefully, specially the\n"
"# ones marked with the [Unsupported] label.\n\n")
(dolist (req requests)
(setq comments (verb-restclient--request-comments req)
body (verb-restclient--request-body req))
(setq valid
(ignore-errors
(funcall validator (concat comments "\n" body)) t))
(insert (format "** Request #%s\n" i))
(unless valid
(insert
"# [Unsupported] This request could not be parsed correctly.\n"))
(insert comments "\n")
(unless (string-empty-p body)
(insert body "\n"))
(newline)
(setq i (1+ i)))
(org-mode)
(goto-char (point-min))
(current-buffer))))