138 lines
4.0 KiB
Java
138 lines
4.0 KiB
Java
|
|
// This file is auto-generated by alef — DO NOT EDIT.
|
||
|
|
// alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
|
||
|
|
// To regenerate: alef generate
|
||
|
|
// To verify freshness: alef verify --exit-code
|
||
|
|
// Issues & docs: https://github.com/kreuzberg-dev/alef
|
||
|
|
package dev.kreuzberg;
|
||
|
|
|
||
|
|
import java.util.List;
|
||
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||
|
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||
|
|
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||
|
|
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
|
||
|
|
import org.jspecify.annotations.Nullable;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Email metadata extracted from .eml and .msg files.
|
||
|
|
*
|
||
|
|
* Includes sender/recipient information, message ID, and attachment list.
|
||
|
|
*/
|
||
|
|
@JsonInclude(JsonInclude.Include.NON_ABSENT)
|
||
|
|
@JsonDeserialize(builder = EmailMetadata.Builder.class)
|
||
|
|
public record EmailMetadata(
|
||
|
|
/**
|
||
|
|
* Sender's email address
|
||
|
|
*/
|
||
|
|
@Nullable @JsonProperty("from_email") String fromEmail,
|
||
|
|
/**
|
||
|
|
* Sender's display name
|
||
|
|
*/
|
||
|
|
@Nullable @JsonProperty("from_name") String fromName,
|
||
|
|
/**
|
||
|
|
* Primary recipients
|
||
|
|
*/
|
||
|
|
@JsonProperty("to_emails") List<String> toEmails,
|
||
|
|
/**
|
||
|
|
* CC recipients
|
||
|
|
*/
|
||
|
|
@JsonProperty("cc_emails") List<String> ccEmails,
|
||
|
|
/**
|
||
|
|
* BCC recipients
|
||
|
|
*/
|
||
|
|
@JsonProperty("bcc_emails") List<String> bccEmails,
|
||
|
|
/**
|
||
|
|
* Message-ID header value
|
||
|
|
*/
|
||
|
|
@Nullable @JsonProperty("message_id") String messageId,
|
||
|
|
/**
|
||
|
|
* List of attachment filenames
|
||
|
|
*/
|
||
|
|
@JsonProperty("attachments") List<String> attachments
|
||
|
|
) {
|
||
|
|
public static Builder builder() {
|
||
|
|
return new Builder();
|
||
|
|
}
|
||
|
|
|
||
|
|
// CPD-OFF
|
||
|
|
@JsonPOJOBuilder(withPrefix = "with", buildMethodName = "build")
|
||
|
|
public static final class Builder {
|
||
|
|
|
||
|
|
@JsonProperty("from_email")
|
||
|
|
private String fromEmail = null;
|
||
|
|
@JsonProperty("from_name")
|
||
|
|
private String fromName = null;
|
||
|
|
@JsonProperty("to_emails")
|
||
|
|
private List<String> toEmails = List.of();
|
||
|
|
@JsonProperty("cc_emails")
|
||
|
|
private List<String> ccEmails = List.of();
|
||
|
|
@JsonProperty("bcc_emails")
|
||
|
|
private List<String> bccEmails = List.of();
|
||
|
|
@JsonProperty("message_id")
|
||
|
|
private String messageId = null;
|
||
|
|
private List<String> attachments = List.of();
|
||
|
|
|
||
|
|
/** Sets the fromEmail field. */
|
||
|
|
@JsonProperty("from_email")
|
||
|
|
public Builder withFromEmail(final @Nullable String value) {
|
||
|
|
this.fromEmail = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the fromName field. */
|
||
|
|
@JsonProperty("from_name")
|
||
|
|
public Builder withFromName(final @Nullable String value) {
|
||
|
|
this.fromName = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the toEmails field. */
|
||
|
|
@JsonProperty("to_emails")
|
||
|
|
public Builder withToEmails(final List<String> value) {
|
||
|
|
this.toEmails = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the ccEmails field. */
|
||
|
|
@JsonProperty("cc_emails")
|
||
|
|
public Builder withCcEmails(final List<String> value) {
|
||
|
|
this.ccEmails = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the bccEmails field. */
|
||
|
|
@JsonProperty("bcc_emails")
|
||
|
|
public Builder withBccEmails(final List<String> value) {
|
||
|
|
this.bccEmails = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the messageId field. */
|
||
|
|
@JsonProperty("message_id")
|
||
|
|
public Builder withMessageId(final @Nullable String value) {
|
||
|
|
this.messageId = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the attachments field. */
|
||
|
|
@JsonProperty("attachments")
|
||
|
|
public Builder withAttachments(final List<String> value) {
|
||
|
|
this.attachments = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Builds the EmailMetadata instance. */
|
||
|
|
public EmailMetadata build() {
|
||
|
|
return new EmailMetadata(
|
||
|
|
fromEmail,
|
||
|
|
fromName,
|
||
|
|
toEmails,
|
||
|
|
ccEmails,
|
||
|
|
bccEmails,
|
||
|
|
messageId,
|
||
|
|
attachments
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
// CPD-ON
|
||
|
|
}
|