Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Improve snippet readability #3

Merged
merged 1 commit into from
Jun 6, 2024
Merged
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
4 changes: 2 additions & 2 deletions snippets/sms/send/Snippet.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ static void execute(SMSService smsService) {
BatchesService batchesService = smsService.batches();

String from = "YOUR_sinch_phone_number";
Collection<String> recipients = Collections.singletonList("YOUR_recipient_phone_number");
String recipient = "YOUR_recipient_phone_number";
String body = "This is a test SMS message using the Sinch Java SDK.";

LOGGER.info("Sending SMS Text");
BatchText value =
batchesService.send(
SendSmsBatchTextRequest.builder()
.setTo(recipients)
.setTo(Collections.singletonList(recipient))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broader question: can we imagine having another method setTo(String phoneNumber) that creates the Collection when the user wants to send a batch for a single recipient (not really a use case for a batch, but in this API, there is no possibility to send a single SMS. The other possibility would be to use the Conversation API but it's huge when your need it to send a SMS to a single recipient).
If we agree on this one, it will be could to implement it on all the SDKs

.setBody(body)
.setFrom(from)
.build());
Expand Down
Loading