1 1d126b15 2021-10-13 op # Gemini library for clojure
3 1d126b15 2021-10-13 op `gemini.core` is a clojure library to make Gemini requests.
9 1d126b15 2021-10-13 op user=> (require '[gemini.core :as gemini])
14 1d126b15 2021-10-13 op `fetch` makes a Gemini request and returns a map with `:request`,
15 1d126b15 2021-10-13 op `:meta`, `:code` and `:body` as keys, or `:error` if an error occur.
17 1d126b15 2021-10-13 op The request needs to be closed afterwards using `close`, or calling
18 1d126b15 2021-10-13 op the `.close` method on the `:request` object.
21 1d126b15 2021-10-13 op user=> (gemini/fetch "gemini://gemini.circumlunar.space/")
23 1d126b15 2021-10-13 op #object[com.omarpolo.gemini.Request 0x3b270767 "com.omarpolo.gemini.Request@3b270767"],
24 1d126b15 2021-10-13 op :meta "gemini://gemini.circumlunar.space/",
27 1d126b15 2021-10-13 op #object[java.io.BufferedReader 0x49358b66 "java.io.BufferedReader@49358b66"]}
30 1d126b15 2021-10-13 op #### body-as-string!
32 1d126b15 2021-10-13 op Read all the response into a string and returns it. It also closes
33 1d126b15 2021-10-13 op the request automatically.
36 1d126b15 2021-10-13 op user=> (-> (gemini/fetch "gemini://gemini.circumlunar.space/")
37 1d126b15 2021-10-13 op gemini/body-as-string!)
38 1d126b15 2021-10-13 op "# Project Gemini\n\n## Overview\n\nGemini is a new internet protocol which..."
43 1d126b15 2021-10-13 op Closes a request.
45 1d126b15 2021-10-13 op #### with-request
47 1d126b15 2021-10-13 op Like `with-open`, but specifically for the requests:
50 1d126b15 2021-10-13 op user=> (with-request [req (fetch "gemini://gemini.circumlunar.space/")]