Skip to content

Commit

Permalink
Merge pull request #5 from sinch/code-formatter
Browse files Browse the repository at this point in the history
style: back to google code formatter style
  • Loading branch information
JPPortier authored Jun 18, 2024
2 parents 357e2ef + 00a9bcc commit 640e54b
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 61 deletions.
32 changes: 16 additions & 16 deletions snippets/numbers/available_list/Snippet.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,26 @@

public class Snippet {

private static final Logger LOGGER = Logger.getLogger(Snippet.class.getName());
private static final Logger LOGGER = Logger.getLogger(Snippet.class.getName());

static void execute(NumbersService numbersService) {
static void execute(NumbersService numbersService) {

AvailableNumberService availableNumbersService = numbersService.available();
AvailableNumberService availableNumbersService = numbersService.available();

String regionCode = "US";
NumberType type = NumberType.LOCAL;
String regionCode = "US";
NumberType type = NumberType.LOCAL;

AvailableNumberListAllRequestParameters parameters =
AvailableNumberListAllRequestParameters.builder()
.setRegionCode(regionCode)
.setType(type)
.build();
AvailableNumberListAllRequestParameters parameters =
AvailableNumberListAllRequestParameters.builder()
.setRegionCode(regionCode)
.setType(type)
.build();

AvailableNumberListResponse response = availableNumbersService.list(parameters);
AvailableNumberListResponse response = availableNumbersService.list(parameters);

response.iterator()
.forEachRemaining(
number ->
LOGGER.info(String.format("Available number details: %s", number)));
}
response
.iterator()
.forEachRemaining(
number -> LOGGER.info(String.format("Available number details: %s", number)));
}
}
1 change: 0 additions & 1 deletion snippets/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@

<googleJavaFormat>
<version>1.22.0</version>
<style>AOSP</style>
<reflowLongStrings>true</reflowLongStrings>
</googleJavaFormat>
<endWithNewline />
Expand Down
33 changes: 16 additions & 17 deletions snippets/sms/send/Snippet.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,30 @@
import com.sinch.sdk.domains.sms.*;
import com.sinch.sdk.domains.sms.models.*;
import com.sinch.sdk.domains.sms.models.requests.*;
import java.util.Collection;
import java.util.Collections;
import java.util.logging.Logger;

public class Snippet {

private static final Logger LOGGER = Logger.getLogger(Snippet.class.getName());
private static final Logger LOGGER = Logger.getLogger(Snippet.class.getName());

static void execute(SMSService smsService) {
static void execute(SMSService smsService) {

BatchesService batchesService = smsService.batches();
BatchesService batchesService = smsService.batches();

String from = "YOUR_sinch_phone_number";
String recipient = "YOUR_recipient_phone_number";
String body = "This is a test SMS message using the Sinch Java SDK.";
String from = "YOUR_sinch_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(Collections.singletonList(recipient))
.setBody(body)
.setFrom(from)
.build());
LOGGER.info("Sending SMS Text");
BatchText value =
batchesService.send(
SendSmsBatchTextRequest.builder()
.setTo(Collections.singletonList(recipient))
.setBody(body)
.setFrom(from)
.build());

LOGGER.info("Response: " + value);
}
LOGGER.info("Response: " + value);
}
}
28 changes: 14 additions & 14 deletions snippets/verification/start_sms/Snippet.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@

public class Snippet {

private static final Logger LOGGER = Logger.getLogger(Snippet.class.getName());
private static final Logger LOGGER = Logger.getLogger(Snippet.class.getName());

static void execute(VerificationService verificationService) {
static void execute(VerificationService verificationService) {

// REMINDER: verification Service require to have set application key/secret
// onto Sinch Client init
VerificationsService verificationsService = verificationService.verifications();
// REMINDER: verification Service require to have set application key/secret
// onto Sinch Client init
VerificationsService verificationsService = verificationService.verifications();

String phoneNumber = "YOUR_phone_number";
String phoneNumber = "YOUR_phone_number";

LOGGER.info(String.format("Sending a SMS verification to '%s'", phoneNumber));
LOGGER.info(String.format("Sending a SMS verification to '%s'", phoneNumber));

StartVerificationResponseSMS response =
verificationsService.startSms(
StartVerificationSMSRequestParameters.builder()
.setIdentity(NumberIdentity.valueOf(phoneNumber))
.build());
StartVerificationResponseSMS response =
verificationsService.startSms(
StartVerificationSMSRequestParameters.builder()
.setIdentity(NumberIdentity.valueOf(phoneNumber))
.build());

LOGGER.info("Response: " + response);
}
LOGGER.info("Response: " + response);
}
}
25 changes: 12 additions & 13 deletions snippets/voice/callouts_text_to_speech/Snippet.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,20 @@

public class Snippet {

public static String execute(VoiceService voiceService) {
public static String execute(VoiceService voiceService) {

CalloutsService calloutsService = voiceService.callouts();
CalloutsService calloutsService = voiceService.callouts();

String phoneNumber = "YOUR_phone_number";
String message =
"Hello, this is a call from Sinch. Congratulations! You made your first call.";
String phoneNumber = "YOUR_phone_number";
String message = "Hello, this is a call from Sinch. Congratulations! You made your first call.";

CalloutRequestParametersTTS parameters =
CalloutRequestParametersTTS.builder()
.setDestination(DestinationNumber.valueOf(phoneNumber))
.setText(message)
.build();
CalloutRequestParametersTTS parameters =
CalloutRequestParametersTTS.builder()
.setDestination(DestinationNumber.valueOf(phoneNumber))
.setText(message)
.build();

String callId = calloutsService.textToSpeech(parameters);
return callId;
}
String callId = calloutsService.textToSpeech(parameters);
return callId;
}
}

0 comments on commit 640e54b

Please sign in to comment.