print mastodon statuses via mastodon-api interop

shadow-cljs
hel 4 years ago
parent c0431f5bae
commit ed817a328d

2398
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -5,5 +5,7 @@
"devDependencies": {
"shadow-cljs": "2.8.100"
},
"dependencies": {}
"dependencies": {
"mastodon-api": "^1.3.0"
}
}

@ -1,7 +1,21 @@
(ns dda.masto-embed.app)
(ns dda.masto-embed.app
(:require ["mastodon-api" :as Mastodon]
[clojure.pprint :as pprint :refer [pprint]]
[cljs.core.async :refer [go]]
[cljs.core.async.interop :refer-macros [<p!]]))
(defn get-content-seq [response]
(map
#(aget % "content")
(array-seq
(aget response "data"))))
(defn init
""
[]
(println "xx")
"Hello world!")
(defn init []
(let [config (js-obj "api_url" "https://social.meissa-gmbh.de/api/v1/" "access_token" "...")
masto (new Mastodon config)
rest-endpoint "accounts/:id/statuses"
id-config (js-obj "id" "2")]
(pprint
(go
(let [response (<p! (.get masto rest-endpoint id-config))]
(get-content-seq response)))))

Loading…
Cancel
Save