diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt
index b86f033f15ff..920c64a6c294 100644
--- a/eng/versioning/version_client.txt
+++ b/eng/versioning/version_client.txt
@@ -79,7 +79,7 @@ com.azure:azure-communication-email;1.0.24;1.1.0-beta.2
com.azure:azure-communication-identity;1.6.7;1.7.0-beta.1
com.azure:azure-communication-jobrouter;1.1.15;2.0.0-beta.1
com.azure:azure-communication-messages;1.1.6;1.2.0-beta.2
-com.azure:azure-communication-phonenumbers;1.3.2;1.4.0-beta.1
+com.azure:azure-communication-phonenumbers;1.3.2;1.4.0
com.azure:azure-communication-rooms;1.2.3;1.3.0-beta.1
com.azure:azure-communication-sms;1.1.35;1.2.0-beta.1
com.azure:azure-compute-batch;1.0.0-beta.4;1.0.0-beta.5
diff --git a/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md b/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md
index c5aa754aa089..835b62568235 100644
--- a/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md
+++ b/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md
@@ -1,14 +1,16 @@
# Release History
-## 1.4.0-beta.1 (Unreleased)
+## 1.4.0 (unreleased)
### Features Added
+- GA release of mobile number type
-### Breaking Changes
-
-### Bugs Fixed
+## 1.4.0-beta.1 (2025-07-22)
-### Other Changes
+### Features Added
+- Adds support for mobile number types
+ - mobile numbers are location associated phone numbers with SMS capabilities
+- API version `2025-06-01` is the default.
## 1.3.2 (2025-08-21)
@@ -30,7 +32,6 @@
- Upgraded `azure-core-http-netty` from `1.15.12` to version `1.15.13`.
- Upgraded `azure-core` from `1.55.4` to version `1.55.5`.
-
## 1.3.0 (2025-06-20)
### Features Added
@@ -68,7 +69,6 @@
- Upgraded `azure-core` from `1.55.2` to version `1.55.3`.
- Upgraded `azure-core-http-netty` from `1.15.10` to version `1.15.11`.
-
## 1.2.1 (2025-03-03)
### Other Changes
@@ -78,7 +78,6 @@
- Upgraded `azure-core-http-netty` from `1.15.8` to version `1.15.10`.
- Upgraded `azure-core` from `1.55.0` to version `1.55.2`.
-
## 1.2.0 (2025-02-11)
### Other Changes
@@ -604,5 +603,3 @@ PhoneNumbersAsyncClient.getPurchasedPhoneNumberWithResponse and PhoneNumbersClie
### Breaking Changes
- PhoneNumberAsyncClient has been replaced with PhoneNumbersAsyncClient, which has the same functionality but different APIs. To learn more about how PhoneNumbersAsyncClient works, refer to the [README.md][https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/communication/azure-communication-phonenumbers/README.md].
- PhoneNumberClient has been replaced with PhoneNumbersClient, which has the same functionality but different APIs. To learn more about how PhoneNumbersClient works, refer to the [README.md][https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/communication/azure-communication-phonenumbers/README.md].
-
-
diff --git a/sdk/communication/azure-communication-phonenumbers/README.md b/sdk/communication/azure-communication-phonenumbers/README.md
index 26f81e426f23..dfaa249bbe73 100644
--- a/sdk/communication/azure-communication-phonenumbers/README.md
+++ b/sdk/communication/azure-communication-phonenumbers/README.md
@@ -59,7 +59,7 @@ add the direct dependency to your project as follows.
com.azure
azure-communication-phonenumbers
- 1.3.0
+ 1.4.0
```
@@ -67,7 +67,7 @@ add the direct dependency to your project as follows.
This SDK provides functionality to easily manage `direct offer` and `direct routing` numbers.
-The `direct offer` numbers come in two types: Geographic and Toll-Free. Geographic phone plans are phone plans associated with a location, whose phone numbers' area codes are associated with the area code of a geographic location. Toll-Free phone plans are phone plans not associated location. For example, in the US, toll-free numbers can come with area codes such as 800 or 888.
+The `direct offer` numbers come in three types: Geographic, Toll-Free and Mobile. Geographic and Mobile phone plans are phone plans associated with a location, whose phone numbers' area codes are associated with the area code of a geographic location. Toll-Free phone plans are phone plans not associated location. For example, in the US, toll-free numbers can come with area codes such as 800 or 888.
They are managed using the `PhoneNumbersClient`
The `direct routing` feature enables connecting your existing telephony infrastructure to ACS.
@@ -143,7 +143,9 @@ Alternatively, you can provide the entire connection string using the connection
#### Phone Number Types overview
-Phone numbers come in two types; Geographic and Toll-Free. Geographic phone plans are phone plans associated with a location, whose phone numbers' area codes are associated with the area code of a geographic location. Toll-Free phone plans are phone plans not associated location. For example, in the US, toll-free numbers can come with area codes such as 800 or 888.
+Phone numbers come in three types; Geographic, Toll-Free and Mobile. Toll-Free numbers are not associated with a location. For example, in the US, toll-free numbers can come with area codes such as 800 or 888. Geographic and Mobile phone numbers are phone numbers associated with a location.
+
+Phone number types with the same country are grouped into a phone plan group with that phone number type. For example all Toll-Free phone numbers within the same country are grouped into a phone plan group.
#### Searching and Purchasing and Releasing numbers
diff --git a/sdk/communication/azure-communication-phonenumbers/assets.json b/sdk/communication/azure-communication-phonenumbers/assets.json
index 59357d4bb75d..91d50fd85f40 100644
--- a/sdk/communication/azure-communication-phonenumbers/assets.json
+++ b/sdk/communication/azure-communication-phonenumbers/assets.json
@@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/communication/azure-communication-phonenumbers",
- "Tag": "java/communication/azure-communication-phonenumbers_ac7d2e0f8b"
+ "Tag": "java/communication/azure-communication-phonenumbers_04c7cd3d26"
}
diff --git a/sdk/communication/azure-communication-phonenumbers/pom.xml b/sdk/communication/azure-communication-phonenumbers/pom.xml
index 896bf5d811f6..dbfb06d53e4b 100644
--- a/sdk/communication/azure-communication-phonenumbers/pom.xml
+++ b/sdk/communication/azure-communication-phonenumbers/pom.xml
@@ -16,7 +16,7 @@
com.azure
azure-communication-phonenumbers
jar
- 1.4.0-beta.1
+ 1.4.0
Microsoft Azure client phone numbers library for communication
diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClient.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClient.java
index a3678f417aa6..aa313b3576ae 100644
--- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClient.java
+++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClient.java
@@ -827,7 +827,31 @@ public PagedFlux listAvailableCountries() {
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listAvailableLocalities(String countryCode, String administrativeDivision) {
try {
- return client.listAvailableLocalitiesAsync(countryCode, null, null, administrativeDivision, acceptLanguage);
+ return client.listAvailableLocalitiesAsync(countryCode, null, null, administrativeDivision, acceptLanguage,
+ null);
+ } catch (RuntimeException ex) {
+ return new PagedFlux<>(() -> monoError(logger, ex));
+ }
+ }
+
+ /**
+ * Gets the list of the available localities. I.e. cities, towns.
+ *
+ * @param countryCode The ISO 3166-2 country code.
+ * @param administrativeDivision An optional parameter. The name or short name
+ * of the state/province within which to list the
+ * localities.
+ * @param phoneNumberType {@link PhoneNumberType} Optional parameter. Restrict the
+ * localities to the phone number type.
+ * @return A {@link PagedFlux} of {@link PhoneNumberLocality} instances
+ * representing available localities with phone numbers.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listAvailableLocalities(String countryCode, String administrativeDivision,
+ PhoneNumberType phoneNumberType) {
+ try {
+ return client.listAvailableLocalitiesAsync(countryCode, null, null, administrativeDivision, acceptLanguage,
+ phoneNumberType);
} catch (RuntimeException ex) {
return new PagedFlux<>(() -> monoError(logger, ex));
}
@@ -879,6 +903,29 @@ public PagedFlux listAvailableGeographicAreaCodes(String co
}
}
+ /**
+ * Gets the list of the available Mobile area codes for a given country and
+ * locality.
+ *
+ * @param countryCode The ISO 3166-2 country code.
+ * @param assignmentType {@link PhoneNumberAssignmentType} The phone
+ * number assignment type.
+ * @param locality The name of the locality (e.g. city or town
+ * name) in which to fetch area codes.
+ * @return A {@link PagedFlux} of {@link PhoneNumberAreaCode} instances
+ * representing purchased telephone numbers.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedFlux listAvailableMobileAreaCodes(String countryCode,
+ PhoneNumberAssignmentType assignmentType, String locality) {
+ try {
+ return client.listAreaCodesAsync(countryCode, PhoneNumberType.MOBILE, null, null, assignmentType, locality,
+ null, acceptLanguage);
+ } catch (RuntimeException ex) {
+ return new PagedFlux<>(() -> monoError(logger, ex));
+ }
+ }
+
/**
* Gets the list of the available phone number offerings for the given country.
*
diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersClient.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersClient.java
index c1a6069af3af..60d5a9924905 100644
--- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersClient.java
+++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersClient.java
@@ -806,7 +806,7 @@ public PagedIterable listAvailableCountries(Context context)
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listAvailableLocalities(String countryCode,
String administrativeDivision) {
- return this.listAvailableLocalities(countryCode, administrativeDivision, null);
+ return this.listAvailableLocalities(countryCode, administrativeDivision, null, null);
}
/**
@@ -825,7 +825,49 @@ public PagedIterable listAvailableLocalities(String country
public PagedIterable listAvailableLocalities(String countryCode, String administrativeDivision,
Context context) {
context = context == null ? Context.NONE : context;
- return client.listAvailableLocalities(countryCode, null, null, administrativeDivision, acceptLanguage, context);
+ return client.listAvailableLocalities(countryCode, null, null, administrativeDivision, acceptLanguage, null,
+ context);
+ }
+
+ /**
+ * Gets the list of the available localities. I.e. cities, towns.
+ *
+ * @param countryCode The ISO 3166-2 country code.
+ * @param administrativeDivision An optional parameter. The name or short name
+ * of the state/province within which to list the
+ * localities.
+ * @param phoneNumberType {@link PhoneNumberType} Optional parameter. Restrict
+ * the localities to the phone number type.
+ * @return A {@link PagedIterable} of {@link PhoneNumberLocality} instances
+ * representing available localities with phone numbers.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listAvailableLocalities(String countryCode, String administrativeDivision,
+ PhoneNumberType phoneNumberType) {
+ return client.listAvailableLocalities(countryCode, null, null, administrativeDivision, acceptLanguage,
+ phoneNumberType, Context.NONE);
+ }
+
+ /**
+ * Gets the list of the available localities. I.e. cities, towns.
+ *
+ * @param countryCode The ISO 3166-2 country code.
+ * @param administrativeDivision An optional parameter. The name or short name
+ * of the state/province within which to list the
+ * localities.
+ * @param phoneNumberType {@link PhoneNumberType} Optional parameter. Restrict
+ * the localities to the phone number type.
+ * @param context A {@link Context} representing the request
+ * context.
+ * @return A {@link PagedIterable} of {@link PhoneNumberLocality} instances
+ * representing available localities with phone numbers.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listAvailableLocalities(String countryCode, String administrativeDivision,
+ PhoneNumberType phoneNumberType, Context context) {
+ context = context == null ? Context.NONE : context;
+ return client.listAvailableLocalities(countryCode, null, null, administrativeDivision, acceptLanguage,
+ phoneNumberType, context);
}
/**
@@ -876,6 +918,46 @@ public PagedIterable listAvailableGeographicAreaCodes(Strin
null);
}
+ /**
+ * Gets the list of the available Mobile area codes for a given country and
+ * locality.
+ *
+ * @param countryCode The ISO 3166-2 country code.
+ * @param assignmentType {@link PhoneNumberAssignmentType} The phone
+ * number assignment type.
+ * @param locality The name of the locality (e.g. city or town
+ * name) in which to fetch area codes.
+ * @param context A {@link Context} representing the request
+ * context.
+ * @return A {@link PagedIterable} of {@link PhoneNumberAreaCode} instances
+ * representing purchased telephone numbers.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listAvailableMobileAreaCodes(String countryCode,
+ PhoneNumberAssignmentType assignmentType, String locality, Context context) {
+ context = context == null ? Context.NONE : context;
+ return client.listAreaCodes(countryCode, PhoneNumberType.MOBILE, null, null, assignmentType, locality, null,
+ acceptLanguage, context);
+ }
+
+ /**
+ * Gets the list of the available Mobile area codes for a given country and
+ * locality.
+ *
+ * @param countryCode The ISO 3166-2 country code.
+ * @param assignmentType {@link PhoneNumberAssignmentType} The phone
+ * number assignment type.
+ * @param locality The name of the locality (e.g. city or town
+ * name) in which to fetch area codes.
+ * @return A {@link PagedIterable} of {@link PhoneNumberAreaCode} instances
+ * representing purchased telephone numbers.
+ */
+ @ServiceMethod(returns = ReturnType.COLLECTION)
+ public PagedIterable listAvailableMobileAreaCodes(String countryCode,
+ PhoneNumberAssignmentType assignmentType, String locality) {
+ return this.listAvailableMobileAreaCodes(countryCode, assignmentType, locality, null);
+ }
+
/**
* Gets the list of the available Geographic area codes for a given country and
* locality.
diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersServiceVersion.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersServiceVersion.java
index e9ae56cb862f..603a711e4deb 100644
--- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersServiceVersion.java
+++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersServiceVersion.java
@@ -22,7 +22,12 @@ public enum PhoneNumbersServiceVersion implements ServiceVersion {
/**
* Cherry Picker GA {@code 2025-04-01}
*/
- V2025_04_01("2025-04-01");
+ V2025_04_01("2025-04-01"),
+
+ /**
+ * Mobile Numbers GA {@code 2025-06-01}
+ */
+ V2025_06_01("2025-06-01");
private final String version;
@@ -47,6 +52,6 @@ public String getVersion() {
*/
public static PhoneNumbersServiceVersion getLatest() {
- return V2025_04_01;
+ return V2025_06_01;
}
}
diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/PhoneNumberAdminClientImplBuilder.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/PhoneNumberAdminClientImplBuilder.java
index 34d20fef55cf..82d6f8e133cc 100644
--- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/PhoneNumberAdminClientImplBuilder.java
+++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/PhoneNumberAdminClientImplBuilder.java
@@ -253,7 +253,7 @@ public PhoneNumberAdminClientImplBuilder retryPolicy(RetryPolicy retryPolicy) {
public PhoneNumberAdminClientImpl buildClient() {
this.validateClient();
HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline();
- String localApiVersion = (apiVersion != null) ? apiVersion : "2025-04-01";
+ String localApiVersion = (apiVersion != null) ? apiVersion : "2025-06-01";
SerializerAdapter localSerializerAdapter
= (serializerAdapter != null) ? serializerAdapter : JacksonAdapter.createDefaultSerializerAdapter();
PhoneNumberAdminClientImpl client
diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/PhoneNumbersImpl.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/PhoneNumbersImpl.java
index 446f403b0b61..c4fe1afcc859 100644
--- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/PhoneNumbersImpl.java
+++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/PhoneNumbersImpl.java
@@ -131,7 +131,8 @@ Mono> listAvailableLocalities(@HostParam("endpoi
@QueryParam("maxPageSize") Integer maxPageSize,
@QueryParam("administrativeDivision") String administrativeDivision,
@QueryParam("api-version") String apiVersion, @HeaderParam("accept-language") String acceptLanguage,
- @HeaderParam("Accept") String accept, Context context);
+ @QueryParam("phoneNumberType") PhoneNumberType phoneNumberType, @HeaderParam("Accept") String accept,
+ Context context);
@Get("/availablePhoneNumbers/countries/{countryCode}/offerings")
@ExpectedResponses({ 200 })
@@ -355,7 +356,7 @@ Mono> listPhoneNumbersNext(
* Gets the list of available area codes.
*
* @param countryCode The ISO 3166-2 country code, e.g. US.
- * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param skip An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.
* @param maxPageSize An optional parameter for how many entries to return, for pagination purposes. The default
* value is 100.
@@ -387,7 +388,7 @@ public Mono> listAreaCodesSinglePageAsync(Str
* Gets the list of available area codes.
*
* @param countryCode The ISO 3166-2 country code, e.g. US.
- * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param skip An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.
* @param maxPageSize An optional parameter for how many entries to return, for pagination purposes. The default
* value is 100.
@@ -419,7 +420,7 @@ public Mono> listAreaCodesSinglePageAsync(Str
* Gets the list of available area codes.
*
* @param countryCode The ISO 3166-2 country code, e.g. US.
- * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param skip An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.
* @param maxPageSize An optional parameter for how many entries to return, for pagination purposes. The default
* value is 100.
@@ -447,7 +448,7 @@ public PagedFlux listAreaCodesAsync(String countryCode, Pho
* Gets the list of available area codes.
*
* @param countryCode The ISO 3166-2 country code, e.g. US.
- * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param skip An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.
* @param maxPageSize An optional parameter for how many entries to return, for pagination purposes. The default
* value is 100.
@@ -476,7 +477,7 @@ public PagedFlux listAreaCodesAsync(String countryCode, Pho
* Gets the list of available area codes.
*
* @param countryCode The ISO 3166-2 country code, e.g. US.
- * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param skip An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.
* @param maxPageSize An optional parameter for how many entries to return, for pagination purposes. The default
* value is 100.
@@ -502,7 +503,7 @@ public PagedResponse listAreaCodesSinglePage(String country
* Gets the list of available area codes.
*
* @param countryCode The ISO 3166-2 country code, e.g. US.
- * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param skip An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.
* @param maxPageSize An optional parameter for how many entries to return, for pagination purposes. The default
* value is 100.
@@ -529,7 +530,7 @@ public PagedResponse listAreaCodesSinglePage(String country
* Gets the list of available area codes.
*
* @param countryCode The ISO 3166-2 country code, e.g. US.
- * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param skip An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.
* @param maxPageSize An optional parameter for how many entries to return, for pagination purposes. The default
* value is 100.
@@ -555,7 +556,7 @@ public PagedIterable listAreaCodes(String countryCode, Phon
* Gets the list of available area codes.
*
* @param countryCode The ISO 3166-2 country code, e.g. US.
- * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param skip An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.
* @param maxPageSize An optional parameter for how many entries to return, for pagination purposes. The default
* value is 100.
@@ -880,6 +881,7 @@ public PhoneNumbersBrowseResult browseAvailableNumbers(String countryCode,
* @param administrativeDivision An optional parameter for the name of the state or province in which to search for
* the area code.
* @param acceptLanguage The locale to display in the localized fields in the response. e.g. 'en-US'.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
@@ -888,11 +890,13 @@ public PhoneNumbersBrowseResult browseAvailableNumbers(String countryCode,
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> listAvailableLocalitiesSinglePageAsync(String countryCode,
- Integer skip, Integer maxPageSize, String administrativeDivision, String acceptLanguage) {
+ Integer skip, Integer maxPageSize, String administrativeDivision, String acceptLanguage,
+ PhoneNumberType phoneNumberType) {
final String accept = "application/json";
return FluxUtil
.withContext(context -> service.listAvailableLocalities(this.client.getEndpoint(), countryCode, skip,
- maxPageSize, administrativeDivision, this.client.getApiVersion(), acceptLanguage, accept, context))
+ maxPageSize, administrativeDivision, this.client.getApiVersion(), acceptLanguage, phoneNumberType,
+ accept, context))
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().getPhoneNumberLocalities(), res.getValue().getNextLink(), null));
}
@@ -907,6 +911,7 @@ public Mono> listAvailableLocalitiesSinglePag
* @param administrativeDivision An optional parameter for the name of the state or province in which to search for
* the area code.
* @param acceptLanguage The locale to display in the localized fields in the response. e.g. 'en-US'.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
@@ -916,11 +921,12 @@ public Mono> listAvailableLocalitiesSinglePag
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono> listAvailableLocalitiesSinglePageAsync(String countryCode,
- Integer skip, Integer maxPageSize, String administrativeDivision, String acceptLanguage, Context context) {
+ Integer skip, Integer maxPageSize, String administrativeDivision, String acceptLanguage,
+ PhoneNumberType phoneNumberType, Context context) {
final String accept = "application/json";
return service
.listAvailableLocalities(this.client.getEndpoint(), countryCode, skip, maxPageSize, administrativeDivision,
- this.client.getApiVersion(), acceptLanguage, accept, context)
+ this.client.getApiVersion(), acceptLanguage, phoneNumberType, accept, context)
.map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(),
res.getValue().getPhoneNumberLocalities(), res.getValue().getNextLink(), null));
}
@@ -935,6 +941,7 @@ public Mono> listAvailableLocalitiesSinglePag
* @param administrativeDivision An optional parameter for the name of the state or province in which to search for
* the area code.
* @param acceptLanguage The locale to display in the localized fields in the response. e.g. 'en-US'.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
@@ -942,9 +949,10 @@ public Mono> listAvailableLocalitiesSinglePag
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listAvailableLocalitiesAsync(String countryCode, Integer skip,
- Integer maxPageSize, String administrativeDivision, String acceptLanguage) {
- return new PagedFlux<>(() -> listAvailableLocalitiesSinglePageAsync(countryCode, skip, maxPageSize,
- administrativeDivision, acceptLanguage),
+ Integer maxPageSize, String administrativeDivision, String acceptLanguage, PhoneNumberType phoneNumberType) {
+ return new PagedFlux<>(
+ () -> listAvailableLocalitiesSinglePageAsync(countryCode, skip, maxPageSize, administrativeDivision,
+ acceptLanguage, phoneNumberType),
nextLink -> listAvailableLocalitiesNextSinglePageAsync(nextLink, acceptLanguage));
}
@@ -958,6 +966,7 @@ public PagedFlux listAvailableLocalitiesAsync(String countr
* @param administrativeDivision An optional parameter for the name of the state or province in which to search for
* the area code.
* @param acceptLanguage The locale to display in the localized fields in the response. e.g. 'en-US'.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
@@ -966,10 +975,11 @@ public PagedFlux listAvailableLocalitiesAsync(String countr
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux listAvailableLocalitiesAsync(String countryCode, Integer skip,
- Integer maxPageSize, String administrativeDivision, String acceptLanguage, Context context) {
+ Integer maxPageSize, String administrativeDivision, String acceptLanguage, PhoneNumberType phoneNumberType,
+ Context context) {
return new PagedFlux<>(
() -> listAvailableLocalitiesSinglePageAsync(countryCode, skip, maxPageSize, administrativeDivision,
- acceptLanguage, context),
+ acceptLanguage, phoneNumberType, context),
nextLink -> listAvailableLocalitiesNextSinglePageAsync(nextLink, acceptLanguage, context));
}
@@ -983,6 +993,7 @@ public PagedFlux listAvailableLocalitiesAsync(String countr
* @param administrativeDivision An optional parameter for the name of the state or province in which to search for
* the area code.
* @param acceptLanguage The locale to display in the localized fields in the response. e.g. 'en-US'.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
@@ -990,9 +1001,9 @@ public PagedFlux listAvailableLocalitiesAsync(String countr
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PagedResponse listAvailableLocalitiesSinglePage(String countryCode, Integer skip,
- Integer maxPageSize, String administrativeDivision, String acceptLanguage) {
+ Integer maxPageSize, String administrativeDivision, String acceptLanguage, PhoneNumberType phoneNumberType) {
return listAvailableLocalitiesSinglePageAsync(countryCode, skip, maxPageSize, administrativeDivision,
- acceptLanguage).block();
+ acceptLanguage, phoneNumberType).block();
}
/**
@@ -1005,6 +1016,7 @@ public PagedResponse listAvailableLocalitiesSinglePage(Stri
* @param administrativeDivision An optional parameter for the name of the state or province in which to search for
* the area code.
* @param acceptLanguage The locale to display in the localized fields in the response. e.g. 'en-US'.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
@@ -1013,9 +1025,10 @@ public PagedResponse listAvailableLocalitiesSinglePage(Stri
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PagedResponse listAvailableLocalitiesSinglePage(String countryCode, Integer skip,
- Integer maxPageSize, String administrativeDivision, String acceptLanguage, Context context) {
+ Integer maxPageSize, String administrativeDivision, String acceptLanguage, PhoneNumberType phoneNumberType,
+ Context context) {
return listAvailableLocalitiesSinglePageAsync(countryCode, skip, maxPageSize, administrativeDivision,
- acceptLanguage, context).block();
+ acceptLanguage, phoneNumberType, context).block();
}
/**
@@ -1028,6 +1041,7 @@ public PagedResponse listAvailableLocalitiesSinglePage(Stri
* @param administrativeDivision An optional parameter for the name of the state or province in which to search for
* the area code.
* @param acceptLanguage The locale to display in the localized fields in the response. e.g. 'en-US'.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
@@ -1036,9 +1050,9 @@ public PagedResponse listAvailableLocalitiesSinglePage(Stri
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listAvailableLocalities(String countryCode, Integer skip,
- Integer maxPageSize, String administrativeDivision, String acceptLanguage) {
- return new PagedIterable<>(
- listAvailableLocalitiesAsync(countryCode, skip, maxPageSize, administrativeDivision, acceptLanguage));
+ Integer maxPageSize, String administrativeDivision, String acceptLanguage, PhoneNumberType phoneNumberType) {
+ return new PagedIterable<>(listAvailableLocalitiesAsync(countryCode, skip, maxPageSize, administrativeDivision,
+ acceptLanguage, phoneNumberType));
}
/**
@@ -1051,6 +1065,7 @@ public PagedIterable listAvailableLocalities(String country
* @param administrativeDivision An optional parameter for the name of the state or province in which to search for
* the area code.
* @param acceptLanguage The locale to display in the localized fields in the response. e.g. 'en-US'.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws CommunicationErrorResponseException thrown if the request is rejected by server.
@@ -1060,9 +1075,10 @@ public PagedIterable listAvailableLocalities(String country
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable listAvailableLocalities(String countryCode, Integer skip,
- Integer maxPageSize, String administrativeDivision, String acceptLanguage, Context context) {
+ Integer maxPageSize, String administrativeDivision, String acceptLanguage, PhoneNumberType phoneNumberType,
+ Context context) {
return new PagedIterable<>(listAvailableLocalitiesAsync(countryCode, skip, maxPageSize, administrativeDivision,
- acceptLanguage, context));
+ acceptLanguage, phoneNumberType, context));
}
/**
@@ -1072,7 +1088,7 @@ public PagedIterable listAvailableLocalities(String country
* @param skip An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.
* @param maxPageSize An optional parameter for how many entries to return, for pagination purposes. The default
* value is 100.
- * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param assignmentType Filter by assignmentType, e.g. Person, Application.
* @param acceptLanguage The locale to display in the localized fields in the response. e.g. 'en-US'.
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -1100,7 +1116,7 @@ public Mono> listOfferingsSinglePageAsync(Str
* @param skip An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.
* @param maxPageSize An optional parameter for how many entries to return, for pagination purposes. The default
* value is 100.
- * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param assignmentType Filter by assignmentType, e.g. Person, Application.
* @param acceptLanguage The locale to display in the localized fields in the response. e.g. 'en-US'.
* @param context The context to associate with this operation.
@@ -1129,7 +1145,7 @@ public Mono> listOfferingsSinglePageAsync(Str
* @param skip An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.
* @param maxPageSize An optional parameter for how many entries to return, for pagination purposes. The default
* value is 100.
- * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param assignmentType Filter by assignmentType, e.g. Person, Application.
* @param acceptLanguage The locale to display in the localized fields in the response. e.g. 'en-US'.
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -1151,7 +1167,7 @@ public PagedFlux listOfferingsAsync(String countryCode, Int
* @param skip An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.
* @param maxPageSize An optional parameter for how many entries to return, for pagination purposes. The default
* value is 100.
- * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param assignmentType Filter by assignmentType, e.g. Person, Application.
* @param acceptLanguage The locale to display in the localized fields in the response. e.g. 'en-US'.
* @param context The context to associate with this operation.
@@ -1177,7 +1193,7 @@ public PagedFlux listOfferingsAsync(String countryCode, Int
* @param skip An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.
* @param maxPageSize An optional parameter for how many entries to return, for pagination purposes. The default
* value is 100.
- * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param assignmentType Filter by assignmentType, e.g. Person, Application.
* @param acceptLanguage The locale to display in the localized fields in the response. e.g. 'en-US'.
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -1200,7 +1216,7 @@ public PagedResponse listOfferingsSinglePage(String country
* @param skip An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.
* @param maxPageSize An optional parameter for how many entries to return, for pagination purposes. The default
* value is 100.
- * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param assignmentType Filter by assignmentType, e.g. Person, Application.
* @param acceptLanguage The locale to display in the localized fields in the response. e.g. 'en-US'.
* @param context The context to associate with this operation.
@@ -1224,7 +1240,7 @@ public PagedResponse listOfferingsSinglePage(String country
* @param skip An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.
* @param maxPageSize An optional parameter for how many entries to return, for pagination purposes. The default
* value is 100.
- * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param assignmentType Filter by assignmentType, e.g. Person, Application.
* @param acceptLanguage The locale to display in the localized fields in the response. e.g. 'en-US'.
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -1246,7 +1262,7 @@ public PagedIterable listOfferings(String countryCode, Inte
* @param skip An optional parameter for how many entries to skip, for pagination purposes. The default value is 0.
* @param maxPageSize An optional parameter for how many entries to return, for pagination purposes. The default
* value is 100.
- * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree.
+ * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree, Mobile.
* @param assignmentType Filter by assignmentType, e.g. Person, Application.
* @param acceptLanguage The locale to display in the localized fields in the response. e.g. 'en-US'.
* @param context The context to associate with this operation.
diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberSearchRequest.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberSearchRequest.java
index fc8ede2ae3e7..ba256309b671 100644
--- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberSearchRequest.java
+++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberSearchRequest.java
@@ -22,7 +22,7 @@
@Fluent
public final class PhoneNumberSearchRequest implements JsonSerializable {
/*
- * The type of phone numbers to search for, e.g. geographic, or tollFree.
+ * The type of phone numbers to search for, e.g. geographic, tollFree, mobile.
*/
@Generated
private PhoneNumberType phoneNumberType;
@@ -60,7 +60,7 @@ public PhoneNumberSearchRequest() {
}
/**
- * Get the phoneNumberType property: The type of phone numbers to search for, e.g. geographic, or tollFree.
+ * Get the phoneNumberType property: The type of phone numbers to search for, e.g. geographic, tollFree, mobile.
*
* @return the phoneNumberType value.
*/
@@ -70,7 +70,7 @@ public PhoneNumberType getPhoneNumberType() {
}
/**
- * Set the phoneNumberType property: The type of phone numbers to search for, e.g. geographic, or tollFree.
+ * Set the phoneNumberType property: The type of phone numbers to search for, e.g. geographic, tollFree, mobile.
*
* @param phoneNumberType the phoneNumberType value to set.
* @return the PhoneNumberSearchRequest object itself.
diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResult.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResult.java
index a6383e892012..7af4c257a5ea 100644
--- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResult.java
+++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResult.java
@@ -33,7 +33,7 @@ public final class PhoneNumberSearchResult implements JsonSerializable phoneNumbers;
/*
- * The phone number's type, e.g. geographic, or tollFree.
+ * The phone number's type, e.g. geographic, tollFree, mobile.
*/
@Generated
private PhoneNumberType phoneNumberType;
@@ -111,7 +111,7 @@ public List getPhoneNumbers() {
}
/**
- * Get the phoneNumberType property: The phone number's type, e.g. geographic, or tollFree.
+ * Get the phoneNumberType property: The phone number's type, e.g. geographic, tollFree, mobile.
*
* @return the phoneNumberType value.
*/
diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberType.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberType.java
index 1a467298a529..e07c533d9754 100644
--- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberType.java
+++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberType.java
@@ -24,6 +24,12 @@ public final class PhoneNumberType extends ExpandableStringEnum
@Generated
public static final PhoneNumberType TOLL_FREE = fromString("tollFree");
+ /**
+ * Static value mobile for PhoneNumberType.
+ */
+ @Generated
+ public static final PhoneNumberType MOBILE = fromString("mobile");
+
/**
* Creates a new instance of PhoneNumberType value.
*
diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PurchasedPhoneNumber.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PurchasedPhoneNumber.java
index e2c768e7688f..8f4b37e42cdc 100644
--- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PurchasedPhoneNumber.java
+++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PurchasedPhoneNumber.java
@@ -38,7 +38,7 @@ public final class PurchasedPhoneNumber implements JsonSerializable {
+ assertNotNull(areaCodes);
+ assertNotNull(areaCodes.getAreaCode());
+ }).verifyComplete();
+ }
+
@ParameterizedTest
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
public void getCountriesWithAAD(HttpClient httpClient) {
@@ -302,6 +318,16 @@ public void getLocalitiesAdministrativeDivisionWithAAD(HttpClient httpClient) {
}).verifyComplete();
}
+ @ParameterizedTest
+ @MethodSource("com.azure.core.test.TestBase#getHttpClients")
+ public void getLocalitiesWithPhoneNumberTypeWithAAD(HttpClient httpClient) {
+ StepVerifier.create(this.getClientWithManagedIdentity(httpClient, "listAvailableLocalities")
+ .listAvailableLocalities("IE", null, PhoneNumberType.MOBILE)
+ .next()).assertNext((PhoneNumberLocality locality) -> {
+ assertNotNull(locality);
+ }).verifyComplete();
+ }
+
@ParameterizedTest
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
public void getOfferingsWithAAD(HttpClient httpClient) {
@@ -355,6 +381,20 @@ public void getGeographicAreaCodesWronglocality(HttpClient httpClient) {
.next()).expectError();
}
+ @ParameterizedTest
+ @MethodSource("com.azure.core.test.TestBase#getHttpClients")
+ public void getMobileAreaCodes(HttpClient httpClient) {
+ PhoneNumberLocality locality = this.getClientWithConnectionString(httpClient, "listAvailableLocalities")
+ .listAvailableLocalities("IE", null, PhoneNumberType.MOBILE)
+ .blockFirst();
+ StepVerifier.create(this.getClientWithConnectionString(httpClient, "listAvailableMobileAreaCodes")
+ .listAvailableMobileAreaCodes("IE", PhoneNumberAssignmentType.APPLICATION, locality.getLocalizedName())
+ .next()).assertNext((PhoneNumberAreaCode areaCodes) -> {
+ assertNotNull(areaCodes);
+ assertNotNull(areaCodes.getAreaCode());
+ }).verifyComplete();
+ }
+
@ParameterizedTest
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
public void getCountries(HttpClient httpClient) {
@@ -395,6 +435,16 @@ public void getLocalitiesAdministrativeDivision(HttpClient httpClient) {
}).verifyComplete();
}
+ @ParameterizedTest
+ @MethodSource("com.azure.core.test.TestBase#getHttpClients")
+ public void getLocalitiesWithPhoneNumberType(HttpClient httpClient) {
+ StepVerifier.create(this.getClientWithConnectionString(httpClient, "listAvailableLocalities")
+ .listAvailableLocalities("IE", null, PhoneNumberType.MOBILE)
+ .next()).assertNext((PhoneNumberLocality locality) -> {
+ assertNotNull(locality);
+ }).verifyComplete();
+ }
+
@ParameterizedTest
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
public void getLocalitiesInvalidAdministrativeDivision(HttpClient httpClient) {
@@ -558,9 +608,7 @@ public void browseAvailablePhoneNumberWrongCountryCodeWithAAD(HttpClient httpCli
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
public void updatePhoneNumbersReservation(HttpClient httpClient) {
BrowsePhoneNumbersOptions browseRequest = new BrowsePhoneNumbersOptions("US", PhoneNumberType.TOLL_FREE)
- .setAssignmentType(PhoneNumberAssignmentType.APPLICATION)
- .setCapabilities(new PhoneNumberCapabilities().setCalling(PhoneNumberCapabilityType.INBOUND_OUTBOUND)
- .setSms(PhoneNumberCapabilityType.INBOUND_OUTBOUND));
+ .setAssignmentType(PhoneNumberAssignmentType.APPLICATION);
PhoneNumbersBrowseResult result = this.getClientWithConnectionString(httpClient, "browseAvailableNumbers")
.browseAvailableNumbers(browseRequest)
@@ -617,20 +665,31 @@ public void updatePhoneNumbersReservation(HttpClient httpClient) {
.verifyError();
}
+ private static Stream httpClientAndPhoneNumberTypeProvider() {
+ return com.azure.core.test.TestBase.getHttpClients()
+ .flatMap(httpClient -> Stream.of(Arguments.of(httpClient, PhoneNumberType.TOLL_FREE, "US"),
+ Arguments.of(httpClient, PhoneNumberType.GEOGRAPHIC, "US"),
+ Arguments.of(httpClient, PhoneNumberType.MOBILE, "IE")));
+ }
+
@ParameterizedTest
- @MethodSource("com.azure.core.test.TestBase#getHttpClients")
- public void updatePhoneNumbersReservationWithAAD(HttpClient httpClient) {
- BrowsePhoneNumbersOptions browseRequest = new BrowsePhoneNumbersOptions("US", PhoneNumberType.TOLL_FREE)
- .setAssignmentType(PhoneNumberAssignmentType.APPLICATION)
- .setCapabilities(new PhoneNumberCapabilities().setCalling(PhoneNumberCapabilityType.INBOUND_OUTBOUND)
- .setSms(PhoneNumberCapabilityType.INBOUND_OUTBOUND));
+ @MethodSource("httpClientAndPhoneNumberTypeProvider")
+ public void updatePhoneNumbersReservationWithAAD(HttpClient httpClient, PhoneNumberType phoneNumberType,
+ String countryCode) {
+ runUpdatePhoneNumbersReservationWithAADTest(httpClient, phoneNumberType, countryCode);
+ }
+
+ private void runUpdatePhoneNumbersReservationWithAADTest(HttpClient httpClient, PhoneNumberType phoneNumberType,
+ String countryCode) {
+ BrowsePhoneNumbersOptions browseRequest = new BrowsePhoneNumbersOptions(countryCode, phoneNumberType)
+ .setAssignmentType(PhoneNumberAssignmentType.APPLICATION);
PhoneNumbersBrowseResult result = this.getClientWithManagedIdentity(httpClient, "browseAvailableNumbers")
.browseAvailableNumbers(browseRequest)
- .block(); // Blocking to retrieve the result synchronously
+ .block();
assertNotNull(result);
- assertEquals(PhoneNumberType.TOLL_FREE, result.getPhoneNumbers().get(0).getPhoneNumberType());
+ assertEquals(phoneNumberType, result.getPhoneNumbers().get(0).getPhoneNumberType());
assertEquals(PhoneNumberAssignmentType.APPLICATION, result.getPhoneNumbers().get(0).getAssignmentType());
List numbersToAdd = new ArrayList<>();
@@ -680,6 +739,73 @@ public void updatePhoneNumbersReservationWithAAD(HttpClient httpClient) {
.verifyError();
}
+ @ParameterizedTest
+ @MethodSource("httpClientAndPhoneNumberTypeProvider")
+ public void updatePhoneNumbersReservation(HttpClient httpClient, PhoneNumberType phoneNumberType,
+ String countryCode) {
+ runUpdatePhoneNumbersReservationTest(httpClient, phoneNumberType, countryCode);
+ }
+
+ private void runUpdatePhoneNumbersReservationTest(HttpClient httpClient, PhoneNumberType phoneNumberType,
+ String countryCode) {
+ BrowsePhoneNumbersOptions browseRequest = new BrowsePhoneNumbersOptions(countryCode, phoneNumberType)
+ .setAssignmentType(PhoneNumberAssignmentType.APPLICATION);
+
+ PhoneNumbersBrowseResult result = this.getClientWithConnectionString(httpClient, "browseAvailableNumbers")
+ .browseAvailableNumbers(browseRequest)
+ .block();
+
+ assertNotNull(result);
+ assertEquals(phoneNumberType, result.getPhoneNumbers().get(0).getPhoneNumberType());
+ assertEquals(PhoneNumberAssignmentType.APPLICATION, result.getPhoneNumbers().get(0).getAssignmentType());
+
+ List numbersToAdd = new ArrayList<>();
+ numbersToAdd.add(result.getPhoneNumbers().get(0));
+
+ PhoneNumbersReservation reservationResponse
+ = this.getClientWithConnectionString(httpClient, "updatePhoneNumberReservation")
+ .createOrUpdateReservation(
+ new CreateOrUpdateReservationOptions(reservationId).setPhoneNumbersToAdd(numbersToAdd))
+ .block();
+
+ assertEquals(reservationId, reservationResponse.getId().toString());
+ assertNotNull(reservationResponse.getPhoneNumbers());
+ assertTrue(reservationResponse.getPhoneNumbers().containsKey(result.getPhoneNumbers().get(0).getId()));
+
+ reservationResponse = this.getClientWithConnectionString(httpClient, "getPhoneNumberReservation")
+ .getReservation(reservationId)
+ .block();
+
+ assertEquals(reservationId, reservationResponse.getId().toString());
+
+ PagedFlux reservationsList
+ = this.getClientWithConnectionString(httpClient, "listPhoneNumberReservations").listReservations();
+
+ StepVerifier.create(reservationsList.collectList()).assertNext(reservations -> {
+ boolean containsReservation
+ = reservations.stream().anyMatch(reservation -> reservation.getId().toString().equals(reservationId));
+ assertTrue(containsReservation, "The reservations list does not contain the expected reservation.");
+ }).verifyComplete();
+
+ List numbersToRemove = new ArrayList<>();
+ numbersToRemove.add(result.getPhoneNumbers().get(0).getId());
+
+ reservationResponse = this.getClientWithConnectionString(httpClient, "updatePhoneNumberReservation")
+ .createOrUpdateReservation(
+ new CreateOrUpdateReservationOptions(reservationId).setPhoneNumbersToRemove(numbersToRemove))
+ .block();
+ assertEquals(reservationId, reservationResponse.getId().toString());
+
+ this.getClientWithConnectionString(httpClient, "deletePhoneNumberReservation")
+ .deleteReservation(reservationId)
+ .block();
+
+ StepVerifier
+ .create(this.getClientWithConnectionString(httpClient, "getPhoneNumberReservation")
+ .getReservation(reservationId))
+ .verifyError();
+ }
+
@ParameterizedTest
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
public void purchaseWithoutAgreementToNotResellFails(HttpClient httpClient) {
diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientIntegrationTest.java
index a0349985c1f3..fdecc3a1d885 100644
--- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientIntegrationTest.java
+++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientIntegrationTest.java
@@ -41,6 +41,8 @@
import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
+import org.junit.jupiter.params.provider.Arguments;
+import java.util.stream.Stream;
import java.time.Duration;
import java.util.ArrayList;
@@ -276,6 +278,37 @@ public void getGeographicAreaCodesWrongLocality(HttpClient httpClient) {
"No area codes were found for the given parameters");
}
+ @ParameterizedTest
+ @MethodSource("com.azure.core.test.TestBase#getHttpClients")
+ public void getMobileAreaCodesWithoutContext(HttpClient httpClient) {
+ PhoneNumberLocality locality = this.getClientWithConnectionString(httpClient, "listAvailableLocalities")
+ .listAvailableLocalities("IE", null, PhoneNumberType.MOBILE)
+ .iterator()
+ .next();
+ PagedIterable areaCodesResult
+ = this.getClientWithConnectionString(httpClient, "listAvailableMobileAreaCodes")
+ .listAvailableMobileAreaCodes("IE", PhoneNumberAssignmentType.APPLICATION, locality.getLocalizedName());
+ PhoneNumberAreaCode areaCodes = areaCodesResult.iterator().next();
+ assertNotNull(areaCodes);
+ assertNotNull(areaCodes.getAreaCode());
+ }
+
+ @ParameterizedTest
+ @MethodSource("com.azure.core.test.TestBase#getHttpClients")
+ public void getMobileAreaCodes(HttpClient httpClient) {
+ PhoneNumberLocality locality = this.getClientWithConnectionString(httpClient, "listAvailableLocalities")
+ .listAvailableLocalities("IE", null, PhoneNumberType.MOBILE)
+ .iterator()
+ .next();
+ PagedIterable areaCodesResult
+ = this.getClientWithConnectionString(httpClient, "listAvailableMobileAreaCodes")
+ .listAvailableMobileAreaCodes("IE", PhoneNumberAssignmentType.APPLICATION, locality.getLocalizedName(),
+ Context.NONE);
+ PhoneNumberAreaCode areaCodes = areaCodesResult.iterator().next();
+ assertNotNull(areaCodes);
+ assertNotNull(areaCodes.getAreaCode());
+ }
+
@ParameterizedTest
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
public void getCountriesWithoutContext(HttpClient httpClient) {
@@ -349,6 +382,26 @@ public void getLocalitiesWithAdministrativeDivision(HttpClient httpClient) {
localityAdministraiveDivision.getLocalizedName());
}
+ @ParameterizedTest
+ @MethodSource("com.azure.core.test.TestBase#getHttpClients")
+ public void getLocalitiesWithPhoneNumberTypeWithoutContext(HttpClient httpClient) {
+ PagedIterable localitiesResult
+ = this.getClientWithConnectionString(httpClient, "listAvailableLocalities")
+ .listAvailableLocalities("IE", null, PhoneNumberType.MOBILE);
+ PhoneNumberLocality locality = localitiesResult.iterator().next();
+ assertNotNull(locality);
+ }
+
+ @ParameterizedTest
+ @MethodSource("com.azure.core.test.TestBase#getHttpClients")
+ public void getLocalitiesWithPhoneNumberType(HttpClient httpClient) {
+ PagedIterable localitiesResult
+ = this.getClientWithConnectionString(httpClient, "listAvailableLocalities")
+ .listAvailableLocalities("IE", null, PhoneNumberType.MOBILE, Context.NONE);
+ PhoneNumberLocality locality = localitiesResult.iterator().next();
+ assertNotNull(locality);
+ }
+
@ParameterizedTest
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
public void getOfferingsWithoutContext(HttpClient httpClient) {
@@ -385,7 +438,7 @@ public void getTollFreeAreaCodesWithAAD(HttpClient httpClient) {
@ParameterizedTest
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
public void getGeographicAreaCodesWithAAD(HttpClient httpClient) {
- PhoneNumberLocality locality = this.getClientWithConnectionString(httpClient, "listAvailableLocalities")
+ PhoneNumberLocality locality = this.getClientWithManagedIdentity(httpClient, "listAvailableLocalities")
.listAvailableLocalities("US", null)
.iterator()
.next();
@@ -398,6 +451,22 @@ public void getGeographicAreaCodesWithAAD(HttpClient httpClient) {
assertNotNull(areaCodes.getAreaCode());
}
+ @ParameterizedTest
+ @MethodSource("com.azure.core.test.TestBase#getHttpClients")
+ public void getMobileAreaCodesWithAAD(HttpClient httpClient) {
+ PhoneNumberLocality locality = this.getClientWithManagedIdentity(httpClient, "listAvailableLocalities")
+ .listAvailableLocalities("IE", null, PhoneNumberType.MOBILE)
+ .iterator()
+ .next();
+ PagedIterable areaCodesResult
+ = this.getClientWithManagedIdentity(httpClient, "listAvailableMobileAreaCodes")
+ .listAvailableMobileAreaCodes("IE", PhoneNumberAssignmentType.APPLICATION, locality.getLocalizedName(),
+ Context.NONE);
+ PhoneNumberAreaCode areaCodes = areaCodesResult.iterator().next();
+ assertNotNull(areaCodes);
+ assertNotNull(areaCodes.getAreaCode());
+ }
+
@ParameterizedTest
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
public void getCountriesWithAAD(HttpClient httpClient) {
@@ -438,6 +507,16 @@ public void getLocalitiesWithAdministrativeDivisionWithAAD(HttpClient httpClient
localityWithAD.getAdministrativeDivision().getLocalizedName());
}
+ @ParameterizedTest
+ @MethodSource("com.azure.core.test.TestBase#getHttpClients")
+ public void getLocalitiesWithPhoneNumberTypeWithAAD(HttpClient httpClient) {
+ PagedIterable localitiesResult
+ = this.getClientWithManagedIdentity(httpClient, "listAvailableLocalities")
+ .listAvailableLocalities("IE", null, PhoneNumberType.MOBILE, Context.NONE);
+ PhoneNumberLocality locality = localitiesResult.iterator().next();
+ assertNotNull(locality);
+ }
+
@ParameterizedTest
@MethodSource("com.azure.core.test.TestBase#getHttpClients")
public void getOfferingsWithAAD(HttpClient httpClient) {
@@ -493,6 +572,14 @@ public void browseAvailablePhoneNumberSucceeds(HttpClient httpClient) {
.browseAvailableNumbers(browseRequest);
assertEquals(PhoneNumberType.TOLL_FREE, result.getPhoneNumbers().get(0).getPhoneNumberType());
assertEquals(PhoneNumberAssignmentType.APPLICATION, result.getPhoneNumbers().get(0).getAssignmentType());
+
+ browseRequest = new BrowsePhoneNumbersOptions("IE", PhoneNumberType.MOBILE)
+ .setAssignmentType(PhoneNumberAssignmentType.APPLICATION);
+
+ result = this.getClientWithConnectionString(httpClient, "browseAvailableNumbers")
+ .browseAvailableNumbers(browseRequest);
+ assertEquals(PhoneNumberType.MOBILE, result.getPhoneNumbers().get(0).getPhoneNumberType());
+ assertEquals(PhoneNumberAssignmentType.APPLICATION, result.getPhoneNumbers().get(0).getAssignmentType());
}
@ParameterizedTest
@@ -522,6 +609,14 @@ public void browseAvailablePhoneNumberSucceedsWithAAD(HttpClient httpClient) {
.browseAvailableNumbers(browseRequest);
assertEquals(PhoneNumberType.TOLL_FREE, result.getPhoneNumbers().get(0).getPhoneNumberType());
assertEquals(PhoneNumberAssignmentType.APPLICATION, result.getPhoneNumbers().get(0).getAssignmentType());
+
+ browseRequest = new BrowsePhoneNumbersOptions("IE", PhoneNumberType.MOBILE)
+ .setAssignmentType(PhoneNumberAssignmentType.APPLICATION);
+
+ result = this.getClientWithManagedIdentity(httpClient, "browseAvailableNumbers")
+ .browseAvailableNumbers(browseRequest);
+ assertEquals(PhoneNumberType.MOBILE, result.getPhoneNumbers().get(0).getPhoneNumberType());
+ assertEquals(PhoneNumberAssignmentType.APPLICATION, result.getPhoneNumbers().get(0).getAssignmentType());
}
@ParameterizedTest
@@ -539,19 +634,29 @@ public void browseAvailablePhoneNumberWrongCountryCodeWithAAD(HttpClient httpCli
"Unable to parse CountryCode");
}
+ private static Stream httpClientAndPhoneNumberTypeProvider() {
+ return com.azure.core.test.TestBase.getHttpClients()
+ .flatMap(httpClient -> Stream.of(Arguments.of(httpClient, PhoneNumberType.TOLL_FREE, "US"),
+ Arguments.of(httpClient, PhoneNumberType.GEOGRAPHIC, "US"),
+ Arguments.of(httpClient, PhoneNumberType.MOBILE, "IE")));
+ }
+
@ParameterizedTest
- @MethodSource("com.azure.core.test.TestBase#getHttpClients")
- public void updatePhoneNumbersReservation(HttpClient httpClient) {
- BrowsePhoneNumbersOptions browseRequest = new BrowsePhoneNumbersOptions("US", PhoneNumberType.TOLL_FREE)
- .setAssignmentType(PhoneNumberAssignmentType.APPLICATION)
- .setCapabilities(new PhoneNumberCapabilities().setCalling(PhoneNumberCapabilityType.INBOUND_OUTBOUND)
- .setSms(PhoneNumberCapabilityType.INBOUND_OUTBOUND));
+ @MethodSource("httpClientAndPhoneNumberTypeProvider")
+ public void updatePhoneNumbersReservation(HttpClient httpClient, PhoneNumberType phoneNumberType,
+ String countryCode) {
+ runUpdatePhoneNumbersReservationTest(httpClient, phoneNumberType, countryCode);
+ }
+
+ private void runUpdatePhoneNumbersReservationTest(HttpClient httpClient, PhoneNumberType phoneNumberType,
+ String countryCode) {
+ BrowsePhoneNumbersOptions browseRequest = new BrowsePhoneNumbersOptions(countryCode, phoneNumberType)
+ .setAssignmentType(PhoneNumberAssignmentType.APPLICATION);
PhoneNumbersBrowseResult result = this.getClientWithConnectionString(httpClient, "browseAvailableNumbers")
.browseAvailableNumbers(browseRequest);
List numbersToAdd = new ArrayList<>();
-
numbersToAdd.add(result.getPhoneNumbers().get(0));
PhoneNumbersReservation reservationResponse
@@ -591,12 +696,16 @@ public void updatePhoneNumbersReservation(HttpClient httpClient) {
}
@ParameterizedTest
- @MethodSource("com.azure.core.test.TestBase#getHttpClients")
- public void updatePhoneNumbersReservationWithAAD(HttpClient httpClient) {
- BrowsePhoneNumbersOptions browseRequest = new BrowsePhoneNumbersOptions("US", PhoneNumberType.TOLL_FREE)
- .setAssignmentType(PhoneNumberAssignmentType.APPLICATION)
- .setCapabilities(new PhoneNumberCapabilities().setCalling(PhoneNumberCapabilityType.INBOUND_OUTBOUND)
- .setSms(PhoneNumberCapabilityType.INBOUND_OUTBOUND));
+ @MethodSource("httpClientAndPhoneNumberTypeProvider")
+ public void updatePhoneNumbersReservationWithAAD(HttpClient httpClient, PhoneNumberType phoneNumberType,
+ String countryCode) {
+ runUpdatePhoneNumbersReservationWithAADTest(httpClient, phoneNumberType, countryCode);
+ }
+
+ private void runUpdatePhoneNumbersReservationWithAADTest(HttpClient httpClient, PhoneNumberType phoneNumberType,
+ String countryCode) {
+ BrowsePhoneNumbersOptions browseRequest = new BrowsePhoneNumbersOptions(countryCode, phoneNumberType)
+ .setAssignmentType(PhoneNumberAssignmentType.APPLICATION);
PhoneNumbersBrowseResult result = this.getClientWithManagedIdentity(httpClient, "browseAvailableNumbers")
.browseAvailableNumbers(browseRequest);
@@ -605,7 +714,7 @@ public void updatePhoneNumbersReservationWithAAD(HttpClient httpClient) {
numbersToAdd.add(result.getPhoneNumbers().get(0));
PhoneNumbersReservation reservationResponse
- = this.getClientWithConnectionString(httpClient, "updatePhoneNumberReservation")
+ = this.getClientWithManagedIdentity(httpClient, "updatePhoneNumberReservation")
.createOrUpdateReservation(
new CreateOrUpdateReservationOptions(reservationId).setPhoneNumbersToAdd(numbersToAdd));
diff --git a/sdk/communication/azure-communication-phonenumbers/swagger/README.md b/sdk/communication/azure-communication-phonenumbers/swagger/README.md
index bde05f193729..51b0f15378e4 100644
--- a/sdk/communication/azure-communication-phonenumbers/swagger/README.md
+++ b/sdk/communication/azure-communication-phonenumbers/swagger/README.md
@@ -23,9 +23,9 @@ autorest README.md --java
### Code generation settings
``` yaml
-tag: package-phonenumber-2025-04-01
+tag: package-phonenumber-2025-06-01
use: '@autorest/java@4.1.52'
-require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/de9cb12d2840ca0915849ce6a3bf8c956a32c022/specification/communication/data-plane/PhoneNumbers/readme.md
+require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/14800a01400c295af0bfa5886e5f4042e4f6c62e/specification/communication/data-plane/PhoneNumbers/readme.md
override-client-name: PhoneNumberAdminClient
custom-types: PurchasedPhoneNumber,BillingFrequency,PhoneNumberOperationStatus,PhoneNumberOperationStatusCodes,PhoneNumberOperationType,PhoneNumberAssignmentType,PhoneNumberCapabilities,PhoneNumberCapabilityType,PhoneNumberCost,PhoneNumberSearchResult,PhoneNumberType,PhoneNumberCapability,PhoneNumberAdministrativeDivision,PhoneNumberCountry,PhoneNumberLocality,PhoneNumberOffering,AreaCodeResult,AreaCodes,PhoneNumberAreaCode,OperatorDetails,OperatorInformation,OperatorInformationResult,OperatorInformationOptions,OperatorNumberType,PhoneNumbersReservation,AvailablePhoneNumber,AvailablePhoneNumberCost,PhoneNumberAvailabilityStatus,PhoneNumbersBrowseResult,BrowsePhoneNumbersOptions,PhoneNumbersReservationStatus
custom-types-subpackage: models