diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/CHANGELOG.md b/sdk/communication/Azure.Communication.PhoneNumbers/CHANGELOG.md index 61d0c0873b41..f8f3d7d7b306 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/CHANGELOG.md +++ b/sdk/communication/Azure.Communication.PhoneNumbers/CHANGELOG.md @@ -1,14 +1,16 @@ # Release History -## 1.5.0-beta.1 (Unreleased) +## 1.5.0 (Unreleased) ### Features Added +- GA release of mobile number types -### Breaking Changes - -### Bugs Fixed +## 1.5.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.4.0 (2025-06-20) diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/README.md b/sdk/communication/Azure.Communication.PhoneNumbers/README.md index 1a77cb58656f..29d1d588dd5f 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/README.md +++ b/sdk/communication/Azure.Communication.PhoneNumbers/README.md @@ -32,7 +32,7 @@ Here's an example using the Azure CLI: 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. @@ -73,9 +73,9 @@ client = new SipRoutingClient(endpoint, tokenCredential); ### Phone numbers client #### 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. - -All geographic phone plans within the same country are grouped into a phone plan group with a Geographic phone number type. All Toll-Free phone plans within the same country are grouped into a phone plan group. +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, purchasing and releasing phone numbers diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/api/Azure.Communication.PhoneNumbers.net8.0.cs b/sdk/communication/Azure.Communication.PhoneNumbers/api/Azure.Communication.PhoneNumbers.net8.0.cs index 11d1d5ce319d..9d0117f7ca5a 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/api/Azure.Communication.PhoneNumbers.net8.0.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/api/Azure.Communication.PhoneNumbers.net8.0.cs @@ -223,11 +223,15 @@ public PhoneNumbersClient(System.Uri endpoint, Azure.Core.TokenCredential tokenC public virtual System.Threading.Tasks.Task DeleteReservationAsync(System.Guid reservationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetAvailableAreaCodesGeographic(string twoLetterIsoCountryName, Azure.Communication.PhoneNumbers.PhoneNumberAssignmentType phoneNumberAssignmentType, string locality, string administrativeDivision = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAvailableAreaCodesGeographicAsync(string twoLetterIsoCountryName, Azure.Communication.PhoneNumbers.PhoneNumberAssignmentType phoneNumberAssignmentType, string locality, string administrativeDivision = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailableAreaCodesMobile(string twoLetterIsoCountryName, Azure.Communication.PhoneNumbers.PhoneNumberAssignmentType phoneNumberAssignmentType, string locality, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableAreaCodesMobileAsync(string twoLetterIsoCountryName, Azure.Communication.PhoneNumbers.PhoneNumberAssignmentType phoneNumberAssignmentType, string locality, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetAvailableAreaCodesTollFree(string twoLetterIsoCountryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAvailableAreaCodesTollFreeAsync(string twoLetterIsoCountryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetAvailableCountries(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAvailableCountriesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailableLocalities(string twoLetterIsoCountryName, Azure.Communication.PhoneNumbers.PhoneNumberType phoneNumberType, string administrativeDivision = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetAvailableLocalities(string twoLetterIsoCountryName, string administrativeDivision = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableLocalitiesAsync(string twoLetterIsoCountryName, Azure.Communication.PhoneNumbers.PhoneNumberType phoneNumberType, string administrativeDivision = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAvailableLocalitiesAsync(string twoLetterIsoCountryName, string administrativeDivision = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetAvailableOfferings(string twoLetterIsoCountryName, Azure.Communication.PhoneNumbers.PhoneNumberType? phoneNumberType = default(Azure.Communication.PhoneNumbers.PhoneNumberType?), Azure.Communication.PhoneNumbers.PhoneNumberAssignmentType? phoneNumberAssignmentType = default(Azure.Communication.PhoneNumbers.PhoneNumberAssignmentType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAvailableOfferingsAsync(string twoLetterIsoCountryName, Azure.Communication.PhoneNumbers.PhoneNumberType? phoneNumberType = default(Azure.Communication.PhoneNumbers.PhoneNumberType?), Azure.Communication.PhoneNumbers.PhoneNumberAssignmentType? phoneNumberAssignmentType = default(Azure.Communication.PhoneNumbers.PhoneNumberAssignmentType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -258,7 +262,7 @@ public PhoneNumbersClient(System.Uri endpoint, Azure.Core.TokenCredential tokenC } public partial class PhoneNumbersClientOptions : Azure.Core.ClientOptions { - public PhoneNumbersClientOptions(Azure.Communication.PhoneNumbers.PhoneNumbersClientOptions.ServiceVersion version = Azure.Communication.PhoneNumbers.PhoneNumbersClientOptions.ServiceVersion.V2025_04_01) { } + public PhoneNumbersClientOptions(Azure.Communication.PhoneNumbers.PhoneNumbersClientOptions.ServiceVersion version = Azure.Communication.PhoneNumbers.PhoneNumbersClientOptions.ServiceVersion.V2025_06_01) { } public string? AcceptedLanguage { get { throw null; } set { } } public enum ServiceVersion { @@ -268,6 +272,7 @@ public enum ServiceVersion V2022_12_01 = 3, V2025_02_11 = 4, V2025_04_01 = 5, + V2025_06_01 = 6, } } public partial class PhoneNumberSearchOptions @@ -361,6 +366,7 @@ internal PhoneNumbersReservation() { } private readonly int _dummyPrimitive; public PhoneNumberType(string value) { throw null; } public static Azure.Communication.PhoneNumbers.PhoneNumberType Geographic { get { throw null; } } + public static Azure.Communication.PhoneNumbers.PhoneNumberType Mobile { get { throw null; } } public static Azure.Communication.PhoneNumbers.PhoneNumberType TollFree { get { throw null; } } public bool Equals(Azure.Communication.PhoneNumbers.PhoneNumberType other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/api/Azure.Communication.PhoneNumbers.netstandard2.0.cs b/sdk/communication/Azure.Communication.PhoneNumbers/api/Azure.Communication.PhoneNumbers.netstandard2.0.cs index 11d1d5ce319d..9d0117f7ca5a 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/api/Azure.Communication.PhoneNumbers.netstandard2.0.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/api/Azure.Communication.PhoneNumbers.netstandard2.0.cs @@ -223,11 +223,15 @@ public PhoneNumbersClient(System.Uri endpoint, Azure.Core.TokenCredential tokenC public virtual System.Threading.Tasks.Task DeleteReservationAsync(System.Guid reservationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetAvailableAreaCodesGeographic(string twoLetterIsoCountryName, Azure.Communication.PhoneNumbers.PhoneNumberAssignmentType phoneNumberAssignmentType, string locality, string administrativeDivision = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAvailableAreaCodesGeographicAsync(string twoLetterIsoCountryName, Azure.Communication.PhoneNumbers.PhoneNumberAssignmentType phoneNumberAssignmentType, string locality, string administrativeDivision = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailableAreaCodesMobile(string twoLetterIsoCountryName, Azure.Communication.PhoneNumbers.PhoneNumberAssignmentType phoneNumberAssignmentType, string locality, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableAreaCodesMobileAsync(string twoLetterIsoCountryName, Azure.Communication.PhoneNumbers.PhoneNumberAssignmentType phoneNumberAssignmentType, string locality, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetAvailableAreaCodesTollFree(string twoLetterIsoCountryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAvailableAreaCodesTollFreeAsync(string twoLetterIsoCountryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetAvailableCountries(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAvailableCountriesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAvailableLocalities(string twoLetterIsoCountryName, Azure.Communication.PhoneNumbers.PhoneNumberType phoneNumberType, string administrativeDivision = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetAvailableLocalities(string twoLetterIsoCountryName, string administrativeDivision = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAvailableLocalitiesAsync(string twoLetterIsoCountryName, Azure.Communication.PhoneNumbers.PhoneNumberType phoneNumberType, string administrativeDivision = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAvailableLocalitiesAsync(string twoLetterIsoCountryName, string administrativeDivision = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetAvailableOfferings(string twoLetterIsoCountryName, Azure.Communication.PhoneNumbers.PhoneNumberType? phoneNumberType = default(Azure.Communication.PhoneNumbers.PhoneNumberType?), Azure.Communication.PhoneNumbers.PhoneNumberAssignmentType? phoneNumberAssignmentType = default(Azure.Communication.PhoneNumbers.PhoneNumberAssignmentType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetAvailableOfferingsAsync(string twoLetterIsoCountryName, Azure.Communication.PhoneNumbers.PhoneNumberType? phoneNumberType = default(Azure.Communication.PhoneNumbers.PhoneNumberType?), Azure.Communication.PhoneNumbers.PhoneNumberAssignmentType? phoneNumberAssignmentType = default(Azure.Communication.PhoneNumbers.PhoneNumberAssignmentType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -258,7 +262,7 @@ public PhoneNumbersClient(System.Uri endpoint, Azure.Core.TokenCredential tokenC } public partial class PhoneNumbersClientOptions : Azure.Core.ClientOptions { - public PhoneNumbersClientOptions(Azure.Communication.PhoneNumbers.PhoneNumbersClientOptions.ServiceVersion version = Azure.Communication.PhoneNumbers.PhoneNumbersClientOptions.ServiceVersion.V2025_04_01) { } + public PhoneNumbersClientOptions(Azure.Communication.PhoneNumbers.PhoneNumbersClientOptions.ServiceVersion version = Azure.Communication.PhoneNumbers.PhoneNumbersClientOptions.ServiceVersion.V2025_06_01) { } public string? AcceptedLanguage { get { throw null; } set { } } public enum ServiceVersion { @@ -268,6 +272,7 @@ public enum ServiceVersion V2022_12_01 = 3, V2025_02_11 = 4, V2025_04_01 = 5, + V2025_06_01 = 6, } } public partial class PhoneNumberSearchOptions @@ -361,6 +366,7 @@ internal PhoneNumbersReservation() { } private readonly int _dummyPrimitive; public PhoneNumberType(string value) { throw null; } public static Azure.Communication.PhoneNumbers.PhoneNumberType Geographic { get { throw null; } } + public static Azure.Communication.PhoneNumbers.PhoneNumberType Mobile { get { throw null; } } public static Azure.Communication.PhoneNumbers.PhoneNumberType TollFree { get { throw null; } } public bool Equals(Azure.Communication.PhoneNumbers.PhoneNumberType other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/assets.json b/sdk/communication/Azure.Communication.PhoneNumbers/assets.json index 073f205d81ee..f098e647db52 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": "net", "TagPrefix": "net/communication/Azure.Communication.PhoneNumbers", - "Tag": "net/communication/Azure.Communication.PhoneNumbers_65309cb1e4" + "Tag": "net/communication/Azure.Communication.PhoneNumbers_14b33ea8b4" } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Azure.Communication.PhoneNumbers.csproj b/sdk/communication/Azure.Communication.PhoneNumbers/src/Azure.Communication.PhoneNumbers.csproj index 5016ab72041e..16a2d0974636 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Azure.Communication.PhoneNumbers.csproj +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Azure.Communication.PhoneNumbers.csproj @@ -5,7 +5,7 @@ For this release, see notes - https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/communication/Azure.Communication.PhoneNumbers/README.md and https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/communication/Azure.Communication.PhoneNumbers/CHANGELOG.md. Azure Communication Phone Numbers Service - 1.5.0-beta.1 + 1.5.0 1.4.0 Microsoft Azure Communication Phone Numbers Service;Microsoft;Azure;Azure Communication Service;Azure Communication Phone Numbers Service;Phone Numbers;Communication;$(PackageCommonTags) diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/InternalPhoneNumbersClient.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/InternalPhoneNumbersClient.cs index 61dfc4789747..81e740c646b6 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/InternalPhoneNumbersClient.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/InternalPhoneNumbersClient.cs @@ -33,7 +33,7 @@ protected InternalPhoneNumbersClient() /// The communication resource, for example https://resourcename.communication.azure.com. /// Api Version. /// , , or is null. - internal InternalPhoneNumbersClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiVersion = "2025-04-01") + internal InternalPhoneNumbersClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiVersion = "2025-06-01") { RestClient = new InternalPhoneNumbersRestClient(clientDiagnostics, pipeline, endpoint, apiVersion); _clientDiagnostics = clientDiagnostics; @@ -308,7 +308,7 @@ public virtual Response OperatorInformationSearch(IEn /// Gets the list of available area codes. /// The ISO 3166-2 country code, e.g. US. - /// Filter by numberType, e.g. Geographic, TollFree. + /// Filter by numberType, e.g. Geographic, TollFree, Mobile. /// An optional parameter for how many entries to skip, for pagination purposes. The default value is 0. /// An optional parameter for how many entries to return, for pagination purposes. The default value is 100. /// Filter by assignmentType, e.g. Person, Application. @@ -328,7 +328,7 @@ public virtual AsyncPageable ListAreaCodesAsync(string twoL /// Gets the list of available area codes. /// The ISO 3166-2 country code, e.g. US. - /// Filter by numberType, e.g. Geographic, TollFree. + /// Filter by numberType, e.g. Geographic, TollFree, Mobile. /// An optional parameter for how many entries to skip, for pagination purposes. The default value is 0. /// An optional parameter for how many entries to return, for pagination purposes. The default value is 100. /// Filter by assignmentType, e.g. Person, Application. @@ -376,14 +376,15 @@ public virtual Pageable ListAvailableCountries(int? skip = n /// An optional parameter for how many entries to return, for pagination purposes. The default value is 100. /// An optional parameter for the name of the state or province in which to search for the area code. /// The locale to display in the localized fields in the response. e.g. 'en-US'. + /// Filter by numberType, e.g. Geographic, TollFree, Mobile. /// The cancellation token to use. /// is null. - public virtual AsyncPageable ListAvailableLocalitiesAsync(string twoLetterIsoCountryName, int? skip = null, int? maxPageSize = null, string administrativeDivision = null, string acceptLanguage = null, CancellationToken cancellationToken = default) + public virtual AsyncPageable ListAvailableLocalitiesAsync(string twoLetterIsoCountryName, int? skip = null, int? maxPageSize = null, string administrativeDivision = null, string acceptLanguage = null, PhoneNumberType? phoneNumberType = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(twoLetterIsoCountryName, nameof(twoLetterIsoCountryName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => RestClient.CreateListAvailableLocalitiesRequest(twoLetterIsoCountryName, skip, maxPageSize, administrativeDivision, acceptLanguage); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RestClient.CreateListAvailableLocalitiesNextPageRequest(nextLink, twoLetterIsoCountryName, skip, maxPageSize, administrativeDivision, acceptLanguage); + HttpMessage FirstPageRequest(int? pageSizeHint) => RestClient.CreateListAvailableLocalitiesRequest(twoLetterIsoCountryName, skip, maxPageSize, administrativeDivision, acceptLanguage, phoneNumberType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RestClient.CreateListAvailableLocalitiesNextPageRequest(nextLink, twoLetterIsoCountryName, skip, maxPageSize, administrativeDivision, acceptLanguage, phoneNumberType); return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PhoneNumberLocality.DeserializePhoneNumberLocality, _clientDiagnostics, _pipeline, "InternalPhoneNumbersClient.ListAvailableLocalities", "phoneNumberLocalities", "nextLink", cancellationToken); } @@ -393,14 +394,15 @@ public virtual AsyncPageable ListAvailableLocalitiesAsync(s /// An optional parameter for how many entries to return, for pagination purposes. The default value is 100. /// An optional parameter for the name of the state or province in which to search for the area code. /// The locale to display in the localized fields in the response. e.g. 'en-US'. + /// Filter by numberType, e.g. Geographic, TollFree, Mobile. /// The cancellation token to use. /// is null. - public virtual Pageable ListAvailableLocalities(string twoLetterIsoCountryName, int? skip = null, int? maxPageSize = null, string administrativeDivision = null, string acceptLanguage = null, CancellationToken cancellationToken = default) + public virtual Pageable ListAvailableLocalities(string twoLetterIsoCountryName, int? skip = null, int? maxPageSize = null, string administrativeDivision = null, string acceptLanguage = null, PhoneNumberType? phoneNumberType = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(twoLetterIsoCountryName, nameof(twoLetterIsoCountryName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => RestClient.CreateListAvailableLocalitiesRequest(twoLetterIsoCountryName, skip, maxPageSize, administrativeDivision, acceptLanguage); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RestClient.CreateListAvailableLocalitiesNextPageRequest(nextLink, twoLetterIsoCountryName, skip, maxPageSize, administrativeDivision, acceptLanguage); + HttpMessage FirstPageRequest(int? pageSizeHint) => RestClient.CreateListAvailableLocalitiesRequest(twoLetterIsoCountryName, skip, maxPageSize, administrativeDivision, acceptLanguage, phoneNumberType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RestClient.CreateListAvailableLocalitiesNextPageRequest(nextLink, twoLetterIsoCountryName, skip, maxPageSize, administrativeDivision, acceptLanguage, phoneNumberType); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PhoneNumberLocality.DeserializePhoneNumberLocality, _clientDiagnostics, _pipeline, "InternalPhoneNumbersClient.ListAvailableLocalities", "phoneNumberLocalities", "nextLink", cancellationToken); } @@ -408,7 +410,7 @@ public virtual Pageable ListAvailableLocalities(string twoL /// The ISO 3166-2 country code, e.g. US. /// An optional parameter for how many entries to skip, for pagination purposes. The default value is 0. /// An optional parameter for how many entries to return, for pagination purposes. The default value is 100. - /// Filter by numberType, e.g. Geographic, TollFree. + /// Filter by numberType, e.g. Geographic, TollFree, Mobile. /// Filter by assignmentType, e.g. Person, Application. /// The locale to display in the localized fields in the response. e.g. 'en-US'. /// The cancellation token to use. @@ -426,7 +428,7 @@ public virtual AsyncPageable ListOfferingsAsync(string twoL /// The ISO 3166-2 country code, e.g. US. /// An optional parameter for how many entries to skip, for pagination purposes. The default value is 0. /// An optional parameter for how many entries to return, for pagination purposes. The default value is 100. - /// Filter by numberType, e.g. Geographic, TollFree. + /// Filter by numberType, e.g. Geographic, TollFree, Mobile. /// Filter by assignmentType, e.g. Person, Application. /// The locale to display in the localized fields in the response. e.g. 'en-US'. /// The cancellation token to use. diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/InternalPhoneNumbersRestClient.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/InternalPhoneNumbersRestClient.cs index f12e0bfa6063..11d6c21b8e67 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/InternalPhoneNumbersRestClient.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/InternalPhoneNumbersRestClient.cs @@ -31,7 +31,7 @@ internal partial class InternalPhoneNumbersRestClient /// The communication resource, for example https://resourcename.communication.azure.com. /// Api Version. /// , , or is null. - public InternalPhoneNumbersRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiVersion = "2025-04-01") + public InternalPhoneNumbersRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiVersion = "2025-06-01") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); @@ -192,7 +192,7 @@ public Response BrowseAvailableNumbers(string countryC } } - internal HttpMessage CreateListAvailableLocalitiesRequest(string twoLetterIsoCountryName, int? skip, int? maxPageSize, string administrativeDivision, string acceptLanguage) + internal HttpMessage CreateListAvailableLocalitiesRequest(string twoLetterIsoCountryName, int? skip, int? maxPageSize, string administrativeDivision, string acceptLanguage, PhoneNumberType? phoneNumberType) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -215,6 +215,10 @@ internal HttpMessage CreateListAvailableLocalitiesRequest(string twoLetterIsoCou uri.AppendQuery("administrativeDivision", administrativeDivision, true); } uri.AppendQuery("api-version", _apiVersion, true); + if (phoneNumberType != null) + { + uri.AppendQuery("phoneNumberType", phoneNumberType.Value.ToString(), true); + } request.Uri = uri; if (acceptLanguage != null) { @@ -1069,7 +1073,7 @@ internal HttpMessage CreateListAvailableCountriesNextPageRequest(string nextLink return message; } - internal HttpMessage CreateListAvailableLocalitiesNextPageRequest(string nextLink, string twoLetterIsoCountryName, int? skip, int? maxPageSize, string administrativeDivision, string acceptLanguage) + internal HttpMessage CreateListAvailableLocalitiesNextPageRequest(string nextLink, string twoLetterIsoCountryName, int? skip, int? maxPageSize, string administrativeDivision, string acceptLanguage, PhoneNumberType? phoneNumberType) { var message = _pipeline.CreateMessage(); var request = message.Request; diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchRequest.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchRequest.cs index d13c982bf96d..ef5e4bec4af3 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchRequest.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchRequest.cs @@ -13,7 +13,7 @@ namespace Azure.Communication.PhoneNumbers internal partial class PhoneNumberSearchRequest { /// Initializes a new instance of . - /// 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. /// The assignment type of the phone numbers to search for. A phone number can be assigned to a person, or to an application. /// Capabilities of a phone number. /// is null. @@ -27,7 +27,7 @@ public PhoneNumberSearchRequest(PhoneNumberType phoneNumberType, PhoneNumberAssi } /// Initializes a new instance of . - /// 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. /// The assignment type of the phone numbers to search for. A phone number can be assigned to a person, or to an application. /// Capabilities of a phone number. /// The area code of the desired phone number, e.g. 425. @@ -41,7 +41,7 @@ internal PhoneNumberSearchRequest(PhoneNumberType phoneNumberType, PhoneNumberAs Quantity = quantity; } - /// 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. public PhoneNumberType PhoneNumberType { get; } /// The assignment type of the phone numbers to search for. A phone number can be assigned to a person, or to an application. public PhoneNumberAssignmentType AssignmentType { get; } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchResult.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchResult.cs index 44609ce81f83..9ceefdedbca4 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchResult.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberSearchResult.cs @@ -17,7 +17,7 @@ public partial class PhoneNumberSearchResult /// Initializes a new instance of . /// The search id. /// The phone numbers that are available. Can be fewer than the desired search quantity. - /// The phone number's type, e.g. geographic, or tollFree. + /// The phone number's type, e.g. geographic, tollFree, mobile. /// Phone number's assignment type. /// Capabilities of a phone number. /// The incurred cost for a single phone number. @@ -42,7 +42,7 @@ internal PhoneNumberSearchResult(string searchId, IEnumerable phoneNumbe /// Initializes a new instance of . /// The search id. /// The phone numbers that are available. Can be fewer than the desired search quantity. - /// The phone number's type, e.g. geographic, or tollFree. + /// The phone number's type, e.g. geographic, tollFree, mobile. /// Phone number's assignment type. /// Capabilities of a phone number. /// The incurred cost for a single phone number. @@ -68,7 +68,7 @@ internal PhoneNumberSearchResult(string searchId, IReadOnlyList phoneNum public string SearchId { get; } /// The phone numbers that are available. Can be fewer than the desired search quantity. public IReadOnlyList PhoneNumbers { get; } - /// The phone number's type, e.g. geographic, or tollFree. + /// The phone number's type, e.g. geographic, tollFree, mobile. public PhoneNumberType PhoneNumberType { get; } /// Phone number's assignment type. public PhoneNumberAssignmentType AssignmentType { get; } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberType.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberType.cs index b60a3adc1103..cdd4ccfaca7d 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberType.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PhoneNumberType.cs @@ -24,11 +24,14 @@ public PhoneNumberType(string value) private const string GeographicValue = "geographic"; private const string TollFreeValue = "tollFree"; + private const string MobileValue = "mobile"; /// geographic. public static PhoneNumberType Geographic { get; } = new PhoneNumberType(GeographicValue); /// tollFree. public static PhoneNumberType TollFree { get; } = new PhoneNumberType(TollFreeValue); + /// mobile. + public static PhoneNumberType Mobile { get; } = new PhoneNumberType(MobileValue); /// Determines if two values are the same. public static bool operator ==(PhoneNumberType left, PhoneNumberType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumber.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumber.cs index 93a39ca8762a..644dc064a72b 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumber.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/Models/PurchasedPhoneNumber.cs @@ -16,7 +16,7 @@ public partial class PurchasedPhoneNumber /// The id of the phone number, e.g. 11234567890. /// String of the E.164 format of the phone number, e.g. +11234567890. /// The ISO 3166-2 code of the phone number's country, e.g. US. - /// The phone number's type, e.g. geographic, tollFree. + /// The phone number's type, e.g. geographic, tollFree, mobile. /// Capabilities of a phone number. /// The assignment type of the phone number. A phone number can be assigned to a person, or to an application. /// The date and time that the phone number was purchased. @@ -46,7 +46,7 @@ internal PurchasedPhoneNumber(string id, string phoneNumber, string countryCode, public string PhoneNumber { get; } /// The ISO 3166-2 code of the phone number's country, e.g. US. public string CountryCode { get; } - /// The phone number's type, e.g. geographic, tollFree. + /// The phone number's type, e.g. geographic, tollFree, mobile. public PhoneNumberType PhoneNumberType { get; } /// Capabilities of a phone number. public PhoneNumberCapabilities Capabilities { get; } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/PhoneNumbersModelFactory.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/PhoneNumbersModelFactory.cs index 7daf95290972..12a97bd6f96b 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/PhoneNumbersModelFactory.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/Generated/PhoneNumbersModelFactory.cs @@ -149,7 +149,7 @@ public static PhoneNumbersReservation PhoneNumbersReservation(Guid id = default, /// Initializes a new instance of . /// The search id. /// The phone numbers that are available. Can be fewer than the desired search quantity. - /// The phone number's type, e.g. geographic, or tollFree. + /// The phone number's type, e.g. geographic, tollFree, mobile. /// Phone number's assignment type. /// Capabilities of a phone number. /// The incurred cost for a single phone number. diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/InternalPhoneNumbersRestClient.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/InternalPhoneNumbersRestClient.cs index c4c724c1d547..74d001221468 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/InternalPhoneNumbersRestClient.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/InternalPhoneNumbersRestClient.cs @@ -11,8 +11,8 @@ namespace Azure.Communication.PhoneNumbers [CodeGenSuppress("ListAreaCodes", typeof(string), typeof(PhoneNumberType), typeof(int?), typeof(int?), typeof(PhoneNumberAssignmentType?), typeof(string), typeof(string), typeof(string), typeof(CancellationToken))] [CodeGenSuppress("ListAvailableCountriesAsync", typeof(int?), typeof(int?), typeof(string), typeof(CancellationToken))] [CodeGenSuppress("ListAvailableCountries", typeof(int?), typeof(int?), typeof(string), typeof(CancellationToken))] - [CodeGenSuppress("ListAvailableLocalitiesAsync", typeof(string), typeof(int?), typeof(int?), typeof(string), typeof(string), typeof(CancellationToken))] - [CodeGenSuppress("ListAvailableLocalities", typeof(string), typeof(int?), typeof(int?), typeof(string), typeof(string), typeof(CancellationToken))] + [CodeGenSuppress("ListAvailableLocalitiesAsync", typeof(string), typeof(int?), typeof(int?), typeof(string), typeof(string), typeof(PhoneNumberType?), typeof(CancellationToken))] + [CodeGenSuppress("ListAvailableLocalities", typeof(string), typeof(int?), typeof(int?), typeof(string), typeof(string), typeof(PhoneNumberType?), typeof(CancellationToken))] [CodeGenSuppress("ListOfferingsAsync", typeof(string), typeof(int?), typeof(int?), typeof(PhoneNumberType?), typeof(PhoneNumberAssignmentType?), typeof(string), typeof(CancellationToken))] [CodeGenSuppress("ListOfferings", typeof(string), typeof(int?), typeof(int?), typeof(PhoneNumberType?), typeof(PhoneNumberAssignmentType?), typeof(string), typeof(CancellationToken))] [CodeGenSuppress("ListPhoneNumbersAsync", typeof(int?), typeof(int?), typeof(CancellationToken))] @@ -23,8 +23,8 @@ namespace Azure.Communication.PhoneNumbers [CodeGenSuppress("ListAreaCodesNextPage", typeof(string), typeof(string), typeof(PhoneNumberType), typeof(int?), typeof(int?), typeof(PhoneNumberAssignmentType?), typeof(string), typeof(string), typeof(string), typeof(CancellationToken))] [CodeGenSuppress("ListAvailableCountriesNextPageAsync", typeof(string), typeof(int?), typeof(int?), typeof(string), typeof(CancellationToken))] [CodeGenSuppress("ListAvailableCountriesNextPage", typeof(string), typeof(int?), typeof(int?), typeof(string), typeof(CancellationToken))] - [CodeGenSuppress("ListAvailableLocalitiesNextPageAsync", typeof(string), typeof(string), typeof(int?), typeof(int?), typeof(string), typeof(string), typeof(CancellationToken))] - [CodeGenSuppress("ListAvailableLocalitiesNextPage", typeof(string), typeof(string), typeof(int?), typeof(int?), typeof(string), typeof(string), typeof(CancellationToken))] + [CodeGenSuppress("ListAvailableLocalitiesNextPageAsync", typeof(string), typeof(string), typeof(int?), typeof(int?), typeof(string), typeof(string), typeof(PhoneNumberType?), typeof(CancellationToken))] + [CodeGenSuppress("ListAvailableLocalitiesNextPage", typeof(string), typeof(string), typeof(int?), typeof(int?), typeof(string), typeof(string), typeof(PhoneNumberType?), typeof(CancellationToken))] [CodeGenSuppress("ListOfferingsNextPageAsync", typeof(string), typeof(string), typeof(int?), typeof(int?), typeof(PhoneNumberType?), typeof(PhoneNumberAssignmentType?), typeof(string), typeof(CancellationToken))] [CodeGenSuppress("ListOfferingsNextPage", typeof(string), typeof(string), typeof(int?), typeof(int?), typeof(PhoneNumberType?), typeof(PhoneNumberAssignmentType?), typeof(string), typeof(CancellationToken))] [CodeGenSuppress("ListPhoneNumbersNextPageAsync", typeof(string), typeof(int?), typeof(int?), typeof(CancellationToken))] diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/PhoneNumbersClient.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/PhoneNumbersClient.cs index 49452d16f2e1..c2725399b548 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/PhoneNumbersClient.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/PhoneNumbersClient.cs @@ -557,11 +557,16 @@ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PhoneNumberCountry.DeserializePhoneNumberCountry, _clientDiagnostics, _pipeline, "InternalPhoneNumbersClient.ListAvailableCountries", "countries", "nextLink", cancellationToken); } - /// Lists the available localities (e.g. city or town) in the given country from which to purchase phone numbers. - /// The ISO 3166-2 country code, e.g. US. - /// The administrative division within the country within which to list localities. This is also known as the state or province. - /// The cancellation token to use. - public virtual AsyncPageable GetAvailableLocalitiesAsync(string twoLetterIsoCountryName, string administrativeDivision = null, CancellationToken cancellationToken = default) + /// + /// Lists the available localities (e.g. city or town) in the given country from which to purchase phone numbers. + /// + /// The ISO 3166-2 country code, e.g. US. + /// The administrative division within the country within which to list localities. This is also known as the state or province. + /// The cancellation token to use. + public virtual AsyncPageable GetAvailableLocalitiesAsync( + string twoLetterIsoCountryName, + string administrativeDivision = null, + CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) { @@ -569,7 +574,13 @@ HttpMessage FirstPageRequest(int? pageSizeHint) scope.Start(); try { - return RestClient.CreateListAvailableLocalitiesRequest(twoLetterIsoCountryName, null, pageSizeHint, administrativeDivision, null); + return RestClient.CreateListAvailableLocalitiesRequest( + twoLetterIsoCountryName, + null, + pageSizeHint, + administrativeDivision, + null, + null); } catch (Exception ex) { @@ -585,7 +596,14 @@ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) { int skip = int.Parse(HttpUtility.ParseQueryString(nextLink).Get("skip")); - return RestClient.CreateListAvailableLocalitiesNextPageRequest(nextLink, twoLetterIsoCountryName, skip, pageSizeHint, administrativeDivision, null); + return RestClient.CreateListAvailableLocalitiesNextPageRequest( + nextLink, + twoLetterIsoCountryName, + skip, + pageSizeHint, + administrativeDivision, + null, + null); } catch (Exception ex) { @@ -593,14 +611,164 @@ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) throw; } } - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, PhoneNumberLocality.DeserializePhoneNumberLocality, _clientDiagnostics, _pipeline, "InternalPhoneNumbersClient.ListAvailableLocalities", "phoneNumberLocalities", "nextLink", cancellationToken); + return PageableHelpers.CreateAsyncPageable( + FirstPageRequest, + NextPageRequest, + PhoneNumberLocality.DeserializePhoneNumberLocality, + _clientDiagnostics, + _pipeline, + "InternalPhoneNumbersClient.ListAvailableLocalities", + "phoneNumberLocalities", + "nextLink", + cancellationToken); } - /// Lists the available localities (e.g. city or town) in the given country from which to purchase phone numbers. - /// The ISO 3166-2 country code, e.g. US. - /// The administrative division within the country within which to list localities. This is also known as the state or province. - /// The cancellation token to use. - public virtual Pageable GetAvailableLocalities(string twoLetterIsoCountryName, string administrativeDivision = null, CancellationToken cancellationToken = default) + /// + /// Lists the available localities (e.g. city or town) in the given country from which to purchase phone numbers. + /// + /// The ISO 3166-2 country code, e.g. US. + /// The administrative division within the country within which to list localities. This is also known as the state or province. + /// The cancellation token to use. + public virtual Pageable GetAvailableLocalities( + string twoLetterIsoCountryName, + string administrativeDivision = null, + CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope($"{nameof(PhoneNumbersClient)}.{nameof(GetAvailableLocalities)}"); + scope.Start(); + try + { + return RestClient.CreateListAvailableLocalitiesRequest( + twoLetterIsoCountryName, + null, + pageSizeHint, + administrativeDivision, + null, + null); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) + { + using var scope = _clientDiagnostics.CreateScope($"{nameof(PhoneNumbersClient)}.{nameof(GetAvailableLocalities)}"); + scope.Start(); + try + { + int skip = int.Parse(HttpUtility.ParseQueryString(nextLink).Get("skip")); + + return RestClient.CreateListAvailableLocalitiesNextPageRequest( + nextLink, + twoLetterIsoCountryName, + skip, + pageSizeHint, + administrativeDivision, + null, + null); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + return PageableHelpers.CreatePageable( + FirstPageRequest, + NextPageRequest, + PhoneNumberLocality.DeserializePhoneNumberLocality, + _clientDiagnostics, + _pipeline, + "InternalPhoneNumbersClient.ListAvailableLocalities", + "phoneNumberLocalities", + "nextLink", + cancellationToken); + } + + /// + /// Lists the available localities (e.g. city or town) in the given country from which to purchase phone numbers. + /// + /// The ISO 3166-2 country code, e.g. US. + /// Filter by numberType, e.g. Geographic, TollFree, Mobile. + /// The administrative division within the country within which to list localities. This is also known as the state or province. + /// The cancellation token to use. + public virtual AsyncPageable GetAvailableLocalitiesAsync( + string twoLetterIsoCountryName, + PhoneNumberType phoneNumberType, + string administrativeDivision = null, + CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) + { + using var scope = _clientDiagnostics.CreateScope($"{nameof(PhoneNumbersClient)}.{nameof(GetAvailableLocalities)}"); + scope.Start(); + try + { + return RestClient.CreateListAvailableLocalitiesRequest( + twoLetterIsoCountryName, + null, + pageSizeHint, + administrativeDivision, + null, + phoneNumberType); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) + { + using var scope = _clientDiagnostics.CreateScope($"{nameof(PhoneNumbersClient)}.{nameof(GetAvailableLocalities)}"); + scope.Start(); + try + { + int skip = int.Parse(HttpUtility.ParseQueryString(nextLink).Get("skip")); + + return RestClient.CreateListAvailableLocalitiesNextPageRequest( + nextLink, + twoLetterIsoCountryName, + skip, + pageSizeHint, + administrativeDivision, + null, + phoneNumberType); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + return PageableHelpers.CreateAsyncPageable( + FirstPageRequest, + NextPageRequest, + PhoneNumberLocality.DeserializePhoneNumberLocality, + _clientDiagnostics, + _pipeline, + "InternalPhoneNumbersClient.ListAvailableLocalities", + "phoneNumberLocalities", + "nextLink", + cancellationToken); + } + + /// + /// Lists the available localities (e.g. city or town) in the given country from which to purchase phone numbers. + /// + /// The ISO 3166-2 country code, e.g. US. + /// Filter by numberType, e.g. Geographic, TollFree, Mobile. + /// The administrative division within the country within which to list localities. This is also known as the state or province. + /// The cancellation token to use. + public virtual Pageable GetAvailableLocalities( + string twoLetterIsoCountryName, + PhoneNumberType phoneNumberType, + string administrativeDivision = null, + CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) { @@ -608,7 +776,13 @@ HttpMessage FirstPageRequest(int? pageSizeHint) scope.Start(); try { - return RestClient.CreateListAvailableLocalitiesRequest(twoLetterIsoCountryName, null, pageSizeHint, administrativeDivision, null); + return RestClient.CreateListAvailableLocalitiesRequest( + twoLetterIsoCountryName, + null, + pageSizeHint, + administrativeDivision, + null, + phoneNumberType); } catch (Exception ex) { @@ -624,7 +798,14 @@ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) { int skip = int.Parse(HttpUtility.ParseQueryString(nextLink).Get("skip")); - return RestClient.CreateListAvailableLocalitiesNextPageRequest(nextLink, twoLetterIsoCountryName, skip, pageSizeHint, administrativeDivision, null); + return RestClient.CreateListAvailableLocalitiesNextPageRequest( + nextLink, + twoLetterIsoCountryName, + skip, + pageSizeHint, + administrativeDivision, + null, + phoneNumberType); } catch (Exception ex) { @@ -632,7 +813,16 @@ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) throw; } } - return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, PhoneNumberLocality.DeserializePhoneNumberLocality, _clientDiagnostics, _pipeline, "InternalPhoneNumbersClient.ListAvailableLocalities", "phoneNumberLocalities", "nextLink", cancellationToken); + return PageableHelpers.CreatePageable( + FirstPageRequest, + NextPageRequest, + PhoneNumberLocality.DeserializePhoneNumberLocality, + _clientDiagnostics, + _pipeline, + "InternalPhoneNumbersClient.ListAvailableLocalities", + "phoneNumberLocalities", + "nextLink", + cancellationToken); } /// Lists the available area codes within a given country and locality. @@ -673,6 +863,26 @@ public virtual Pageable GetAvailableAreaCodesGeographic(str return GetAvailableAreaCodes(twoLetterIsoCountryName, PhoneNumberType.Geographic, phoneNumberAssignmentType, locality, administrativeDivision, cancellationToken); } + /// Lists the available area codes within a given country and locality. + /// The ISO 3166-2 country code, e.g. US. + /// The assignment type of the phone numbers to search for. + /// The locality in which to list area codes. This is also known as the state or province. + /// The cancellation token to use. + public virtual AsyncPageable GetAvailableAreaCodesMobileAsync (string twoLetterIsoCountryName, PhoneNumberAssignmentType phoneNumberAssignmentType, string locality, CancellationToken cancellationToken = default) + { + return GetAvailableAreaCodesAsync(twoLetterIsoCountryName, PhoneNumberType.Mobile, phoneNumberAssignmentType, locality, null, cancellationToken); + } + + /// Lists the available area codes within a given country and locality. + /// The ISO 3166-2 country code, e.g. US. + /// The assignment type of the phone numbers to search for. + /// The locality in which to list area codes. This is also known as the state or province. + /// The cancellation token to use. + public virtual Pageable GetAvailableAreaCodesMobile(string twoLetterIsoCountryName, PhoneNumberAssignmentType phoneNumberAssignmentType, string locality, CancellationToken cancellationToken = default) + { + return GetAvailableAreaCodes(twoLetterIsoCountryName, PhoneNumberType.Mobile, phoneNumberAssignmentType, locality, null, cancellationToken); + } + /// Lists the available offerings in the given country. /// The ISO 3166-2 country code, e.g. US. /// The type of phone numbers to search for. @@ -1177,6 +1387,10 @@ private AsyncPageable GetAvailableAreaCodesAsync(string two { operationName = "GetAvailableAreaCodesTollFree"; } + else if (phoneNumberType == "mobile") + { + operationName = "GetAvailableAreaCodesMobile"; + } HttpMessage FirstPageRequest(int? pageSizeHint) { @@ -1231,6 +1445,10 @@ private Pageable GetAvailableAreaCodes(string twoLetterIsoC { operationName = "GetAvailableAreaCodesTollFree"; } + else if (phoneNumberType == "mobile") + { + operationName = "GetAvailableAreaCodesMobile"; + } HttpMessage FirstPageRequest(int? pageSizeHint) { using var scope = _clientDiagnostics.CreateScope($"{nameof(PhoneNumbersClient)}.{operationName}"); diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/PhoneNumbersClientOptions.cs b/sdk/communication/Azure.Communication.PhoneNumbers/src/PhoneNumbersClientOptions.cs index 847558c7f769..1761397aa9c9 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/PhoneNumbersClientOptions.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/PhoneNumbersClientOptions.cs @@ -13,7 +13,7 @@ namespace Azure.Communication.PhoneNumbers /// Client options for PhoneNumbersClient. public class PhoneNumbersClientOptions : ClientOptions { - private const ServiceVersion LatestVersion = ServiceVersion.V2025_04_01; + private const ServiceVersion LatestVersion = ServiceVersion.V2025_06_01; /// The version of the service to use. public enum ServiceVersion @@ -29,7 +29,9 @@ public enum ServiceVersion /// Service version "2025-02-11". V2025_02_11 = 4, /// Service version "2025-04-01". - V2025_04_01 = 5 + V2025_04_01 = 5, + /// Service version "2025-06-01". + V2025_06_01= 6 #pragma warning restore CA1707 // Identifiers should not contain underscores } @@ -53,6 +55,7 @@ public PhoneNumbersClientOptions(ServiceVersion version = LatestVersion) ServiceVersion.V2022_12_01 => "2022-12-01", ServiceVersion.V2025_02_11 => "2025-02-11", ServiceVersion.V2025_04_01 => "2025-04-01", + ServiceVersion.V2025_06_01 => "2025-06-01", _ => throw new NotSupportedException() }; } diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/src/autorest.md b/sdk/communication/Azure.Communication.PhoneNumbers/src/autorest.md index e3f13ef46cd3..d0d51b7937e9 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/src/autorest.md +++ b/sdk/communication/Azure.Communication.PhoneNumbers/src/autorest.md @@ -7,10 +7,10 @@ Run `dotnet msbuild /t:GenerateCode` to generate code. ``` yaml public-clients: true -tag: package-phonenumber-2025-04-01 +tag: package-phonenumber-2025-06-01 model-namespace: false require: - - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/de9cb12d2840ca0915849ce6a3bf8c956a32c022/specification/communication/data-plane/PhoneNumbers/readme.md + - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/14800a01400c295af0bfa5886e5f4042e4f6c62e/specification/communication/data-plane/PhoneNumbers/readme.md title: Phone numbers payload-flattening-threshold: 3 generation1-convenience-client: true diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/tests/PhoneNumbersClient/PhoneNumbersClientLiveTests.cs b/sdk/communication/Azure.Communication.PhoneNumbers/tests/PhoneNumbersClient/PhoneNumbersClientLiveTests.cs index 7525728a668e..41c4b446bf2f 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/tests/PhoneNumbersClient/PhoneNumbersClientLiveTests.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/tests/PhoneNumbersClient/PhoneNumbersClientLiveTests.cs @@ -979,6 +979,42 @@ public void GetGeographicAreaCodesAsPages() Assert.AreEqual(areaCodesCount, actual); } + [Test] + [AsyncOnly] + public async Task GetMobileAreaCodesAsync() + { + var client = CreateClient(); + var availableLocalities = client.GetAvailableLocalitiesAsync("IE", PhoneNumberType.Mobile); + await foreach (PhoneNumberLocality firstLocality in availableLocalities) + { + var areaCodes = client.GetAvailableAreaCodesMobileAsync("IE", PhoneNumberAssignmentType.Application, firstLocality.LocalizedName); + await foreach (PhoneNumberAreaCode areaCode in areaCodes) + { + Console.WriteLine("Mobile Area Code " + areaCode.AreaCode); + } + Assert.IsNotNull(areaCodes); + break; + } + } + + [Test] + [SyncOnly] + public void GetMobileAreaCodes() + { + var client = CreateClient(); + var availableLocalities = client.GetAvailableLocalities("IE", PhoneNumberType.Mobile); + foreach (PhoneNumberLocality firstLocality in availableLocalities) + { + var areaCodes = client.GetAvailableAreaCodesMobile("IE", PhoneNumberAssignmentType.Application, firstLocality.LocalizedName); + foreach (PhoneNumberAreaCode areaCode in areaCodes) + { + Console.WriteLine("Mobile Area Code " + areaCode.AreaCode); + } + Assert.IsNotNull(areaCodes); + break; + } + } + [Test] [AsyncOnly] public async Task GetCountriesAsync() @@ -1123,6 +1159,102 @@ public void GetLocalities() Assert.IsNotNull(localities); } + [Test] + [AsyncOnly] + public async Task GetLocalitiesWithPhoneNumberTypeAsync() + { + var client = CreateClient(); + + var localities = client.GetAvailableLocalitiesAsync("IE", PhoneNumberType.Mobile); + await foreach (PhoneNumberLocality locality in localities) + { + Console.WriteLine("Locality " + locality.LocalizedName); + } + Assert.IsNotNull(localities); + } + + [Test] + [SyncOnly] + public void GetLocalitiesWithPhoneNumberType() + { + var client = CreateClient(); + + var localities = client.GetAvailableLocalities("IE", PhoneNumberType.Mobile); + foreach (PhoneNumberLocality locality in localities) + { + Console.WriteLine("Locality " + locality.LocalizedName); + } + Assert.IsNotNull(localities); + } + + [Test] + [AsyncOnly] + public async Task GetLocalitiesWithPhoneNumberTypeAsyncAsPages() + { + var client = CreateClient(); + var localities = await client.GetAvailableLocalitiesAsync("IE", PhoneNumberType.Mobile).ToEnumerableAsync(); + var localitiesCount = localities.Count; + var expectedPageSize = localitiesCount; + + if (localitiesCount >= 2) + { + expectedPageSize = localitiesCount / 2; + } + var pages = client.GetAvailableLocalitiesAsync("IE", PhoneNumberType.Mobile).AsPages(pageSizeHint: expectedPageSize); + var actual = 0; + await foreach (var page in pages) + { + if (page == null || expectedPageSize == 0) + { + break; + } + if (actual == 0) + { + Assert.AreEqual(expectedPageSize, page.Values.Count); + } + foreach (var phoneNumber in page.Values) + { + actual++; + } + } + + Assert.AreEqual(localitiesCount, actual); + } + + [Test] + [SyncOnly] + public void GetLocalitiesWithPhoneNumberTypeAsPages() + { + var client = CreateClient(); + var localities = client.GetAvailableLocalities("IE", PhoneNumberType.Mobile).ToList(); + var localitiesCount = localities.Count; + var expectedPageSize = localitiesCount; + + if (localitiesCount >= 2) + { + expectedPageSize = localitiesCount / 2; + } + var pages = client.GetAvailableLocalities("IE", PhoneNumberType.Mobile).AsPages(pageSizeHint: expectedPageSize); + var actual = 0; + foreach (var page in pages) + { + if (page == null || expectedPageSize == 0) + { + break; + } + if (actual == 0) + { + Assert.AreEqual(expectedPageSize, page.Values.Count); + } + foreach (var phoneNumber in page.Values) + { + actual++; + } + } + + Assert.AreEqual(localitiesCount, actual); + } + [Test] [AsyncOnly] public async Task GetLocalitiesAsyncAsPages() diff --git a/sdk/communication/Azure.Communication.PhoneNumbers/tests/PhoneNumbersClient/PhoneNumbersReservationsTests.cs b/sdk/communication/Azure.Communication.PhoneNumbers/tests/PhoneNumbersClient/PhoneNumbersReservationsTests.cs index 05cb716de8c3..c8285b22897d 100644 --- a/sdk/communication/Azure.Communication.PhoneNumbers/tests/PhoneNumbersClient/PhoneNumbersReservationsTests.cs +++ b/sdk/communication/Azure.Communication.PhoneNumbers/tests/PhoneNumbersClient/PhoneNumbersReservationsTests.cs @@ -117,6 +117,14 @@ public async Task BrowseAvailableNumbersAsync(AuthMethod authMethod) Assert.IsNotNull(response.Value); Assert.Greater(response.Value.PhoneNumbers.Count, 0); + + browseRequest = new PhoneNumbersBrowseOptions("IE", PhoneNumberType.Mobile); + + response = await client.BrowseAvailableNumbersAsync(browseRequest); + + Assert.IsNotNull(response.Value); + Assert.Greater(response.Value.PhoneNumbers.Count, 0); + Assert.IsTrue(response.Value.PhoneNumbers[0].PhoneNumberType == PhoneNumberType.Mobile); } [TestCase(AuthMethod.ConnectionString, TestName = "BrowseAvailableNumbersUsingConnectionString")] @@ -132,6 +140,15 @@ public void BrowseAvailableNumbers(AuthMethod authMethod) Assert.IsNotNull(response.Value); Assert.Greater(response.Value.PhoneNumbers.Count, 0); + Assert.IsTrue(response.Value.PhoneNumbers[0].PhoneNumberType == PhoneNumberType.TollFree); + + browseRequest = new PhoneNumbersBrowseOptions("IE", PhoneNumberType.Mobile); + + response = client.BrowseAvailableNumbers(browseRequest); + + Assert.IsNotNull(response.Value); + Assert.Greater(response.Value.PhoneNumbers.Count, 0); + Assert.IsTrue(response.Value.PhoneNumbers[0].PhoneNumberType == PhoneNumberType.Mobile); } [TestCase(AuthMethod.ConnectionString, TestName = "GetPhoneNumbersReservationsAsyncWithConnectionString")] @@ -203,15 +220,21 @@ public void GetReservation(AuthMethod authMethod) Assert.AreEqual(_initialReservationState!.Status, reservation.Status); } - [TestCase(AuthMethod.ConnectionString, TestName = "CreateOrUpdateReservationAsyncUsingConnectionString")] - [TestCase(AuthMethod.KeyCredential, TestName = "CreateOrUpdateReservationAsyncUsingAzureKeyCredential")] - [TestCase(AuthMethod.TokenCredential, TestName = "CreateOrUpdateReservationAsyncUsingTokenCredential")] + [TestCase(AuthMethod.ConnectionString, "US", "tollFree", TestName = "CreateOrUpdateReservationAsyncTollFreeUsingConnectionString")] + [TestCase(AuthMethod.ConnectionString, "US", "geographic", TestName = "CreateOrUpdateReservationAsyncGeographicUsingConnectionString")] + [TestCase(AuthMethod.ConnectionString, "IE", "mobile", TestName = "CreateOrUpdateReservationAsyncMobileUsingConnectionString")] + [TestCase(AuthMethod.KeyCredential, "US", "tollFree", TestName = "CreateOrUpdateReservationAsyncTollFreeUsingKeyCredential")] + [TestCase(AuthMethod.KeyCredential, "US", "geographic", TestName = "CreateOrUpdateReservationAsyncGeographicUsingKeyCredential")] + [TestCase(AuthMethod.KeyCredential, "IE", "mobile", TestName = "CreateOrUpdateReservationAsyncMobileUsingKeyCredential")] + [TestCase(AuthMethod.TokenCredential, "US", "tollFree", TestName = "CreateOrUpdateReservationAsyncTollFreeUsingTokenCredential")] + [TestCase(AuthMethod.TokenCredential, "US", "geographic", TestName = "CreateOrUpdateReservationAsyncGeographicUsingTokenCredential")] + [TestCase(AuthMethod.TokenCredential, "IE", "mobile", TestName = "CreateOrUpdateReservationAsyncMobileUsingTokenCredential")] [AsyncOnly] [Order(2)] // This test is executed after tests that depend on the initial reservation state. - public async Task CreateOrUpdateReservationAsync(AuthMethod authMethod) + public async Task CreateOrUpdateReservationAsync(AuthMethod authMethod, string countryCode, string phoneNumberType) { PhoneNumbersClient client = CreateClient(authMethod); - var browseRequest = new PhoneNumbersBrowseOptions("US", PhoneNumberType.TollFree); + var browseRequest = new PhoneNumbersBrowseOptions(countryCode, phoneNumberType); var response = await client.BrowseAvailableNumbersAsync(browseRequest); var availablePhoneNumbers = response.Value.PhoneNumbers; @@ -251,15 +274,21 @@ public async Task CreateOrUpdateReservationAsync(AuthMethod authMethod) Assert.IsFalse(reservationAfterRemove.PhoneNumbers.ContainsKey(phoneNumberIdToRemove)); } - [TestCase(AuthMethod.ConnectionString, TestName = "CreateOrUpdateReservationUsingConnectionString")] - [TestCase(AuthMethod.KeyCredential, TestName = "CreateOrUpdateReservationUsingAzureKeyCredential")] - [TestCase(AuthMethod.TokenCredential, TestName = "CreateOrUpdateReservationUsingTokenCredential")] + [TestCase(AuthMethod.ConnectionString, "US", "tollFree", TestName = "CreateOrUpdateReservationTollFreeUsingConnectionString")] + [TestCase(AuthMethod.ConnectionString, "US", "geographic", TestName = "CreateOrUpdateReservationGeographicUsingConnectionString")] + [TestCase(AuthMethod.ConnectionString, "IE", "mobile", TestName = "CreateOrUpdateReservationMobileUsingConnectionString")] + [TestCase(AuthMethod.KeyCredential, "US", "tollFree", TestName = "CreateOrUpdateReservationTollFreeUsingKeyCredential")] + [TestCase(AuthMethod.KeyCredential, "US", "geographic", TestName = "CreateOrUpdateReservationGeographicUsingKeyCredential")] + [TestCase(AuthMethod.KeyCredential, "IE", "mobile", TestName = "CreateOrUpdateReservationMobileUsingKeyCredential")] + [TestCase(AuthMethod.TokenCredential, "US", "tollFree", TestName = "CreateOrUpdateReservationTollFreeUsingTokenCredential")] + [TestCase(AuthMethod.TokenCredential, "US", "geographic", TestName = "CreateOrUpdateReservationGeographicUsingTokenCredential")] + [TestCase(AuthMethod.TokenCredential, "IE", "mobile", TestName = "CreateOrUpdateReservationMobileUsingTokenCredential")] [SyncOnly] [Order(2)] // This test is executed after tests that depend on the initial reservation state. - public void CreateOrUpdateReservation(AuthMethod authMethod) + public void CreateOrUpdateReservation(AuthMethod authMethod, string countryCode, string phoneNumberType) { PhoneNumbersClient client = CreateClient(authMethod); - var browseRequest = new PhoneNumbersBrowseOptions("US", PhoneNumberType.TollFree); + var browseRequest = new PhoneNumbersBrowseOptions(countryCode, phoneNumberType); var response = client.BrowseAvailableNumbers(browseRequest); var availablePhoneNumbers = response.Value.PhoneNumbers;