Skip to content

Commit

Permalink
Adding 'numbers.available.list' snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
JPPortier committed May 24, 2024
1 parent e940352 commit f55fd98
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions snippets/numbers/available/List.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package numbers;

import com.sinch.sdk.domains.numbers.*;
import com.sinch.sdk.domains.numbers.models.NumberType;
import com.sinch.sdk.domains.numbers.models.requests.AvailableNumberListAllRequestParameters;
import java.util.logging.Logger;

public class List {

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

public void list(NumbersService numbersService) {

var service = numbersService.available();

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

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

var response = service.list(parameters);

response.iterator().forEachRemaining(f -> LOGGER.info(f.toString()));
}
}

0 comments on commit f55fd98

Please sign in to comment.