Skip to content

Commit

Permalink
added new sdk version syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Kewyn Akshlley committed Sep 22, 2023
1 parent b2175e7 commit ab6f97e
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/main/java/com/resend/Main.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.resend;

import com.resend.core.provider.AuthenticationProvider;
import com.resend.core.provider.impl.AuthenticationProviderStandard;
import com.resend.services.emails.ResendEmails;
import com.resend.services.emails.model.Attachment;
import com.resend.services.emails.model.SendEmailRequest;
import com.resend.services.emails.model.SendEmailResponse;
Expand All @@ -14,10 +11,7 @@
public class Main {
public static void main(String[] args) {

String apiKey = "re_123";

AuthenticationProvider provider = new AuthenticationProviderStandard(apiKey);
ResendEmails emailClient = new ResendEmails(provider);
Resend resend = new Resend("re_123456789");

String fileContent = null;
try {
Expand All @@ -33,19 +27,16 @@ public static void main(String[] args) {
.build();

SendEmailRequest sendEmailRequest = SendEmailRequest.builder()
.from("Me <[email protected]>")
.to("to@example", "[email protected]")
.cc("[email protected]", "[email protected]")
.bcc("[email protected]", "[email protected]")
.replyTo("[email protected]", "[email protected]")
.from("Acme <[email protected]>")
.to("[email protected]")
.attachments(att)
.text("Hello, world!")
.html("<strong>It works!</strong")
.subject("Hello from Java!")
.build();

SendEmailResponse ser = emailClient.sendEmail(sendEmailRequest);
SendEmailResponse data = resend.emails().send(sendEmailRequest);

System.out.println(ser.getId());
System.out.println(data.getId());

}
}

0 comments on commit ab6f97e

Please sign in to comment.