package activitypub_client

  1. Overview
  2. Docs

Implementation of objects

Objects

Implementation of objects inherits from Activitypub.Object.object_ and here we provide a way to dereference objects. To dereference an object, you need an actor and its public/private key to sign http queries. An Http_t module is used by Make to create a module of type T which can be used to create and dereference objects with the actor of the Http_t module in parameter of Make.

module type Http_t = sig ... end

Performing HTTP queries as a given actor.

type dereferencer = Iri.t -> (Rdf.Graph.graph * Iri.t option, Activitypub.E.error) Stdlib.result Lwt.t

A dereferencer takes an IRI and returns the result as a RDF graph and an optional IRI (for queries creating remote objects, like POST queries).

module type T = sig ... end

The type of modules to create, dereference and query objects as a given actor.

module Make (H : Http_t) : T

Convenient functions to create some specific objects and graphs.

val note : ?add:(Rdf.Graph.graph -> Rdf.Term.term -> unit) -> ?content_map:string Activitypub.Smap.t -> string -> Rdf.Graph.graph * Rdf.Term.term

note content creates a new graph, with empty name, of type Note, with the given content. An optional content_map can be passed to specify language-specific contents. The function returns the graph and the subject sub (a blank node) corresponding to the note id. The add optional argument is called on g and sub before returning.

link iri creates a new Activitypub.Object.link from the given parameters.

type attachment = [
  1. | `Iri of Iri.t
  2. | `Obj of Activitypub.Types.object_
]
val add_attachment : Rdf.Graph.graph -> Rdf.Term.term -> attachment -> unit

add_attachment g sub a adds a as an attachment to sub in graph g, eventually merging parts of a's triples into g.

val document : (module T) -> ?g:Rdf.Graph.graph -> ?root:Rdf.Term.term -> ?height:int -> ?media_type:Ldp.Ct.t -> ?name:string -> ?type_:Iri.t -> ?width:int -> Iri.t -> Activitypub.Types.document

document (module O) url creates a new object O.o from the given parameters. If no graph g is provided, a new one with an empty named is used. If no root node is provided, a blank node is used as id for the object. Default type of the object is Document but another one can be specified with typ argument.

OCaml

Innovation. Community. Security.