My agentic slop goes here. Not intended for anyone else!
1(** JMAP Module Type Signatures implementation *)
2
3(** Core Signatures *)
4
5module type JSONABLE = sig
6 type t
7 val to_json : t -> Yojson.Safe.t
8 val of_json : Yojson.Safe.t -> (t, string) result
9end
10
11module type PRINTABLE = sig
12 type t
13 val pp : Format.formatter -> t -> unit
14 val pp_hum : Format.formatter -> t -> unit
15end
16
17(** Wire Protocol Signatures *)
18
19module type WIRE_TYPE = sig
20 type t
21 include JSONABLE with type t := t
22 include PRINTABLE with type t := t
23 val validate : t -> (unit, string) result
24end
25
26(** JMAP Object Signatures *)
27
28module type JMAP_OBJECT = sig
29 type t
30 type id_type = string
31 include JSONABLE with type t := t
32 include PRINTABLE with type t := t
33 val id : t -> id_type option
34 val create : ?id:id_type -> unit -> t
35 val to_json_with_properties : properties:string list -> t -> Yojson.Safe.t
36 val valid_properties : unit -> string list
37end
38
39(** Method Signatures *)
40
41module type METHOD_ARGS = sig
42 type t
43 type account_id = string
44 include JSONABLE with type t := t
45 include PRINTABLE with type t := t
46 val account_id : t -> account_id
47 val validate : t -> (unit, string) result
48 val method_name : unit -> string
49end
50
51module type METHOD_RESPONSE = sig
52 type t
53 type account_id = string
54 type state = string
55 include JSONABLE with type t := t
56 include PRINTABLE with type t := t
57 val account_id : t -> account_id
58 val state : t -> state option
59 val is_error : t -> bool
60end
61
62(** Collection Signatures *)
63
64module type COLLECTION = sig
65 type t
66 type item
67 include JSONABLE with type t := t
68 include PRINTABLE with type t := t
69 val items : t -> item list
70 val total : t -> int option
71 val create : items:item list -> ?total:int -> unit -> t
72 val map : (item -> item) -> t -> t
73 val filter : (item -> bool) -> t -> t
74end
75
76(** Error Handling Signatures *)
77
78module type ERROR_TYPE = sig
79 type t
80 include JSONABLE with type t := t
81 include PRINTABLE with type t := t
82 val error_type : t -> string
83 val description : t -> string option
84 val create : error_type:string -> ?description:string -> unit -> t
85end
86
87(** RFC Compliance Signatures *)
88
89module type RFC_COMPLIANT = sig
90 type t
91 val rfc_section : unit -> string
92 val rfc_url : unit -> string
93 val implementation_notes : unit -> string list
94 val is_complete : unit -> bool
95 val unimplemented_features : unit -> string list
96end
97
98(** Vendor Extension Signatures *)
99
100module type VENDOR_EXTENSION = sig
101 type t
102 include JSONABLE with type t := t
103 include PRINTABLE with type t := t
104 val vendor : unit -> string
105 val extension_name : unit -> string
106 val capability_uri : unit -> string option
107 val is_experimental : unit -> bool
108end
109
110(** Patch Operations Signatures *)
111
112module type PATCHABLE = sig
113 type t
114 type patch
115 include JSONABLE with type t := t
116 val create_patch : from:t -> to_:t -> patch
117 val apply_patch : patch:patch -> t -> (t, string) result
118 val patch_to_operations : patch -> (string * Yojson.Safe.t) list
119end
120
121(** Composite Signatures *)
122
123module type FULL_JMAP_OBJECT = sig
124 include JMAP_OBJECT
125 include PATCHABLE with type t := t
126 include RFC_COMPLIANT with type t := t
127end
128
129module type JMAP_METHOD = sig
130 val name : unit -> string
131 module Args : METHOD_ARGS
132 module Response : METHOD_RESPONSE
133 val execute : Args.t -> (Response.t, string) result
134end