print mastodon statuses via mastodon-api interop

This commit is contained in:
hel 2020-04-24 13:55:33 +02:00
parent c0431f5bae
commit ed817a328d
3 changed files with 2421 additions and 7 deletions

2398
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

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

View file

@ -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 (defn init []
"" (let [config (js-obj "api_url" "https://social.meissa-gmbh.de/api/v1/" "access_token" "...")
[] masto (new Mastodon config)
(println "xx") rest-endpoint "accounts/:id/statuses"
"Hello world!") id-config (js-obj "id" "2")]
(pprint
(go
(let [response (<p! (.get masto rest-endpoint id-config))]
(get-content-seq response)))))