//// Sendr - An email library for Gleam import sendr/message/attachment.{type Attachment} import sendr/message/mailbox.{type Mailbox} /// Represents the fields of an email message that can be validated. pub type Field { From ReplyTo To Cc Bcc Subject } /// Errors related to attachment fields during validation. pub type AttachmentField { RequiredFilenameMissing RequiredContentIdMissing AttachmentTypeNotSupported } /// Errors related to the message body during validation. pub type BodyField { NoBody TextToShort(minimum: Int, length: Int) HtmlToShort(minimum: Int, length: Int) } /// The top-level error type for a Sendr backend. /// /// `error` is the backend-specific error type (e.g. connection or API errors). /// Validation errors use the other variants directly; backend errors are /// wrapped in `BackendError`. pub type SendrError(error) { RequiredFieldMissing(field: Field) FieldExceedsMaximumLength(field: Field, maximum: Int, length: Int) TooManyEntries(field: Field) NoRecipients InvalidMailbox(field: Field, mailbox: Mailbox) InvalidAttachment(field: AttachmentField, attachment: Attachment) InvalidBody(BodyField) BackendError(error) }