dda-masto-embed/src/main/dda/masto_embed/app.cljs

25 lines
694 B
Text
Raw Normal View History

(ns dda.masto-embed.app
2020-04-24 15:22:51 +00:00
(:require
["mastodon-api" :as Mastodon]
[clojure.pprint :as pprint :refer [pprint]]
[cljs.core.async :refer [go]]
[cljs.core.async.interop :refer-macros [<p!]]))
2020-04-24 13:27:41 +00:00
(defn get-content-seq [response]
2020-04-24 13:27:41 +00:00
(map
#(aget % "content")
(array-seq
(aget response "data"))))
2020-04-24 09:24:09 +00:00
(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")]
2020-04-24 13:27:41 +00:00
(pprint
(go
(let [response (<p! (.get masto rest-endpoint id-config))]
(get-content-seq response))))))
2020-04-24 12:42:30 +00:00
(defn add-one [a]
(+ a 1))