added activitystreams2 namespace
This commit is contained in:
parent
061e800437
commit
938c323dd2
1 changed files with 56 additions and 0 deletions
|
@ -0,0 +1,56 @@
|
|||
(ns org.domaindrivenarchitecture.activity-pub-poc.core
|
||||
(:require [clojure.spec.alpha :as s]))
|
||||
|
||||
(s/def ::Object (s/keys
|
||||
:req-un [::id ::type] ;type darf nicht "Link" sein
|
||||
:opt-un [::attributedTo ::und-mehr]))
|
||||
(s/def ::id any?)
|
||||
(s/def ::type any?);(fn [s] (s/or (uri? s) (= s "Link"))))
|
||||
|
||||
(s/def ::Link (s/keys
|
||||
:req-un [::type] ; type muss "Link" sein
|
||||
:opt-un [::attributedTo ::und-mehr]))
|
||||
|
||||
(s/def ::Relationship (s/keys :req-un [::object ::und-mehr]))
|
||||
|
||||
; #### ACTIVITY ####
|
||||
(s/def ::Activity (s/merge
|
||||
::Object
|
||||
(s/keys
|
||||
:req-un [::actor ::object]
|
||||
:opt-un [::result ::target ::origin ::instrument
|
||||
::verb])))
|
||||
; "IntransitiveActivity" erbt von Activity, aber ohne ::object
|
||||
|
||||
(s/def ::actor (s/* (s/or ::Object ::Link)))
|
||||
(s/def ::attributedTo (s/* (s/or ::Object ::Link)))
|
||||
|
||||
(s/def ::object (s/* (s/or ::Object ::Link)))
|
||||
|
||||
(s/def ::result (s/* (s/or ::Object ::Link)))
|
||||
|
||||
(s/def ::target (s/* (s/or ::Object ::Link)))
|
||||
|
||||
(s/def ::origin (s/* (s/or ::Object ::Link)))
|
||||
|
||||
(s/def ::instrument (s/* (s/or ::Object ::Link)))
|
||||
|
||||
(s/def ::verb (s/* uri?))
|
||||
|
||||
(s/def ::instrument (s/* (s/or ::Object ::Link)))
|
||||
|
||||
|
||||
|
||||
|
||||
; #### LIKE ####
|
||||
(s/def ::Like ::Activity)
|
||||
|
||||
; Was beim Type Activity optional und required ist, ist abhängig vom Aktivitätstyp.
|
||||
; Bspw brauch ein Like einen actor und den type "Like" und (xor) target/object.
|
||||
; Aber die "IntransitiveActivity" (die alles von Activity erbt außer "object") vom Type "Question" besitzt keinen "actor".
|
||||
|
||||
(def maybeLike?
|
||||
{:id "https://social.bla/alyssa#likes/RANDOMHASH",
|
||||
:type "Like",
|
||||
:actor "https://social.bla/alyssa",
|
||||
:object "https://chatty.bla/ben/posts/234s23-2g34234-2hhj536"})
|
Loading…
Reference in a new issue