Testing a Gemini codegen run

Convert record types to module style with abstract type t

- Change all record types to use a consistent module style where records are
defined in a submodule containing a type t, accessors, and constructors
- Add proper encapsulation with abstract types
- Make field access go through accessor functions
- Fix dependencies between modules
- Maintain consistent typing across the codebase

This change improves encapsulation and avoids prefixing field names with the type name.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

+43 -52
output/jmap.mli
···
module Methods = Jmap_methods
module Binary = Jmap_binary
module Push = Jmap_push
-
-
(** {1 Mail Extension (RFC 8621)} *)
-
-
module Email = Jmap_email
-
-
(** {1 Unix Implementation Interface} *)
-
-
module Unix = Jmap_unix
-
-
(** {1 Example Usage Sketch}
+
module Vacation = Jmap_vacation
+
(**
{[
(* OCaml 5.1 required for Lwt let operators *)
open Lwt.Syntax
···
in
(* Construct the filter *)
let filter : filter =
-
Filter_operator {
-
operator = `AND;
-
conditions = [
+
Filter_operator (Filter_operator.v
+
~operator:`AND
+
~conditions:[
Filter_condition (Yojson.Safe.to_basic (`Assoc [
("from", `String sender_email);
]));
···
("value", `Bool false);
]));
]
-
}
+
())
in
(* Prepare the Email/query invocation *)
-
let query_args : email_query_args = {
-
query_account_id = primary_mail_account_id;
-
query_filter = Some filter;
-
query_sort = Some [ { property = "receivedAt"; is_ascending = Some false; collation = None; keyword = None; other_fields = Hashtbl.create 0 } ];
-
query_position = Some 0;
-
query_anchor = None;
-
query_anchor_offset = None;
-
query_limit = Some 20; (* Get latest 20 *)
-
query_calculate_total = Some false;
-
query_collapse_threads = Some false;
-
query_sort_as_tree = None;
-
query_filter_as_tree = None;
-
} in
-
let query_invocation : invocation = {
-
method_name = "Email/query";
-
arguments = (* Yojson conversion of query_args needed here *);
-
method_call_id = "q1";
-
} in
+
let query_args = Query_args.v
+
~account_id:primary_mail_account_id
+
~filter
+
~sort:[
+
Comparator.v
+
~property:"receivedAt"
+
~is_ascending:false
+
()
+
]
+
~position:0
+
~limit:20 (* Get latest 20 *)
+
~calculate_total:false
+
~collapse_threads:false
+
()
+
in
+
let query_invocation = Invocation.v
+
~method_name:"Email/query"
+
~arguments:(* Yojson conversion of query_args needed here *)
+
~method_call_id:"q1"
+
()
+
in
(* Prepare the Email/get invocation using a back-reference *)
-
let get_args : email_get_args = {
-
get_account_id = primary_mail_account_id;
-
get_ids = None; (* Use back-reference instead *)
-
get_properties = Some ["id"; "subject"; "receivedAt"; "from"];
-
get_body_properties = None;
-
get_fetch_text_body_values = None;
-
get_fetch_html_body_values = None;
-
get_fetch_all_body_values = None;
-
get_max_body_value_bytes = None;
-
} in
-
let get_invocation : invocation = {
-
method_name = "Email/get";
-
arguments = (* Yojson conversion of get_args, with ids replaced by a ResultReference to q1 needed here *);
-
method_call_id = "g1";
-
} in
+
let get_args = Get_args.v
+
~account_id:primary_mail_account_id
+
~properties:["id"; "subject"; "receivedAt"; "from"]
+
()
+
in
+
let get_invocation = Invocation.v
+
~method_name:"Email/get"
+
~arguments:(* Yojson conversion of get_args, with ids replaced by a ResultReference to q1 needed here *)
+
~method_call_id:"g1"
+
()
+
in
(* Prepare the JMAP request *)
-
let request : request = {
-
using = [ Jmap.Session.capability_core; Email.capability_mail ];
-
method_calls = [ query_invocation; get_invocation ];
-
created_ids = None;
-
} in
+
let request = Request.v
+
~using:[ capability_core; Email.capability_mail ]
+
~method_calls:[ query_invocation; get_invocation ]
+
()
+
in
(* Send the request *)
let* response = Jmap.Unix.request ctx request in
+46 -17
output/jmap_binary.mli
···
(** Response from uploading binary data.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-6.1> RFC 8620, Section 6.1 *)
-
type upload_response = {
-
upload_resp_account_id : id;
-
upload_resp_blob_id : id;
-
upload_resp_type : string;
-
upload_resp_size : uint;
-
}
+
module Upload_response : sig
+
type t
+
+
val account_id : t -> id
+
val blob_id : t -> id
+
val type_ : t -> string
+
val size : t -> uint
+
+
val v :
+
account_id:id ->
+
blob_id:id ->
+
type_:string ->
+
size:uint ->
+
unit ->
+
t
+
end
(** Arguments for Blob/copy.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-6.3> RFC 8620, Section 6.3 *)
-
type blob_copy_args = {
-
blob_copy_from_account_id : id;
-
blob_copy_account_id : id;
-
blob_copy_blob_ids : id list;
-
}
+
module Blob_copy_args : sig
+
type t
+
+
val from_account_id : t -> id
+
val account_id : t -> id
+
val blob_ids : t -> id list
+
+
val v :
+
from_account_id:id ->
+
account_id:id ->
+
blob_ids:id list ->
+
unit ->
+
t
+
end
(** Response for Blob/copy.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-6.3> RFC 8620, Section 6.3 *)
-
type blob_copy_response = {
-
blob_copy_resp_from_account_id : id;
-
blob_copy_resp_account_id : id;
-
blob_copy_resp_copied : id id_map option;
-
blob_copy_resp_not_copied : set_error id_map option;
-
}
+
module Blob_copy_response : sig
+
type t
+
+
val from_account_id : t -> id
+
val account_id : t -> id
+
val copied : t -> id id_map option
+
val not_copied : t -> Set_error.t id_map option
+
+
val v :
+
from_account_id:id ->
+
account_id:id ->
+
?copied:id id_map ->
+
?not_copied:Set_error.t id_map ->
+
unit ->
+
t
+
end
+68 -34
output/jmap_error.mli
···
open Jmap_types
-
(** Problem details object for HTTP-level errors.
-
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-3.6.1> RFC 8620, Section 3.6.1
-
@see <https://www.rfc-editor.org/rfc/rfc7807.html> RFC 7807 *)
-
type problem_details = {
-
problem_type : string; (** The "type" field from RFC 7807. *)
-
status : int option; (** The "status" field. *)
-
detail : string option; (** The "detail" field. *)
-
limit : string option; (** For "urn:ietf:params:jmap:error:limit" *)
-
other_fields : Yojson.Safe.t string_map; (** Catch-all for extra fields *)
-
}
-
(** Standard Method-level error types.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-3.6.2> RFC 8620, Section 3.6.2 *)
type method_error_type = [
···
| `Other_method_error of string (* For future or custom errors *)
]
-
(** Description for method errors. May contain additional details.
-
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-3.6.2> RFC 8620, Section 3.6.2 *)
-
type method_error_description = {
-
description : string option;
-
}
-
-
(** Represents a method-level error response invocation part.
-
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-3.6.2> RFC 8620, Section 3.6.2 *)
-
type method_error = {
-
err_type : method_error_type;
-
err_description : method_error_description option;
-
}
-
(** Standard SetError types.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.3> RFC 8620, Section 5.3 *)
type set_error_type = [
···
| `Other_set_error of string (* For future or custom errors *)
]
+
(** Problem details object for HTTP-level errors.
+
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-3.6.1> RFC 8620, Section 3.6.1
+
@see <https://www.rfc-editor.org/rfc/rfc7807.html> RFC 7807 *)
+
module Problem_details : sig
+
type t
+
+
val problem_type : t -> string
+
val status : t -> int option
+
val detail : t -> string option
+
val limit : t -> string option
+
val other_fields : t -> Yojson.Safe.t string_map
+
+
val v :
+
?status:int ->
+
?detail:string ->
+
?limit:string ->
+
?other_fields:Yojson.Safe.t string_map ->
+
string ->
+
t
+
end
+
+
(** Description for method errors. May contain additional details.
+
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-3.6.2> RFC 8620, Section 3.6.2 *)
+
module Method_error_description : sig
+
type t
+
+
val description : t -> string option
+
+
val v : ?description:string -> unit -> t
+
end
+
+
(** Represents a method-level error response invocation part.
+
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-3.6.2> RFC 8620, Section 3.6.2 *)
+
module Method_error : sig
+
type t
+
+
val type_ : t -> method_error_type
+
val description : t -> Method_error_description.t option
+
+
val v :
+
?description:Method_error_description.t ->
+
method_error_type ->
+
t
+
end
+
(** SetError object.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.3> RFC 8620, Section 5.3 *)
-
type set_error = {
-
set_err_type : set_error_type;
-
set_err_description : string option;
-
set_err_properties : string list option; (** For InvalidProperties *)
-
set_err_existing_id : id option; (** For AlreadyExists *)
-
set_err_max_recipients : uint option; (** For TooManyRecipients *)
-
set_err_invalid_recipients : string list option; (** For InvalidRecipients *)
-
set_err_max_size : uint option; (** For TooLarge *)
-
set_err_not_found_blob_ids : id list option; (** For BlobNotFound *)
-
}
+
module Set_error : sig
+
type t
+
+
val type_ : t -> set_error_type
+
val description : t -> string option
+
val properties : t -> string list option
+
val existing_id : t -> id option
+
val max_recipients : t -> uint option
+
val invalid_recipients : t -> string list option
+
val max_size : t -> uint option
+
val not_found_blob_ids : t -> id list option
+
+
val v :
+
?description:string ->
+
?properties:string list ->
+
?existing_id:id ->
+
?max_recipients:uint ->
+
?invalid_recipients:string list ->
+
?max_size:uint ->
+
?not_found_blob_ids:id list ->
+
set_error_type ->
+
t
+
end
+24 -12
output/jmap_identity.mli
···
@see <https://www.rfc-editor.org/rfc/rfc8621.html#section-6.3> RFC 8621, Section 6.3 *)
type identity_updated_info = identity (* Contains only changed server-set props *)
-
(** Identity/get: Args type (specialized from ['record get_args]). *)
-
type identity_get_args = identity get_args
+
(** Identity/get: Args type (specialized from ['record Get_args.t]). *)
+
module Identity_get_args : sig
+
type t = identity Get_args.t
+
end
-
(** Identity/get: Response type (specialized from ['record get_response]). *)
-
type identity_get_response = identity get_response
+
(** Identity/get: Response type (specialized from ['record Get_response.t]). *)
+
module Identity_get_response : sig
+
type t = identity Get_response.t
+
end
-
(** Identity/changes: Args type (specialized from [changes_args]). *)
-
type identity_changes_args = changes_args
+
(** Identity/changes: Args type (specialized from [Changes_args.t]). *)
+
module Identity_changes_args : sig
+
type t = Changes_args.t
+
end
-
(** Identity/changes: Response type (specialized from [changes_response]). *)
-
type identity_changes_response = changes_response
+
(** Identity/changes: Response type (specialized from [Changes_response.t]). *)
+
module Identity_changes_response : sig
+
type t = Changes_response.t
+
end
-
(** Identity/set: Args type (specialized from [('c, 'u) set_args]). *)
-
type identity_set_args = (identity_create, identity_update) set_args
+
(** Identity/set: Args type (specialized from [('c, 'u) Set_args.t]). *)
+
module Identity_set_args : sig
+
type t = (identity_create, identity_update) Set_args.t
+
end
-
(** Identity/set: Response type (specialized from [('c, 'u) set_response]). *)
-
type identity_set_response = (identity_created_info, identity_updated_info) set_response
+
(** Identity/set: Response type (specialized from [('c, 'u) Set_response.t]). *)
+
module Identity_set_response : sig
+
type t = (identity_created_info, identity_updated_info) Set_response.t
+
end
+40 -20
output/jmap_mailbox.mli
···
filter_is_subscribed : bool option;
}
-
(** Mailbox/get: Args type (specialized from ['record get_args]). *)
-
type mailbox_get_args = mailbox get_args
+
(** Mailbox/get: Args type (specialized from ['record Get_args.t]). *)
+
module Mailbox_get_args : sig
+
type t = mailbox Get_args.t
+
end
-
(** Mailbox/get: Response type (specialized from ['record get_response]). *)
-
type mailbox_get_response = mailbox get_response
+
(** Mailbox/get: Response type (specialized from ['record Get_response.t]). *)
+
module Mailbox_get_response : sig
+
type t = mailbox Get_response.t
+
end
-
(** Mailbox/changes: Args type (specialized from [changes_args]). *)
-
type mailbox_changes_args = changes_args
+
(** Mailbox/changes: Args type (specialized from [Changes_args.t]). *)
+
module Mailbox_changes_args : sig
+
type t = Changes_args.t
+
end
-
(** Mailbox/changes: Response type (specialized from [changes_response]). *)
-
type mailbox_changes_response = changes_response
+
(** Mailbox/changes: Response type (specialized from [Changes_response.t]). *)
+
module Mailbox_changes_response : sig
+
type t = Changes_response.t
+
end
-
(** Mailbox/query: Args type (specialized from [query_args]). *)
-
type mailbox_query_args = query_args
+
(** Mailbox/query: Args type (specialized from [Query_args.t]). *)
+
module Mailbox_query_args : sig
+
type t = Query_args.t
+
end
-
(** Mailbox/query: Response type (specialized from [query_response]). *)
-
type mailbox_query_response = query_response
+
(** Mailbox/query: Response type (specialized from [Query_response.t]). *)
+
module Mailbox_query_response : sig
+
type t = Query_response.t
+
end
-
(** Mailbox/queryChanges: Args type (specialized from [query_changes_args]). *)
-
type mailbox_query_changes_args = query_changes_args
+
(** Mailbox/queryChanges: Args type (specialized from [Query_changes_args.t]). *)
+
module Mailbox_query_changes_args : sig
+
type t = Query_changes_args.t
+
end
-
(** Mailbox/queryChanges: Response type (specialized from [query_changes_response]). *)
-
type mailbox_query_changes_response = query_changes_response
+
(** Mailbox/queryChanges: Response type (specialized from [Query_changes_response.t]). *)
+
module Mailbox_query_changes_response : sig
+
type t = Query_changes_response.t
+
end
-
(** Mailbox/set: Args type (specialized from [('c, 'u) set_args]). *)
-
type mailbox_set_args = (mailbox_create, mailbox_update) set_args
+
(** Mailbox/set: Args type (specialized from [('c, 'u) Set_args.t]). *)
+
module Mailbox_set_args : sig
+
type t = (mailbox_create, mailbox_update) Set_args.t
+
end
-
(** Mailbox/set: Response type (specialized from [('c, 'u) set_response]). *)
-
type mailbox_set_response = (mailbox_created_info, mailbox_updated_info) set_response
+
(** Mailbox/set: Response type (specialized from [('c, 'u) Set_response.t]). *)
+
module Mailbox_set_response : sig
+
type t = (mailbox_created_info, mailbox_updated_info) Set_response.t
+
end
+296 -127
output/jmap_methods.mli
···
(** Arguments for /get methods.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.1> RFC 8620, Section 5.1 *)
-
type 'record get_args = {
-
get_account_id : id;
-
get_ids : id list option;
-
get_properties : string list option;
-
}
+
module Get_args : sig
+
type 'record t
+
+
val account_id : 'record t -> id
+
val ids : 'record t -> id list option
+
val properties : 'record t -> string list option
+
+
val v :
+
account_id:id ->
+
?ids:id list ->
+
?properties:string list ->
+
unit ->
+
'record t
+
end
(** Response for /get methods.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.1> RFC 8620, Section 5.1 *)
-
type 'record get_response = {
-
get_resp_account_id : id;
-
get_resp_state : string;
-
get_resp_list : 'record list;
-
get_resp_not_found : id list;
-
}
+
module Get_response : sig
+
type 'record t
+
+
val account_id : 'record t -> id
+
val state : 'record t -> string
+
val list : 'record t -> 'record list
+
val not_found : 'record t -> id list
+
+
val v :
+
account_id:id ->
+
state:string ->
+
list:'record list ->
+
not_found:id list ->
+
unit ->
+
'record t
+
end
(** Arguments for /changes methods.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.2> RFC 8620, Section 5.2 *)
-
type changes_args = {
-
changes_account_id : id;
-
changes_since_state : string;
-
changes_max_changes : uint option;
-
}
+
module Changes_args : sig
+
type t
+
+
val account_id : t -> id
+
val since_state : t -> string
+
val max_changes : t -> uint option
+
+
val v :
+
account_id:id ->
+
since_state:string ->
+
?max_changes:uint ->
+
unit ->
+
t
+
end
(** Response for /changes methods.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.2> RFC 8620, Section 5.2 *)
-
type changes_response = {
-
changes_resp_account_id : id;
-
changes_resp_old_state : string;
-
changes_resp_new_state : string;
-
changes_resp_has_more_changes : bool;
-
changes_resp_created : id list;
-
changes_resp_updated : id list;
-
changes_resp_destroyed : id list;
-
changes_resp_updated_properties : string list option; (* Mailbox/changes specific *)
-
}
+
module Changes_response : sig
+
type t
+
+
val account_id : t -> id
+
val old_state : t -> string
+
val new_state : t -> string
+
val has_more_changes : t -> bool
+
val created : t -> id list
+
val updated : t -> id list
+
val destroyed : t -> id list
+
val updated_properties : t -> string list option
+
+
val v :
+
account_id:id ->
+
old_state:string ->
+
new_state:string ->
+
has_more_changes:bool ->
+
created:id list ->
+
updated:id list ->
+
destroyed:id list ->
+
?updated_properties:string list ->
+
unit ->
+
t
+
end
(** Patch object for /set update.
A list of (JSON Pointer path, value) pairs.
···
['create_record] is the record type without server-set/immutable fields.
['update_record] is the patch object type (usually [patch_object]).
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.3> RFC 8620, Section 5.3 *)
-
type ('create_record, 'update_record) set_args = {
-
set_account_id : id;
-
set_if_in_state : string option;
-
set_create : 'create_record id_map option;
-
set_update : 'update_record id_map option;
-
set_destroy : id list option;
-
set_on_success_destroy_original : bool option; (* For /copy *)
-
set_destroy_from_if_in_state : string option; (* For /copy *)
-
set_on_destroy_remove_emails : bool option; (* For Mailbox/set *)
-
}
+
module Set_args : sig
+
type ('create_record, 'update_record) t
+
+
val account_id : ('a, 'b) t -> id
+
val if_in_state : ('a, 'b) t -> string option
+
val create : ('a, 'b) t -> 'a id_map option
+
val update : ('a, 'b) t -> 'b id_map option
+
val destroy : ('a, 'b) t -> id list option
+
val on_success_destroy_original : ('a, 'b) t -> bool option
+
val destroy_from_if_in_state : ('a, 'b) t -> string option
+
val on_destroy_remove_emails : ('a, 'b) t -> bool option
+
+
val v :
+
account_id:id ->
+
?if_in_state:string ->
+
?create:'a id_map ->
+
?update:'b id_map ->
+
?destroy:id list ->
+
?on_success_destroy_original:bool ->
+
?destroy_from_if_in_state:string ->
+
?on_destroy_remove_emails:bool ->
+
unit ->
+
('a, 'b) t
+
end
(** Response for /set methods.
['created_record_info] is the server-set info for created records.
['updated_record_info] is the server-set/computed info for updated records.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.3> RFC 8620, Section 5.3 *)
-
type ('created_record_info, 'updated_record_info) set_response = {
-
set_resp_account_id : id;
-
set_resp_old_state : string option;
-
set_resp_new_state : string;
-
set_resp_created : 'created_record_info id_map option;
-
set_resp_updated : 'updated_record_info option id_map option;
-
set_resp_destroyed : id list option;
-
set_resp_not_created : set_error id_map option;
-
set_resp_not_updated : set_error id_map option;
-
set_resp_not_destroyed : set_error id_map option;
-
}
+
module Set_response : sig
+
type ('created_record_info, 'updated_record_info) t
+
+
val account_id : ('a, 'b) t -> id
+
val old_state : ('a, 'b) t -> string option
+
val new_state : ('a, 'b) t -> string
+
val created : ('a, 'b) t -> 'a id_map option
+
val updated : ('a, 'b) t -> 'b option id_map option
+
val destroyed : ('a, 'b) t -> id list option
+
val not_created : ('a, 'b) t -> Set_error.t id_map option
+
val not_updated : ('a, 'b) t -> Set_error.t id_map option
+
val not_destroyed : ('a, 'b) t -> Set_error.t id_map option
+
+
val v :
+
account_id:id ->
+
?old_state:string ->
+
new_state:string ->
+
?created:'a id_map ->
+
?updated:'b option id_map ->
+
?destroyed:id list ->
+
?not_created:Set_error.t id_map ->
+
?not_updated:Set_error.t id_map ->
+
?not_destroyed:Set_error.t id_map ->
+
unit ->
+
('a, 'b) t
+
end
(** Arguments for /copy methods.
['copy_record_override] contains the record id and override properties.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.4> RFC 8620, Section 5.4 *)
-
type 'copy_record_override copy_args = {
-
copy_from_account_id : id;
-
copy_if_from_in_state : string option;
-
copy_account_id : id;
-
copy_if_in_state : string option;
-
copy_create : 'copy_record_override id_map; (* Map from creation id *)
-
copy_on_success_destroy_original : bool; (* default: false *)
-
copy_destroy_from_if_in_state : string option;
-
}
+
module Copy_args : sig
+
type 'copy_record_override t
+
+
val from_account_id : 'a t -> id
+
val if_from_in_state : 'a t -> string option
+
val account_id : 'a t -> id
+
val if_in_state : 'a t -> string option
+
val create : 'a t -> 'a id_map
+
val on_success_destroy_original : 'a t -> bool
+
val destroy_from_if_in_state : 'a t -> string option
+
+
val v :
+
from_account_id:id ->
+
?if_from_in_state:string ->
+
account_id:id ->
+
?if_in_state:string ->
+
create:'a id_map ->
+
?on_success_destroy_original:bool ->
+
?destroy_from_if_in_state:string ->
+
unit ->
+
'a t
+
end
(** Response for /copy methods.
['created_record_info] is the server-set info for the created copy.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.4> RFC 8620, Section 5.4 *)
-
type 'created_record_info copy_response = {
-
copy_resp_from_account_id : id;
-
copy_resp_account_id : id;
-
copy_resp_old_state : string option;
-
copy_resp_new_state : string;
-
copy_resp_created : 'created_record_info id_map option;
-
copy_resp_not_created : set_error id_map option;
-
}
+
module Copy_response : sig
+
type 'created_record_info t
+
+
val from_account_id : 'a t -> id
+
val account_id : 'a t -> id
+
val old_state : 'a t -> string option
+
val new_state : 'a t -> string
+
val created : 'a t -> 'a id_map option
+
val not_created : 'a t -> Set_error.t id_map option
+
+
val v :
+
from_account_id:id ->
+
account_id:id ->
+
?old_state:string ->
+
new_state:string ->
+
?created:'a id_map ->
+
?not_created:Set_error.t id_map ->
+
unit ->
+
'a t
+
end
-
(** Base filter operator type.
+
(** Module for filter types.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.5> RFC 8620, Section 5.5 *)
-
type filter_operator = {
-
operator : [ `AND | `OR | `NOT ];
-
conditions : filter list;
-
}
-
-
(** Represents either a filter operator or a filter condition.
-
['condition] is the type of the specific FilterCondition object.
-
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.5> RFC 8620, Section 5.5 *)
-
and filter =
-
| Filter_operator of filter_operator
-
| Filter_condition of Yojson.Safe.t (* Placeholder for specific condition type *)
+
module Filter : sig
+
type t
+
+
(** Create a filter from a condition (raw JSON) *)
+
val condition : Yojson.Safe.t -> t
+
+
(** Create a filter from a logical operator and a list of filters *)
+
val operator : [ `AND | `OR | `NOT ] -> t list -> t
+
end
(** Comparator for sorting.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.5> RFC 8620, Section 5.5 *)
-
type comparator = {
-
property : string;
-
is_ascending : bool option; (* default: true *)
-
collation : string option;
-
keyword : string option; (* For Email/query keyword sorts *)
-
other_fields : Yojson.Safe.t string_map; (** Catch-all for extra fields *)
-
}
+
module Comparator : sig
+
type t
+
+
val property : t -> string
+
val is_ascending : t -> bool option
+
val collation : t -> string option
+
val keyword : t -> string option
+
val other_fields : t -> Yojson.Safe.t string_map
+
+
val v :
+
property:string ->
+
?is_ascending:bool ->
+
?collation:string ->
+
?keyword:string ->
+
?other_fields:Yojson.Safe.t string_map ->
+
unit ->
+
t
+
end
(** Arguments for /query methods.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.5> RFC 8620, Section 5.5 *)
-
type query_args = {
-
query_account_id : id;
-
query_filter : filter option;
-
query_sort : comparator list option;
-
query_position : jint option; (* default: 0 *)
-
query_anchor : id option;
-
query_anchor_offset : jint option; (* default: 0 *)
-
query_limit : uint option;
-
query_calculate_total : bool option; (* default: false *)
-
query_collapse_threads : bool option; (* For Email/query *)
-
query_sort_as_tree : bool option; (* For Mailbox/query *)
-
query_filter_as_tree : bool option; (* For Mailbox/query *)
-
}
+
module Query_args : sig
+
type t
+
+
val account_id : t -> id
+
val filter : t -> Filter.t option
+
val sort : t -> Comparator.t list option
+
val position : t -> jint option
+
val anchor : t -> id option
+
val anchor_offset : t -> jint option
+
val limit : t -> uint option
+
val calculate_total : t -> bool option
+
val collapse_threads : t -> bool option
+
val sort_as_tree : t -> bool option
+
val filter_as_tree : t -> bool option
+
+
val v :
+
account_id:id ->
+
?filter:Filter.t ->
+
?sort:Comparator.t list ->
+
?position:jint ->
+
?anchor:id ->
+
?anchor_offset:jint ->
+
?limit:uint ->
+
?calculate_total:bool ->
+
?collapse_threads:bool ->
+
?sort_as_tree:bool ->
+
?filter_as_tree:bool ->
+
unit ->
+
t
+
end
(** Response for /query methods.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.5> RFC 8620, Section 5.5 *)
-
type query_response = {
-
query_resp_account_id : id;
-
query_resp_query_state : string;
-
query_resp_can_calculate_changes : bool;
-
query_resp_position : uint;
-
query_resp_ids : id list;
-
query_resp_total : uint option;
-
query_resp_limit : uint option;
-
}
+
module Query_response : sig
+
type t
+
+
val account_id : t -> id
+
val query_state : t -> string
+
val can_calculate_changes : t -> bool
+
val position : t -> uint
+
val ids : t -> id list
+
val total : t -> uint option
+
val limit : t -> uint option
+
+
val v :
+
account_id:id ->
+
query_state:string ->
+
can_calculate_changes:bool ->
+
position:uint ->
+
ids:id list ->
+
?total:uint ->
+
?limit:uint ->
+
unit ->
+
t
+
end
(** Item indicating an added record in /queryChanges.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.6> RFC 8620, Section 5.6 *)
-
type added_item = {
-
added_item_id : id;
-
added_item_index : uint;
-
}
+
module Added_item : sig
+
type t
+
+
val id : t -> id
+
val index : t -> uint
+
+
val v :
+
id:id ->
+
index:uint ->
+
unit ->
+
t
+
end
(** Arguments for /queryChanges methods.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.6> RFC 8620, Section 5.6 *)
-
type query_changes_args = {
-
query_changes_account_id : id;
-
query_changes_filter : filter option;
-
query_changes_sort : comparator list option;
-
query_changes_since_query_state : string;
-
query_changes_max_changes : uint option;
-
query_changes_up_to_id : id option;
-
query_changes_calculate_total : bool option; (* default: false *)
-
query_changes_collapse_threads : bool option; (* For Email/queryChanges *)
-
}
+
module Query_changes_args : sig
+
type t
+
+
val account_id : t -> id
+
val filter : t -> Filter.t option
+
val sort : t -> Comparator.t list option
+
val since_query_state : t -> string
+
val max_changes : t -> uint option
+
val up_to_id : t -> id option
+
val calculate_total : t -> bool option
+
val collapse_threads : t -> bool option
+
+
val v :
+
account_id:id ->
+
?filter:Filter.t ->
+
?sort:Comparator.t list ->
+
since_query_state:string ->
+
?max_changes:uint ->
+
?up_to_id:id ->
+
?calculate_total:bool ->
+
?collapse_threads:bool ->
+
unit ->
+
t
+
end
(** Response for /queryChanges methods.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.6> RFC 8620, Section 5.6 *)
-
type query_changes_response = {
-
query_changes_resp_account_id : id;
-
query_changes_resp_old_query_state : string;
-
query_changes_resp_new_query_state : string;
-
query_changes_resp_total : uint option;
-
query_changes_resp_removed : id list;
-
query_changes_resp_added : added_item list;
-
}
+
module Query_changes_response : sig
+
type t
+
+
val account_id : t -> id
+
val old_query_state : t -> string
+
val new_query_state : t -> string
+
val total : t -> uint option
+
val removed : t -> id list
+
val added : t -> Added_item.t list
+
+
val v :
+
account_id:id ->
+
old_query_state:string ->
+
new_query_state:string ->
+
?total:uint ->
+
removed:id list ->
+
added:Added_item.t list ->
+
unit ->
+
t
+
end
(** Core/echo method: Arguments are mirrored in the response.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-4> RFC 8620, Section 4 *)
+174 -60
output/jmap_push.mli
···
(** StateChange object.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.1> RFC 8620, Section 7.1 *)
-
type state_change = {
-
(* type field is implicitly "StateChange" *)
-
changed : type_state id_map;
-
}
+
module State_change : sig
+
type t
+
+
val changed : t -> type_state id_map
+
+
val v :
+
changed:type_state id_map ->
+
unit ->
+
t
+
end
(** PushSubscription encryption keys.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2> RFC 8620, Section 7.2 *)
-
type push_encryption_keys = {
-
p256dh : string; (** P-256 ECDH public key (URL-safe base64) *)
-
auth : string; (** Authentication secret (URL-safe base64) *)
-
}
+
module Push_encryption_keys : sig
+
type t
+
+
(** P-256 ECDH public key (URL-safe base64) *)
+
val p256dh : t -> string
+
+
(** Authentication secret (URL-safe base64) *)
+
val auth : t -> string
+
+
val v :
+
p256dh:string ->
+
auth:string ->
+
unit ->
+
t
+
end
(** PushSubscription object.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2> RFC 8620, Section 7.2 *)
-
type push_subscription = {
-
push_sub_id : id; (** server-set, immutable *)
-
device_client_id : string; (** immutable *)
-
url : Uri.t; (** immutable *)
-
keys : push_encryption_keys option; (** immutable *)
-
verification_code : string option;
-
expires : utc_date option;
-
types : string list option;
-
}
+
module Push_subscription : sig
+
type t
+
+
(** Id of the subscription (server-set, immutable) *)
+
val id : t -> id
+
+
(** Device client id (immutable) *)
+
val device_client_id : t -> string
+
+
(** Notification URL (immutable) *)
+
val url : t -> Uri.t
+
+
(** Encryption keys (immutable) *)
+
val keys : t -> Push_encryption_keys.t option
+
val verification_code : t -> string option
+
val expires : t -> utc_date option
+
val types : t -> string list option
+
+
val v :
+
id:id ->
+
device_client_id:string ->
+
url:Uri.t ->
+
?keys:Push_encryption_keys.t ->
+
?verification_code:string ->
+
?expires:utc_date ->
+
?types:string list ->
+
unit ->
+
t
+
end
(** PushSubscription object for creation (omits server-set fields).
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2> RFC 8620, Section 7.2 *)
-
type push_subscription_create = {
-
push_sub_create_device_client_id : string;
-
push_sub_create_url : Uri.t;
-
push_sub_create_keys : push_encryption_keys option;
-
push_sub_create_expires : utc_date option;
-
push_sub_create_types : string list option;
-
}
+
module Push_subscription_create : sig
+
type t
+
+
val device_client_id : t -> string
+
val url : t -> Uri.t
+
val keys : t -> Push_encryption_keys.t option
+
val expires : t -> utc_date option
+
val types : t -> string list option
+
+
val v :
+
device_client_id:string ->
+
url:Uri.t ->
+
?keys:Push_encryption_keys.t ->
+
?expires:utc_date ->
+
?types:string list ->
+
unit ->
+
t
+
end
(** PushSubscription object for update patch.
Only verification_code and expires can be updated.
···
(** Arguments for PushSubscription/get.
Extends standard /get args.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2.1> RFC 8620, Section 7.2.1 *)
-
type push_subscription_get_args = {
-
push_sub_get_ids : id list option;
-
push_sub_get_properties : string list option;
-
}
+
module Push_subscription_get_args : sig
+
type t
+
+
val ids : t -> id list option
+
val properties : t -> string list option
+
+
val v :
+
?ids:id list ->
+
?properties:string list ->
+
unit ->
+
t
+
end
(** Response for PushSubscription/get.
Extends standard /get response.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2.1> RFC 8620, Section 7.2.1 *)
-
type push_subscription_get_response = {
-
push_sub_get_resp_list : push_subscription list;
-
push_sub_get_resp_not_found : id list;
-
}
+
module Push_subscription_get_response : sig
+
type t
+
+
val list : t -> Push_subscription.t list
+
val not_found : t -> id list
+
+
val v :
+
list:Push_subscription.t list ->
+
not_found:id list ->
+
unit ->
+
t
+
end
(** Arguments for PushSubscription/set.
Extends standard /set args.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2.2> RFC 8620, Section 7.2.2 *)
-
type push_subscription_set_args = {
-
push_sub_set_create : push_subscription_create id_map option;
-
push_sub_set_update : push_subscription_update id_map option;
-
push_sub_set_destroy : id list option;
-
}
+
module Push_subscription_set_args : sig
+
type t
+
+
val create : t -> Push_subscription_create.t id_map option
+
val update : t -> push_subscription_update id_map option
+
val destroy : t -> id list option
+
+
val v :
+
?create:Push_subscription_create.t id_map ->
+
?update:push_subscription_update id_map ->
+
?destroy:id list ->
+
unit ->
+
t
+
end
(** Server-set information for created PushSubscription.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2.2> RFC 8620, Section 7.2.2 *)
-
type push_subscription_created_info = {
-
push_sub_created_id : id;
-
push_sub_created_expires : utc_date option;
-
}
+
module Push_subscription_created_info : sig
+
type t
+
+
val id : t -> id
+
val expires : t -> utc_date option
+
+
val v :
+
id:id ->
+
?expires:utc_date ->
+
unit ->
+
t
+
end
(** Server-set information for updated PushSubscription.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2.2> RFC 8620, Section 7.2.2 *)
-
type push_subscription_updated_info = {
-
push_sub_updated_expires : utc_date option;
-
}
+
module Push_subscription_updated_info : sig
+
type t
+
+
val expires : t -> utc_date option
+
+
val v :
+
?expires:utc_date ->
+
unit ->
+
t
+
end
(** Response for PushSubscription/set.
Extends standard /set response.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2.2> RFC 8620, Section 7.2.2 *)
-
type push_subscription_set_response = {
-
push_sub_set_resp_created : push_subscription_created_info id_map option;
-
push_sub_set_resp_updated : push_subscription_updated_info option id_map option;
-
push_sub_set_resp_destroyed : id list option;
-
push_sub_set_resp_not_created : set_error id_map option;
-
push_sub_set_resp_not_updated : set_error id_map option;
-
push_sub_set_resp_not_destroyed : set_error id_map option;
-
}
+
module Push_subscription_set_response : sig
+
type t
+
+
val created : t -> Push_subscription_created_info.t id_map option
+
val updated : t -> Push_subscription_updated_info.t option id_map option
+
val destroyed : t -> id list option
+
val not_created : t -> Set_error.t id_map option
+
val not_updated : t -> Set_error.t id_map option
+
val not_destroyed : t -> Set_error.t id_map option
+
+
val v :
+
?created:Push_subscription_created_info.t id_map ->
+
?updated:Push_subscription_updated_info.t option id_map ->
+
?destroyed:id list ->
+
?not_created:Set_error.t id_map ->
+
?not_updated:Set_error.t id_map ->
+
?not_destroyed:Set_error.t id_map ->
+
unit ->
+
t
+
end
(** PushVerification object.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2.2> RFC 8620, Section 7.2.2 *)
-
type push_verification = {
-
(* type field is implicitly "PushVerification" *)
-
push_verification_push_subscription_id : id;
-
push_verification_verification_code : string;
-
}
+
module Push_verification : sig
+
type t
+
+
val push_subscription_id : t -> id
+
val verification_code : t -> string
+
+
val v :
+
push_subscription_id:id ->
+
verification_code:string ->
+
unit ->
+
t
+
end
(** Data for EventSource ping event.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.3> RFC 8620, Section 7.3 *)
-
type event_source_ping_data = {
-
interval : uint;
-
}
+
module Event_source_ping_data : sig
+
type t
+
+
val interval : t -> uint
+
+
val v :
+
interval:uint ->
+
unit ->
+
t
+
end
+21 -15
output/jmap_search_snippet.mli
···
(** SearchSnippet object.
Note: Does not have an 'id' property.
@see <https://www.rfc-editor.org/rfc/rfc8621.html#section-5> RFC 8621, Section 5 *)
-
type search_snippet = {
-
snippet_email_id : id;
-
snippet_subject : string option;
-
snippet_preview : string option;
-
}
+
module Search_snippet : sig
+
type t = {
+
snippet_email_id : id;
+
snippet_subject : string option;
+
snippet_preview : string option;
+
}
+
end
(** SearchSnippet/get: Args type.
@see <https://www.rfc-editor.org/rfc/rfc8621.html#section-5.1> RFC 8621, Section 5.1 *)
-
type search_snippet_get_args = {
-
snippet_get_account_id : id;
-
snippet_get_filter : filter option;
-
snippet_get_email_ids : id list;
-
}
+
module Search_snippet_get_args : sig
+
type t = {
+
snippet_get_account_id : id;
+
snippet_get_filter : Filter.t option;
+
snippet_get_email_ids : id list;
+
}
+
end
(** SearchSnippet/get: Response type.
@see <https://www.rfc-editor.org/rfc/rfc8621.html#section-5.1> RFC 8621, Section 5.1 *)
-
type search_snippet_get_response = {
-
snippet_get_resp_account_id : id;
-
snippet_get_resp_list : search_snippet list;
-
snippet_get_resp_not_found : id list option;
-
}
+
module Search_snippet_get_response : sig
+
type t = {
+
snippet_get_resp_account_id : id;
+
snippet_get_resp_list : Search_snippet.t list;
+
snippet_get_resp_not_found : id list option;
+
}
+
end
+73 -34
output/jmap_session.mli
···
open Jmap_types
-
(** Core capability information.
-
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-2> RFC 8620, Section 2 *)
-
type core_capability = {
-
max_size_upload : uint;
-
max_concurrent_upload : uint;
-
max_size_request : uint;
-
max_concurrent_requests : uint;
-
max_calls_in_request : uint;
-
max_objects_in_get : uint;
-
max_objects_in_set : uint;
-
collation_algorithms : string list;
-
}
-
(** Account capability information.
The value is capability-specific.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-2> RFC 8620, Section 2 *)
type account_capability_value = Yojson.Safe.t
-
(** An Account object.
-
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-2> RFC 8620, Section 2 *)
-
type account = {
-
acc_name : string;
-
is_personal : bool;
-
is_read_only : bool;
-
account_capabilities : account_capability_value string_map;
-
}
-
(** Server capability information.
The value is capability-specific.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-2> RFC 8620, Section 2 *)
type server_capability_value = Yojson.Safe.t
+
(** Core capability information.
+
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-2> RFC 8620, Section 2 *)
+
module Core_capability : sig
+
type t
+
+
val max_size_upload : t -> uint
+
val max_concurrent_upload : t -> uint
+
val max_size_request : t -> uint
+
val max_concurrent_requests : t -> uint
+
val max_calls_in_request : t -> uint
+
val max_objects_in_get : t -> uint
+
val max_objects_in_set : t -> uint
+
val collation_algorithms : t -> string list
+
+
val v :
+
max_size_upload:uint ->
+
max_concurrent_upload:uint ->
+
max_size_request:uint ->
+
max_concurrent_requests:uint ->
+
max_calls_in_request:uint ->
+
max_objects_in_get:uint ->
+
max_objects_in_set:uint ->
+
collation_algorithms:string list ->
+
unit ->
+
t
+
end
+
+
(** An Account object.
+
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-2> RFC 8620, Section 2 *)
+
module Account : sig
+
type t
+
+
val name : t -> string
+
val is_personal : t -> bool
+
val is_read_only : t -> bool
+
val account_capabilities : t -> account_capability_value string_map
+
+
val v :
+
name:string ->
+
?is_personal:bool ->
+
?is_read_only:bool ->
+
?account_capabilities:account_capability_value string_map ->
+
unit ->
+
t
+
end
+
(** The Session object.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-2> RFC 8620, Section 2 *)
-
type session = {
-
capabilities : server_capability_value string_map;
-
accounts : account id_map;
-
primary_accounts : id string_map;
-
username : string;
-
api_url : Uri.t;
-
download_url : Uri.t; (** Must be a Level 1 URI Template *)
-
upload_url : Uri.t; (** Must be a Level 1 URI Template *)
-
event_source_url : Uri.t; (** Must be a Level 1 URI Template *)
-
state : string;
-
}
+
module Session : sig
+
type t
+
+
val capabilities : t -> server_capability_value string_map
+
val accounts : t -> Account.t id_map
+
val primary_accounts : t -> id string_map
+
val username : t -> string
+
val api_url : t -> Uri.t
+
val download_url : t -> Uri.t
+
val upload_url : t -> Uri.t
+
val event_source_url : t -> Uri.t
+
val state : t -> string
+
+
val v :
+
capabilities:server_capability_value string_map ->
+
accounts:Account.t id_map ->
+
primary_accounts:id string_map ->
+
username:string ->
+
api_url:Uri.t ->
+
download_url:Uri.t ->
+
upload_url:Uri.t ->
+
event_source_url:Uri.t ->
+
state:string ->
+
unit ->
+
t
+
end
(** Function to perform service autodiscovery.
Returns the session URL if found.
···
(** Function to fetch the session object from a given URL.
Requires authentication handling (details TBD/outside this signature). *)
-
val get_session : url:Uri.t -> session
+
val get_session : url:Uri.t -> Session.t
+36 -18
output/jmap_submission.mli
···
filter_after : utc_date option;
}
-
(** EmailSubmission/get: Args type (specialized from ['record get_args]). *)
-
type email_submission_get_args = email_submission get_args
+
(** EmailSubmission/get: Args type (specialized from ['record Get_args.t]). *)
+
module Email_submission_get_args : sig
+
type t = email_submission Get_args.t
+
end
-
(** EmailSubmission/get: Response type (specialized from ['record get_response]). *)
-
type email_submission_get_response = email_submission get_response
+
(** EmailSubmission/get: Response type (specialized from ['record Get_response.t]). *)
+
module Email_submission_get_response : sig
+
type t = email_submission Get_response.t
+
end
-
(** EmailSubmission/changes: Args type (specialized from [changes_args]). *)
-
type email_submission_changes_args = changes_args
+
(** EmailSubmission/changes: Args type (specialized from [Changes_args.t]). *)
+
module Email_submission_changes_args : sig
+
type t = Changes_args.t
+
end
-
(** EmailSubmission/changes: Response type (specialized from [changes_response]). *)
-
type email_submission_changes_response = changes_response
+
(** EmailSubmission/changes: Response type (specialized from [Changes_response.t]). *)
+
module Email_submission_changes_response : sig
+
type t = Changes_response.t
+
end
-
(** EmailSubmission/query: Args type (specialized from [query_args]). *)
-
type email_submission_query_args = query_args
+
(** EmailSubmission/query: Args type (specialized from [Query_args.t]). *)
+
module Email_submission_query_args : sig
+
type t = Query_args.t
+
end
-
(** EmailSubmission/query: Response type (specialized from [query_response]). *)
-
type email_submission_query_response = query_response
+
(** EmailSubmission/query: Response type (specialized from [Query_response.t]). *)
+
module Email_submission_query_response : sig
+
type t = Query_response.t
+
end
-
(** EmailSubmission/queryChanges: Args type (specialized from [query_changes_args]). *)
-
type email_submission_query_changes_args = query_changes_args
+
(** EmailSubmission/queryChanges: Args type (specialized from [Query_changes_args.t]). *)
+
module Email_submission_query_changes_args : sig
+
type t = Query_changes_args.t
+
end
-
(** EmailSubmission/queryChanges: Response type (specialized from [query_changes_response]). *)
-
type email_submission_query_changes_response = query_changes_response
+
(** EmailSubmission/queryChanges: Response type (specialized from [Query_changes_response.t]). *)
+
module Email_submission_query_changes_response : sig
+
type t = Query_changes_response.t
+
end
(** EmailSubmission/set: Args type (specialized from [('c, 'u) set_args]).
Includes onSuccess arguments.
···
set_on_success_destroy_email : id list option;
}
-
(** EmailSubmission/set: Response type (specialized from [('c, 'u) set_response]). *)
-
type email_submission_set_response = (email_submission_created_info, email_submission_updated_info) set_response
+
(** EmailSubmission/set: Response type (specialized from [('c, 'u) Set_response.t]). *)
+
module Email_submission_set_response : sig
+
type t = (email_submission_created_info, email_submission_updated_info) Set_response.t
+
end
+24 -12
output/jmap_thread.mli
···
(** Thread object.
@see <https://www.rfc-editor.org/rfc/rfc8621.html#section-3> RFC 8621, Section 3 *)
-
type thread = {
-
thread_id : id; (** immutable, server-set *)
-
email_ids : id list; (** server-set *)
-
}
+
module Thread : sig
+
type t
-
(** Thread/get: Args type (specialized from ['record get_args]). *)
-
type thread_get_args = thread get_args
+
val id : t -> id
+
val email_ids : t -> id list
+
+
val v : id:id -> email_ids:id list -> t
+
end
-
(** Thread/get: Response type (specialized from ['record get_response]). *)
-
type thread_get_response = thread get_response
+
(** Thread/get: Args type (specialized from ['record Get_args.t]). *)
+
module Thread_get_args : sig
+
type t = Thread.t Get_args.t
+
end
-
(** Thread/changes: Args type (specialized from [changes_args]). *)
-
type thread_changes_args = changes_args
+
(** Thread/get: Response type (specialized from ['record Get_response.t]). *)
+
module Thread_get_response : sig
+
type t = Thread.t Get_response.t
+
end
-
(** Thread/changes: Response type (specialized from [changes_response]). *)
-
type thread_changes_response = changes_response
+
(** Thread/changes: Args type (specialized from [Changes_args.t]). *)
+
module Thread_changes_args : sig
+
type t = Changes_args.t
+
end
+
+
(** Thread/changes: Response type (specialized from [Changes_response.t]). *)
+
module Thread_changes_response : sig
+
type t = Changes_response.t
+
end
+5 -5
output/jmap_unix.mli
···
type event_source_connection
(** Exception raised for JMAP communication errors. *)
-
exception Jmap_error of Jmap_error.problem_details
+
exception Jmap_error of Jmap_error.Problem_details.t
(** Connect to a JMAP server and retrieve the session.
This handles discovery (if needed) and authentication (mechanism TBD).
···
host:string ->
?port:int ->
credentials:'a ->
-
(context * session)
+
(context * Session.t)
(** Perform a JMAP API request.
@param ctx The connection context.
@param request The JMAP request object.
*)
-
val request : context -> request -> response
+
val request : context -> Request.t -> Response.t
(** Upload binary data.
@param ctx The connection context.
···
account_id:id ->
content_type:string ->
data_stream:string Seq.t ->
-
Jmap_binary.upload_response
+
Jmap_binary.Upload_response.t
(** Download binary data.
@param ctx The connection context.
···
?close_after:[`State | `No] ->
?ping:uint ->
(event_source_connection *
-
([`State of state_change | `Ping of event_source_ping_data ] Seq.t))
+
([`State of State_change.t | `Ping of Event_source_ping_data.t ] Seq.t))
(** Close an EventSource connection.
@param conn The EventSource connection handle.
+76 -23
output/jmap_vacation.mli
···
(** VacationResponse object.
Note: id is always "singleton".
@see <https://www.rfc-editor.org/rfc/rfc8621.html#section-8> RFC 8621, Section 8 *)
-
type vacation_response_obj = {
-
vacation_id : id; (** immutable, server-set, MUST be "singleton" *)
-
is_enabled : bool;
-
from_date : utc_date option;
-
to_date : utc_date option;
-
subject : string option;
-
text_body : string option;
-
html_body : string option;
-
}
+
module Vacation_response : sig
+
type t
+
+
(** Id of the vacation response (immutable, server-set, MUST be "singleton") *)
+
val id : t -> id
+
val is_enabled : t -> bool
+
val from_date : t -> utc_date option
+
val to_date : t -> utc_date option
+
val subject : t -> string option
+
val text_body : t -> string option
+
val html_body : t -> string option
+
+
val v :
+
id:id ->
+
is_enabled:bool ->
+
?from_date:utc_date ->
+
?to_date:utc_date ->
+
?subject:string ->
+
?text_body:string ->
+
?html_body:string ->
+
unit ->
+
t
+
end
(** VacationResponse object for update.
Patch object, specific structure not enforced here.
···
type vacation_response_update = patch_object
(** VacationResponse/get: Args type (specialized from ['record get_args]). *)
-
type vacation_response_get_args = vacation_response_obj get_args
+
module Vacation_response_get_args : sig
+
type t = Vacation_response.t Get_args.t
+
+
val v :
+
account_id:id ->
+
?ids:id list ->
+
?properties:string list ->
+
unit ->
+
t
+
end
(** VacationResponse/get: Response type (specialized from ['record get_response]). *)
-
type vacation_response_get_response = vacation_response_obj get_response
+
module Vacation_response_get_response : sig
+
type t = Vacation_response.t Get_response.t
+
+
val v :
+
account_id:id ->
+
state:string ->
+
list:Vacation_response.t list ->
+
not_found:id list ->
+
unit ->
+
t
+
end
(** VacationResponse/set: Args type.
Only allows update, id must be "singleton".
@see <https://www.rfc-editor.org/rfc/rfc8621.html#section-8.2> RFC 8621, Section 8.2 *)
-
type vacation_response_set_args = {
-
set_account_id : id;
-
set_if_in_state : string option;
-
set_update : vacation_response_update id_map option;
-
}
+
module Vacation_response_set_args : sig
+
type t
+
+
val account_id : t -> id
+
val if_in_state : t -> string option
+
val update : t -> vacation_response_update id_map option
+
+
val v :
+
account_id:id ->
+
?if_in_state:string ->
+
?update:vacation_response_update id_map ->
+
unit ->
+
t
+
end
(** VacationResponse/set: Response type.
@see <https://www.rfc-editor.org/rfc/rfc8621.html#section-8.2> RFC 8621, Section 8.2 *)
-
type vacation_response_set_response = {
-
set_resp_account_id : id;
-
set_resp_old_state : string option;
-
set_resp_new_state : string;
-
set_resp_updated : vacation_response_obj option id_map option;
-
set_resp_not_updated : set_error id_map option;
-
}
+
module Vacation_response_set_response : sig
+
type t
+
+
val account_id : t -> id
+
val old_state : t -> string option
+
val new_state : t -> string
+
val updated : t -> Vacation_response.t option id_map option
+
val not_updated : t -> Set_error.t id_map option
+
+
val v :
+
account_id:id ->
+
?old_state:string ->
+
new_state:string ->
+
?updated:Vacation_response.t option id_map ->
+
?not_updated:Set_error.t id_map ->
+
unit ->
+
t
+
end
+63 -27
output/jmap_wire.mli
···
(** An invocation tuple within a request or response.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-3.2> RFC 8620, Section 3.2 *)
-
type invocation = {
-
method_name : string;
-
arguments : Yojson.Safe.t;
-
method_call_id : string;
-
}
+
module Invocation : sig
+
type t
+
+
val method_name : t -> string
+
val arguments : t -> Yojson.Safe.t
+
val method_call_id : t -> string
+
+
val v :
+
?arguments:Yojson.Safe.t ->
+
method_name:string ->
+
method_call_id:string ->
+
unit ->
+
t
+
end
+
+
(** A response invocation part, which can be a standard response or an error.
+
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-3.4> RFC 8620, Section 3.4
+
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-3.6.2> RFC 8620, Section 3.6.2 *)
+
type response_invocation =
+
| Response of Invocation.t
+
| Error of Method_error.t * string (* string is the method_call_id *)
(** A reference to a previous method call's result.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-3.7> RFC 8620, Section 3.7 *)
-
type result_reference = {
-
result_of : string; (** The method call id of the previous call *)
-
name : string; (** The required response name *)
-
path : json_pointer; (** JSON Pointer path *)
-
}
+
module Result_reference : sig
+
type t
+
+
val result_of : t -> string
+
val name : t -> string
+
val path : t -> json_pointer
+
+
val v :
+
result_of:string ->
+
name:string ->
+
path:json_pointer ->
+
unit ->
+
t
+
end
(** The Request object.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-3.3> RFC 8620, Section 3.3 *)
-
type request = {
-
using : string list;
-
method_calls : invocation list;
-
created_ids : id id_map option;
-
}
-
-
(** A response invocation part, which can be a standard response or an error.
-
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-3.4> RFC 8620, Section 3.4
-
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-3.6.2> RFC 8620, Section 3.6.2 *)
-
type response_invocation =
-
| Response of invocation
-
| Error of method_error * string (* string is the method_call_id *)
+
module Request : sig
+
type t
+
+
val using : t -> string list
+
val method_calls : t -> Invocation.t list
+
val created_ids : t -> id id_map option
+
+
val v :
+
using:string list ->
+
method_calls:Invocation.t list ->
+
?created_ids:id id_map ->
+
unit ->
+
t
+
end
(** The Response object.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-3.4> RFC 8620, Section 3.4 *)
-
type response = {
-
method_responses : response_invocation list;
-
created_ids : id id_map option;
-
session_state : string;
-
}
+
module Response : sig
+
type t
+
+
val method_responses : t -> response_invocation list
+
val created_ids : t -> id id_map option
+
val session_state : t -> string
+
+
val v :
+
method_responses:response_invocation list ->
+
?created_ids:id id_map ->
+
session_state:string ->
+
unit ->
+
t
+
end