V1.ContactContact metadata with temporal support.
Contact schema V1 with temporal support.
This module defines the V1 contact schema with support for time-bounded information such as emails and organizations that are valid only during specific periods.
Schema Version Policy:
Contact kind - what type of entity this represents.
type service_kind = | ActivityPub of activitypub_variantActivityPub-compatible services
*)| GithubGitHub
*)| GitGitLab, Gitea, Codeberg, etc
*)| TwitterTwitter/X
*)| LinkedIn| PhotoImmich, Flickr, Instagram, etc
*)| Custom of stringOther service types
*)Service kind - categorization of online presence.
type service = {url : string;Full URL (primary identifier)
*)kind : service_kind option;Optional service categorization
*)handle : string option;Optional short handle/username
*)label : string option;Human description: "Cambridge GitLab", "Work account"
*)range : Sortal_schema__.Sortal_schema_temporal.range option;Temporal validity
*)primary : bool;Is this the primary/preferred service of its kind?
*)}An online service/identity.
type email = {address : string;type_ : email_type option;range : Sortal_schema__.Sortal_schema_temporal.range option;Validity period
*)note : string option;Context note, e.g., "NetApp position"
*)}type organization = {name : string;title : string option;department : string option;range : Sortal_schema__.Sortal_schema_temporal.range option;Employment period
*)email : string option;Work email during this period
*)url : string option;Work homepage during this period
*)address : string option;Office/postal address
*)}An AT Protocol service entry.
type atproto = {atp_handle : string;atp_did : string option;None until sync resolves
*)atp_services : atproto_service list;}AT Protocol identity with handle, cached DID, and services.
type t = {version : int;Schema version (always 1 for V1)
*)kind : contact_kind;Type of entity (Person, Organization, etc)
*)handle : string;Unique identifier
*)names : string list;Names, first is primary
*)emails : email list;Email addresses with temporal validity
*)organizations : organization list;Employment/affiliation history
*)urls : url_entry list;URLs with optional temporal validity
*)services : service list;Online services/identities
*)icon : string option;Avatar URL
*)thumbnail : string option;Local thumbnail path
*)orcid : string option;ORCID identifier
*)feeds : Sortal_schema__.Sortal_schema_feed.t list option;Feed subscriptions
*)atproto : atproto option;AT Protocol identity
*)}val make :
handle:string ->
names:string list ->
?kind:contact_kind ->
?emails:email list ->
?organizations:organization list ->
?urls:url_entry list ->
?services:service list ->
?icon:string ->
?thumbnail:string ->
?orcid:string ->
?feeds:Sortal_schema__.Sortal_schema_feed.t list ->
?atproto:atproto ->
unit ->
tmake ~handle ~names ?kind ?emails ?organizations ?urls ?services ?icon ?thumbnail ?orcid ?feeds () creates a new V1 contact.
The version field is automatically set to 1. The kind defaults to Person if not specified.
val make_email :
?type_:email_type ->
?from:Ptime.date ->
?until:Ptime.date ->
?note:string ->
string ->
emailmake_email ?type_ ?from ?until ?note address creates an email entry.
val email_of_string : string -> emailemail_of_string s creates a simple always-valid personal email.
val make_org :
?title:string ->
?department:string ->
?from:Ptime.date ->
?until:Ptime.date ->
?email:string ->
?url:string ->
?address:string ->
string ->
organizationmake_org ?title ?department ?from ?until ?email ?url ?address name creates an organization entry.
val make_url :
?label:string ->
?from:Ptime.date ->
?until:Ptime.date ->
string ->
url_entrymake_url ?label ?from ?until url creates a URL entry.
val url_of_string : string -> url_entryurl_of_string s creates a simple always-valid URL.
val make_service :
?kind:service_kind ->
?handle:string ->
?label:string ->
?from:Ptime.date ->
?until:Ptime.date ->
?primary:bool ->
string ->
servicemake_service ?kind ?handle ?label ?from ?until ?primary url creates a service entry.
val service_of_url : string -> serviceservice_of_url url creates a simple always-valid service from just a URL.
val version_of : t -> intval kind : t -> contact_kindval handle : t -> stringval names : t -> string listval name : t -> stringval primary_name : t -> stringval organizations : t -> organization listval icon : t -> string optionval thumbnail : t -> string optionval orcid : t -> string optionval feeds : t -> Sortal_schema__.Sortal_schema_feed.t list optionval atproto_handle : t -> string optionatproto_handle t returns the AT Protocol handle if present.
val atproto_did : t -> string optionatproto_did t returns the cached DID if resolved.
val atproto_services : t -> atproto_service listatproto_services t returns the list of AT Protocol services.
These accessors provide easy access to common service types.
val github_handle : t -> string optiongithub_handle t returns the GitHub username if present.
val twitter_handle : t -> string optiontwitter_handle t returns the Twitter/X username if present.
val mastodon_handle : t -> string optionmastodon_handle t returns the Mastodon handle if present.
val bluesky_handle : t -> string optionbluesky_handle t returns the Bluesky handle from AT Protocol identity if present.
val linkedin_handle : t -> string optionlinkedin_handle t returns the LinkedIn handle if present.
instagram t returns the Instagram/Photo service entry if present.
val email_at : t -> date:Ptime.date -> string optionemail_at t ~date returns the primary email valid at date.
val emails_at : t -> date:Ptime.date -> email listemails_at t ~date returns all emails valid at date.
val current_email : t -> string optioncurrent_email t returns the current primary email.
val organization_at : t -> date:Ptime.date -> organization optionorganization_at t ~date returns the organization at date.
val current_organization : t -> organization optioncurrent_organization t returns the current organization.
val current_organizations : t -> organization listcurrent_organizations t returns all current organizations.
val url_at : t -> date:Ptime.date -> string optionurl_at t ~date returns the primary URL valid at date.
val current_url : t -> string optioncurrent_url t returns the current primary URL.
val all_email_addresses : t -> string listall_email_addresses t returns all email addresses (any period).
val best_url : t -> string optionbest_url t returns the best available URL (current URL or service fallback).
val services_of_kind : t -> service_kind -> service listservices_of_kind t kind returns all services matching the given kind.
val services_at : t -> date:Ptime.date -> service listservices_at t ~date returns all services valid at date.
val primary_service : t -> service_kind -> service optionprimary_service t kind returns the primary service of the given kind.
val pp : Format.formatter -> t -> unitjson_t is the jsont encoder/decoder for V1 contacts.
The schema includes a version field that is always encoded and must equal 1 when decoded.
val contact_kind_to_string : contact_kind -> stringval contact_kind_of_string : string -> contact_kind optionval activitypub_variant_to_string : activitypub_variant -> stringval activitypub_variant_of_string : string -> activitypub_variantval service_kind_to_string : service_kind -> stringval service_kind_of_string : string -> service_kind optionval email_type_to_string : email_type -> stringval email_type_of_string : string -> email_type optionval atproto_service_type_to_string : atproto_service_type -> stringval atproto_service_type_of_string : string -> atproto_service_type