Compare commits

...

3 commits

Author SHA1 Message Date
d44a30577a Write file 2023-06-23 13:11:55 +02:00
804250ed85 WIP write json 2023-06-23 13:11:31 +02:00
e0e5bc666f Add json dep 2023-06-23 13:11:13 +02:00
3 changed files with 18 additions and 0 deletions

View file

@ -9,6 +9,7 @@
:resource-paths ["src/main/resources"]
:dependencies [[org.clojure/clojure "1.11.1"]
[orchestra "2021.01.01-1"]
[org.clojure/data.json "2.4.0"]
;; Incoming HTTP
[ring/ring-core "1.9.6"]
[ring/ring-jetty-adapter "1.9.6"]

View file

@ -5,6 +5,7 @@
[org.domaindrivenarchitecture.activity-pub-poc.common :as cm]
[clojure.spec.alpha :as s]
[orchestra.core :refer [defn-spec]]
[clojure.data.json :as json]
[clojure.inspector :as ins]
[hato.client :as hato]
[clojure.string :as st]
@ -49,6 +50,7 @@
(s/def to-uri uri-vector?)
(s/def actor uri-string?)
(s/def object uri-string?)
(s/def ::to uri-string?)
(s/def ::target string?)
(s/def ::from uri-string?)
@ -82,6 +84,13 @@
"actor" (:from input-map)
"object" (:target input-map)))
(defn-spec write-json-ld string?
[input map?
filename string?]
(->
input
(json/write-str)
(#(spit filename %))))

View file

@ -0,0 +1,8 @@
{
"@context": "https:\/\/www.w3.org\/ns\/activitystreams",
"type": "Like",
"id": "https:\/\/social.bla\/alyssa\/out\/sdfsd44243g324g3455",
"to": "https:\/\/chatty.bla\/ben\/",
"actor": "https:\/\/social.bla\/alyssa\/",
"object": "posts\/234s23-2g34234-2hhj536"
}