title: How to provide completion of interactive function from a request?
body: <p>I would like to provide completion for an emacs interactive function whose content would be based on a HTTP request's content.
  Here, the <code>TODO</code> explains it all.</p>
  <pre><code>(defun sensei-record-flow (flow-type)
    &quot;Interactive function to record change in flow.&quot;
    
    (interactive (list (completing-read
                        &quot;Flow: &quot;
                        ;; TODO need to get the completion from a variable filled with user's
                        ;; flow types
                        '((&quot;Foo&quot; Foo) (&quot;Bar&quot; Bar) (&quot;Baz&quot; Baz))
                        nil t)))
    (let ((directory (projectile-project-root)))
      (setq sensei-cur-directory directory)
      (sensei-send-event-flow directory flow-type))
    )
  </code></pre>
  <p>How can I do that? <code>request.el</code> provides a <code>:completion</code> key to block until completion of a request, but it's not clear to me how to do that? I think what I need is to make the <code>interactive</code> function a continuation of the call to <code>senseiilist-flows</code> but I don't know how to do that in elisp.</p>
  <p>EDIT: Here is the code of <code>sensei-list-flows</code> based on <code>request.el</code></p>
  <pre><code>(defun sensei-list-flows (on-success)
    &quot;List available flow types for the current user.
  
  ON-SUCCESS is a function that's called upon successful completion of the call
  and is passed a list of symbols listing user-defined flow names.&quot;
    (let* ((config (sensei-read-config))
           (auth-token (cdr (assoc 'authToken config)))
           (username (cdr (assoc 'configUser config)))
           (server-uri (cdr (assoc 'serverUri config))))
      (request (concat server-uri &quot;api/users/&quot; username)
        :headers `((&quot;Content-Type&quot; . &quot;application/json&quot;)
                   (&quot;X-API-Version&quot; . &quot;0.38.0&quot;)
                   (&quot;Authorization&quot; . ,(concat &quot;Bearer &quot; auth-token)))
        :parser 'json-read
        :error  (cl-function (lambda (&amp;rest args &amp;key error-thrown &amp;allow-other-keys)
                               (message &quot;Got error: %S&quot; error-thrown)))
        :success  (cl-function (lambda (&amp;key data &amp;allow-other-keys)
                                 (funcall on-success
                                       (map 'list 'car (cdr (assoc 'userFlowTypes data)))))))))
  </code></pre>