My agentic slop goes here. Not intended for anyone else!
1(** JMAP EmailSubmission Type *)
2
3open Jmap_core
4
5(** SMTP Address with parameters (RFC 8621 Section 7.1.1) *)
6module Address : sig
7 type t = {
8 email : string;
9 parameters : (string * string) list option;
10 }
11
12 (** Accessors *)
13 val email : t -> string
14 val parameters : t -> (string * string) list option
15
16 (** Constructor *)
17 val v : email:string -> ?parameters:(string * string) list -> unit -> t
18
19 val of_json : Ezjsonm.value -> t
20 val to_json : t -> Ezjsonm.value
21end
22
23(** SMTP Envelope (RFC 8621 Section 7.1.1) *)
24module Envelope : sig
25 type t = {
26 mail_from : Address.t;
27 rcpt_to : Address.t list;
28 }
29
30 (** Accessors *)
31 val mail_from : t -> Address.t
32 val rcpt_to : t -> Address.t list
33
34 (** Constructor *)
35 val v : mail_from:Address.t -> rcpt_to:Address.t list -> t
36
37 val of_json : Ezjsonm.value -> t
38 val to_json : t -> Ezjsonm.value
39end
40
41(** Delivery status for a single recipient (RFC 8621 Section 7.1.4) *)
42module DeliveryStatus : sig
43 (** Whether message was delivered *)
44 type delivered =
45 | Queued
46 | Yes
47 | No
48 | Unknown
49
50 (** Whether message was displayed (MDN) *)
51 type displayed =
52 | Unknown
53 | Yes
54
55 type t = {
56 smtp_reply : string;
57 delivered : delivered;
58 displayed : displayed;
59 }
60
61 (** Accessors *)
62 val smtp_reply : t -> string
63 val delivered : t -> delivered
64 val displayed : t -> displayed
65
66 (** Constructor *)
67 val v : smtp_reply:string -> delivered:delivered -> displayed:displayed -> t
68
69 val of_json : Ezjsonm.value -> t
70 val to_json : t -> Ezjsonm.value
71
72 val delivered_of_string : string -> delivered
73 val delivered_to_string : delivered -> string
74 val displayed_of_string : string -> displayed
75 val displayed_to_string : displayed -> string
76end
77
78(** Undo status (RFC 8621 Section 7.1.3) *)
79type undo_status =
80 | Pending
81 | Final
82 | Canceled
83
84(** EmailSubmission object type (RFC 8621 Section 7.1) *)
85type t = {
86 id : Id.t;
87 identity_id : Id.t;
88 email_id : Id.t;
89 thread_id : Id.t;
90 envelope : Envelope.t option;
91 send_at : Primitives.UTCDate.t;
92 undo_status : undo_status;
93 delivery_status : (string * DeliveryStatus.t) list option;
94 dsn_blob_ids : Id.t list;
95 mdn_blob_ids : Id.t list;
96}
97
98(** Accessors *)
99val id : t -> Id.t
100val identity_id : t -> Id.t
101val email_id : t -> Id.t
102val thread_id : t -> Id.t
103val envelope : t -> Envelope.t option
104val send_at : t -> Primitives.UTCDate.t
105val undo_status : t -> undo_status
106val delivery_status : t -> (string * DeliveryStatus.t) list option
107val dsn_blob_ids : t -> Id.t list
108val mdn_blob_ids : t -> Id.t list
109
110(** Constructor *)
111val v :
112 id:Id.t ->
113 identity_id:Id.t ->
114 email_id:Id.t ->
115 thread_id:Id.t ->
116 ?envelope:Envelope.t ->
117 send_at:Primitives.UTCDate.t ->
118 undo_status:undo_status ->
119 ?delivery_status:(string * DeliveryStatus.t) list ->
120 dsn_blob_ids:Id.t list ->
121 mdn_blob_ids:Id.t list ->
122 unit ->
123 t
124
125(** Standard /get method *)
126module Get : sig
127 type request = t Standard_methods.Get.request
128 type response = t Standard_methods.Get.response
129
130 val request_of_json : Ezjsonm.value -> request
131 val response_of_json : Ezjsonm.value -> response
132end
133
134(** Standard /changes method *)
135module Changes : sig
136 type request = Standard_methods.Changes.request
137 type response = Standard_methods.Changes.response
138
139 val request_of_json : Ezjsonm.value -> request
140 val response_of_json : Ezjsonm.value -> response
141end
142
143(** EmailSubmission-specific filter for /query *)
144module Filter : sig
145 type t = {
146 identity_ids : Id.t list option;
147 email_ids : Id.t list option;
148 thread_ids : Id.t list option;
149 undo_status : undo_status option;
150 before : Primitives.UTCDate.t option;
151 after : Primitives.UTCDate.t option;
152 }
153
154 (** Accessors *)
155 val identity_ids : t -> Id.t list option
156 val email_ids : t -> Id.t list option
157 val thread_ids : t -> Id.t list option
158 val undo_status : t -> undo_status option
159 val before : t -> Primitives.UTCDate.t option
160 val after : t -> Primitives.UTCDate.t option
161
162 (** Constructor *)
163 val v :
164 ?identity_ids:Id.t list ->
165 ?email_ids:Id.t list ->
166 ?thread_ids:Id.t list ->
167 ?undo_status:undo_status ->
168 ?before:Primitives.UTCDate.t ->
169 ?after:Primitives.UTCDate.t ->
170 unit ->
171 t
172
173 val of_json : Ezjsonm.value -> t
174end
175
176(** Standard /query method *)
177module Query : sig
178 type request = Filter.t Standard_methods.Query.request
179 type response = Standard_methods.Query.response
180
181 val request_of_json : Ezjsonm.value -> request
182 val response_of_json : Ezjsonm.value -> response
183end
184
185(** Standard /queryChanges method *)
186module QueryChanges : sig
187 type request = Filter.t Standard_methods.QueryChanges.request
188 type response = Standard_methods.QueryChanges.response
189
190 val request_of_json : Ezjsonm.value -> request
191 val response_of_json : Ezjsonm.value -> response
192end
193
194(** Standard /set method *)
195module Set : sig
196 (** On success action for EmailSubmission/set create *)
197 type on_success = {
198 set_email_keywords : (Id.t * (string * bool) list) option;
199 }
200
201 type request = {
202 account_id : Id.t;
203 if_in_state : string option;
204 create : (Id.t * t) list option;
205 update : (Id.t * Standard_methods.Set.patch_object) list option;
206 destroy : Id.t list option;
207 on_success_update_email : (Id.t * on_success) list option;
208 on_success_destroy_email : Id.t list option;
209 }
210
211 type response = t Standard_methods.Set.response
212
213 (** Accessors for on_success *)
214 val on_success_set_email_keywords : on_success -> (Id.t * (string * bool) list) option
215
216 (** Constructor for on_success *)
217 val on_success_v :
218 ?set_email_keywords:(Id.t * (string * bool) list) ->
219 unit ->
220 on_success
221
222 (** Accessors for request *)
223 val account_id : request -> Id.t
224 val if_in_state : request -> string option
225 val create : request -> (Id.t * t) list option
226 val update : request -> (Id.t * Standard_methods.Set.patch_object) list option
227 val destroy : request -> Id.t list option
228 val on_success_update_email : request -> (Id.t * on_success) list option
229 val on_success_destroy_email : request -> Id.t list option
230
231 (** Constructor for request *)
232 val request_v :
233 account_id:Id.t ->
234 ?if_in_state:string ->
235 ?create:(Id.t * t) list ->
236 ?update:(Id.t * Standard_methods.Set.patch_object) list ->
237 ?destroy:Id.t list ->
238 ?on_success_update_email:(Id.t * on_success) list ->
239 ?on_success_destroy_email:Id.t list ->
240 unit ->
241 request
242
243 val request_of_json : Ezjsonm.value -> request
244 val response_of_json : Ezjsonm.value -> response
245end
246
247(** Parser submodule *)
248module Parser : sig
249 val of_json : Ezjsonm.value -> t
250 val to_json : t -> Ezjsonm.value
251end
252
253(** Helper functions for undo_status *)
254val undo_status_of_string : string -> undo_status
255val undo_status_to_string : undo_status -> string