Skip to content

Commit

Permalink
feature (Numbers/update): Add 'active number update' snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
JPPortier committed Jun 20, 2024
1 parent dd9b3a7 commit c1bb1e2
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions snippets/numbers/active_update/Snippet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package numbers;

import com.sinch.sdk.domains.numbers.ActiveNumberService;
import com.sinch.sdk.domains.numbers.NumbersService;
import com.sinch.sdk.domains.numbers.models.ActiveNumber;
import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberUpdateRequestParameters;
import com.sinch.sdk.domains.numbers.models.requests.ActiveNumberUpdateVoiceConfigurationRequestParameters;
import java.util.logging.Logger;

public class Snippet {

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

static void execute(NumbersService numbersService) {

ActiveNumberService activeNumbersService = numbersService.active();

String phoneNumber = "YOUR_phone_number_to_be_rented";
String appId = "YOUR_app_id";
String displayName = "Updated from Sinch Java SDK";

ActiveNumberUpdateVoiceConfigurationRequestParameters voiceConfiguration =
ActiveNumberUpdateVoiceConfigurationRequestParameters.builder().setAppId(appId).build();

ActiveNumberUpdateRequestParameters updateRequest =
ActiveNumberUpdateRequestParameters.builder()
.setDisplayName(displayName)
.setVoiceConfiguration(voiceConfiguration)
.build();

ActiveNumber response = activeNumbersService.update(phoneNumber, updateRequest);

LOGGER.info(String.format("Updated number: %s", response));
}
}

0 comments on commit c1bb1e2

Please sign in to comment.