Skip to content

Commit

Permalink
Updating Java SDK for GA Release (#34151)
Browse files Browse the repository at this point in the history
Co-authored-by: Yogesh Mohanraj <ymohanraj@microsoft.com>
  • Loading branch information
yogeshmo and Yogesh Mohanraj authored Mar 22, 2023
1 parent d194507 commit 6a6203f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
8 changes: 4 additions & 4 deletions sdk/communication/azure-communication-email/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ EmailMessage message = new EmailMessage()
.setSubject("test subject")
.setBodyPlainText("test message");

SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message, null);
SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message);
PollResponse<EmailSendResult> response = poller.waitForCompletion();

System.out.println("Operation Id: " + response.getValue().getId());
Expand All @@ -135,7 +135,7 @@ EmailMessage message = new EmailMessage()
.setCcRecipients("<cc-recipient-email-address>")
.setBccRecipients("<bcc-recipient-email-address>");

SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message, null);
SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message);
PollResponse<EmailSendResult> response = poller.waitForCompletion();

System.out.println("Operation Id: " + response.getValue().getId());
Expand All @@ -156,7 +156,7 @@ EmailMessage message = new EmailMessage()
.setBodyPlainText("test message")
.setToRecipients(toAddress1, toAddress2);

SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message, null);
SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message);
PollResponse<EmailSendResult> response = poller.waitForCompletion();

System.out.println("Operation Id: " + response.getValue().getId());
Expand All @@ -181,7 +181,7 @@ EmailMessage message = new EmailMessage()
.setBodyPlainText("test message")
.setAttachments(attachment);

SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message, null);
SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message);
PollResponse<EmailSendResult> response = poller.waitForCompletion();

System.out.println("Operation Id: " + response.getValue().getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ public final class EmailClient {
this.client = client;
}

/**
* Queues an email message to be sent to one or more recipients.
*
* @param message Message payload for sending an email.
* @throws ErrorResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of status of the long running operation.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller<EmailSendResult, EmailSendResult> beginSend(EmailMessage message) {
return beginSend(message, Context.NONE);
}

/**
* Queues an email message to be sent to one or more recipients.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void sendEmailToSingleRecipient() {
.setSubject("test subject")
.setBodyPlainText("test message");

SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message, null);
SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message);
PollResponse<EmailSendResult> response = poller.waitForCompletion();

System.out.println("Operation Id: " + response.getValue().getId());
Expand All @@ -85,7 +85,7 @@ public void sendEmailToMultipleRecipients() {
.setCcRecipients("<cc-recipient-email-address>")
.setBccRecipients("<bcc-recipient-email-address>");

SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message, null);
SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message);
PollResponse<EmailSendResult> response = poller.waitForCompletion();

System.out.println("Operation Id: " + response.getValue().getId());
Expand All @@ -108,7 +108,7 @@ public void sendEmailToMultipleRecipientsWithOptions() {
.setBodyPlainText("test message")
.setToRecipients(toAddress1, toAddress2);

SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message, null);
SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message);
PollResponse<EmailSendResult> response = poller.waitForCompletion();

System.out.println("Operation Id: " + response.getValue().getId());
Expand All @@ -134,7 +134,7 @@ public void sendEmailWithAttachment() {
.setBodyPlainText("test message")
.setAttachments(attachment);

SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message, null);
SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message);
PollResponse<EmailSendResult> response = poller.waitForCompletion();

System.out.println("Operation Id: " + response.getValue().getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void sendEmailToSingleRecipient(HttpClient httpClient) {
.setSubject("test subject")
.setBodyHtml("<h1>test message</h1>");

SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message, null);
SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message);
PollResponse<EmailSendResult> response = poller.waitForCompletion();

assertEquals(response.getValue().getStatus(), EmailSendStatus.SUCCEEDED);
Expand All @@ -55,7 +55,7 @@ public void sendEmailToMultipleRecipients(HttpClient httpClient) {
.setCcRecipients(RECIPIENT_ADDRESS)
.setBccRecipients(RECIPIENT_ADDRESS);

SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message, null);
SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message);
PollResponse<EmailSendResult> response = poller.waitForCompletion();

assertEquals(response.getValue().getStatus(), EmailSendStatus.SUCCEEDED);
Expand All @@ -79,7 +79,7 @@ public void sendEmailWithAttachment(HttpClient httpClient) {
.setBodyHtml("<h1>test message</h1>")
.setAttachments(attachment);

SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message, null);
SyncPoller<EmailSendResult, EmailSendResult> poller = emailClient.beginSend(message);
PollResponse<EmailSendResult> response = poller.waitForCompletion();

assertEquals(response.getValue().getStatus(), EmailSendStatus.SUCCEEDED);
Expand Down

0 comments on commit 6a6203f

Please sign in to comment.