My agentic slop goes here. Not intended for anyone else!
1(** JMAP Email/parse method implementation as defined in RFC 8621 Section 4.9.
2
3 The Email/parse method allows parsing blobs as messages (RFC 5322) to
4 get Email objects. This can be used to parse and display attached messages
5 without importing them as top-level Email objects.
6
7 Note: The following metadata properties will be null if requested:
8 - id, mailboxIds, keywords, receivedAt
9
10 @see <https://www.rfc-editor.org/rfc/rfc8621.html#section-4.9> RFC 8621, Section 4.9 *)
11
12(** {1 Email/parse Arguments} *)
13
14(** Arguments for Email/parse method calls.
15
16 @see <https://www.rfc-editor.org/rfc/rfc8621.html#section-4.9> RFC 8621, Section 4.9 *)
17module Parse_args : sig
18 type t
19
20 (** Create Email/parse arguments.
21 @param account_id The account ID to use
22 @param blob_ids Array of blob IDs to parse
23 @param ?properties Optional list of properties to return for each Email (defaults to standard set)
24 @param ?body_properties Optional list of properties to fetch for each EmailBodyPart
25 @param ?fetch_text_body_values Whether to include text/* parts in bodyValues (default: false)
26 @param ?fetch_html_body_values Whether to include HTML parts in bodyValues (default: false)
27 @param ?fetch_all_body_values Whether to include all text/* parts in bodyValues (default: false)
28 @param ?max_body_value_bytes Maximum bytes for bodyValues (0 = no limit, default: 0)
29 @return Email/parse arguments object *)
30 val create :
31 account_id:string ->
32 blob_ids:Jmap.Id.t list ->
33 ?properties:string list ->
34 ?body_properties:string list ->
35 ?fetch_text_body_values:bool ->
36 ?fetch_html_body_values:bool ->
37 ?fetch_all_body_values:bool ->
38 ?max_body_value_bytes:int ->
39 unit ->
40 t
41
42 (** Get the account ID.
43 @return The account ID for this request *)
44 val account_id : t -> string
45
46 (** Get the blob IDs to parse.
47 @return List of blob IDs to parse *)
48 val blob_ids : t -> Jmap.Id.t list
49
50 (** Get the properties list.
51 @return List of properties to return, or None for default *)
52 val properties : t -> string list option
53
54 (** Get the body properties list.
55 @return List of body properties to fetch, or None for default *)
56 val body_properties : t -> string list option
57
58 (** Get fetch text body values flag.
59 @return Whether to include text body values *)
60 val fetch_text_body_values : t -> bool
61
62 (** Get fetch HTML body values flag.
63 @return Whether to include HTML body values *)
64 val fetch_html_body_values : t -> bool
65
66 (** Get fetch all body values flag.
67 @return Whether to include all body values *)
68 val fetch_all_body_values : t -> bool
69
70 (** Get max body value bytes limit.
71 @return Maximum bytes for body values (0 = no limit) *)
72 val max_body_value_bytes : t -> int
73
74 (** JSON serialization for Email/parse arguments *)
75 include Jmap_sigs.JSONABLE with type t := t
76end
77
78(** {1 Email/parse Response} *)
79
80(** Response for Email/parse method calls.
81
82 @see <https://www.rfc-editor.org/rfc/rfc8621.html#section-4.9> RFC 8621, Section 4.9 *)
83module Parse_response : sig
84 type response
85
86 (** Create an Email/parse response.
87 @param account_id The account ID used for the call
88 @param ?parsed Optional map of blob IDs to successfully parsed Email objects
89 @param ?not_parsable Optional list of blob IDs that could not be parsed
90 @param ?not_found Optional list of blob IDs that could not be found
91 @return Email/parse response object *)
92 val create :
93 account_id:string ->
94 ?parsed:(Jmap.Id.t * Yojson.Safe.t) list -> (* Using Yojson.Safe.t for Email objects for now *)
95 ?not_parsable:Jmap.Id.t list ->
96 ?not_found:Jmap.Id.t list ->
97 unit ->
98 response
99
100 (** Get the account ID.
101 @return The account ID used for the call *)
102 val account_id : response -> string
103
104 (** Get the parsed emails.
105 @return Map of blob IDs to successfully parsed Email objects, or empty list if none *)
106 val parsed : response -> (Jmap.Id.t * Yojson.Safe.t) list
107
108 (** Get the not parsable blob IDs.
109 @return List of blob IDs that could not be parsed, or empty list if none *)
110 val not_parsable : response -> Jmap.Id.t list
111
112 (** Get the not found blob IDs.
113 @return List of blob IDs that could not be found, or empty list if none *)
114 val not_found : response -> Jmap.Id.t list
115
116 (** JSON serialization for Email/parse responses *)
117 include Jmap_sigs.JSONABLE with type t := response
118end