My agentic slop goes here. Not intended for anyone else!
1(** Email address representation and address groups. 2 3 This module provides types and operations for email addresses and address groups 4 as defined in RFC 8621 Sections 4.1.2.3 and 4.1.2.4. Email addresses consist 5 of a required email field and optional display name, while address groups 6 allow multiple addresses to be grouped under a common name. 7 8 @see <https://www.rfc-editor.org/rfc/rfc8621.html#section-4.1.2.3> RFC 8621, Section 4.1.2.3 - Email Address 9 @see <https://www.rfc-editor.org/rfc/rfc8621.html#section-4.1.2.4> RFC 8621, Section 4.1.2.4 - Email Address Group 10*) 11 12(** Email address representation. 13 14 Represents an email address as specified in RFC 8621 Section 4.1.2.3. 15 An email address consists of an email field (required) and an optional 16 name field for display purposes. 17 18 The email field MUST be a valid RFC 5322 addr-spec and the name field, 19 if present, provides a human-readable display name for use in email headers. 20*) 21type t 22 23(** JSON serialization interface *) 24include Jmap_sigs.JSONABLE with type t := t 25 26(** Pretty-printing interface *) 27include Jmap_sigs.PRINTABLE with type t := t 28 29(** Alias for the main type for use in nested modules *) 30type address = t 31 32(** Get the display name for the address. 33 @param t The email address 34 @return The human-readable display name, or None if not set *) 35val name : t -> string option 36 37(** Get the actual email address. 38 @param t The email address 39 @return The RFC 5322 addr-spec email address *) 40val email : t -> string 41 42(** Create a new email address object. 43 @param name Optional human-readable display name 44 @param email Required RFC 5322 addr-spec email address 45 @return Result containing new email address object or validation error *) 46val create : 47 ?name:string -> 48 email:string -> 49 unit -> (t, string) result 50 51(** Create a new email address object without validation. 52 53 For use when email address is known to be valid or comes from 54 trusted sources like server responses. 55 56 @param name Optional human-readable display name 57 @param email Required RFC 5322 addr-spec email address 58 @return New email address object *) 59val create_unsafe : 60 ?name:string -> 61 email:string -> 62 unit -> t 63 64(** Email address group representation. 65 66 Represents a named group of email addresses as specified in RFC 8621 Section 4.1.2.4. 67 This corresponds to RFC 5322 group syntax in email headers, allowing multiple 68 addresses to be grouped under a common name. 69*) 70module Group : sig 71 (** Email address group type *) 72 type t 73 74 (** JSON serialization interface *) 75 include Jmap_sigs.JSONABLE with type t := t 76 77 (** Pretty-printing interface *) 78 include Jmap_sigs.PRINTABLE with type t := t 79 80 (** Get the name of the address group. 81 @param t The address group 82 @return The group name, or None if not set *) 83 val name : t -> string option 84 85 (** Get the list of email addresses in the group. 86 @param t The address group 87 @return List of email addresses belonging to this group *) 88 val addresses : t -> address list 89 90 (** Create a new email address group. 91 @param name Optional group name 92 @param addresses List of email addresses in the group 93 @return New address group object *) 94 val create : 95 ?name:string -> 96 addresses:address list -> 97 unit -> t 98end