Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/main/java/com/resend/services/emails/model/Attachment.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ public class Attachment {
@JsonProperty("path")
private final String path;

@JsonProperty("content_id")
private final String contentId;

private Attachment(Builder builder) {
this.fileName = builder.fileName;
this.content = builder.content;
this.path = builder.path;
this.contentId = builder.contentId;
}

/**
Expand All @@ -45,6 +49,14 @@ public String getPath() {
return path;
}

/**
* Get the content ID for inline attachments used in HTML content with cid: references.
* @return The content ID for inline attachments.
*/
public String getContentId() {
return contentId;
}

/**
* Create a new Attachment builder.
* @return A new Builder instance.
Expand All @@ -60,6 +72,7 @@ public static class Builder {
private String fileName;
private String content;
private String path;
private String contentId;

/**
* Set the filename of the attachment.
Expand Down Expand Up @@ -91,6 +104,16 @@ public Builder path(String path) {
return this;
}

/**
* Set the content ID for inline attachments used in HTML content with cid: references.
* @param contentId The content ID for inline attachments.
* @return The Builder instance.
*/
public Builder contentId(String contentId) {
this.contentId = contentId;
return this;
}

/**
* Build an Attachment instance.
* @return The built Attachment.
Expand Down
2 changes: 0 additions & 2 deletions src/test/java/com/resend/services/emails/EmailsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import java.util.Collections;
import java.util.List;
import java.util.Map;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
Expand Down
1 change: 1 addition & 0 deletions src/test/java/com/resend/services/util/EmailsUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public static Attachment createAttachment() {
return Attachment.builder()
.fileName("invoice.pdf")
.content("invoice.pdf")
.contentId("my-image")
.build();
}

Expand Down