121 lines
3.4 KiB
Java
121 lines
3.4 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 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 attachment representation.
|
||
|
|
*
|
||
|
|
* Contains metadata and optionally the content of an email attachment.
|
||
|
|
*/
|
||
|
|
@JsonInclude(JsonInclude.Include.NON_ABSENT)
|
||
|
|
@JsonDeserialize(builder = EmailAttachment.Builder.class)
|
||
|
|
public record EmailAttachment(
|
||
|
|
/**
|
||
|
|
* Attachment name (from Content-Disposition header)
|
||
|
|
*/
|
||
|
|
@Nullable @JsonProperty("name") String name,
|
||
|
|
/**
|
||
|
|
* Filename of the attachment
|
||
|
|
*/
|
||
|
|
@Nullable @JsonProperty("filename") String filename,
|
||
|
|
/**
|
||
|
|
* MIME type of the attachment
|
||
|
|
*/
|
||
|
|
@Nullable @JsonProperty("mime_type") String mimeType,
|
||
|
|
/**
|
||
|
|
* Size in bytes
|
||
|
|
*/
|
||
|
|
@Nullable @JsonProperty("size") Long size,
|
||
|
|
/**
|
||
|
|
* Whether this attachment is an image
|
||
|
|
*/
|
||
|
|
@JsonProperty("is_image") boolean isImage,
|
||
|
|
/**
|
||
|
|
* Attachment data (if extracted).
|
||
|
|
* Uses {@code bytes.Bytes} for cheap cloning of large buffers.
|
||
|
|
*/
|
||
|
|
@Nullable @JsonProperty("data") byte[] data
|
||
|
|
) {
|
||
|
|
public static Builder builder() {
|
||
|
|
return new Builder();
|
||
|
|
}
|
||
|
|
|
||
|
|
// CPD-OFF
|
||
|
|
@JsonPOJOBuilder(withPrefix = "with", buildMethodName = "build")
|
||
|
|
public static final class Builder {
|
||
|
|
|
||
|
|
private String name = null;
|
||
|
|
private String filename = null;
|
||
|
|
@JsonProperty("mime_type")
|
||
|
|
private String mimeType = null;
|
||
|
|
private Long size = null;
|
||
|
|
@JsonProperty("is_image")
|
||
|
|
private boolean isImage = false;
|
||
|
|
private byte[] data = null;
|
||
|
|
|
||
|
|
/** Sets the name field. */
|
||
|
|
@JsonProperty("name")
|
||
|
|
public Builder withName(final @Nullable String value) {
|
||
|
|
this.name = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the filename field. */
|
||
|
|
@JsonProperty("filename")
|
||
|
|
public Builder withFilename(final @Nullable String value) {
|
||
|
|
this.filename = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the mimeType field. */
|
||
|
|
@JsonProperty("mime_type")
|
||
|
|
public Builder withMimeType(final @Nullable String value) {
|
||
|
|
this.mimeType = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the size field. */
|
||
|
|
@JsonProperty("size")
|
||
|
|
public Builder withSize(final @Nullable long value) {
|
||
|
|
this.size = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the isImage field. */
|
||
|
|
@JsonProperty("is_image")
|
||
|
|
public Builder withIsImage(final boolean value) {
|
||
|
|
this.isImage = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Sets the data field. */
|
||
|
|
@JsonProperty("data")
|
||
|
|
public Builder withData(final @Nullable byte[] value) {
|
||
|
|
this.data = value;
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
|
||
|
|
/** Builds the EmailAttachment instance. */
|
||
|
|
public EmailAttachment build() {
|
||
|
|
return new EmailAttachment(
|
||
|
|
name,
|
||
|
|
filename,
|
||
|
|
mimeType,
|
||
|
|
size,
|
||
|
|
isImage,
|
||
|
|
data
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
// CPD-ON
|
||
|
|
}
|