2020-04-24 11:55:33 +00:00
|
|
|
(ns dda.masto-embed.app
|
2020-04-24 13:27:41 +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 11:55:33 +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
|
|
|
|
2020-04-24 11:55:33 +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
|
2020-04-24 11:55:33 +00:00
|
|
|
(go
|
|
|
|
(let [response (<p! (.get masto rest-endpoint id-config))]
|
2020-04-24 12:52:51 +00:00
|
|
|
(get-content-seq response))))))
|
2020-04-24 12:42:30 +00:00
|
|
|
|
2020-04-24 12:52:51 +00:00
|
|
|
(defn add-one [a]
|
|
|
|
(+ a 1))
|