From 69fad2a68590788da0ebf62f320dbf48437299e2 Mon Sep 17 00:00:00 2001 From: Erica <34174887+ericasp16@users.noreply.github.com> Date: Mon, 29 Jan 2024 15:01:37 -0800 Subject: [PATCH 01/25] Number lookup ga (#37719) GA implementation of the number lookup feature. This commit should cover the vast majority of the work needed, and is updated to incorporate feedback from the stewardship board. These changes are going into a branch to wait until we're ready to do our final bug bashing and eventually merging and shipping the feature. ---------- * Implementation of Number Lookup feature for public preview in communication-phonenumbers (#35674) * implementation of number lookup in java SDK * fix readme to remove debug logging * fix autorest generation swagger mismatch issue * update autorest generation and yaml directives * update service version * fix public/private type generation, update changelog * fix checkstyle issues * update test recordings * update test base to redact phonenumbers in operatorInformation response, update test recordings * update changelog * update date format for changelog * Increment package versions for communication releases (#36670) * fix imports in test file * update auto-generated files * implement ga updates * removing edits to version_client.txt * fix build errors * attempt to fix versioning issue * update based on SDK review --------- Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> --- .../CHANGELOG.md | 12 +- .../assets.json | 2 +- .../azure-communication-phonenumbers/pom.xml | 2 +- .../phonenumbers/PhoneNumbersAsyncClient.java | 70 +- .../phonenumbers/PhoneNumbersClient.java | 66 +- .../PhoneNumbersServiceVersion.java | 11 +- .../PhoneNumberAdminClientImpl.java | 25 +- .../PhoneNumberAdminClientImplBuilder.java | 235 +++++- .../implementation/PhoneNumbersImpl.java | 752 +++++++++++------- .../models/CommunicationError.java | 4 +- .../models/CommunicationErrorResponse.java | 4 +- .../CommunicationErrorResponseException.java | 2 - .../implementation/models/Error.java | 83 ++ .../models/OfferingsResponse.java | 4 +- .../models/OperatorInformationOptions.java | 42 + .../models/OperatorInformationRequest.java | 65 ++ .../OperatorInformationRequestOptions.java | 43 + .../models/PhoneNumberAreaCodes.java | 4 +- .../PhoneNumberCapabilitiesRequest.java | 4 +- .../models/PhoneNumberCountries.java | 4 +- .../models/PhoneNumberLocalities.java | 4 +- .../models/PhoneNumberPurchaseRequest.java | 4 +- .../models/PhoneNumberRawOperation.java | 2 - .../models/PhoneNumberSearchRequest.java | 7 +- .../models/PhoneNumberSearchResultError.java | 84 ++ .../PhoneNumbersGetOperationHeaders.java | 2 - .../PhoneNumbersGetOperationResponse.java | 6 +- ...oneNumbersPurchasePhoneNumbersHeaders.java | 2 - ...PhoneNumbersReleasePhoneNumberHeaders.java | 2 - ...ersSearchAvailablePhoneNumbersHeaders.java | 2 - ...rsSearchAvailablePhoneNumbersResponse.java | 6 +- ...PhoneNumbersUpdateCapabilitiesHeaders.java | 2 - ...honeNumbersUpdateCapabilitiesResponse.java | 6 +- .../models/PurchasedPhoneNumbers.java | 4 +- .../implementation/package-info.java | 4 +- .../phonenumbers/models/BillingFrequency.java | 9 +- .../phonenumbers/models/OperatorDetails.java | 57 ++ .../models/OperatorInformation.java | 103 +++ .../models/OperatorInformationResult.java | 33 + .../models/OperatorNumberType.java | 44 + .../PhoneNumberAdministrativeDivision.java | 2 +- .../models/PhoneNumberAreaCode.java | 4 +- .../models/PhoneNumberAssignmentType.java | 6 +- .../models/PhoneNumberCapabilities.java | 2 +- .../models/PhoneNumberCapabilityType.java | 6 +- .../phonenumbers/models/PhoneNumberCost.java | 2 +- .../models/PhoneNumberCountry.java | 2 +- .../models/PhoneNumberLocality.java | 2 +- .../models/PhoneNumberOffering.java | 2 +- .../models/PhoneNumberOperationStatus.java | 6 +- .../models/PhoneNumberOperationType.java | 8 +- .../models/PhoneNumberSearchResult.java | 58 +- .../models/PhoneNumberSearchResultError.java | 84 ++ .../phonenumbers/models/PhoneNumberType.java | 6 +- .../models/PurchasedPhoneNumber.java | 2 +- ...honeNumbersAsyncClientIntegrationTest.java | 121 +-- .../PhoneNumbersClientBuilderTest.java | 4 +- .../PhoneNumbersClientIntegrationTest.java | 142 +--- .../PhoneNumbersIntegrationTestBase.java | 6 +- .../swagger/README.md | 59 +- 60 files changed, 1723 insertions(+), 618 deletions(-) create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/Error.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationOptions.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequest.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequestOptions.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberSearchResultError.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorDetails.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformation.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationResult.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorNumberType.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResultError.java diff --git a/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md b/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md index 76530a5a6748..f843b15cf380 100644 --- a/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md +++ b/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md @@ -1,14 +1,18 @@ # Release History -## 1.2.0-beta.1 (Unreleased) +## 1.2.0 (2024-03-01) ### Features Added +- Add support for number lookup + - Format only can be returned for no cost + - Additional number details can be returned for a cost -### Breaking Changes +## 1.2.0-beta.1 (2023-09-07) -### Bugs Fixed +### Features Added +- Number Lookup API public preview +- API version `2023-05-01-preview` is the default -### Other Changes ## 1.1.9 (2023-12-04) diff --git a/sdk/communication/azure-communication-phonenumbers/assets.json b/sdk/communication/azure-communication-phonenumbers/assets.json index 3787aed70683..6927bef02db0 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_154a5685d1" + "Tag": "java/communication/azure-communication-phonenumbers_04198d656b" } diff --git a/sdk/communication/azure-communication-phonenumbers/pom.xml b/sdk/communication/azure-communication-phonenumbers/pom.xml index 307e0c4e2b86..bca50a85acad 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.2.0-beta.1 + 1.2.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 db9390db88a3..2d1e2ecdf0fe 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 @@ -14,6 +14,9 @@ import com.azure.communication.phonenumbers.implementation.models.PhoneNumbersReleasePhoneNumberResponse; import com.azure.communication.phonenumbers.implementation.models.PhoneNumberCapabilitiesRequest; import com.azure.communication.phonenumbers.implementation.models.PhoneNumbersUpdateCapabilitiesResponse; +import com.azure.communication.phonenumbers.implementation.models.OperatorInformationRequest; +import com.azure.communication.phonenumbers.implementation.models.OperatorInformationRequestOptions; +import com.azure.communication.phonenumbers.models.OperatorInformationResult; import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode; import com.azure.communication.phonenumbers.models.PurchasedPhoneNumber; import com.azure.communication.phonenumbers.models.ReleasePhoneNumberResult; @@ -45,6 +48,7 @@ import reactor.core.publisher.Mono; import java.time.Duration; +import java.util.List; import java.util.Objects; import java.util.function.BiFunction; import java.util.function.Function; @@ -61,7 +65,7 @@ * * - * + * *
  * PhoneNumbersAsyncClient phoneNumberAsyncClient = new PhoneNumbersClientBuilder()
  *         .endpoint(endpoint)
@@ -69,7 +73,7 @@
  *         .httpClient(httpClient)
  *         .buildAsyncClient();
  * 
- * + * * * * @see PhoneNumbersClientBuilder @@ -99,13 +103,13 @@ public final class PhoneNumbersAsyncClient { * * - * + * *
      * PurchasedPhoneNumber phoneNumber = phoneNumberAsyncClient.getPurchasedPhoneNumber("+18001234567").block();
      * System.out.println("Phone Number Value: " + phoneNumber.getPhoneNumber());
      * System.out.println("Phone Number Country Code: " + phoneNumber.getCountryCode());
      * 
- * + * * * * @param phoneNumber The phone number id in E.164 format. The leading plus can @@ -133,7 +137,7 @@ public Mono getPurchasedPhoneNumber(String phoneNumber) { * * - * + * *
      * Response<PurchasedPhoneNumber> response = phoneNumberAsyncClient
      *         .getPurchasedPhoneNumberWithResponse("+18001234567").block();
@@ -141,7 +145,7 @@ public Mono getPurchasedPhoneNumber(String phoneNumber) {
      * System.out.println("Phone Number Value: " + phoneNumber.getPhoneNumber());
      * System.out.println("Phone Number Country Code: " + phoneNumber.getCountryCode());
      * 
- * + * * * @@ -170,14 +174,14 @@ public Mono> getPurchasedPhoneNumberWithResponse( * * - * + * *
      * PagedFlux<PurchasedPhoneNumber> phoneNumbers = phoneNumberAsyncClient.listPurchasedPhoneNumbers();
      * PurchasedPhoneNumber phoneNumber = phoneNumbers.blockFirst();
      * System.out.println("Phone Number Value: " + phoneNumber.getPhoneNumber());
      * System.out.println("Phone Number Country Code: " + phoneNumber.getCountryCode());
      * 
- * + * * * * @return A {@link PagedFlux} of {@link PurchasedPhoneNumber} instances @@ -201,7 +205,7 @@ public PagedFlux listPurchasedPhoneNumbers() { * * - * + * *
      * PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities()
      *         .setCalling(PhoneNumberCapabilityType.INBOUND)
@@ -221,7 +225,7 @@ public PagedFlux listPurchasedPhoneNumbers() {
      *     System.out.println("Phone number costs:" + searchResult.getCost().getAmount());
      * }
      * 
- * + * * * @@ -252,7 +256,7 @@ public PollerFlux beginSearchAvai * - * + * *
      * PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities()
      *         .setCalling(PhoneNumberCapabilityType.INBOUND)
@@ -272,7 +276,7 @@ public PollerFlux beginSearchAvai
      *     System.out.println("Phone number costs:" + searchResult.getCost().getAmount());
      * }
      * 
- * + * * @@ -406,13 +410,13 @@ private Function, Mono - * + * *
      * AsyncPollResponse<PhoneNumberOperation, PurchasePhoneNumbersResult> purchaseResponse = phoneNumberAsyncClient
      *         .beginPurchasePhoneNumbers(searchId).blockFirst();
      * System.out.println("Purchase phone numbers is complete: " + purchaseResponse.getStatus());
      * 
- * + * * * * @param searchId ID of the search. @@ -472,13 +476,13 @@ private Function, Mono - * + * *
      * AsyncPollResponse<PhoneNumberOperation, ReleasePhoneNumberResult> releaseResponse = phoneNumberAsyncClient
      *         .beginReleasePhoneNumber("+18001234567").blockFirst();
      * System.out.println("Release phone number is complete: " + releaseResponse.getStatus());
      * 
- * + * * * * @param phoneNumber The phone number id in E.164 format. The leading plus can @@ -534,7 +538,7 @@ private Function, Mono - * + * *
      * PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities();
      * capabilities
@@ -551,7 +555,7 @@ private Function, Mono
-     * 
+     *
      * 
      *
@@ -715,6 +719,36 @@ public PagedFlux listAvailableOfferings(String countryCode,
         }
     }
 
+    /**
+     * Searches for operator information for a given list of phone numbers.
+     *
+     * @param phoneNumbers The phone number(s) whose operator information should be searched.
+     *
+     * @return A {@link OperatorInformationResult} which contains the results of the search.
+     */
+    @ServiceMethod(returns = ReturnType.SINGLE)
+    public Mono searchOperatorInformation(List phoneNumbers) {
+        return this.searchOperatorInformation(phoneNumbers, false);
+    }
+
+    /**
+     * Searches for operator information for a given list of phone numbers.
+     *
+     * @param phoneNumbers The phone number(s) whose operator information should be searched.
+     * @param includeAdditionalPhoneAndOperatorDetails Modifies the search to include additional fields in the response.
+     *                  Please note: use of this option will affect the cost of the search.
+     *
+     * @return A {@link OperatorInformationResult} which contains the results of the search.
+     */
+    @ServiceMethod(returns = ReturnType.SINGLE)
+    public Mono> searchOperatorInformationWithResponse(List phoneNumbers, boolean includeAdditionalPhoneAndOperatorDetails) {
+        OperatorInformationRequest request = new OperatorInformationRequest();
+        request.setPhoneNumbers(phoneNumbers);
+        request.setOptions(new OperatorInformationRequestOptions().setIncludeAdditionalPhoneAndOperatorDetails(includeAdditionalPhoneAndOperatorDetails));
+        return client.operatorInformationSearchWithResponseAsync(request)
+                .onErrorMap(CommunicationErrorResponseException.class, e -> translateException(e));
+    }
+
     private Mono getOperation(String operationId) {
         return client.getOperationAsync(operationId)
                 .onErrorMap(CommunicationErrorResponseException.class, e -> translateException(e))
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 87d302a15e66..ee31d1ffb6c2 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
@@ -2,10 +2,14 @@
 // Licensed under the MIT License.
 package com.azure.communication.phonenumbers;
 
+import java.util.List;
 import java.util.Objects;
 
 import com.azure.communication.phonenumbers.implementation.PhoneNumberAdminClientImpl;
 import com.azure.communication.phonenumbers.implementation.PhoneNumbersImpl;
+import com.azure.communication.phonenumbers.implementation.models.OperatorInformationRequest;
+import com.azure.communication.phonenumbers.implementation.models.OperatorInformationRequestOptions;
+import com.azure.communication.phonenumbers.models.OperatorInformationResult;
 import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode;
 import com.azure.communication.phonenumbers.models.PhoneNumberAssignmentType;
 import com.azure.communication.phonenumbers.models.PhoneNumberCapabilities;
@@ -104,7 +108,7 @@ public PurchasedPhoneNumber getPurchasedPhoneNumber(String phoneNumber) {
      *
      * 
-     * 
+     *
      * 
      * Response<PurchasedPhoneNumber> response = phoneNumberClient
      *         .getPurchasedPhoneNumberWithResponse("+18001234567", Context.NONE);
@@ -112,7 +116,7 @@ public PurchasedPhoneNumber getPurchasedPhoneNumber(String phoneNumber) {
      * System.out.println("Phone Number Value: " + phoneNumber.getPhoneNumber());
      * System.out.println("Phone Number Country Code: " + phoneNumber.getCountryCode());
      * 
- * + * * * @@ -164,14 +168,14 @@ public PagedIterable listPurchasedPhoneNumbers() { * * - * + * *
      * PagedIterable<PurchasedPhoneNumber> phoneNumbers = phoneNumberClient.listPurchasedPhoneNumbers(Context.NONE);
      * PurchasedPhoneNumber phoneNumber = phoneNumbers.iterator().next();
      * System.out.println("Phone Number Value: " + phoneNumber.getPhoneNumber());
      * System.out.println("Phone Number Country Code: " + phoneNumber.getCountryCode());
      * 
- * + * * * @@ -198,7 +202,7 @@ public PagedIterable listPurchasedPhoneNumbers(Context con * * - * + * *
      * PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities()
      *         .setCalling(PhoneNumberCapabilityType.INBOUND)
@@ -218,7 +222,7 @@ public PagedIterable listPurchasedPhoneNumbers(Context con
      *     System.out.println("Phone number costs:" + searchResult.getCost().getAmount());
      * }
      * 
- * + * * * * @param countryCode The ISO 3166-2 country code. @@ -253,7 +257,7 @@ public SyncPoller beginSearchAvai * - * + * *
      * PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities()
      *         .setCalling(PhoneNumberCapabilityType.INBOUND)
@@ -274,7 +278,7 @@ public SyncPoller beginSearchAvai
      *     System.out.println("Phone number costs:" + searchResult.getCost().getAmount());
      * }
      * 
- * + * * @@ -342,13 +346,13 @@ public SyncPoller beginPurchas * * - * + * *
      * PollResponse<PhoneNumberOperation> purchaseResponse = phoneNumberClient
      *         .beginPurchasePhoneNumbers(searchId, Context.NONE).waitForCompletion();
      * System.out.println("Purchase phone numbers is complete: " + purchaseResponse.getStatus());
      * 
- * + * * * @@ -406,13 +410,13 @@ public SyncPoller beginReleasePh * * - * + * *
      * PollResponse<PhoneNumberOperation> releaseResponse = phoneNumberClient
      *         .beginReleasePhoneNumber("+18001234567", Context.NONE).waitForCompletion();
      * System.out.println("Release phone number is complete: " + releaseResponse.getStatus());
      * 
- * + * * * @@ -442,7 +446,7 @@ public SyncPoller beginReleasePh * * - * + * *
      * PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities();
      * capabilities
@@ -459,7 +463,7 @@ public SyncPoller beginReleasePh
      *     System.out.println("Phone Number SMS capabilities: " + phoneNumber.getCapabilities().getSms());
      * }
      * 
- * + * * * @@ -491,7 +495,7 @@ public SyncPoller beginUpdatePhoneNu * - * + * *
      * PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities();
      * capabilities
@@ -508,7 +512,7 @@ public SyncPoller beginUpdatePhoneNu
      *     System.out.println("Phone Number SMS capabilities: " + phoneNumber.getCapabilities().getSms());
      * }
      * 
- * + * * @@ -695,4 +699,34 @@ public PagedIterable listAvailableOfferings(String countryC context = context == null ? Context.NONE : context; return client.listOfferings(countryCode, null, null, phoneNumberType, assignmentType, acceptLanguage, context); } + + /** + * Searches for operator information for a given list of phone numbers. + * + * @param phoneNumbers The phone number(s) whose operator information should be searched. + * + * @return A {@link OperatorInformationResult} which contains the results of the search. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperatorInformationResult searchOperatorInformation(List phoneNumbers) { + return this.searchOperatorInformation(phoneNumbers, false); + } + + /** + * Searches for operator information for a given list of phone numbers. + * + * @param phoneNumbers The phone number(s) whose operator information should be searched. + * @param includeAdditionalPhoneAndOperatorDetails Modifies the search to include additional fields in the response. + * Please note: use of this option will affect the cost of the search. + * + * @return A {@link OperatorInformationResult} which contains the results of the search. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response searchOperatorInformation(List phoneNumbers, + boolean includeAdditionalPhoneAndOperatorDetails) { + OperatorInformationRequest request = new OperatorInformationRequest(); + request.setPhoneNumbers(phoneNumbers); + request.setOptions(new OperatorInformationRequestOptions().setIncludeAdditionalPhoneAndOperatorDetails(includeAdditionalPhoneAndOperatorDetails)); + return client.operatorInformationSearchWithResponse(request); + } } 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 31e2a47be246..d60f50fb93cb 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 @@ -10,9 +10,14 @@ */ public enum PhoneNumbersServiceVersion implements ServiceVersion { /** - * Service version {@code 2021-03-07}. + * Latest stable service version {@code 2024-03-01} */ - V2021_03_07("2021-03-07"); + V2024_03_01("2024-03-01"), + + /** + * Number Lookup preview version {@code 2023-05-01-preview} + */ + V2023_05_01_Preview("2023-05-01-preview"); private final String version; @@ -37,6 +42,6 @@ public String getVersion() { */ public static PhoneNumbersServiceVersion getLatest() { - return V2021_03_07; + return V2024_03_01; } } diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/PhoneNumberAdminClientImpl.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/PhoneNumberAdminClientImpl.java index 6513b87288d5..0e399024be73 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/PhoneNumberAdminClientImpl.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/PhoneNumberAdminClientImpl.java @@ -74,23 +74,31 @@ public PhoneNumbersImpl getPhoneNumbers() { return this.phoneNumbers; } - /** Initializes an instance of PhoneNumberAdminClient client. */ - PhoneNumberAdminClientImpl(String endpoint) { + /** + * Initializes an instance of PhoneNumberAdminClient client. + * + * @param endpoint The communication resource, for example https://resourcename.communication.azure.com. + * @param apiVersion Api Version. + */ + PhoneNumberAdminClientImpl(String endpoint, String apiVersion) { this( new HttpPipelineBuilder() .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) .build(), JacksonAdapter.createDefaultSerializerAdapter(), - endpoint); + endpoint, + apiVersion); } /** * Initializes an instance of PhoneNumberAdminClient client. * * @param httpPipeline The HTTP pipeline to send requests through. + * @param endpoint The communication resource, for example https://resourcename.communication.azure.com. + * @param apiVersion Api Version. */ - PhoneNumberAdminClientImpl(HttpPipeline httpPipeline, String endpoint) { - this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint); + PhoneNumberAdminClientImpl(HttpPipeline httpPipeline, String endpoint, String apiVersion) { + this(httpPipeline, JacksonAdapter.createDefaultSerializerAdapter(), endpoint, apiVersion); } /** @@ -98,12 +106,15 @@ public PhoneNumbersImpl getPhoneNumbers() { * * @param httpPipeline The HTTP pipeline to send requests through. * @param serializerAdapter The serializer to serialize an object into a string. + * @param endpoint The communication resource, for example https://resourcename.communication.azure.com. + * @param apiVersion Api Version. */ - PhoneNumberAdminClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint) { + PhoneNumberAdminClientImpl( + HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint, String apiVersion) { this.httpPipeline = httpPipeline; this.serializerAdapter = serializerAdapter; this.endpoint = endpoint; - this.apiVersion = "2022-12-01"; + this.apiVersion = apiVersion; this.phoneNumbers = new PhoneNumbersImpl(this); } } 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 425704ad03a3..42e7f0e9ac1c 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 @@ -4,55 +4,182 @@ package com.azure.communication.phonenumbers.implementation; +import com.azure.core.annotation.Generated; import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.client.traits.ConfigurationTrait; +import com.azure.core.client.traits.EndpointTrait; +import com.azure.core.client.traits.HttpTrait; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.AddHeadersPolicy; import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.ClientOptions; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.builder.ClientBuilderUtil; import com.azure.core.util.serializer.JacksonAdapter; import com.azure.core.util.serializer.SerializerAdapter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** A builder for creating a new instance of the PhoneNumberAdminClient type. */ @ServiceClientBuilder(serviceClients = {PhoneNumberAdminClientImpl.class}) -public final class PhoneNumberAdminClientImplBuilder { +public final class PhoneNumberAdminClientImplBuilder + implements HttpTrait, + ConfigurationTrait, + EndpointTrait { + @Generated private static final String SDK_NAME = "name"; + + @Generated private static final String SDK_VERSION = "version"; + + @Generated private final Map properties = new HashMap<>(); + + @Generated private final List pipelinePolicies; + + /** Create an instance of the PhoneNumberAdminClientImplBuilder. */ + @Generated + public PhoneNumberAdminClientImplBuilder() { + this.pipelinePolicies = new ArrayList<>(); + } + /* - * The communication resource, for example - * https://resourcename.communication.azure.com + * The HTTP pipeline to send requests through. */ - private String endpoint; + @Generated private HttpPipeline pipeline; - /** - * Sets The communication resource, for example https://resourcename.communication.azure.com. - * - * @param endpoint the endpoint value. - * @return the PhoneNumberAdminClientImplBuilder. + /** {@inheritDoc}. */ + @Generated + @Override + public PhoneNumberAdminClientImplBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The HTTP client used to send the request. + */ + @Generated private HttpClient httpClient; + + /** {@inheritDoc}. */ + @Generated + @Override + public PhoneNumberAdminClientImplBuilder httpClient(HttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + /* + * The logging configuration for HTTP requests and responses. */ + @Generated private HttpLogOptions httpLogOptions; + + /** {@inheritDoc}. */ + @Generated + @Override + public PhoneNumberAdminClientImplBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /* + * The client options such as application ID and custom headers to set on a + * request. + */ + @Generated private ClientOptions clientOptions; + + /** {@inheritDoc}. */ + @Generated + @Override + public PhoneNumberAdminClientImplBuilder clientOptions(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + return this; + } + + /* + * The retry options to configure retry policy for failed requests. + */ + @Generated private RetryOptions retryOptions; + + /** {@inheritDoc}. */ + @Generated + @Override + public PhoneNumberAdminClientImplBuilder retryOptions(RetryOptions retryOptions) { + this.retryOptions = retryOptions; + return this; + } + + /** {@inheritDoc}. */ + @Generated + @Override + public PhoneNumberAdminClientImplBuilder addPolicy(HttpPipelinePolicy customPolicy) { + pipelinePolicies.add(customPolicy); + return this; + } + + /* + * The configuration store that is used during construction of the service + * client. + */ + @Generated private Configuration configuration; + + /** {@inheritDoc}. */ + @Generated + @Override + public PhoneNumberAdminClientImplBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /* + * The service endpoint + */ + @Generated private String endpoint; + + /** {@inheritDoc}. */ + @Generated + @Override public PhoneNumberAdminClientImplBuilder endpoint(String endpoint) { this.endpoint = endpoint; return this; } /* - * The HTTP pipeline to send requests through + * Api Version */ - private HttpPipeline pipeline; + @Generated private String apiVersion; /** - * Sets The HTTP pipeline to send requests through. + * Sets Api Version. * - * @param pipeline the pipeline value. + * @param apiVersion the apiVersion value. * @return the PhoneNumberAdminClientImplBuilder. */ - public PhoneNumberAdminClientImplBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; + @Generated + public PhoneNumberAdminClientImplBuilder apiVersion(String apiVersion) { + this.apiVersion = apiVersion; return this; } /* * The serializer to serialize an object into a string */ - private SerializerAdapter serializerAdapter; + @Generated private SerializerAdapter serializerAdapter; /** * Sets The serializer to serialize an object into a string. @@ -60,27 +187,93 @@ public PhoneNumberAdminClientImplBuilder pipeline(HttpPipeline pipeline) { * @param serializerAdapter the serializerAdapter value. * @return the PhoneNumberAdminClientImplBuilder. */ + @Generated public PhoneNumberAdminClientImplBuilder serializerAdapter(SerializerAdapter serializerAdapter) { this.serializerAdapter = serializerAdapter; return this; } + /* + * The retry policy that will attempt to retry failed requests, if + * applicable. + */ + @Generated private RetryPolicy retryPolicy; + + /** + * Sets The retry policy that will attempt to retry failed requests, if applicable. + * + * @param retryPolicy the retryPolicy value. + * @return the PhoneNumberAdminClientImplBuilder. + */ + @Generated + public PhoneNumberAdminClientImplBuilder retryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + /** * Builds an instance of PhoneNumberAdminClientImpl with the provided parameters. * * @return an instance of PhoneNumberAdminClientImpl. */ + @Generated public PhoneNumberAdminClientImpl buildClient() { if (pipeline == null) { - this.pipeline = - new HttpPipelineBuilder() - .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) - .build(); + this.pipeline = createHttpPipeline(); + } + if (apiVersion == null) { + this.apiVersion = "2024-03-01"; } if (serializerAdapter == null) { this.serializerAdapter = JacksonAdapter.createDefaultSerializerAdapter(); } - PhoneNumberAdminClientImpl client = new PhoneNumberAdminClientImpl(pipeline, serializerAdapter, endpoint); + PhoneNumberAdminClientImpl client = + new PhoneNumberAdminClientImpl(pipeline, serializerAdapter, endpoint, apiVersion); return client; } + + @Generated + private HttpPipeline createHttpPipeline() { + Configuration buildConfiguration = + (configuration == null) ? Configuration.getGlobalConfiguration() : configuration; + if (httpLogOptions == null) { + httpLogOptions = new HttpLogOptions(); + } + if (clientOptions == null) { + clientOptions = new ClientOptions(); + } + List policies = new ArrayList<>(); + String clientName = properties.getOrDefault(SDK_NAME, "UnknownName"); + String clientVersion = properties.getOrDefault(SDK_VERSION, "UnknownVersion"); + String applicationId = CoreUtils.getApplicationId(clientOptions, httpLogOptions); + policies.add(new UserAgentPolicy(applicationId, clientName, clientVersion, buildConfiguration)); + policies.add(new RequestIdPolicy()); + policies.add(new AddHeadersFromContextPolicy()); + HttpHeaders headers = new HttpHeaders(); + clientOptions.getHeaders().forEach(header -> headers.set(header.getName(), header.getValue())); + if (headers.getSize() > 0) { + policies.add(new AddHeadersPolicy(headers)); + } + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy())); + policies.add(new AddDatePolicy()); + policies.add(new CookiePolicy()); + policies.addAll( + this.pipelinePolicies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .httpClient(httpClient) + .clientOptions(clientOptions) + .build(); + return httpPipeline; + } } 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 8f37bf040525..dd2e8c5c0f01 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 @@ -6,6 +6,7 @@ import com.azure.communication.phonenumbers.implementation.models.CommunicationErrorResponseException; import com.azure.communication.phonenumbers.implementation.models.OfferingsResponse; +import com.azure.communication.phonenumbers.implementation.models.OperatorInformationRequest; import com.azure.communication.phonenumbers.implementation.models.PhoneNumberAreaCodes; import com.azure.communication.phonenumbers.implementation.models.PhoneNumberCapabilitiesRequest; import com.azure.communication.phonenumbers.implementation.models.PhoneNumberCountries; @@ -19,6 +20,7 @@ import com.azure.communication.phonenumbers.implementation.models.PhoneNumbersSearchAvailablePhoneNumbersResponse; import com.azure.communication.phonenumbers.implementation.models.PhoneNumbersUpdateCapabilitiesResponse; import com.azure.communication.phonenumbers.implementation.models.PurchasedPhoneNumbers; +import com.azure.communication.phonenumbers.models.OperatorInformationResult; import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode; import com.azure.communication.phonenumbers.models.PhoneNumberAssignmentType; import com.azure.communication.phonenumbers.models.PhoneNumberCountry; @@ -92,6 +94,7 @@ Mono> listAreaCodes( @QueryParam("administrativeDivision") String administrativeDivision, @QueryParam("api-version") String apiVersion, @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Accept") String accept, Context context); @Get("/availablePhoneNumbers/countries") @@ -103,6 +106,7 @@ Mono> listAvailableCountries( @QueryParam("maxPageSize") Integer maxPageSize, @QueryParam("api-version") String apiVersion, @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Accept") String accept, Context context); @Get("/availablePhoneNumbers/countries/{countryCode}/localities") @@ -116,6 +120,7 @@ Mono> listAvailableLocalities( @QueryParam("administrativeDivision") String administrativeDivision, @QueryParam("api-version") String apiVersion, @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Accept") String accept, Context context); @Get("/availablePhoneNumbers/countries/{countryCode}/offerings") @@ -130,6 +135,7 @@ Mono> listOfferings( @QueryParam("assignmentType") PhoneNumberAssignmentType assignmentType, @QueryParam("api-version") String apiVersion, @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Accept") String accept, Context context); @Post("/availablePhoneNumbers/countries/{countryCode}/:search") @@ -140,6 +146,7 @@ Mono searchAvailablePhoneNumber @PathParam("countryCode") String countryCode, @QueryParam("api-version") String apiVersion, @BodyParam("application/json") PhoneNumberSearchRequest body, + @HeaderParam("Accept") String accept, Context context); @Get("/availablePhoneNumbers/searchResults/{searchId}") @@ -149,6 +156,7 @@ Mono> getSearchResult( @HostParam("endpoint") String endpoint, @PathParam("searchId") String searchId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); @Post("/availablePhoneNumbers/:purchase") @@ -158,6 +166,7 @@ Mono purchasePhoneNumbers( @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @BodyParam("application/json") PhoneNumberPurchaseRequest body, + @HeaderParam("Accept") String accept, Context context); @Get("/phoneNumbers/operations/{operationId}") @@ -167,6 +176,7 @@ Mono getOperation( @HostParam("endpoint") String endpoint, @PathParam("operationId") String operationId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); @Delete("/phoneNumbers/operations/{operationId}") @@ -176,6 +186,7 @@ Mono> cancelOperation( @HostParam("endpoint") String endpoint, @PathParam("operationId") String operationId, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); @Patch("/phoneNumbers/{phoneNumber}/capabilities") @@ -186,6 +197,7 @@ Mono updateCapabilities( @PathParam("phoneNumber") String phoneNumber, @QueryParam("api-version") String apiVersion, @BodyParam("application/merge-patch+json") PhoneNumberCapabilitiesRequest body, + @HeaderParam("Accept") String accept, Context context); @Get("/phoneNumbers/{phoneNumber}") @@ -195,6 +207,7 @@ Mono> getByNumber( @HostParam("endpoint") String endpoint, @PathParam("phoneNumber") String phoneNumber, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); @Delete("/phoneNumbers/{phoneNumber}") @@ -204,6 +217,7 @@ Mono releasePhoneNumber( @HostParam("endpoint") String endpoint, @PathParam("phoneNumber") String phoneNumber, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, Context context); @Get("/phoneNumbers") @@ -214,48 +228,78 @@ Mono> listPhoneNumbers( @QueryParam("skip") Integer skip, @QueryParam("top") Integer top, @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Post("/operatorInformation/:search") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) + Mono> operatorInformationSearch( + @HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") OperatorInformationRequest body, + @HeaderParam("Accept") String accept, Context context); @Get("{nextLink}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) Mono> listAreaCodesNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Accept") String accept, + Context context); @Get("{nextLink}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) Mono> listAvailableCountriesNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Accept") String accept, + Context context); @Get("{nextLink}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) Mono> listAvailableLocalitiesNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Accept") String accept, + Context context); @Get("{nextLink}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) Mono> listOfferingsNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, + @HeaderParam("accept-language") String acceptLanguage, + @HeaderParam("Accept") String accept, + Context context); @Get("{nextLink}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(CommunicationErrorResponseException.class) Mono> listPhoneNumbersNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, Context context); + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, + Context context); } /** * Gets the list of available area codes. * * @param countryCode The ISO 3166-2 country code, e.g. US. - * @param phoneNumberType Represents the number type of the offering. + * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree. * @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 assignmentType Represents the assignment type of the offering. + * @param assignmentType Filter by assignmentType, e.g. Person, Application. * @param locality The name of locality or town in which to search for the area code. This is required if the number * type is Geographic. * @param administrativeDivision The name of the state or province in which to search for the area code. @@ -263,7 +307,8 @@ Mono> listPhoneNumbersNext( * @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. - * @return the list of available area codes. + * @return the list of available area codes along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listAreaCodesSinglePageAsync( @@ -275,6 +320,7 @@ public Mono> listAreaCodesSinglePageAsync( String locality, String administrativeDivision, String acceptLanguage) { + final String accept = "application/json"; return FluxUtil.withContext( context -> service.listAreaCodes( @@ -288,6 +334,7 @@ public Mono> listAreaCodesSinglePageAsync( administrativeDivision, this.client.getApiVersion(), acceptLanguage, + accept, context)) .map( res -> @@ -304,11 +351,11 @@ public Mono> listAreaCodesSinglePageAsync( * Gets the list of available area codes. * * @param countryCode The ISO 3166-2 country code, e.g. US. - * @param phoneNumberType Represents the number type of the offering. + * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree. * @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 assignmentType Represents the assignment type of the offering. + * @param assignmentType Filter by assignmentType, e.g. Person, Application. * @param locality The name of locality or town in which to search for the area code. This is required if the number * type is Geographic. * @param administrativeDivision The name of the state or province in which to search for the area code. @@ -317,7 +364,8 @@ public Mono> listAreaCodesSinglePageAsync( * @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. - * @return the list of available area codes. + * @return the list of available area codes along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listAreaCodesSinglePageAsync( @@ -330,6 +378,7 @@ public Mono> listAreaCodesSinglePageAsync( String administrativeDivision, String acceptLanguage, Context context) { + final String accept = "application/json"; return service.listAreaCodes( this.client.getEndpoint(), countryCode, @@ -341,6 +390,7 @@ public Mono> listAreaCodesSinglePageAsync( administrativeDivision, this.client.getApiVersion(), acceptLanguage, + accept, context) .map( res -> @@ -357,11 +407,11 @@ public Mono> listAreaCodesSinglePageAsync( * Gets the list of available area codes. * * @param countryCode The ISO 3166-2 country code, e.g. US. - * @param phoneNumberType Represents the number type of the offering. + * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree. * @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 assignmentType Represents the assignment type of the offering. + * @param assignmentType Filter by assignmentType, e.g. Person, Application. * @param locality The name of locality or town in which to search for the area code. This is required if the number * type is Geographic. * @param administrativeDivision The name of the state or province in which to search for the area code. @@ -369,7 +419,7 @@ public Mono> listAreaCodesSinglePageAsync( * @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. - * @return the list of available area codes. + * @return the list of available area codes as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listAreaCodesAsync( @@ -392,18 +442,18 @@ public PagedFlux listAreaCodesAsync( locality, administrativeDivision, acceptLanguage), - nextLink -> listAreaCodesNextSinglePageAsync(nextLink)); + nextLink -> listAreaCodesNextSinglePageAsync(nextLink, acceptLanguage)); } /** * Gets the list of available area codes. * * @param countryCode The ISO 3166-2 country code, e.g. US. - * @param phoneNumberType Represents the number type of the offering. + * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree. * @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 assignmentType Represents the assignment type of the offering. + * @param assignmentType Filter by assignmentType, e.g. Person, Application. * @param locality The name of locality or town in which to search for the area code. This is required if the number * type is Geographic. * @param administrativeDivision The name of the state or province in which to search for the area code. @@ -412,7 +462,7 @@ public PagedFlux listAreaCodesAsync( * @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. - * @return the list of available area codes. + * @return the list of available area codes as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listAreaCodesAsync( @@ -437,18 +487,18 @@ public PagedFlux listAreaCodesAsync( administrativeDivision, acceptLanguage, context), - nextLink -> listAreaCodesNextSinglePageAsync(nextLink, context)); + nextLink -> listAreaCodesNextSinglePageAsync(nextLink, acceptLanguage, context)); } /** * Gets the list of available area codes. * * @param countryCode The ISO 3166-2 country code, e.g. US. - * @param phoneNumberType Represents the number type of the offering. + * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree. * @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 assignmentType Represents the assignment type of the offering. + * @param assignmentType Filter by assignmentType, e.g. Person, Application. * @param locality The name of locality or town in which to search for the area code. This is required if the number * type is Geographic. * @param administrativeDivision The name of the state or province in which to search for the area code. @@ -456,7 +506,7 @@ public PagedFlux listAreaCodesAsync( * @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. - * @return the list of available area codes. + * @return the list of available area codes as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listAreaCodes( @@ -484,11 +534,11 @@ public PagedIterable listAreaCodes( * Gets the list of available area codes. * * @param countryCode The ISO 3166-2 country code, e.g. US. - * @param phoneNumberType Represents the number type of the offering. + * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree. * @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 assignmentType Represents the assignment type of the offering. + * @param assignmentType Filter by assignmentType, e.g. Person, Application. * @param locality The name of locality or town in which to search for the area code. This is required if the number * type is Geographic. * @param administrativeDivision The name of the state or province in which to search for the area code. @@ -497,7 +547,7 @@ public PagedIterable listAreaCodes( * @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. - * @return the list of available area codes. + * @return the list of available area codes as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listAreaCodes( @@ -533,11 +583,13 @@ public PagedIterable listAreaCodes( * @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. - * @return the list of supported countries. + * @return the list of supported countries along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listAvailableCountriesSinglePageAsync( Integer skip, Integer maxPageSize, String acceptLanguage) { + final String accept = "application/json"; return FluxUtil.withContext( context -> service.listAvailableCountries( @@ -546,6 +598,7 @@ public Mono> listAvailableCountriesSinglePageA maxPageSize, this.client.getApiVersion(), acceptLanguage, + accept, context)) .map( res -> @@ -569,17 +622,20 @@ public Mono> listAvailableCountriesSinglePageA * @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. - * @return the list of supported countries. + * @return the list of supported countries along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listAvailableCountriesSinglePageAsync( Integer skip, Integer maxPageSize, String acceptLanguage, Context context) { + final String accept = "application/json"; return service.listAvailableCountries( this.client.getEndpoint(), skip, maxPageSize, this.client.getApiVersion(), acceptLanguage, + accept, context) .map( res -> @@ -602,14 +658,14 @@ public Mono> listAvailableCountriesSinglePageA * @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. - * @return the list of supported countries. + * @return the list of supported countries as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listAvailableCountriesAsync( Integer skip, Integer maxPageSize, String acceptLanguage) { return new PagedFlux<>( () -> listAvailableCountriesSinglePageAsync(skip, maxPageSize, acceptLanguage), - nextLink -> listAvailableCountriesNextSinglePageAsync(nextLink)); + nextLink -> listAvailableCountriesNextSinglePageAsync(nextLink, acceptLanguage)); } /** @@ -623,14 +679,14 @@ public PagedFlux listAvailableCountriesAsync( * @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. - * @return the list of supported countries. + * @return the list of supported countries as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listAvailableCountriesAsync( Integer skip, Integer maxPageSize, String acceptLanguage, Context context) { return new PagedFlux<>( () -> listAvailableCountriesSinglePageAsync(skip, maxPageSize, acceptLanguage, context), - nextLink -> listAvailableCountriesNextSinglePageAsync(nextLink, context)); + nextLink -> listAvailableCountriesNextSinglePageAsync(nextLink, acceptLanguage, context)); } /** @@ -643,7 +699,7 @@ public PagedFlux listAvailableCountriesAsync( * @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. - * @return the list of supported countries. + * @return the list of supported countries as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listAvailableCountries( @@ -662,7 +718,7 @@ public PagedIterable listAvailableCountries( * @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. - * @return the list of supported countries. + * @return the list of supported countries as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listAvailableCountries( @@ -683,7 +739,8 @@ public PagedIterable listAvailableCountries( * @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. - * @return the list of cities or towns with available phone numbers. + * @return the list of cities or towns with available phone numbers along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listAvailableLocalitiesSinglePageAsync( @@ -692,6 +749,7 @@ public Mono> listAvailableLocalitiesSinglePag Integer maxPageSize, String administrativeDivision, String acceptLanguage) { + final String accept = "application/json"; return FluxUtil.withContext( context -> service.listAvailableLocalities( @@ -702,6 +760,7 @@ public Mono> listAvailableLocalitiesSinglePag administrativeDivision, this.client.getApiVersion(), acceptLanguage, + accept, context)) .map( res -> @@ -728,7 +787,8 @@ public Mono> listAvailableLocalitiesSinglePag * @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. - * @return the list of cities or towns with available phone numbers. + * @return the list of cities or towns with available phone numbers along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listAvailableLocalitiesSinglePageAsync( @@ -738,6 +798,7 @@ public Mono> listAvailableLocalitiesSinglePag String administrativeDivision, String acceptLanguage, Context context) { + final String accept = "application/json"; return service.listAvailableLocalities( this.client.getEndpoint(), countryCode, @@ -746,6 +807,7 @@ public Mono> listAvailableLocalitiesSinglePag administrativeDivision, this.client.getApiVersion(), acceptLanguage, + accept, context) .map( res -> @@ -771,7 +833,7 @@ public Mono> listAvailableLocalitiesSinglePag * @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. - * @return the list of cities or towns with available phone numbers. + * @return the list of cities or towns with available phone numbers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listAvailableLocalitiesAsync( @@ -784,7 +846,7 @@ public PagedFlux listAvailableLocalitiesAsync( () -> listAvailableLocalitiesSinglePageAsync( countryCode, skip, maxPageSize, administrativeDivision, acceptLanguage), - nextLink -> listAvailableLocalitiesNextSinglePageAsync(nextLink)); + nextLink -> listAvailableLocalitiesNextSinglePageAsync(nextLink, acceptLanguage)); } /** @@ -801,7 +863,7 @@ public PagedFlux listAvailableLocalitiesAsync( * @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. - * @return the list of cities or towns with available phone numbers. + * @return the list of cities or towns with available phone numbers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listAvailableLocalitiesAsync( @@ -815,7 +877,7 @@ public PagedFlux listAvailableLocalitiesAsync( () -> listAvailableLocalitiesSinglePageAsync( countryCode, skip, maxPageSize, administrativeDivision, acceptLanguage, context), - nextLink -> listAvailableLocalitiesNextSinglePageAsync(nextLink, context)); + nextLink -> listAvailableLocalitiesNextSinglePageAsync(nextLink, acceptLanguage, context)); } /** @@ -831,7 +893,8 @@ public PagedFlux listAvailableLocalitiesAsync( * @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. - * @return the list of cities or towns with available phone numbers. + * @return the list of cities or towns with available phone numbers as paginated response with {@link + * PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listAvailableLocalities( @@ -858,7 +921,8 @@ public PagedIterable listAvailableLocalities( * @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. - * @return the list of cities or towns with available phone numbers. + * @return the list of cities or towns with available phone numbers as paginated response with {@link + * PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listAvailableLocalities( @@ -880,13 +944,14 @@ public PagedIterable listAvailableLocalities( * @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 Represents the number type of the offering. - * @param assignmentType Represents the assignment type of the offering. + * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree. + * @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. * @throws CommunicationErrorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a wrapper around a list of offerings. + * @return represents a wrapper around a list of offerings along with {@link PagedResponse} on successful completion + * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listOfferingsSinglePageAsync( @@ -896,6 +961,7 @@ public Mono> listOfferingsSinglePageAsync( PhoneNumberType phoneNumberType, PhoneNumberAssignmentType assignmentType, String acceptLanguage) { + final String accept = "application/json"; return FluxUtil.withContext( context -> service.listOfferings( @@ -907,6 +973,7 @@ public Mono> listOfferingsSinglePageAsync( assignmentType, this.client.getApiVersion(), acceptLanguage, + accept, context)) .map( res -> @@ -926,14 +993,15 @@ public Mono> listOfferingsSinglePageAsync( * @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 Represents the number type of the offering. - * @param assignmentType Represents the assignment type of the offering. + * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree. + * @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. * @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. - * @return represents a wrapper around a list of offerings. + * @return represents a wrapper around a list of offerings along with {@link PagedResponse} on successful completion + * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listOfferingsSinglePageAsync( @@ -944,6 +1012,7 @@ public Mono> listOfferingsSinglePageAsync( PhoneNumberAssignmentType assignmentType, String acceptLanguage, Context context) { + final String accept = "application/json"; return service.listOfferings( this.client.getEndpoint(), countryCode, @@ -953,6 +1022,7 @@ public Mono> listOfferingsSinglePageAsync( assignmentType, this.client.getApiVersion(), acceptLanguage, + accept, context) .map( res -> @@ -972,13 +1042,13 @@ public Mono> listOfferingsSinglePageAsync( * @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 Represents the number type of the offering. - * @param assignmentType Represents the assignment type of the offering. + * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree. + * @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. * @throws CommunicationErrorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a wrapper around a list of offerings. + * @return represents a wrapper around a list of offerings as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listOfferingsAsync( @@ -992,7 +1062,7 @@ public PagedFlux listOfferingsAsync( () -> listOfferingsSinglePageAsync( countryCode, skip, maxPageSize, phoneNumberType, assignmentType, acceptLanguage), - nextLink -> listOfferingsNextSinglePageAsync(nextLink)); + nextLink -> listOfferingsNextSinglePageAsync(nextLink, acceptLanguage)); } /** @@ -1002,14 +1072,14 @@ public PagedFlux listOfferingsAsync( * @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 Represents the number type of the offering. - * @param assignmentType Represents the assignment type of the offering. + * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree. + * @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. * @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. - * @return represents a wrapper around a list of offerings. + * @return represents a wrapper around a list of offerings as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listOfferingsAsync( @@ -1030,7 +1100,7 @@ public PagedFlux listOfferingsAsync( assignmentType, acceptLanguage, context), - nextLink -> listOfferingsNextSinglePageAsync(nextLink, context)); + nextLink -> listOfferingsNextSinglePageAsync(nextLink, acceptLanguage, context)); } /** @@ -1040,13 +1110,13 @@ public PagedFlux listOfferingsAsync( * @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 Represents the number type of the offering. - * @param assignmentType Represents the assignment type of the offering. + * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree. + * @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. * @throws CommunicationErrorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a wrapper around a list of offerings. + * @return represents a wrapper around a list of offerings as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listOfferings( @@ -1067,14 +1137,14 @@ public PagedIterable listOfferings( * @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 Represents the number type of the offering. - * @param assignmentType Represents the assignment type of the offering. + * @param phoneNumberType Filter by numberType, e.g. Geographic, TollFree. + * @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. * @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. - * @return represents a wrapper around a list of offerings. + * @return represents a wrapper around a list of offerings as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listOfferings( @@ -1094,98 +1164,86 @@ public PagedIterable listOfferings( * Search for available phone numbers to purchase. * * @param countryCode The ISO 3166-2 country code, e.g. US. - * @param body Represents a phone number search request to find phone numbers. Found phone numbers are temporarily - * held for a following purchase. + * @param body The phone number search request. * @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. - * @return the result of a phone number search operation. + * @return the result of a phone number search operation on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono searchAvailablePhoneNumbersWithResponseAsync( String countryCode, PhoneNumberSearchRequest body) { + final String accept = "application/json"; return FluxUtil.withContext( context -> service.searchAvailablePhoneNumbers( - this.client.getEndpoint(), countryCode, this.client.getApiVersion(), body, context)); + this.client.getEndpoint(), + countryCode, + this.client.getApiVersion(), + body, + accept, + context)); } /** * Search for available phone numbers to purchase. * * @param countryCode The ISO 3166-2 country code, e.g. US. - * @param body Represents a phone number search request to find phone numbers. Found phone numbers are temporarily - * held for a following purchase. + * @param body The phone number search request. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the result of a phone number search operation. + * @return the result of a phone number search operation on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono searchAvailablePhoneNumbersWithResponseAsync( String countryCode, PhoneNumberSearchRequest body, Context context) { + final String accept = "application/json"; return service.searchAvailablePhoneNumbers( - this.client.getEndpoint(), countryCode, this.client.getApiVersion(), body, context); + this.client.getEndpoint(), countryCode, this.client.getApiVersion(), body, accept, context); } /** * Search for available phone numbers to purchase. * * @param countryCode The ISO 3166-2 country code, e.g. US. - * @param body Represents a phone number search request to find phone numbers. Found phone numbers are temporarily - * held for a following purchase. + * @param body The phone number search request. * @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. - * @return the result of a phone number search operation. + * @return the result of a phone number search operation on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono searchAvailablePhoneNumbersAsync( String countryCode, PhoneNumberSearchRequest body) { return searchAvailablePhoneNumbersWithResponseAsync(countryCode, body) - .flatMap( - (PhoneNumbersSearchAvailablePhoneNumbersResponse res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Search for available phone numbers to purchase. * * @param countryCode The ISO 3166-2 country code, e.g. US. - * @param body Represents a phone number search request to find phone numbers. Found phone numbers are temporarily - * held for a following purchase. + * @param body The phone number search request. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the result of a phone number search operation. + * @return the result of a phone number search operation on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono searchAvailablePhoneNumbersAsync( String countryCode, PhoneNumberSearchRequest body, Context context) { return searchAvailablePhoneNumbersWithResponseAsync(countryCode, body, context) - .flatMap( - (PhoneNumbersSearchAvailablePhoneNumbersResponse res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Search for available phone numbers to purchase. * * @param countryCode The ISO 3166-2 country code, e.g. US. - * @param body Represents a phone number search request to find phone numbers. Found phone numbers are temporarily - * held for a following purchase. + * @param body The phone number search request. * @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. @@ -1200,8 +1258,7 @@ public PhoneNumberSearchResult searchAvailablePhoneNumbers(String countryCode, P * Search for available phone numbers to purchase. * * @param countryCode The ISO 3166-2 country code, e.g. US. - * @param body Represents a phone number search request to find phone numbers. Found phone numbers are temporarily - * held for a following purchase. + * @param body The phone number search request. * @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. @@ -1209,9 +1266,9 @@ public PhoneNumberSearchResult searchAvailablePhoneNumbers(String countryCode, P * @return the result of a phone number search operation. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PhoneNumberSearchResult searchAvailablePhoneNumbers( + public PhoneNumbersSearchAvailablePhoneNumbersResponse searchAvailablePhoneNumbersWithResponse( String countryCode, PhoneNumberSearchRequest body, Context context) { - return searchAvailablePhoneNumbersAsync(countryCode, body, context).block(); + return searchAvailablePhoneNumbersWithResponseAsync(countryCode, body, context).block(); } /** @@ -1221,14 +1278,16 @@ public PhoneNumberSearchResult searchAvailablePhoneNumbers( * @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. - * @return a phone number search result by search id. + * @return a phone number search result by search id along with {@link Response} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getSearchResultWithResponseAsync(String searchId) { + final String accept = "application/json"; return FluxUtil.withContext( context -> service.getSearchResult( - this.client.getEndpoint(), searchId, this.client.getApiVersion(), context)); + this.client.getEndpoint(), searchId, this.client.getApiVersion(), accept, context)); } /** @@ -1239,11 +1298,14 @@ public Mono> getSearchResultWithResponseAsync( * @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. - * @return a phone number search result by search id. + * @return a phone number search result by search id along with {@link Response} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getSearchResultWithResponseAsync(String searchId, Context context) { - return service.getSearchResult(this.client.getEndpoint(), searchId, this.client.getApiVersion(), context); + final String accept = "application/json"; + return service.getSearchResult( + this.client.getEndpoint(), searchId, this.client.getApiVersion(), accept, context); } /** @@ -1253,19 +1315,11 @@ public Mono> getSearchResultWithResponseAsync( * @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. - * @return a phone number search result by search id. + * @return a phone number search result by search id on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getSearchResultAsync(String searchId) { - return getSearchResultWithResponseAsync(searchId) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + return getSearchResultWithResponseAsync(searchId).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -1276,19 +1330,11 @@ public Mono getSearchResultAsync(String searchId) { * @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. - * @return a phone number search result by search id. + * @return a phone number search result by search id on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getSearchResultAsync(String searchId, Context context) { - return getSearchResultWithResponseAsync(searchId, context) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + return getSearchResultWithResponseAsync(searchId, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -1313,82 +1359,83 @@ public PhoneNumberSearchResult getSearchResult(String searchId) { * @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. - * @return a phone number search result by search id. + * @return a phone number search result by search id along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PhoneNumberSearchResult getSearchResult(String searchId, Context context) { - return getSearchResultAsync(searchId, context).block(); + public Response getSearchResultWithResponse(String searchId, Context context) { + return getSearchResultWithResponseAsync(searchId, context).block(); } /** * Purchases phone numbers. * - * @param body The phone number search purchase request. + * @param body The phone number purchase request. * @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. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono purchasePhoneNumbersWithResponseAsync( PhoneNumberPurchaseRequest body) { + final String accept = "application/json"; return FluxUtil.withContext( context -> service.purchasePhoneNumbers( - this.client.getEndpoint(), this.client.getApiVersion(), body, context)); + this.client.getEndpoint(), this.client.getApiVersion(), body, accept, context)); } /** * Purchases phone numbers. * - * @param body The phone number search purchase request. + * @param body The phone number purchase request. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono purchasePhoneNumbersWithResponseAsync( PhoneNumberPurchaseRequest body, Context context) { - return service.purchasePhoneNumbers(this.client.getEndpoint(), this.client.getApiVersion(), body, context); + final String accept = "application/json"; + return service.purchasePhoneNumbers( + this.client.getEndpoint(), this.client.getApiVersion(), body, accept, context); } /** * Purchases phone numbers. * - * @param body The phone number search purchase request. + * @param body The phone number purchase request. * @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. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono purchasePhoneNumbersAsync(PhoneNumberPurchaseRequest body) { - return purchasePhoneNumbersWithResponseAsync(body) - .flatMap((PhoneNumbersPurchasePhoneNumbersResponse res) -> Mono.empty()); + return purchasePhoneNumbersWithResponseAsync(body).flatMap(ignored -> Mono.empty()); } /** * Purchases phone numbers. * - * @param body The phone number search purchase request. + * @param body The phone number purchase request. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono purchasePhoneNumbersAsync(PhoneNumberPurchaseRequest body, Context context) { - return purchasePhoneNumbersWithResponseAsync(body, context) - .flatMap((PhoneNumbersPurchasePhoneNumbersResponse res) -> Mono.empty()); + return purchasePhoneNumbersWithResponseAsync(body, context).flatMap(ignored -> Mono.empty()); } /** * Purchases phone numbers. * - * @param body The phone number search purchase request. + * @param body The phone number purchase request. * @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. @@ -1401,15 +1448,17 @@ public void purchasePhoneNumbers(PhoneNumberPurchaseRequest body) { /** * Purchases phone numbers. * - * @param body The phone number search purchase request. + * @param body The phone number purchase request. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void purchasePhoneNumbers(PhoneNumberPurchaseRequest body, Context context) { - purchasePhoneNumbersAsync(body, context).block(); + public PhoneNumbersPurchasePhoneNumbersResponse purchasePhoneNumbersWithResponse( + PhoneNumberPurchaseRequest body, Context context) { + return purchasePhoneNumbersWithResponseAsync(body, context).block(); } /** @@ -1419,14 +1468,15 @@ public void purchasePhoneNumbers(PhoneNumberPurchaseRequest body, Context contex * @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. - * @return an operation by its id. + * @return an operation by its id on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getOperationWithResponseAsync(String operationId) { + final String accept = "application/json"; return FluxUtil.withContext( context -> service.getOperation( - this.client.getEndpoint(), operationId, this.client.getApiVersion(), context)); + this.client.getEndpoint(), operationId, this.client.getApiVersion(), accept, context)); } /** @@ -1437,11 +1487,13 @@ public Mono getOperationWithResponseAsync(Stri * @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. - * @return an operation by its id. + * @return an operation by its id on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getOperationWithResponseAsync(String operationId, Context context) { - return service.getOperation(this.client.getEndpoint(), operationId, this.client.getApiVersion(), context); + final String accept = "application/json"; + return service.getOperation( + this.client.getEndpoint(), operationId, this.client.getApiVersion(), accept, context); } /** @@ -1451,19 +1503,11 @@ public Mono getOperationWithResponseAsync(Stri * @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. - * @return an operation by its id. + * @return an operation by its id on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getOperationAsync(String operationId) { - return getOperationWithResponseAsync(operationId) - .flatMap( - (PhoneNumbersGetOperationResponse res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + return getOperationWithResponseAsync(operationId).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -1474,19 +1518,11 @@ public Mono getOperationAsync(String operationId) { * @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. - * @return an operation by its id. + * @return an operation by its id on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getOperationAsync(String operationId, Context context) { - return getOperationWithResponseAsync(operationId, context) - .flatMap( - (PhoneNumbersGetOperationResponse res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + return getOperationWithResponseAsync(operationId, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -1514,8 +1550,8 @@ public PhoneNumberRawOperation getOperation(String operationId) { * @return an operation by its id. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PhoneNumberRawOperation getOperation(String operationId, Context context) { - return getOperationAsync(operationId, context).block(); + public PhoneNumbersGetOperationResponse getOperationWithResponse(String operationId, Context context) { + return getOperationWithResponseAsync(operationId, context).block(); } /** @@ -1525,14 +1561,15 @@ public PhoneNumberRawOperation getOperation(String operationId, Context context) * @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. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> cancelOperationWithResponseAsync(String operationId) { + final String accept = "application/json"; return FluxUtil.withContext( context -> service.cancelOperation( - this.client.getEndpoint(), operationId, this.client.getApiVersion(), context)); + this.client.getEndpoint(), operationId, this.client.getApiVersion(), accept, context)); } /** @@ -1543,11 +1580,13 @@ public Mono> cancelOperationWithResponseAsync(String operationId) * @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. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> cancelOperationWithResponseAsync(String operationId, Context context) { - return service.cancelOperation(this.client.getEndpoint(), operationId, this.client.getApiVersion(), context); + final String accept = "application/json"; + return service.cancelOperation( + this.client.getEndpoint(), operationId, this.client.getApiVersion(), accept, context); } /** @@ -1557,11 +1596,11 @@ public Mono> cancelOperationWithResponseAsync(String operationId, * @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. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono cancelOperationAsync(String operationId) { - return cancelOperationWithResponseAsync(operationId).flatMap((Response res) -> Mono.empty()); + return cancelOperationWithResponseAsync(operationId).flatMap(ignored -> Mono.empty()); } /** @@ -1572,11 +1611,11 @@ public Mono cancelOperationAsync(String operationId) { * @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. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono cancelOperationAsync(String operationId, Context context) { - return cancelOperationWithResponseAsync(operationId, context).flatMap((Response res) -> Mono.empty()); + return cancelOperationWithResponseAsync(operationId, context).flatMap(ignored -> Mono.empty()); } /** @@ -1600,10 +1639,11 @@ public void cancelOperation(String operationId) { * @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. + * @return the {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void cancelOperation(String operationId, Context context) { - cancelOperationAsync(operationId, context).block(); + public Response cancelOperationWithResponse(String operationId, Context context) { + return cancelOperationWithResponseAsync(operationId, context).block(); } /** @@ -1611,19 +1651,25 @@ public void cancelOperation(String operationId, Context context) { * * @param phoneNumber The phone number id in E.164 format. The leading plus can be either + or encoded as %2B, e.g. * +11234567890. - * @param body Capabilities of a phone number. + * @param body Defines the update capabilities request. * @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. - * @return represents a purchased phone number. + * @return represents a purchased phone number on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono updateCapabilitiesWithResponseAsync( String phoneNumber, PhoneNumberCapabilitiesRequest body) { + final String accept = "application/json"; return FluxUtil.withContext( context -> service.updateCapabilities( - this.client.getEndpoint(), phoneNumber, this.client.getApiVersion(), body, context)); + this.client.getEndpoint(), + phoneNumber, + this.client.getApiVersion(), + body, + accept, + context)); } /** @@ -1631,18 +1677,19 @@ public Mono updateCapabilitiesWithRespon * * @param phoneNumber The phone number id in E.164 format. The leading plus can be either + or encoded as %2B, e.g. * +11234567890. - * @param body Capabilities of a phone number. + * @param body Defines the update capabilities request. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a purchased phone number. + * @return represents a purchased phone number on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono updateCapabilitiesWithResponseAsync( String phoneNumber, PhoneNumberCapabilitiesRequest body, Context context) { + final String accept = "application/json"; return service.updateCapabilities( - this.client.getEndpoint(), phoneNumber, this.client.getApiVersion(), body, context); + this.client.getEndpoint(), phoneNumber, this.client.getApiVersion(), body, accept, context); } /** @@ -1650,23 +1697,15 @@ public Mono updateCapabilitiesWithRespon * * @param phoneNumber The phone number id in E.164 format. The leading plus can be either + or encoded as %2B, e.g. * +11234567890. - * @param body Capabilities of a phone number. + * @param body Defines the update capabilities request. * @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. - * @return represents a purchased phone number. + * @return represents a purchased phone number on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono updateCapabilitiesAsync(String phoneNumber, PhoneNumberCapabilitiesRequest body) { - return updateCapabilitiesWithResponseAsync(phoneNumber, body) - .flatMap( - (PhoneNumbersUpdateCapabilitiesResponse res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + return updateCapabilitiesWithResponseAsync(phoneNumber, body).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -1674,25 +1713,18 @@ public Mono updateCapabilitiesAsync(String phoneNumber, Ph * * @param phoneNumber The phone number id in E.164 format. The leading plus can be either + or encoded as %2B, e.g. * +11234567890. - * @param body Capabilities of a phone number. + * @param body Defines the update capabilities request. * @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. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a purchased phone number. + * @return represents a purchased phone number on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono updateCapabilitiesAsync( String phoneNumber, PhoneNumberCapabilitiesRequest body, Context context) { return updateCapabilitiesWithResponseAsync(phoneNumber, body, context) - .flatMap( - (PhoneNumbersUpdateCapabilitiesResponse res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -1700,7 +1732,7 @@ public Mono updateCapabilitiesAsync( * * @param phoneNumber The phone number id in E.164 format. The leading plus can be either + or encoded as %2B, e.g. * +11234567890. - * @param body Capabilities of a phone number. + * @param body Defines the update capabilities request. * @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. @@ -1716,7 +1748,7 @@ public PurchasedPhoneNumber updateCapabilities(String phoneNumber, PhoneNumberCa * * @param phoneNumber The phone number id in E.164 format. The leading plus can be either + or encoded as %2B, e.g. * +11234567890. - * @param body Capabilities of a phone number. + * @param body Defines the update capabilities request. * @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. @@ -1724,9 +1756,9 @@ public PurchasedPhoneNumber updateCapabilities(String phoneNumber, PhoneNumberCa * @return represents a purchased phone number. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PurchasedPhoneNumber updateCapabilities( + public PhoneNumbersUpdateCapabilitiesResponse updateCapabilitiesWithResponse( String phoneNumber, PhoneNumberCapabilitiesRequest body, Context context) { - return updateCapabilitiesAsync(phoneNumber, body, context).block(); + return updateCapabilitiesWithResponseAsync(phoneNumber, body, context).block(); } /** @@ -1736,14 +1768,16 @@ public PurchasedPhoneNumber updateCapabilities( * @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. - * @return the details of the given purchased phone number. + * @return the details of the given purchased phone number along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getByNumberWithResponseAsync(String phoneNumber) { + final String accept = "application/json"; return FluxUtil.withContext( context -> service.getByNumber( - this.client.getEndpoint(), phoneNumber, this.client.getApiVersion(), context)); + this.client.getEndpoint(), phoneNumber, this.client.getApiVersion(), accept, context)); } /** @@ -1754,11 +1788,14 @@ public Mono> getByNumberWithResponseAsync(String * @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. - * @return the details of the given purchased phone number. + * @return the details of the given purchased phone number along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getByNumberWithResponseAsync(String phoneNumber, Context context) { - return service.getByNumber(this.client.getEndpoint(), phoneNumber, this.client.getApiVersion(), context); + final String accept = "application/json"; + return service.getByNumber( + this.client.getEndpoint(), phoneNumber, this.client.getApiVersion(), accept, context); } /** @@ -1768,19 +1805,11 @@ public Mono> getByNumberWithResponseAsync(String * @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. - * @return the details of the given purchased phone number. + * @return the details of the given purchased phone number on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getByNumberAsync(String phoneNumber) { - return getByNumberWithResponseAsync(phoneNumber) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + return getByNumberWithResponseAsync(phoneNumber).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -1791,19 +1820,11 @@ public Mono getByNumberAsync(String phoneNumber) { * @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. - * @return the details of the given purchased phone number. + * @return the details of the given purchased phone number on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getByNumberAsync(String phoneNumber, Context context) { - return getByNumberWithResponseAsync(phoneNumber, context) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + return getByNumberWithResponseAsync(phoneNumber, context).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** @@ -1828,11 +1849,11 @@ public PurchasedPhoneNumber getByNumber(String phoneNumber) { * @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. - * @return the details of the given purchased phone number. + * @return the details of the given purchased phone number along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PurchasedPhoneNumber getByNumber(String phoneNumber, Context context) { - return getByNumberAsync(phoneNumber, context).block(); + public Response getByNumberWithResponse(String phoneNumber, Context context) { + return getByNumberWithResponseAsync(phoneNumber, context).block(); } /** @@ -1842,14 +1863,15 @@ public PurchasedPhoneNumber getByNumber(String phoneNumber, Context context) { * @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. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono releasePhoneNumberWithResponseAsync(String phoneNumber) { + final String accept = "application/json"; return FluxUtil.withContext( context -> service.releasePhoneNumber( - this.client.getEndpoint(), phoneNumber, this.client.getApiVersion(), context)); + this.client.getEndpoint(), phoneNumber, this.client.getApiVersion(), accept, context)); } /** @@ -1860,12 +1882,14 @@ public Mono releasePhoneNumberWithRespon * @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. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono releasePhoneNumberWithResponseAsync( String phoneNumber, Context context) { - return service.releasePhoneNumber(this.client.getEndpoint(), phoneNumber, this.client.getApiVersion(), context); + final String accept = "application/json"; + return service.releasePhoneNumber( + this.client.getEndpoint(), phoneNumber, this.client.getApiVersion(), accept, context); } /** @@ -1875,12 +1899,11 @@ public Mono releasePhoneNumberWithRespon * @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. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono releasePhoneNumberAsync(String phoneNumber) { - return releasePhoneNumberWithResponseAsync(phoneNumber) - .flatMap((PhoneNumbersReleasePhoneNumberResponse res) -> Mono.empty()); + return releasePhoneNumberWithResponseAsync(phoneNumber).flatMap(ignored -> Mono.empty()); } /** @@ -1891,12 +1914,11 @@ public Mono releasePhoneNumberAsync(String phoneNumber) { * @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. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono releasePhoneNumberAsync(String phoneNumber, Context context) { - return releasePhoneNumberWithResponseAsync(phoneNumber, context) - .flatMap((PhoneNumbersReleasePhoneNumberResponse res) -> Mono.empty()); + return releasePhoneNumberWithResponseAsync(phoneNumber, context).flatMap(ignored -> Mono.empty()); } /** @@ -1920,10 +1942,11 @@ public void releasePhoneNumber(String phoneNumber) { * @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. + * @return the response. */ @ServiceMethod(returns = ReturnType.SINGLE) - public void releasePhoneNumber(String phoneNumber, Context context) { - releasePhoneNumberAsync(phoneNumber, context).block(); + public PhoneNumbersReleasePhoneNumberResponse releasePhoneNumberWithResponse(String phoneNumber, Context context) { + return releasePhoneNumberWithResponseAsync(phoneNumber, context).block(); } /** @@ -1935,14 +1958,21 @@ public void releasePhoneNumber(String phoneNumber, Context context) { * @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. - * @return the list of all purchased phone numbers. + * @return the list of all purchased phone numbers along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listPhoneNumbersSinglePageAsync(Integer skip, Integer top) { + final String accept = "application/json"; return FluxUtil.withContext( context -> service.listPhoneNumbers( - this.client.getEndpoint(), skip, top, this.client.getApiVersion(), context)) + this.client.getEndpoint(), + skip, + top, + this.client.getApiVersion(), + accept, + context)) .map( res -> new PagedResponseBase<>( @@ -1964,12 +1994,15 @@ public Mono> listPhoneNumbersSinglePageAsync * @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. - * @return the list of all purchased phone numbers. + * @return the list of all purchased phone numbers along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listPhoneNumbersSinglePageAsync( Integer skip, Integer top, Context context) { - return service.listPhoneNumbers(this.client.getEndpoint(), skip, top, this.client.getApiVersion(), context) + final String accept = "application/json"; + return service.listPhoneNumbers( + this.client.getEndpoint(), skip, top, this.client.getApiVersion(), accept, context) .map( res -> new PagedResponseBase<>( @@ -1990,7 +2023,7 @@ public Mono> listPhoneNumbersSinglePageAsync * @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. - * @return the list of all purchased phone numbers. + * @return the list of all purchased phone numbers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listPhoneNumbersAsync(Integer skip, Integer top) { @@ -2009,7 +2042,7 @@ public PagedFlux listPhoneNumbersAsync(Integer skip, Integ * @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. - * @return the list of all purchased phone numbers. + * @return the list of all purchased phone numbers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listPhoneNumbersAsync(Integer skip, Integer top, Context context) { @@ -2027,7 +2060,7 @@ public PagedFlux listPhoneNumbersAsync(Integer skip, Integ * @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. - * @return the list of all purchased phone numbers. + * @return the list of all purchased phone numbers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listPhoneNumbers(Integer skip, Integer top) { @@ -2044,25 +2077,136 @@ public PagedIterable listPhoneNumbers(Integer skip, Intege * @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. - * @return the list of all purchased phone numbers. + * @return the list of all purchased phone numbers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listPhoneNumbers(Integer skip, Integer top, Context context) { return new PagedIterable<>(listPhoneNumbersAsync(skip, top, context)); } + /** + * Searches for number format and operator information for a given list of phone numbers. + * + * @param body The phone number(s) whose number format and operator information should be searched. + * @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. + * @return represents a search result containing format and operator information associated with the requested phone + * numbers along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> operatorInformationSearchWithResponseAsync( + OperatorInformationRequest body) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.operatorInformationSearch( + this.client.getEndpoint(), this.client.getApiVersion(), body, accept, context)); + } + + /** + * Searches for number format and operator information for a given list of phone numbers. + * + * @param body The phone number(s) whose number format and operator information should be searched. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a search result containing format and operator information associated with the requested phone + * numbers along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> operatorInformationSearchWithResponseAsync( + OperatorInformationRequest body, Context context) { + final String accept = "application/json"; + return service.operatorInformationSearch( + this.client.getEndpoint(), this.client.getApiVersion(), body, accept, context); + } + + /** + * Searches for number format and operator information for a given list of phone numbers. + * + * @param body The phone number(s) whose number format and operator information should be searched. + * @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. + * @return represents a search result containing format and operator information associated with the requested phone + * numbers on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono operatorInformationSearchAsync(OperatorInformationRequest body) { + return operatorInformationSearchWithResponseAsync(body).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Searches for number format and operator information for a given list of phone numbers. + * + * @param body The phone number(s) whose number format and operator information should be searched. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a search result containing format and operator information associated with the requested phone + * numbers on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono operatorInformationSearchAsync( + OperatorInformationRequest body, Context context) { + return operatorInformationSearchWithResponseAsync(body, context) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Searches for number format and operator information for a given list of phone numbers. + * + * @param body The phone number(s) whose number format and operator information should be searched. + * @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. + * @return represents a search result containing format and operator information associated with the requested phone + * numbers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperatorInformationResult operatorInformationSearch(OperatorInformationRequest body) { + return operatorInformationSearchAsync(body).block(); + } + + /** + * Searches for number format and operator information for a given list of phone numbers. + * + * @param body The phone number(s) whose number format and operator information should be searched. + * @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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a search result containing format and operator information associated with the requested phone + * numbers along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response operatorInformationSearchWithResponse( + OperatorInformationRequest body, Context context) { + return operatorInformationSearchWithResponseAsync(body, context).block(); + } + /** * Get the next page of items. * * @param nextLink The nextLink parameter. + * @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. * @throws CommunicationErrorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the list of available area codes. + * @return the list of available area codes along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listAreaCodesNextSinglePageAsync(String nextLink) { - return FluxUtil.withContext(context -> service.listAreaCodesNext(nextLink, context)) + public Mono> listAreaCodesNextSinglePageAsync( + String nextLink, String acceptLanguage) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.listAreaCodesNext( + nextLink, this.client.getEndpoint(), acceptLanguage, accept, context)) .map( res -> new PagedResponseBase<>( @@ -2078,15 +2222,19 @@ public Mono> listAreaCodesNextSinglePageAsync * Get the next page of items. * * @param nextLink The nextLink parameter. + * @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. * @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. - * @return the list of available area codes. + * @return the list of available area codes along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listAreaCodesNextSinglePageAsync(String nextLink, Context context) { - return service.listAreaCodesNext(nextLink, context) + public Mono> listAreaCodesNextSinglePageAsync( + String nextLink, String acceptLanguage, Context context) { + final String accept = "application/json"; + return service.listAreaCodesNext(nextLink, this.client.getEndpoint(), acceptLanguage, accept, context) .map( res -> new PagedResponseBase<>( @@ -2102,14 +2250,21 @@ public Mono> listAreaCodesNextSinglePageAsync * Get the next page of items. * * @param nextLink The nextLink parameter. + * @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. * @throws CommunicationErrorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a wrapper around a list of countries. + * @return represents a wrapper around a list of countries along with {@link PagedResponse} on successful completion + * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listAvailableCountriesNextSinglePageAsync(String nextLink) { - return FluxUtil.withContext(context -> service.listAvailableCountriesNext(nextLink, context)) + public Mono> listAvailableCountriesNextSinglePageAsync( + String nextLink, String acceptLanguage) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.listAvailableCountriesNext( + nextLink, this.client.getEndpoint(), acceptLanguage, accept, context)) .map( res -> new PagedResponseBase<>( @@ -2125,16 +2280,19 @@ public Mono> listAvailableCountriesNextSingleP * Get the next page of items. * * @param nextLink The nextLink parameter. + * @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. * @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. - * @return represents a wrapper around a list of countries. + * @return represents a wrapper around a list of countries along with {@link PagedResponse} on successful completion + * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listAvailableCountriesNextSinglePageAsync( - String nextLink, Context context) { - return service.listAvailableCountriesNext(nextLink, context) + String nextLink, String acceptLanguage, Context context) { + final String accept = "application/json"; + return service.listAvailableCountriesNext(nextLink, this.client.getEndpoint(), acceptLanguage, accept, context) .map( res -> new PagedResponseBase<>( @@ -2150,14 +2308,21 @@ public Mono> listAvailableCountriesNextSingleP * Get the next page of items. * * @param nextLink The nextLink parameter. + * @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. * @throws CommunicationErrorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a wrapper around a list of cities or towns. + * @return represents a wrapper around a list of cities or towns along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listAvailableLocalitiesNextSinglePageAsync(String nextLink) { - return FluxUtil.withContext(context -> service.listAvailableLocalitiesNext(nextLink, context)) + public Mono> listAvailableLocalitiesNextSinglePageAsync( + String nextLink, String acceptLanguage) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.listAvailableLocalitiesNext( + nextLink, this.client.getEndpoint(), acceptLanguage, accept, context)) .map( res -> new PagedResponseBase<>( @@ -2173,16 +2338,19 @@ public Mono> listAvailableLocalitiesNextSingl * Get the next page of items. * * @param nextLink The nextLink parameter. + * @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. * @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. - * @return represents a wrapper around a list of cities or towns. + * @return represents a wrapper around a list of cities or towns along with {@link PagedResponse} on successful + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listAvailableLocalitiesNextSinglePageAsync( - String nextLink, Context context) { - return service.listAvailableLocalitiesNext(nextLink, context) + String nextLink, String acceptLanguage, Context context) { + final String accept = "application/json"; + return service.listAvailableLocalitiesNext(nextLink, this.client.getEndpoint(), acceptLanguage, accept, context) .map( res -> new PagedResponseBase<>( @@ -2198,14 +2366,21 @@ public Mono> listAvailableLocalitiesNextSingl * Get the next page of items. * * @param nextLink The nextLink parameter. + * @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. * @throws CommunicationErrorResponseException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a wrapper around a list of offerings. + * @return represents a wrapper around a list of offerings along with {@link PagedResponse} on successful completion + * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listOfferingsNextSinglePageAsync(String nextLink) { - return FluxUtil.withContext(context -> service.listOfferingsNext(nextLink, context)) + public Mono> listOfferingsNextSinglePageAsync( + String nextLink, String acceptLanguage) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.listOfferingsNext( + nextLink, this.client.getEndpoint(), acceptLanguage, accept, context)) .map( res -> new PagedResponseBase<>( @@ -2221,15 +2396,19 @@ public Mono> listOfferingsNextSinglePageAsync * Get the next page of items. * * @param nextLink The nextLink parameter. + * @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. * @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. - * @return represents a wrapper around a list of offerings. + * @return represents a wrapper around a list of offerings along with {@link PagedResponse} on successful completion + * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> listOfferingsNextSinglePageAsync(String nextLink, Context context) { - return service.listOfferingsNext(nextLink, context) + public Mono> listOfferingsNextSinglePageAsync( + String nextLink, String acceptLanguage, Context context) { + final String accept = "application/json"; + return service.listOfferingsNext(nextLink, this.client.getEndpoint(), acceptLanguage, accept, context) .map( res -> new PagedResponseBase<>( @@ -2248,11 +2427,14 @@ public Mono> listOfferingsNextSinglePageAsync * @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. - * @return the list of purchased phone numbers. + * @return the list of purchased phone numbers along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listPhoneNumbersNextSinglePageAsync(String nextLink) { - return FluxUtil.withContext(context -> service.listPhoneNumbersNext(nextLink, context)) + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.listPhoneNumbersNext(nextLink, this.client.getEndpoint(), accept, context)) .map( res -> new PagedResponseBase<>( @@ -2272,12 +2454,14 @@ public Mono> listPhoneNumbersNextSinglePageA * @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. - * @return the list of purchased phone numbers. + * @return the list of purchased phone numbers along with {@link PagedResponse} on successful completion of {@link + * Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> listPhoneNumbersNextSinglePageAsync( String nextLink, Context context) { - return service.listPhoneNumbersNext(nextLink, context) + final String accept = "application/json"; + return service.listPhoneNumbersNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/CommunicationError.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/CommunicationError.java index 8af08537303e..6faa242aeb4c 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/CommunicationError.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/CommunicationError.java @@ -4,13 +4,11 @@ package com.azure.communication.phonenumbers.implementation.models; -import com.azure.communication.phonenumbers.CodeCoverageAnnotation.Generated; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The CommunicationError model. */ -@Generated +/** The Communication Services error. */ @Fluent public final class CommunicationError { /* diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/CommunicationErrorResponse.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/CommunicationErrorResponse.java index 3d99b21e80f2..43cf593dca00 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/CommunicationErrorResponse.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/CommunicationErrorResponse.java @@ -4,13 +4,11 @@ package com.azure.communication.phonenumbers.implementation.models; -import com.azure.communication.phonenumbers.CodeCoverageAnnotation.Generated; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The CommunicationErrorResponse model. */ +/** The Communication Services error. */ @Fluent -@Generated public final class CommunicationErrorResponse { /* * The Communication Services error. diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/CommunicationErrorResponseException.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/CommunicationErrorResponseException.java index 3fc15d3aa72c..246a19981b61 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/CommunicationErrorResponseException.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/CommunicationErrorResponseException.java @@ -4,12 +4,10 @@ package com.azure.communication.phonenumbers.implementation.models; -import com.azure.communication.phonenumbers.CodeCoverageAnnotation.Generated; import com.azure.core.exception.HttpResponseException; import com.azure.core.http.HttpResponse; /** Exception thrown for an invalid response with CommunicationErrorResponse information. */ -@Generated public final class CommunicationErrorResponseException extends HttpResponseException { /** * Initializes a new instance of the CommunicationErrorResponseException class. diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/Error.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/Error.java new file mode 100644 index 000000000000..8ffdcac479bf --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/Error.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.phonenumbers.implementation.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Error. */ +public final class Error extends ExpandableStringEnum { + /** Static value NoError for Error. */ + public static final Error NO_ERROR = fromString("NoError"); + + /** Static value UnknownErrorCode for Error. */ + public static final Error UNKNOWN_ERROR_CODE = fromString("UnknownErrorCode"); + + /** Static value OutOfStock for Error. */ + public static final Error OUT_OF_STOCK = fromString("OutOfStock"); + + /** Static value AuthorizationDenied for Error. */ + public static final Error AUTHORIZATION_DENIED = fromString("AuthorizationDenied"); + + /** Static value MissingAddress for Error. */ + public static final Error MISSING_ADDRESS = fromString("MissingAddress"); + + /** Static value InvalidAddress for Error. */ + public static final Error INVALID_ADDRESS = fromString("InvalidAddress"); + + /** Static value InvalidOfferModel for Error. */ + public static final Error INVALID_OFFER_MODEL = fromString("InvalidOfferModel"); + + /** Static value NotEnoughLicenses for Error. */ + public static final Error NOT_ENOUGH_LICENSES = fromString("NotEnoughLicenses"); + + /** Static value NoWallet for Error. */ + public static final Error NO_WALLET = fromString("NoWallet"); + + /** Static value NotEnoughCredit for Error. */ + public static final Error NOT_ENOUGH_CREDIT = fromString("NotEnoughCredit"); + + /** Static value NumbersPartiallyAcquired for Error. */ + public static final Error NUMBERS_PARTIALLY_ACQUIRED = fromString("NumbersPartiallyAcquired"); + + /** Static value AllNumbersNotAcquired for Error. */ + public static final Error ALL_NUMBERS_NOT_ACQUIRED = fromString("AllNumbersNotAcquired"); + + /** Static value ReservationExpired for Error. */ + public static final Error RESERVATION_EXPIRED = fromString("ReservationExpired"); + + /** Static value PurchaseFailed for Error. */ + public static final Error PURCHASE_FAILED = fromString("PurchaseFailed"); + + /** Static value BillingUnavailable for Error. */ + public static final Error BILLING_UNAVAILABLE = fromString("BillingUnavailable"); + + /** Static value ProvisioningFailed for Error. */ + public static final Error PROVISIONING_FAILED = fromString("ProvisioningFailed"); + + /** Static value UnknownSearchError for Error. */ + public static final Error UNKNOWN_SEARCH_ERROR = fromString("UnknownSearchError"); + + /** + * Creates or finds a Error from its string representation. + * + * @param name a name to look for. + * @return the corresponding Error. + */ + @JsonCreator + public static Error fromString(String name) { + return fromString(name, Error.class); + } + + /** + * Gets known Error values. + * + * @return known Error values. + */ + public static Collection values() { + return values(Error.class); + } +} diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OfferingsResponse.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OfferingsResponse.java index bca1348a8d91..3d1f1d3c1cf1 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OfferingsResponse.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OfferingsResponse.java @@ -4,15 +4,13 @@ package com.azure.communication.phonenumbers.implementation.models; -import com.azure.communication.phonenumbers.CodeCoverageAnnotation.Generated; import com.azure.communication.phonenumbers.models.PhoneNumberOffering; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The OfferingsResponse model. */ +/** Represents a wrapper around a list of offerings. */ @Immutable -@Generated public final class OfferingsResponse { /* * Represents the underlying list of offerings. diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationOptions.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationOptions.java new file mode 100644 index 000000000000..bb4982e04af0 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationOptions.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.phonenumbers.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents options to modify a search request for operator information. */ +@Fluent +public final class OperatorInformationOptions { + /* + * Includes the fields operatorDetails, numberType, and isoCountryCode in + * the response. Please note: use of this option will result in additional + * costs + */ + @JsonProperty(value = "includeAdditionalOperatorDetails") + private Boolean includeAdditionalOperatorDetails; + + /** + * Get the includeAdditionalOperatorDetails property: Includes the fields operatorDetails, numberType, and + * isoCountryCode in the response. Please note: use of this option will result in additional costs. + * + * @return the includeAdditionalOperatorDetails value. + */ + public Boolean isIncludeAdditionalOperatorDetails() { + return this.includeAdditionalOperatorDetails; + } + + /** + * Set the includeAdditionalOperatorDetails property: Includes the fields operatorDetails, numberType, and + * isoCountryCode in the response. Please note: use of this option will result in additional costs. + * + * @param includeAdditionalOperatorDetails the includeAdditionalOperatorDetails value to set. + * @return the OperatorInformationOptions object itself. + */ + public OperatorInformationOptions setIncludeAdditionalOperatorDetails(Boolean includeAdditionalOperatorDetails) { + this.includeAdditionalOperatorDetails = includeAdditionalOperatorDetails; + return this; + } +} diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequest.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequest.java new file mode 100644 index 000000000000..e2862f0c026e --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequest.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.phonenumbers.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a search request for operator information for the given phone numbers. */ +@Fluent +public final class OperatorInformationRequest { + /* + * Phone number(s) whose operator information is being requested + */ + @JsonProperty(value = "phoneNumbers") + private List phoneNumbers; + + /* + * Represents options to modify a search request for operator information + */ + @JsonProperty(value = "options") + private OperatorInformationOptions options; + + /** + * Get the phoneNumbers property: Phone number(s) whose operator information is being requested. + * + * @return the phoneNumbers value. + */ + public List getPhoneNumbers() { + return this.phoneNumbers; + } + + /** + * Set the phoneNumbers property: Phone number(s) whose operator information is being requested. + * + * @param phoneNumbers the phoneNumbers value to set. + * @return the OperatorInformationRequest object itself. + */ + public OperatorInformationRequest setPhoneNumbers(List phoneNumbers) { + this.phoneNumbers = phoneNumbers; + return this; + } + + /** + * Get the options property: Represents options to modify a search request for operator information. + * + * @return the options value. + */ + public OperatorInformationOptions getOptions() { + return this.options; + } + + /** + * Set the options property: Represents options to modify a search request for operator information. + * + * @param options the options value to set. + * @return the OperatorInformationRequest object itself. + */ + public OperatorInformationRequest setOptions(OperatorInformationOptions options) { + this.options = options; + return this; + } +} diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequestOptions.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequestOptions.java new file mode 100644 index 000000000000..c9cdbcf84a98 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequestOptions.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.phonenumbers.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents options to modify a search request for operator information. */ +@Fluent +public final class OperatorInformationRequestOptions { + /* + * Includes the fields operatorDetails, numberType, and isoCountryCode in + * the response. Please note: use of this option will result in additional + * costs + */ + @JsonProperty(value = "includeAdditionalPhoneAndOperatorDetails") + private Boolean includeAdditionalPhoneAndOperatorDetails; + + /** + * Get the includeAdditionalPhoneAndOperatorDetails property: Includes the fields operatorDetails, numberType, and + * isoCountryCode in the response. Please note: use of this option will result in additional costs. + * + * @return the includeAdditionalPhoneAndOperatorDetails value. + */ + public Boolean isIncludeAdditionalPhoneAndOperatorDetails() { + return this.includeAdditionalPhoneAndOperatorDetails; + } + + /** + * Set the includeAdditionalPhoneAndOperatorDetails property: Includes the fields operatorDetails, numberType, and + * isoCountryCode in the response. Please note: use of this option will result in additional costs. + * + * @param includeAdditionalPhoneAndOperatorDetails the includeAdditionalPhoneAndOperatorDetails value to set. + * @return the OperatorInformationRequestOptions object itself. + */ + public OperatorInformationRequestOptions setIncludeAdditionalPhoneAndOperatorDetails( + Boolean includeAdditionalPhoneAndOperatorDetails) { + this.includeAdditionalPhoneAndOperatorDetails = includeAdditionalPhoneAndOperatorDetails; + return this; + } +} diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberAreaCodes.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberAreaCodes.java index e698325d511d..6ceaebb5b9bd 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberAreaCodes.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberAreaCodes.java @@ -4,15 +4,13 @@ package com.azure.communication.phonenumbers.implementation.models; -import com.azure.communication.phonenumbers.CodeCoverageAnnotation.Generated; import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The PhoneNumberAreaCodes model. */ +/** The list of available area codes. */ @Immutable -@Generated public final class PhoneNumberAreaCodes { /* * Represents a list of available toll-free area codes. diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberCapabilitiesRequest.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberCapabilitiesRequest.java index 64c1aa6477e7..97da4316da66 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberCapabilitiesRequest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberCapabilitiesRequest.java @@ -4,14 +4,12 @@ package com.azure.communication.phonenumbers.implementation.models; -import com.azure.communication.phonenumbers.CodeCoverageAnnotation.Generated; import com.azure.communication.phonenumbers.models.PhoneNumberCapabilityType; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The PhoneNumberCapabilitiesRequest model. */ +/** Capabilities of a phone number. */ @Fluent -@Generated public final class PhoneNumberCapabilitiesRequest { /* * Capability value for calling. diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberCountries.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberCountries.java index feb74b0171ab..33eef7b2fbe2 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberCountries.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberCountries.java @@ -4,15 +4,13 @@ package com.azure.communication.phonenumbers.implementation.models; -import com.azure.communication.phonenumbers.CodeCoverageAnnotation.Generated; import com.azure.communication.phonenumbers.models.PhoneNumberCountry; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The PhoneNumberCountries model. */ +/** Represents a wrapper around a list of countries. */ @Immutable -@Generated public final class PhoneNumberCountries { /* * Represents the underlying list of countries. diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberLocalities.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberLocalities.java index 345ea3e369cc..eff6de721cdb 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberLocalities.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberLocalities.java @@ -4,15 +4,13 @@ package com.azure.communication.phonenumbers.implementation.models; -import com.azure.communication.phonenumbers.CodeCoverageAnnotation.Generated; import com.azure.communication.phonenumbers.models.PhoneNumberLocality; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The PhoneNumberLocalities model. */ +/** Represents a wrapper around a list of cities or towns. */ @Immutable -@Generated public final class PhoneNumberLocalities { /* * Represents the underlying list of localities, e.g. cities or town. diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberPurchaseRequest.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberPurchaseRequest.java index a0a14467f64b..f9eca676f6b4 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberPurchaseRequest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberPurchaseRequest.java @@ -4,13 +4,11 @@ package com.azure.communication.phonenumbers.implementation.models; -import com.azure.communication.phonenumbers.CodeCoverageAnnotation.Generated; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The PhoneNumberPurchaseRequest model. */ +/** The phone number search purchase request. */ @Fluent -@Generated public final class PhoneNumberPurchaseRequest { /* * The search id. diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberRawOperation.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberRawOperation.java index 9861f11c85ec..880f519aab0b 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberRawOperation.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberRawOperation.java @@ -4,7 +4,6 @@ package com.azure.communication.phonenumbers.implementation.models; -import com.azure.communication.phonenumbers.CodeCoverageAnnotation.Generated; import com.azure.communication.phonenumbers.models.PhoneNumberOperationStatus; import com.azure.communication.phonenumbers.models.PhoneNumberOperationType; import com.azure.core.annotation.Fluent; @@ -13,7 +12,6 @@ /** The PhoneNumberRawOperation model. */ @Fluent -@Generated public final class PhoneNumberRawOperation { /* * The type of operation, e.g. Search 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 85b73cb1fa3b..b83dff58033f 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 @@ -4,16 +4,17 @@ package com.azure.communication.phonenumbers.implementation.models; -import com.azure.communication.phonenumbers.CodeCoverageAnnotation.Generated; import com.azure.communication.phonenumbers.models.PhoneNumberAssignmentType; import com.azure.communication.phonenumbers.models.PhoneNumberCapabilities; import com.azure.communication.phonenumbers.models.PhoneNumberType; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The PhoneNumberSearchRequest model. */ +/** + * Represents a phone number search request to find phone numbers. Found phone numbers are temporarily held for a + * following purchase. + */ @Fluent -@Generated public final class PhoneNumberSearchRequest { /* * The type of phone numbers to search for, e.g. geographic, or tollFree. diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberSearchResultError.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberSearchResultError.java new file mode 100644 index 000000000000..9313a8bf4139 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberSearchResultError.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.phonenumbers.implementation.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PhoneNumberSearchResultError. */ +public final class PhoneNumberSearchResultError extends ExpandableStringEnum { + /** Static value NoError for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError NO_ERROR = fromString("NoError"); + + /** Static value UnknownErrorCode for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError UNKNOWN_ERROR_CODE = fromString("UnknownErrorCode"); + + /** Static value OutOfStock for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError OUT_OF_STOCK = fromString("OutOfStock"); + + /** Static value AuthorizationDenied for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError AUTHORIZATION_DENIED = fromString("AuthorizationDenied"); + + /** Static value MissingAddress for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError MISSING_ADDRESS = fromString("MissingAddress"); + + /** Static value InvalidAddress for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError INVALID_ADDRESS = fromString("InvalidAddress"); + + /** Static value InvalidOfferModel for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError INVALID_OFFER_MODEL = fromString("InvalidOfferModel"); + + /** Static value NotEnoughLicenses for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError NOT_ENOUGH_LICENSES = fromString("NotEnoughLicenses"); + + /** Static value NoWallet for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError NO_WALLET = fromString("NoWallet"); + + /** Static value NotEnoughCredit for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError NOT_ENOUGH_CREDIT = fromString("NotEnoughCredit"); + + /** Static value NumbersPartiallyAcquired for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError NUMBERS_PARTIALLY_ACQUIRED = + fromString("NumbersPartiallyAcquired"); + + /** Static value AllNumbersNotAcquired for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError ALL_NUMBERS_NOT_ACQUIRED = fromString("AllNumbersNotAcquired"); + + /** Static value ReservationExpired for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError RESERVATION_EXPIRED = fromString("ReservationExpired"); + + /** Static value PurchaseFailed for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError PURCHASE_FAILED = fromString("PurchaseFailed"); + + /** Static value BillingUnavailable for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError BILLING_UNAVAILABLE = fromString("BillingUnavailable"); + + /** Static value ProvisioningFailed for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError PROVISIONING_FAILED = fromString("ProvisioningFailed"); + + /** Static value UnknownSearchError for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError UNKNOWN_SEARCH_ERROR = fromString("UnknownSearchError"); + + /** + * Creates or finds a PhoneNumberSearchResultError from its string representation. + * + * @param name a name to look for. + * @return the corresponding PhoneNumberSearchResultError. + */ + @JsonCreator + public static PhoneNumberSearchResultError fromString(String name) { + return fromString(name, PhoneNumberSearchResultError.class); + } + + /** + * Gets known PhoneNumberSearchResultError values. + * + * @return known PhoneNumberSearchResultError values. + */ + public static Collection values() { + return values(PhoneNumberSearchResultError.class); + } +} diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersGetOperationHeaders.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersGetOperationHeaders.java index 5b6d2a109b08..750735aec94a 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersGetOperationHeaders.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersGetOperationHeaders.java @@ -4,13 +4,11 @@ package com.azure.communication.phonenumbers.implementation.models; -import com.azure.communication.phonenumbers.CodeCoverageAnnotation.Generated; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; /** The PhoneNumbersGetOperationHeaders model. */ @Fluent -@Generated public final class PhoneNumbersGetOperationHeaders { /* * The Location property. diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersGetOperationResponse.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersGetOperationResponse.java index 5155754aed56..ab10ce0b9de7 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersGetOperationResponse.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersGetOperationResponse.java @@ -29,7 +29,11 @@ public PhoneNumbersGetOperationResponse( super(request, statusCode, rawHeaders, value, headers); } - /** @return the deserialized response body. */ + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ @Override public PhoneNumberRawOperation getValue() { return super.getValue(); diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersPurchasePhoneNumbersHeaders.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersPurchasePhoneNumbersHeaders.java index 04e19ebdafae..d1839773ea2d 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersPurchasePhoneNumbersHeaders.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersPurchasePhoneNumbersHeaders.java @@ -4,13 +4,11 @@ package com.azure.communication.phonenumbers.implementation.models; -import com.azure.communication.phonenumbers.CodeCoverageAnnotation.Generated; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; /** The PhoneNumbersPurchasePhoneNumbersHeaders model. */ @Fluent -@Generated public final class PhoneNumbersPurchasePhoneNumbersHeaders { /* * The operation-id property. diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersReleasePhoneNumberHeaders.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersReleasePhoneNumberHeaders.java index 79a04996bfcc..ed6778ee2fd3 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersReleasePhoneNumberHeaders.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersReleasePhoneNumberHeaders.java @@ -4,13 +4,11 @@ package com.azure.communication.phonenumbers.implementation.models; -import com.azure.communication.phonenumbers.CodeCoverageAnnotation.Generated; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; /** The PhoneNumbersReleasePhoneNumberHeaders model. */ @Fluent -@Generated public final class PhoneNumbersReleasePhoneNumberHeaders { /* * The release-id property. diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersSearchAvailablePhoneNumbersHeaders.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersSearchAvailablePhoneNumbersHeaders.java index cd821f23c7b8..1c0c5d37b9d8 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersSearchAvailablePhoneNumbersHeaders.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersSearchAvailablePhoneNumbersHeaders.java @@ -4,13 +4,11 @@ package com.azure.communication.phonenumbers.implementation.models; -import com.azure.communication.phonenumbers.CodeCoverageAnnotation.Generated; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; /** The PhoneNumbersSearchAvailablePhoneNumbersHeaders model. */ @Fluent -@Generated public final class PhoneNumbersSearchAvailablePhoneNumbersHeaders { /* * The operation-id property. diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersSearchAvailablePhoneNumbersResponse.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersSearchAvailablePhoneNumbersResponse.java index 885ad0f71db4..41e0b46b111f 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersSearchAvailablePhoneNumbersResponse.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersSearchAvailablePhoneNumbersResponse.java @@ -30,7 +30,11 @@ public PhoneNumbersSearchAvailablePhoneNumbersResponse( super(request, statusCode, rawHeaders, value, headers); } - /** @return the deserialized response body. */ + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ @Override public PhoneNumberSearchResult getValue() { return super.getValue(); diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersUpdateCapabilitiesHeaders.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersUpdateCapabilitiesHeaders.java index 233623fd2d94..a24924527770 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersUpdateCapabilitiesHeaders.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersUpdateCapabilitiesHeaders.java @@ -4,13 +4,11 @@ package com.azure.communication.phonenumbers.implementation.models; -import com.azure.communication.phonenumbers.CodeCoverageAnnotation.Generated; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; /** The PhoneNumbersUpdateCapabilitiesHeaders model. */ @Fluent -@Generated public final class PhoneNumbersUpdateCapabilitiesHeaders { /* * The capabilities-id property. diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersUpdateCapabilitiesResponse.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersUpdateCapabilitiesResponse.java index e8df2c4afc4e..4514062064b2 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersUpdateCapabilitiesResponse.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumbersUpdateCapabilitiesResponse.java @@ -30,7 +30,11 @@ public PhoneNumbersUpdateCapabilitiesResponse( super(request, statusCode, rawHeaders, value, headers); } - /** @return the deserialized response body. */ + /** + * Gets the deserialized response body. + * + * @return the deserialized response body. + */ @Override public PurchasedPhoneNumber getValue() { return super.getValue(); diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PurchasedPhoneNumbers.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PurchasedPhoneNumbers.java index bece66deae9f..22b42f45753e 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PurchasedPhoneNumbers.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PurchasedPhoneNumbers.java @@ -4,15 +4,13 @@ package com.azure.communication.phonenumbers.implementation.models; -import com.azure.communication.phonenumbers.CodeCoverageAnnotation.Generated; import com.azure.communication.phonenumbers.models.PurchasedPhoneNumber; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The PurchasedPhoneNumbers model. */ +/** The list of purchased phone numbers. */ @Fluent -@Generated public final class PurchasedPhoneNumbers { /* * Represents a list of phone numbers. diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/package-info.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/package-info.java index ca2fb8168ac6..407db3a212ab 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/package-info.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/package-info.java @@ -3,7 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * Package containing the implementations and inner classes for PhoneNumberAdminClient. The phone numbers client uses - * Azure Communication Services to purchase and manage phone numbers. + * Package containing the implementations for PhoneNumberAdminClient. The phone numbers client uses Azure Communication + * Services to purchase and manage phone numbers. */ package com.azure.communication.phonenumbers.implementation; diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/BillingFrequency.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/BillingFrequency.java index 2d799d007c96..4a5e7ba00c62 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/BillingFrequency.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/BillingFrequency.java @@ -3,6 +3,7 @@ // Code generated by Microsoft (R) AutoRest Code Generator. package com.azure.communication.phonenumbers.models; + import com.azure.core.util.ExpandableStringEnum; import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; @@ -23,10 +24,10 @@ public static BillingFrequency fromString(String name) { return fromString(name, BillingFrequency.class); } - /** - * Gives a Collection of BillingFrequency Values - * - * @return known BillingFrequency values. + /** + * Gets known BillingFrequency values. + * + * @return known BillingFrequency values. */ public static Collection values() { return values(BillingFrequency.class); diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorDetails.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorDetails.java new file mode 100644 index 000000000000..fb69c89585fc --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorDetails.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.phonenumbers.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents metadata describing the operator of a phone number. */ +@Immutable +public final class OperatorDetails { + /* + * Name of the phone operator + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Mobile Network Code + */ + @JsonProperty(value = "mobileNetworkCode", access = JsonProperty.Access.WRITE_ONLY) + private String mobileNetworkCode; + + /* + * Mobile Country Code + */ + @JsonProperty(value = "mobileCountryCode", access = JsonProperty.Access.WRITE_ONLY) + private String mobileCountryCode; + + /** + * Get the name property: Name of the phone operator. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * Get the mobileNetworkCode property: Mobile Network Code. + * + * @return the mobileNetworkCode value. + */ + public String getMobileNetworkCode() { + return this.mobileNetworkCode; + } + + /** + * Get the mobileCountryCode property: Mobile Country Code. + * + * @return the mobileCountryCode value. + */ + public String getMobileCountryCode() { + return this.mobileCountryCode; + } +} diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformation.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformation.java new file mode 100644 index 000000000000..410b55388d24 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformation.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.phonenumbers.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents metadata about a phone number that is controlled/provided by that phone number's operator. */ +@Immutable +public final class OperatorInformation { + /* + * E.164 formatted string representation of the phone number + */ + @JsonProperty(value = "phoneNumber", required = true, access = JsonProperty.Access.WRITE_ONLY) + private String phoneNumber; + + /* + * National format of the phone number + */ + @JsonProperty(value = "nationalFormat", access = JsonProperty.Access.WRITE_ONLY) + private String nationalFormat; + + /* + * International format of the phone number + */ + @JsonProperty(value = "internationalFormat", access = JsonProperty.Access.WRITE_ONLY) + private String internationalFormat; + + /* + * Type of service associated with the phone number + */ + @JsonProperty(value = "numberType", access = JsonProperty.Access.WRITE_ONLY) + private OperatorNumberType numberType; + + /* + * ISO 3166-1 two character ('alpha-2') code associated with the phone + * number. + */ + @JsonProperty(value = "isoCountryCode", access = JsonProperty.Access.WRITE_ONLY) + private String isoCountryCode; + + /* + * Represents metadata describing the operator of a phone number + */ + @JsonProperty(value = "operatorDetails", access = JsonProperty.Access.WRITE_ONLY) + private OperatorDetails operatorDetails; + + /** + * Get the phoneNumber property: E.164 formatted string representation of the phone number. + * + * @return the phoneNumber value. + */ + public String getPhoneNumber() { + return this.phoneNumber; + } + + /** + * Get the nationalFormat property: National format of the phone number. + * + * @return the nationalFormat value. + */ + public String getNationalFormat() { + return this.nationalFormat; + } + + /** + * Get the internationalFormat property: International format of the phone number. + * + * @return the internationalFormat value. + */ + public String getInternationalFormat() { + return this.internationalFormat; + } + + /** + * Get the numberType property: Type of service associated with the phone number. + * + * @return the numberType value. + */ + public OperatorNumberType getNumberType() { + return this.numberType; + } + + /** + * Get the isoCountryCode property: ISO 3166-1 two character ('alpha-2') code associated with the phone number. + * + * @return the isoCountryCode value. + */ + public String getIsoCountryCode() { + return this.isoCountryCode; + } + + /** + * Get the operatorDetails property: Represents metadata describing the operator of a phone number. + * + * @return the operatorDetails value. + */ + public OperatorDetails getOperatorDetails() { + return this.operatorDetails; + } +} diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationResult.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationResult.java new file mode 100644 index 000000000000..3f8c271d5b74 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationResult.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.phonenumbers.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Represents a search result containing format and operator information associated with the requested phone numbers. + */ +@Immutable +public final class OperatorInformationResult { + /* + * Results of a search. + * This array will have one entry per requested phone number which will + * contain the relevant operator information. + */ + @JsonProperty(value = "values", access = JsonProperty.Access.WRITE_ONLY) + private List values; + + /** + * Get the values property: Results of a search. This array will have one entry per requested phone number which + * will contain the relevant operator information. + * + * @return the values value. + */ + public List getValues() { + return this.values; + } +} diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorNumberType.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorNumberType.java new file mode 100644 index 000000000000..9dc622e180eb --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorNumberType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.phonenumbers.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OperatorNumberType. */ +public final class OperatorNumberType extends ExpandableStringEnum { + /** Static value unavailable for OperatorNumberType. */ + public static final OperatorNumberType UNAVAILABLE = fromString("unavailable"); + + /** Static value other for OperatorNumberType. */ + public static final OperatorNumberType OTHER = fromString("other"); + + /** Static value geographic for OperatorNumberType. */ + public static final OperatorNumberType GEOGRAPHIC = fromString("geographic"); + + /** Static value mobile for OperatorNumberType. */ + public static final OperatorNumberType MOBILE = fromString("mobile"); + + /** + * Creates or finds a OperatorNumberType from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperatorNumberType. + */ + @JsonCreator + public static OperatorNumberType fromString(String name) { + return fromString(name, OperatorNumberType.class); + } + + /** + * Gets known OperatorNumberType values. + * + * @return known OperatorNumberType values. + */ + public static Collection values() { + return values(OperatorNumberType.class); + } +} diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberAdministrativeDivision.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberAdministrativeDivision.java index 61dce61a3501..d8c6f9245fe7 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberAdministrativeDivision.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberAdministrativeDivision.java @@ -7,7 +7,7 @@ import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; -/** The PhoneNumberAdministrativeDivision model. */ +/** Represents an administrative division. e.g. state or province. */ @Immutable public final class PhoneNumberAdministrativeDivision { /* diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberAreaCode.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberAreaCode.java index 20f0f4cdebb1..c82d3211fe93 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberAreaCode.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberAreaCode.java @@ -7,9 +7,7 @@ import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; -/** - * The PhoneNumberAreaCode model. - */ +/** Represents an Area Code. */ @Immutable public final class PhoneNumberAreaCode { /* diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberAssignmentType.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberAssignmentType.java index 394760625eea..243e0860a2f9 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberAssignmentType.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberAssignmentType.java @@ -27,9 +27,9 @@ public static PhoneNumberAssignmentType fromString(String name) { return fromString(name, PhoneNumberAssignmentType.class); } - /** - * Gives a collestion ov PhoneNumberAssignmentType - * + /** + * Gets known PhoneNumberAssignmentType values. + * * @return known PhoneNumberAssignmentType values. */ public static Collection values() { diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberCapabilities.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberCapabilities.java index c6f809cc7ac2..c31e1683e256 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberCapabilities.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberCapabilities.java @@ -7,7 +7,7 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The PhoneNumberCapabilities model. */ +/** Capabilities of a phone number. */ @Fluent public final class PhoneNumberCapabilities { /* diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberCapabilityType.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberCapabilityType.java index cb7f07c39d71..8e52991b3d4e 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberCapabilityType.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberCapabilityType.java @@ -33,9 +33,9 @@ public static PhoneNumberCapabilityType fromString(String name) { return fromString(name, PhoneNumberCapabilityType.class); } - /** - * Gives a Collection of PhoneNumberCapabilityType - * + /** + * Gets known PhoneNumberCapabilityType values. + * * @return known PhoneNumberCapabilityType values. */ public static Collection values() { diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberCost.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberCost.java index a66a2f4b552f..cd5635b330d4 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberCost.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberCost.java @@ -7,7 +7,7 @@ import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; -/** The PhoneNumberCost model. */ +/** The incurred cost for a single phone number. */ @Immutable public final class PhoneNumberCost { /* diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberCountry.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberCountry.java index 525593379bc1..675f0181b7e1 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberCountry.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberCountry.java @@ -7,7 +7,7 @@ import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; -/** The PhoneNumberCountry model. */ +/** Represents a country. */ @Immutable public final class PhoneNumberCountry { /* diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberLocality.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberLocality.java index 470546892fb3..99136bca717c 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberLocality.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberLocality.java @@ -7,7 +7,7 @@ import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; -/** The PhoneNumberLocality model. */ +/** Represents a locality. */ @Immutable public final class PhoneNumberLocality { /* diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberOffering.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberOffering.java index 59d80cc5fbeb..7272cb519105 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberOffering.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberOffering.java @@ -7,7 +7,7 @@ import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; -/** The PhoneNumberOffering model. */ +/** Represents a phone number capability offering. */ @Immutable public final class PhoneNumberOffering { /* diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberOperationStatus.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberOperationStatus.java index 30c5feac9a03..d77a8de27201 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberOperationStatus.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberOperationStatus.java @@ -33,7 +33,11 @@ public static PhoneNumberOperationStatus fromString(String name) { return fromString(name, PhoneNumberOperationStatus.class); } - /** @return known PhoneNumberOperationStatus values. */ + /** + * Gets known PhoneNumberOperationStatus values. + * + * @return known PhoneNumberOperationStatus values. + */ public static Collection values() { return values(PhoneNumberOperationStatus.class); } diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberOperationType.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberOperationType.java index 1fbb70b421e7..cb15a0b29011 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberOperationType.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberOperationType.java @@ -34,10 +34,10 @@ public static PhoneNumberOperationType fromString(String name) { return fromString(name, PhoneNumberOperationType.class); } - /** - * Gives a collection of PhoneNumberOperationType values - * - * @return known PhoneNumberOperationType values + /** + * Gets known PhoneNumberOperationType values. + * + * @return known PhoneNumberOperationType values. */ public static Collection values() { return values(PhoneNumberOperationType.class); 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 5214db68b4b6..12cdffd29a5e 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 @@ -4,13 +4,13 @@ package com.azure.communication.phonenumbers.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; import java.util.List; -/** The PhoneNumberSearchResult model. */ -@Immutable +/** The result of a phone number search operation. */ +@Fluent public final class PhoneNumberSearchResult { /* * The search id. @@ -57,6 +57,18 @@ public final class PhoneNumberSearchResult { @JsonProperty(value = "searchExpiresBy", required = true, access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime searchExpiresBy; + /* + * The error code of the search. + */ + @JsonProperty(value = "errorCode") + private Integer errorCode; + + /* + * Mapping Error Messages to Codes + */ + @JsonProperty(value = "error") + private PhoneNumberSearchResultError error; + /** * Get the searchId property: The search id. * @@ -121,4 +133,44 @@ public PhoneNumberCost getCost() { public OffsetDateTime getSearchExpiresBy() { return this.searchExpiresBy; } + + /** + * Get the errorCode property: The error code of the search. + * + * @return the errorCode value. + */ + public Integer getErrorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The error code of the search. + * + * @param errorCode the errorCode value to set. + * @return the PhoneNumberSearchResult object itself. + */ + public PhoneNumberSearchResult setErrorCode(Integer errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Get the error property: Mapping Error Messages to Codes. + * + * @return the error value. + */ + public PhoneNumberSearchResultError getError() { + return this.error; + } + + /** + * Set the error property: Mapping Error Messages to Codes. + * + * @param error the error value to set. + * @return the PhoneNumberSearchResult object itself. + */ + public PhoneNumberSearchResult setError(PhoneNumberSearchResultError error) { + this.error = error; + return this; + } } diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResultError.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResultError.java new file mode 100644 index 000000000000..47db8912beb9 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResultError.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.phonenumbers.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PhoneNumberSearchResultError. */ +public final class PhoneNumberSearchResultError extends ExpandableStringEnum { + /** Static value NoError for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError NO_ERROR = fromString("NoError"); + + /** Static value UnknownErrorCode for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError UNKNOWN_ERROR_CODE = fromString("UnknownErrorCode"); + + /** Static value OutOfStock for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError OUT_OF_STOCK = fromString("OutOfStock"); + + /** Static value AuthorizationDenied for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError AUTHORIZATION_DENIED = fromString("AuthorizationDenied"); + + /** Static value MissingAddress for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError MISSING_ADDRESS = fromString("MissingAddress"); + + /** Static value InvalidAddress for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError INVALID_ADDRESS = fromString("InvalidAddress"); + + /** Static value InvalidOfferModel for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError INVALID_OFFER_MODEL = fromString("InvalidOfferModel"); + + /** Static value NotEnoughLicenses for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError NOT_ENOUGH_LICENSES = fromString("NotEnoughLicenses"); + + /** Static value NoWallet for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError NO_WALLET = fromString("NoWallet"); + + /** Static value NotEnoughCredit for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError NOT_ENOUGH_CREDIT = fromString("NotEnoughCredit"); + + /** Static value NumbersPartiallyAcquired for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError NUMBERS_PARTIALLY_ACQUIRED = + fromString("NumbersPartiallyAcquired"); + + /** Static value AllNumbersNotAcquired for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError ALL_NUMBERS_NOT_ACQUIRED = fromString("AllNumbersNotAcquired"); + + /** Static value ReservationExpired for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError RESERVATION_EXPIRED = fromString("ReservationExpired"); + + /** Static value PurchaseFailed for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError PURCHASE_FAILED = fromString("PurchaseFailed"); + + /** Static value BillingUnavailable for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError BILLING_UNAVAILABLE = fromString("BillingUnavailable"); + + /** Static value ProvisioningFailed for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError PROVISIONING_FAILED = fromString("ProvisioningFailed"); + + /** Static value UnknownSearchError for PhoneNumberSearchResultError. */ + public static final PhoneNumberSearchResultError UNKNOWN_SEARCH_ERROR = fromString("UnknownSearchError"); + + /** + * Creates or finds a PhoneNumberSearchResultError from its string representation. + * + * @param name a name to look for. + * @return the corresponding PhoneNumberSearchResultError. + */ + @JsonCreator + public static PhoneNumberSearchResultError fromString(String name) { + return fromString(name, PhoneNumberSearchResultError.class); + } + + /** + * Gets known PhoneNumberSearchResultError values. + * + * @return known PhoneNumberSearchResultError values. + */ + public static Collection values() { + return values(PhoneNumberSearchResultError.class); + } +} 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 91c09ef7c16f..e4537fd9c691 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 @@ -27,9 +27,9 @@ public static PhoneNumberType fromString(String name) { return fromString(name, PhoneNumberType.class); } - /** - * Gives a collection of PhoneNumberType values - * + /** + * Gets known PhoneNumberType values. + * * @return known PhoneNumberType values. */ public static Collection values() { 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 6f05ff05fb16..b24bd52c4f29 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 @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; -/** The PurchasedPhoneNumber model. */ +/** Represents a purchased phone number. */ @Immutable public final class PurchasedPhoneNumber { /* diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java index 3932f7eeba8c..1bf2fb647381 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java @@ -4,8 +4,7 @@ import com.azure.communication.phonenumbers.implementation.converters.PhoneNumberErrorConverter; import com.azure.communication.phonenumbers.implementation.models.CommunicationError; -import com.azure.communication.phonenumbers.models.BillingFrequency; -import com.azure.communication.phonenumbers.models.PhoneNumberAdministrativeDivision; +import com.azure.communication.phonenumbers.models.OperatorInformationResult; import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode; import com.azure.communication.phonenumbers.models.PhoneNumberAssignmentType; import com.azure.communication.phonenumbers.models.PhoneNumberCapabilities; @@ -265,7 +264,10 @@ public void getTollFreeAreaCodesWithAAD(HttpClient httpClient) { StepVerifier.create( this.getClientWithManagedIdentity(httpClient, "listAvailableTollFreeAreaCodes") .listAvailableTollFreeAreaCodes("US", PhoneNumberAssignmentType.APPLICATION).next()) - .expectAccessibleContext(); + .assertNext((PhoneNumberAreaCode areaCodes) -> { + assertNotNull(areaCodes.getAreaCode()); + }) + .verifyComplete(); } @ParameterizedTest @@ -280,7 +282,6 @@ public void getGeographicAreaCodesWithAAD(HttpClient httpClient) { .next()) .assertNext((PhoneNumberAreaCode areaCodes) -> { assertNotNull(areaCodes); - assertNotNull(areaCodes.getAreaCode()); }) .verifyComplete(); } @@ -319,7 +320,6 @@ public void getLocalitiesAdministrativeDivisionWithAAD(HttpClient httpClient) { .assertNext((PhoneNumberLocality localityWithAD) -> { assertNotNull(localityWithAD); assertEquals(localityWithAD.getAdministrativeDivision().getAbbreviatedName(), locality.getAdministrativeDivision().getAbbreviatedName()); - assertEquals(localityWithAD.getAdministrativeDivision().getLocalizedName(), locality.getAdministrativeDivision().getLocalizedName()); }) .verifyComplete(); } @@ -332,10 +332,6 @@ public void getOfferingsWithAAD(HttpClient httpClient) { .listAvailableOfferings("US", null, null).next()) .assertNext((PhoneNumberOffering offering) -> { assertNotNull(offering); - offering.getCost().getBillingFrequency(); - assertNotNull(BillingFrequency.values()); - assertNotNull(offering.getCost().getCurrencyCode()); - assertNotNull(offering.getCost().getAmount()); }) .verifyComplete(); } @@ -346,16 +342,10 @@ public void getTollFreeAreaCodes(HttpClient httpClient) { StepVerifier.create( this.getClientWithConnectionString(httpClient, "listAvailableTollFreeAreaCodes") .listAvailableTollFreeAreaCodes("US", PhoneNumberAssignmentType.APPLICATION).next()) - .expectAccessibleContext(); - } - - @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getTollFreeAreaCodesWrongCountryCode(HttpClient httpClient) { - StepVerifier.create( - this.getClientWithConnectionString(httpClient, "listAvailableTollFreeAreaCodes") - .listAvailableTollFreeAreaCodes("XX", PhoneNumberAssignmentType.APPLICATION).next()) - .expectError(); + .assertNext((PhoneNumberAreaCode areaCodes) -> { + assertNotNull(areaCodes.getAreaCode()); + }) + .verifyComplete(); } @ParameterizedTest @@ -370,22 +360,10 @@ public void getGeographicAreaCodes(HttpClient httpClient) { .next()) .assertNext((PhoneNumberAreaCode areaCodes) -> { assertNotNull(areaCodes); - assertNotNull(areaCodes.getAreaCode()); }) .verifyComplete(); } - @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getGeographicAreaCodesWronglocality(HttpClient httpClient) { - StepVerifier.create( - this.getClientWithConnectionString(httpClient, "listAvailableGeographicAreaCodes") - .listAvailableGeographicAreaCodes("US", PhoneNumberAssignmentType.PERSON, - "XX", "XX") - .next()) - .expectError(); - } - @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void getCountries(HttpClient httpClient) { @@ -413,30 +391,19 @@ public void getLocalities(HttpClient httpClient) { @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void getLocalitiesAdministrativeDivision(HttpClient httpClient) { - PhoneNumberAdministrativeDivision localityAdministraiveDivision = this.getClientWithConnectionString(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", null).blockFirst().getAdministrativeDivision(); + String localityAdministraiveDivision = this.getClientWithConnectionString(httpClient, "listAvailableLocalities") + .listAvailableLocalities("US", null).blockFirst().getAdministrativeDivision().getAbbreviatedName(); StepVerifier.create( this.getClientWithConnectionString(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", localityAdministraiveDivision.getAbbreviatedName()).next()) + .listAvailableLocalities("US", localityAdministraiveDivision).next()) .assertNext((PhoneNumberLocality locality) -> { assertNotNull(locality); assertEquals(locality.getAdministrativeDivision().getAbbreviatedName(), - localityAdministraiveDivision.getAbbreviatedName()); - assertEquals(locality.getAdministrativeDivision().getLocalizedName(), - localityAdministraiveDivision.getLocalizedName()); + localityAdministraiveDivision); }) .verifyComplete(); } - @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getLocalitiesInvalidAdministrativeDivision(HttpClient httpClient) { - StepVerifier.create( - this.getClientWithConnectionString(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", "null").next()) - .expectError(); - } - @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void getOfferings(HttpClient httpClient) { @@ -445,10 +412,6 @@ public void getOfferings(HttpClient httpClient) { .listAvailableOfferings("US", null, null).next()) .assertNext((PhoneNumberOffering offering) -> { assertNotNull(offering); - offering.getCost().getBillingFrequency(); - assertNotNull(BillingFrequency.values()); - assertNotNull(offering.getCost().getCurrencyCode()); - assertNotNull(offering.getCost().getAmount()); }) .verifyComplete(); } @@ -480,6 +443,64 @@ public void convertCommunicationErrorWithNull(HttpClient httpClient) { assertEquals(null, error); } + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void searchOperatorInformation(HttpClient httpClient) { + List phoneNumbers = new ArrayList(); + phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); + StepVerifier.create( + this.getClientWithConnectionString(httpClient, "searchOperatorInformation") + .searchOperatorInformation(phoneNumbers)) + .assertNext((OperatorInformationResult result) -> { + assertEquals(phoneNumbers.get(0), result.getValues().get(0).getPhoneNumber()); + }) + .verifyComplete(); + } + + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void searchOperatorInformationOnlyAcceptsOnePhoneNumber(HttpClient httpClient) { + List phoneNumbers = new ArrayList(); + phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); + phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); + StepVerifier.create( + this.getClientWithConnectionString(httpClient, "searchOperatorInformationOnlyAcceptsOnePhoneNumber") + .searchOperatorInformation(phoneNumbers)) + .verifyError(); + } + + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void searchOperatorInformationRespectsSearchOptions(HttpClient httpClient) { + List phoneNumbers = new ArrayList(); + phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); + StepVerifier.create( + this.getClientWithConnectionString(httpClient, "searchOperatorInformation") + .searchOperatorInformation(phoneNumbers)) + .assertNext((OperatorInformationResult result) -> { + assertEquals(phoneNumbers.get(0), result.getValues().get(0).getPhoneNumber()); + assertNotNull(result.getValues().get(0).getNationalFormat()); + assertNotNull(result.getValues().get(0).getInternationalFormat()); + assertEquals(null, result.getValues().get(0).getNumberType()); + assertEquals(null, result.getValues().get(0).getIsoCountryCode()); + assertEquals(null, result.getValues().get(0).getOperatorDetails()); + }) + .verifyComplete(); + + StepVerifier.create( + this.getClientWithConnectionString(httpClient, "searchOperatorInformation") + .searchOperatorInformation(phoneNumbers, true)) + .assertNext((OperatorInformationResult result) -> { + assertEquals(phoneNumbers.get(0), result.getValues().get(0).getPhoneNumber()); + assertNotNull(result.getValues().get(0).getNationalFormat()); + assertNotNull(result.getValues().get(0).getInternationalFormat()); + assertNotNull(result.getValues().get(0).getNumberType()); + assertNotNull(result.getValues().get(0).getIsoCountryCode()); + assertNotNull(result.getValues().get(0).getOperatorDetails()); + }) + .verifyComplete(); + } + private PollerFlux beginSearchAvailablePhoneNumbersHelper( PhoneNumbersAsyncClient client, boolean withOptions) { PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities(); diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java index 6a05ee7a5ea5..dbb73ebd6769 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java @@ -110,7 +110,7 @@ public void buildClientWithConfiguration() { public void buildClientWithServiceVersion() { // Build client with required settings and mock configuration PhoneNumbersClient phoneNumberClient = this.setupBuilderWithHttpClientWithCredential(this.clientBuilder) - .serviceVersion(PhoneNumbersServiceVersion.V2021_03_07) + .serviceVersion(PhoneNumbersServiceVersion.V2023_05_01_Preview) .buildClient(); // Validate client created with expected settings @@ -227,7 +227,7 @@ public void buildAsyncClientWithServiceVersion() { // Build client with required settings and mock configuration PhoneNumbersAsyncClient phoneNumberAsyncClient = this .setupBuilderWithHttpClientWithCredential(this.clientBuilder) - .serviceVersion(PhoneNumbersServiceVersion.V2021_03_07) + .serviceVersion(PhoneNumbersServiceVersion.V2023_05_01_Preview) .buildAsyncClient(); // Validate client created with expected settings 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 1679ab3ab2fc..1526d5b51055 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 @@ -4,8 +4,7 @@ import com.azure.communication.phonenumbers.implementation.converters.PhoneNumberErrorConverter; import com.azure.communication.phonenumbers.implementation.models.CommunicationError; -import com.azure.communication.phonenumbers.implementation.models.CommunicationErrorResponseException; -import com.azure.communication.phonenumbers.models.PhoneNumberAdministrativeDivision; +import com.azure.communication.phonenumbers.models.OperatorInformationResult; import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode; import com.azure.communication.phonenumbers.models.PhoneNumberAssignmentType; import com.azure.communication.phonenumbers.models.PhoneNumberCapabilities; @@ -36,13 +35,10 @@ import java.time.Duration; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; public class PhoneNumbersClientIntegrationTest extends PhoneNumbersIntegrationTestBase { @@ -185,54 +181,14 @@ public void beginUpdatePhoneNumberCapabilities(HttpClient httpClient) { assertEquals(PhoneNumberOperationStatus.SUCCEEDED, result.getValue().getStatus()); } - @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getTollFreeAreaCodesWithoutContext(HttpClient httpClient) { - PagedIterable areaCodesResult = this - .getClientWithConnectionString(httpClient, "listAvailableTollFreeAreaCodes") - .listAvailableTollFreeAreaCodes("US"); - List expectedAreaCodes = Arrays.asList("888", "877", "866", "855", "844", "800", "833", "88"); - for (PhoneNumberAreaCode areaCode : areaCodesResult) { - assertTrue(expectedAreaCodes.contains(areaCode.getAreaCode())); - } - assertNotNull(areaCodesResult); - } - @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void getTollFreeAreaCodes(HttpClient httpClient) { PagedIterable areaCodesResult = this .getClientWithConnectionString(httpClient, "listAvailableTollFreeAreaCodes") - .listAvailableTollFreeAreaCodes("US", Context.NONE); - List expectedAreaCodes = Arrays.asList("888", "877", "866", "855", "844", "800", "833", "88"); - for (PhoneNumberAreaCode areaCode : areaCodesResult) { - assertTrue(expectedAreaCodes.contains(areaCode.getAreaCode())); - } - assertNotNull(areaCodesResult); - } - - @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getTollFreeAreaCodesWrongCountryCode(HttpClient httpClient) { - PhoneNumbersClient client = this.getClientWithConnectionString(httpClient, "listAvailableAreaCodes"); - - assertThrows(RuntimeException.class, - () -> client.listAvailableTollFreeAreaCodes("XX", null).iterator().next(), - "Unable to parse country code."); - } - - @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getGeographicAreaCodesWithoutContext(HttpClient httpClient) { - PhoneNumberLocality locality = this.getClientWithConnectionString(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", null).iterator().next(); - PagedIterable areaCodesResult = this - .getClientWithConnectionString(httpClient, "listAvailableGeographicAreaCodes") - .listAvailableGeographicAreaCodes("US", PhoneNumberAssignmentType.PERSON, locality.getLocalizedName(), - locality.getAdministrativeDivision().getAbbreviatedName()); + .listAvailableTollFreeAreaCodes("US"); PhoneNumberAreaCode areaCodes = areaCodesResult.iterator().next(); assertNotNull(areaCodes); - assertNotNull(areaCodes.getAreaCode()); } @ParameterizedTest @@ -243,54 +199,18 @@ public void getGeographicAreaCodes(HttpClient httpClient) { PagedIterable areaCodesResult = this .getClientWithConnectionString(httpClient, "listAvailableGeographicAreaCodes") .listAvailableGeographicAreaCodes("US", PhoneNumberAssignmentType.PERSON, locality.getLocalizedName(), - locality.getAdministrativeDivision().getAbbreviatedName(), Context.NONE); + locality.getAdministrativeDivision().getAbbreviatedName()); PhoneNumberAreaCode areaCodes = areaCodesResult.iterator().next(); assertNotNull(areaCodes); - assertNotNull(areaCodes.getAreaCode()); - } - - @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getGeographicAreaCodesWrongLocality(HttpClient httpClient) { - PhoneNumbersClient client = this.getClientWithConnectionString(httpClient, "listAvailableAreaCodes"); - - assertThrows(RuntimeException.class, - () -> client.listAvailableGeographicAreaCodes("US", PhoneNumberAssignmentType.PERSON, "XX", - "XX").iterator().next(), - "No area codes were found for the given parameters"); - } - - @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getCountriesWithoutContext(HttpClient httpClient) { - PagedIterable countriesResult = this - .getClientWithConnectionString(httpClient, "listAvailableCountries").listAvailableCountries(); - PhoneNumberCountry country = countriesResult.iterator().next(); - assertNotNull(country); - assertNotNull(country.getCountryCode()); - assertNotNull(country.getLocalizedName()); } @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void getCountries(HttpClient httpClient) { PagedIterable countriesResult = this - .getClientWithConnectionString(httpClient, "listAvailableCountries") - .listAvailableCountries(Context.NONE); + .getClientWithConnectionString(httpClient, "listAvailableCountries").listAvailableCountries(); PhoneNumberCountry country = countriesResult.iterator().next(); assertNotNull(country); - assertNotNull(country.getCountryCode()); - assertNotNull(country.getLocalizedName()); - } - - @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getLocalitiesWithoutContext(HttpClient httpClient) { - PagedIterable localitiesResult = this - .getClientWithConnectionString(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", null); - PhoneNumberLocality locality = localitiesResult.iterator().next(); - assertNotNull(locality); } @ParameterizedTest @@ -298,43 +218,22 @@ public void getLocalitiesWithoutContext(HttpClient httpClient) { public void getLocalities(HttpClient httpClient) { PagedIterable localitiesResult = this .getClientWithConnectionString(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", null, Context.NONE); + .listAvailableLocalities("US", null); PhoneNumberLocality locality = localitiesResult.iterator().next(); assertNotNull(locality); } - @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getLocalitiesWithInvalidAdministrativeDivision(HttpClient httpClient) { - PhoneNumbersClient client = this.getClientWithConnectionString(httpClient, "listAvailableLocalities"); - - assertThrows(CommunicationErrorResponseException.class, - () -> client.listAvailableLocalities("US", "null").iterator().next(), - "No localities were found for the given parameters"); - } - @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void getLocalitiesWithAdministrativeDivision(HttpClient httpClient) { - PhoneNumberAdministrativeDivision localityAdministraiveDivision = this.getClientWithConnectionString(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", null).iterator().next().getAdministrativeDivision(); + String localityAdministraiveDivision = this.getClientWithConnectionString(httpClient, "listAvailableLocalities") + .listAvailableLocalities("US", null).iterator().next().getAdministrativeDivision().getAbbreviatedName(); PagedIterable localitiesResult = this .getClientWithConnectionString(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", localityAdministraiveDivision.getAbbreviatedName()); + .listAvailableLocalities("US", localityAdministraiveDivision); PhoneNumberLocality locality = localitiesResult.iterator().next(); assertNotNull(locality); - assertEquals(locality.getAdministrativeDivision().getAbbreviatedName(), localityAdministraiveDivision.getAbbreviatedName()); - assertEquals(locality.getAdministrativeDivision().getLocalizedName(), localityAdministraiveDivision.getLocalizedName()); - } - - @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getOfferingsWithoutContext(HttpClient httpClient) { - PagedIterable offeringsResult = this - .getClientWithConnectionString(httpClient, "listAvailableOfferings") - .listAvailableOfferings("US", null, null); - PhoneNumberOffering offering = offeringsResult.iterator().next(); - assertNotNull(offering); + assertEquals(locality.getAdministrativeDivision().getAbbreviatedName(), localityAdministraiveDivision); } @ParameterizedTest @@ -342,7 +241,7 @@ public void getOfferingsWithoutContext(HttpClient httpClient) { public void getOfferings(HttpClient httpClient) { PagedIterable offeringsResult = this .getClientWithConnectionString(httpClient, "listAvailableOfferings") - .listAvailableOfferings("US", null, null, Context.NONE); + .listAvailableOfferings("US", null, null); PhoneNumberOffering offering = offeringsResult.iterator().next(); assertNotNull(offering); } @@ -353,11 +252,8 @@ public void getTollFreeAreaCodesWithAAD(HttpClient httpClient) { PagedIterable areaCodesResult = this .getClientWithManagedIdentity(httpClient, "listAvailableTollFreeAreaCodes") .listAvailableTollFreeAreaCodes("US"); - List expectedAreaCodes = Arrays.asList("888", "877", "866", "855", "844", "800", "833", "88"); - for (PhoneNumberAreaCode areaCode : areaCodesResult) { - assertTrue(expectedAreaCodes.contains(areaCode.getAreaCode())); - } - assertNotNull(areaCodesResult); + PhoneNumberAreaCode areaCodes = areaCodesResult.iterator().next(); + assertNotNull(areaCodes); } @ParameterizedTest @@ -371,7 +267,6 @@ public void getGeographicAreaCodesWithAAD(HttpClient httpClient) { locality.getAdministrativeDivision().getAbbreviatedName()); PhoneNumberAreaCode areaCodes = areaCodesResult.iterator().next(); assertNotNull(areaCodes); - assertNotNull(areaCodes.getAreaCode()); } @ParameterizedTest @@ -381,8 +276,6 @@ public void getCountriesWithAAD(HttpClient httpClient) { .getClientWithManagedIdentity(httpClient, "listAvailableCountries").listAvailableCountries(); PhoneNumberCountry country = countriesResult.iterator().next(); assertNotNull(country); - assertNotNull(country.getCountryCode()); - assertNotNull(country.getLocalizedName()); } @ParameterizedTest @@ -409,7 +302,6 @@ public void getLocalitiesWithAdministrativeDivisionWithAAD(HttpClient httpClient PhoneNumberLocality locality = localitiesResult.iterator().next(); assertNotNull(locality); assertEquals(locality.getAdministrativeDivision().getAbbreviatedName(), localityWithAD.getAdministrativeDivision().getAbbreviatedName()); - assertEquals(locality.getAdministrativeDivision().getLocalizedName(), localityWithAD.getAdministrativeDivision().getLocalizedName()); } @ParameterizedTest @@ -443,10 +335,12 @@ public void convertCommunicationError(HttpClient httpClient) { @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void convertCommunicationErrorWithNull(HttpClient httpClient) { - CommunicationError communicationError = null; - PhoneNumberError error = PhoneNumberErrorConverter.convert(communicationError); - assertEquals(null, error); + public void searchOperatorInformation(HttpClient httpClient) { + List phoneNumbers = new ArrayList(); + phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); + OperatorInformationResult result = this.getClientWithConnectionString(httpClient, "searchOperatorInformation") + .searchOperatorInformation(phoneNumbers); + assertEquals(phoneNumbers.get(0), result.getValues().get(0).getPhoneNumber()); } private SyncPoller beginSearchAvailablePhoneNumbersHelper( diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java index ac819bc9e07f..aafdf05c8a22 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java @@ -53,7 +53,8 @@ protected PhoneNumbersClientBuilder getClientBuilderWithConnectionString(HttpCli private void addTestProxyMatchers() { interceptorManager.addMatchers(Arrays.asList( - new CustomMatcher().setHeadersKeyOnlyMatch(Arrays.asList("x-ms-hmac-string-to-sign-base64")))); + new CustomMatcher().setHeadersKeyOnlyMatch(Arrays.asList("x-ms-hmac-string-to-sign-base64", "x-ms-content-sha256")))); + } private void addTestProxySanitizer() { @@ -61,7 +62,8 @@ private void addTestProxySanitizer() { interceptorManager.addSanitizers(Arrays.asList( new TestProxySanitizer("(?<=/phoneNumbers/)([^/?]+)", "REDACTED", TestProxySanitizerType.URL), new TestProxySanitizer("id", null, "REDACTED", TestProxySanitizerType.BODY_KEY), - new TestProxySanitizer("phoneNumber", null, "REDACTED", TestProxySanitizerType.BODY_KEY))); + new TestProxySanitizer("phoneNumber", null, "REDACTED", TestProxySanitizerType.BODY_KEY), + new TestProxySanitizer("$..phoneNumber", null, "REDACTED", TestProxySanitizerType.BODY_KEY))); } protected PhoneNumbersClientBuilder getClientBuilderUsingManagedIdentity(HttpClient httpClient) { diff --git a/sdk/communication/azure-communication-phonenumbers/swagger/README.md b/sdk/communication/azure-communication-phonenumbers/swagger/README.md index 0f02dacaea86..7a9089727347 100644 --- a/sdk/communication/azure-communication-phonenumbers/swagger/README.md +++ b/sdk/communication/azure-communication-phonenumbers/swagger/README.md @@ -23,10 +23,10 @@ autorest README.md --java --v4 --use=@autorest/java@4.0.2 ### Code generation settings ``` yaml -tag: package-phonenumber-2022-12-01 -require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/edf1d7365a436f0b124c0cecbefd63499e049af0/specification/communication/data-plane/PhoneNumbers/readme.md +tag: package-phonenumber-2024-03-01 +require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/e91cb6ec619e2a4744f59c5391e906cfe608e569/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 +custom-types: PurchasedPhoneNumber,BillingFrequency,PhoneNumberOperationStatus,PhoneNumberOperationStatusCodes,PhoneNumberOperationType,PhoneNumberAssignmentType,PhoneNumberCapabilities,PhoneNumberCapabilityType,PhoneNumberCost,PhoneNumberSearchResult,PhoneNumberType,PhoneNumberCapability,PhoneNumberAdministrativeDivision,PhoneNumberCountry,PhoneNumberLocality,PhoneNumberOffering,AreaCodeResult,AreaCodes,PhoneNumberAreaCode,PhoneNumberSearchResultError,OperatorDetails,OperatorInformation,OperatorInformationResult,OperatorNumberType custom-types-subpackage: models models-subpackage: implementation.models java: true @@ -149,7 +149,6 @@ directive: $["properties"]["localizedName"].readOnly = true; ``` - ### Add readonly attribute to PhoneNumberLocalities properties ```yaml directive: @@ -190,4 +189,54 @@ directive: transform: > $["properties"]["localizedName"].readOnly = true; $["properties"]["countryCode"].readOnly = true; -``` \ No newline at end of file +``` + +### Add readonly attribute to OperatorDetails properties +```yaml +directive: + - from: swagger-document + where: $.definitions.OperatorDetails + transform: > + $["properties"]["name"].readOnly = true; + $["properties"]["mobileNetworkCode"].readOnly = true; + $["properties"]["mobileCountryCode"].readOnly = true; +``` + +### Add readonly attribute to OperatorInformation properties +```yaml +directive: + - from: swagger-document + where: $.definitions.OperatorInformation + transform: > + $["properties"]["phoneNumber"].readOnly = true; + $["properties"]["numberType"].readOnly = true; + $["properties"]["isoCountryCode"].readOnly = true; + $["properties"]["operatorDetails"].readOnly = true; + $["properties"]["nationalFormat"].readOnly = true; + $["properties"]["internationalFormat"].readOnly = true; +``` + +### Add readonly attribute to OperatorInformationResult properties +```yaml +directive: + - from: swagger-document + where: $.definitions.OperatorInformationResult + transform: > + $["properties"]["values"].readOnly = true; +``` + +``` yaml +directive: + from: swagger-document + where: $.definitions.PhoneNumberSearchResult.properties.error.x-ms-enum + transform: > + $["name"] = "PhoneNumberSearchResultError"; +``` + +``` yaml +directive: + from: swagger-document + where: $.parameters.Endpoint + transform: > + $["format"] = ""; +``` From 5ab29726dbbc006b09858774290a55fe8cdefb6d Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Thu, 15 Feb 2024 15:35:45 -0800 Subject: [PATCH 02/25] update generated code --- .../phonenumbers/PhoneNumbersAsyncClient.java | 14 +++++--- .../phonenumbers/PhoneNumbersClient.java | 17 ++++++---- .../PhoneNumberAdminClientImplBuilder.java | 2 +- .../models/OperatorInformationRequest.java | 2 +- .../phonenumbers/models/OperatorDetails.java | 2 +- .../models/OperatorInformation.java | 28 ++++++++-------- .../models/OperatorNumberType.java | 4 +-- ...honeNumbersAsyncClientIntegrationTest.java | 32 +++++++++---------- .../swagger/README.md | 4 +-- 9 files changed, 57 insertions(+), 48 deletions(-) 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 2d1e2ecdf0fe..6f5e75729805 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 @@ -15,7 +15,7 @@ import com.azure.communication.phonenumbers.implementation.models.PhoneNumberCapabilitiesRequest; import com.azure.communication.phonenumbers.implementation.models.PhoneNumbersUpdateCapabilitiesResponse; import com.azure.communication.phonenumbers.implementation.models.OperatorInformationRequest; -import com.azure.communication.phonenumbers.implementation.models.OperatorInformationRequestOptions; +import com.azure.communication.phonenumbers.implementation.models.OperatorInformationOptions; import com.azure.communication.phonenumbers.models.OperatorInformationResult; import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode; import com.azure.communication.phonenumbers.models.PurchasedPhoneNumber; @@ -728,23 +728,27 @@ public PagedFlux listAvailableOfferings(String countryCode, */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono searchOperatorInformation(List phoneNumbers) { - return this.searchOperatorInformation(phoneNumbers, false); + OperatorInformationRequest request = new OperatorInformationRequest(); + request.setPhoneNumbers(phoneNumbers); + request.setOptions(new OperatorInformationOptions().setIncludeAdditionalOperatorDetails(false)); + return client.operatorInformationSearchAsync(request) + .onErrorMap(CommunicationErrorResponseException.class, e -> translateException(e)); } /** * Searches for operator information for a given list of phone numbers. * * @param phoneNumbers The phone number(s) whose operator information should be searched. - * @param includeAdditionalPhoneAndOperatorDetails Modifies the search to include additional fields in the response. + * @param includeAdditionalOperatorDetails Modifies the search to include additional fields in the response. * Please note: use of this option will affect the cost of the search. * * @return A {@link OperatorInformationResult} which contains the results of the search. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> searchOperatorInformationWithResponse(List phoneNumbers, boolean includeAdditionalPhoneAndOperatorDetails) { + public Mono> searchOperatorInformationWithResponse(List phoneNumbers, boolean includeAdditionalOperatorDetails) { OperatorInformationRequest request = new OperatorInformationRequest(); request.setPhoneNumbers(phoneNumbers); - request.setOptions(new OperatorInformationRequestOptions().setIncludeAdditionalPhoneAndOperatorDetails(includeAdditionalPhoneAndOperatorDetails)); + request.setOptions(new OperatorInformationOptions().setIncludeAdditionalOperatorDetails(includeAdditionalOperatorDetails)); return client.operatorInformationSearchWithResponseAsync(request) .onErrorMap(CommunicationErrorResponseException.class, e -> translateException(e)); } 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 ee31d1ffb6c2..861a2e1fd2dc 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 @@ -8,7 +8,7 @@ import com.azure.communication.phonenumbers.implementation.PhoneNumberAdminClientImpl; import com.azure.communication.phonenumbers.implementation.PhoneNumbersImpl; import com.azure.communication.phonenumbers.implementation.models.OperatorInformationRequest; -import com.azure.communication.phonenumbers.implementation.models.OperatorInformationRequestOptions; +import com.azure.communication.phonenumbers.implementation.models.OperatorInformationOptions; import com.azure.communication.phonenumbers.models.OperatorInformationResult; import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode; import com.azure.communication.phonenumbers.models.PhoneNumberAssignmentType; @@ -709,24 +709,29 @@ public PagedIterable listAvailableOfferings(String countryC */ @ServiceMethod(returns = ReturnType.SINGLE) public OperatorInformationResult searchOperatorInformation(List phoneNumbers) { - return this.searchOperatorInformation(phoneNumbers, false); + OperatorInformationRequest request = new OperatorInformationRequest(); + request.setPhoneNumbers(phoneNumbers); + request.setOptions(new OperatorInformationOptions().setIncludeAdditionalOperatorDetails(false)); + return client.operatorInformationSearch(request); } /** * Searches for operator information for a given list of phone numbers. * * @param phoneNumbers The phone number(s) whose operator information should be searched. - * @param includeAdditionalPhoneAndOperatorDetails Modifies the search to include additional fields in the response. + * @param includeAdditionalOperatorDetails Modifies the search to include additional fields in the response. * Please note: use of this option will affect the cost of the search. * * @return A {@link OperatorInformationResult} which contains the results of the search. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response searchOperatorInformation(List phoneNumbers, - boolean includeAdditionalPhoneAndOperatorDetails) { + boolean includeAdditionalOperatorDetails, + Context context) { + context = context == null ? Context.NONE : context; OperatorInformationRequest request = new OperatorInformationRequest(); request.setPhoneNumbers(phoneNumbers); - request.setOptions(new OperatorInformationRequestOptions().setIncludeAdditionalPhoneAndOperatorDetails(includeAdditionalPhoneAndOperatorDetails)); - return client.operatorInformationSearchWithResponse(request); + request.setOptions(new OperatorInformationOptions().setIncludeAdditionalOperatorDetails(includeAdditionalOperatorDetails)); + return client.operatorInformationSearchWithResponse(request, context); } } 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 42e7f0e9ac1c..3df8f784d61d 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 @@ -222,7 +222,7 @@ public PhoneNumberAdminClientImpl buildClient() { this.pipeline = createHttpPipeline(); } if (apiVersion == null) { - this.apiVersion = "2024-03-01"; + this.apiVersion = "2024-03-01-preview"; } if (serializerAdapter == null) { this.serializerAdapter = JacksonAdapter.createDefaultSerializerAdapter(); diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequest.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequest.java index e2862f0c026e..53f95e9e31a3 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequest.java @@ -14,7 +14,7 @@ public final class OperatorInformationRequest { /* * Phone number(s) whose operator information is being requested */ - @JsonProperty(value = "phoneNumbers") + @JsonProperty(value = "phoneNumbers", required = true) private List phoneNumbers; /* diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorDetails.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorDetails.java index fb69c89585fc..d1c40ee27acc 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorDetails.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorDetails.java @@ -13,7 +13,7 @@ public final class OperatorDetails { /* * Name of the phone operator */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + @JsonProperty(value = "name", required = true, access = JsonProperty.Access.WRITE_ONLY) private String name; /* diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformation.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformation.java index 410b55388d24..d3bbe11c89a8 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformation.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformation.java @@ -28,12 +28,6 @@ public final class OperatorInformation { @JsonProperty(value = "internationalFormat", access = JsonProperty.Access.WRITE_ONLY) private String internationalFormat; - /* - * Type of service associated with the phone number - */ - @JsonProperty(value = "numberType", access = JsonProperty.Access.WRITE_ONLY) - private OperatorNumberType numberType; - /* * ISO 3166-1 two character ('alpha-2') code associated with the phone * number. @@ -41,6 +35,12 @@ public final class OperatorInformation { @JsonProperty(value = "isoCountryCode", access = JsonProperty.Access.WRITE_ONLY) private String isoCountryCode; + /* + * Type of service associated with the phone number + */ + @JsonProperty(value = "numberType", access = JsonProperty.Access.WRITE_ONLY) + private OperatorNumberType numberType; + /* * Represents metadata describing the operator of a phone number */ @@ -75,21 +75,21 @@ public String getInternationalFormat() { } /** - * Get the numberType property: Type of service associated with the phone number. + * Get the isoCountryCode property: ISO 3166-1 two character ('alpha-2') code associated with the phone number. * - * @return the numberType value. + * @return the isoCountryCode value. */ - public OperatorNumberType getNumberType() { - return this.numberType; + public String getIsoCountryCode() { + return this.isoCountryCode; } /** - * Get the isoCountryCode property: ISO 3166-1 two character ('alpha-2') code associated with the phone number. + * Get the numberType property: Type of service associated with the phone number. * - * @return the isoCountryCode value. + * @return the numberType value. */ - public String getIsoCountryCode() { - return this.isoCountryCode; + public OperatorNumberType getNumberType() { + return this.numberType; } /** diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorNumberType.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorNumberType.java index 9dc622e180eb..9f86c3654121 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorNumberType.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorNumberType.java @@ -10,8 +10,8 @@ /** Defines values for OperatorNumberType. */ public final class OperatorNumberType extends ExpandableStringEnum { - /** Static value unavailable for OperatorNumberType. */ - public static final OperatorNumberType UNAVAILABLE = fromString("unavailable"); + /** Static value unknown for OperatorNumberType. */ + public static final OperatorNumberType UNKNOWN = fromString("unknown"); /** Static value other for OperatorNumberType. */ public static final OperatorNumberType OTHER = fromString("other"); diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java index 1bf2fb647381..ee5535f615e4 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java @@ -476,27 +476,27 @@ public void searchOperatorInformationRespectsSearchOptions(HttpClient httpClient phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); StepVerifier.create( this.getClientWithConnectionString(httpClient, "searchOperatorInformation") - .searchOperatorInformation(phoneNumbers)) - .assertNext((OperatorInformationResult result) -> { - assertEquals(phoneNumbers.get(0), result.getValues().get(0).getPhoneNumber()); - assertNotNull(result.getValues().get(0).getNationalFormat()); - assertNotNull(result.getValues().get(0).getInternationalFormat()); - assertEquals(null, result.getValues().get(0).getNumberType()); - assertEquals(null, result.getValues().get(0).getIsoCountryCode()); - assertEquals(null, result.getValues().get(0).getOperatorDetails()); + .searchOperatorInformationWithResponse(phoneNumbers, false)) + .assertNext((Response result) -> { + assertEquals(phoneNumbers.get(0), result.getValue().getValues().get(0).getPhoneNumber()); + assertNotNull(result.getValue().getValues().get(0).getNationalFormat()); + assertNotNull(result.getValue().getValues().get(0).getInternationalFormat()); + assertEquals(null, result.getValue().getValues().get(0).getNumberType()); + assertEquals(null, result.getValue().getValues().get(0).getIsoCountryCode()); + assertEquals(null, result.getValue().getValues().get(0).getOperatorDetails()); }) .verifyComplete(); StepVerifier.create( this.getClientWithConnectionString(httpClient, "searchOperatorInformation") - .searchOperatorInformation(phoneNumbers, true)) - .assertNext((OperatorInformationResult result) -> { - assertEquals(phoneNumbers.get(0), result.getValues().get(0).getPhoneNumber()); - assertNotNull(result.getValues().get(0).getNationalFormat()); - assertNotNull(result.getValues().get(0).getInternationalFormat()); - assertNotNull(result.getValues().get(0).getNumberType()); - assertNotNull(result.getValues().get(0).getIsoCountryCode()); - assertNotNull(result.getValues().get(0).getOperatorDetails()); + .searchOperatorInformationWithResponse(phoneNumbers, true)) + .assertNext((Response result) -> { + assertEquals(phoneNumbers.get(0), result.getValue().getValues().get(0).getPhoneNumber()); + assertNotNull(result.getValue().getValues().get(0).getNationalFormat()); + assertNotNull(result.getValue().getValues().get(0).getInternationalFormat()); + assertNotNull(result.getValue().getValues().get(0).getNumberType()); + assertNotNull(result.getValue().getValues().get(0).getIsoCountryCode()); + assertNotNull(result.getValue().getValues().get(0).getOperatorDetails()); }) .verifyComplete(); } diff --git a/sdk/communication/azure-communication-phonenumbers/swagger/README.md b/sdk/communication/azure-communication-phonenumbers/swagger/README.md index 7a9089727347..bea840923739 100644 --- a/sdk/communication/azure-communication-phonenumbers/swagger/README.md +++ b/sdk/communication/azure-communication-phonenumbers/swagger/README.md @@ -23,8 +23,8 @@ autorest README.md --java --v4 --use=@autorest/java@4.0.2 ### Code generation settings ``` yaml -tag: package-phonenumber-2024-03-01 -require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/e91cb6ec619e2a4744f59c5391e906cfe608e569/specification/communication/data-plane/PhoneNumbers/readme.md +tag: package-phonenumber-2024-03-01-preview +require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/b56afb26c5450157006a3a1d9be57bae429051a2/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,PhoneNumberSearchResultError,OperatorDetails,OperatorInformation,OperatorInformationResult,OperatorNumberType custom-types-subpackage: models From 2e5bae79b68312374503d086fe034abe92489b8d Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Thu, 22 Feb 2024 10:26:16 -0800 Subject: [PATCH 03/25] update test recordings --- sdk/communication/azure-communication-phonenumbers/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/communication/azure-communication-phonenumbers/assets.json b/sdk/communication/azure-communication-phonenumbers/assets.json index 6927bef02db0..2874c0ee7cdb 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_04198d656b" + "Tag": "java/communication/azure-communication-phonenumbers_aa89446716" } From c6dcf5683346dcb0fb0df188d0480fff72363cbe Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Thu, 22 Feb 2024 10:29:28 -0800 Subject: [PATCH 04/25] update package to beta version --- sdk/communication/azure-communication-phonenumbers/CHANGELOG.md | 2 +- sdk/communication/azure-communication-phonenumbers/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md b/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md index f843b15cf380..f5b359a67a67 100644 --- a/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md +++ b/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 1.2.0 (2024-03-01) +## 1.2.0-beta.2 (2024-03-01) ### Features Added - Add support for number lookup diff --git a/sdk/communication/azure-communication-phonenumbers/pom.xml b/sdk/communication/azure-communication-phonenumbers/pom.xml index bca50a85acad..193614c2fbab 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.2.0 + 1.2.0-beta.2 Microsoft Azure client phone numbers library for communication From 474271339735363a6ea5b37251f51e2b8c518445 Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Thu, 22 Feb 2024 10:38:17 -0800 Subject: [PATCH 05/25] update service version --- .../phonenumbers/PhoneNumbersServiceVersion.java | 10 +++++----- .../phonenumbers/PhoneNumbersClientBuilderTest.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) 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 d60f50fb93cb..b30996e3c88e 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 @@ -10,14 +10,14 @@ */ public enum PhoneNumbersServiceVersion implements ServiceVersion { /** - * Latest stable service version {@code 2024-03-01} + * Service version {@code 2021-03-07}. */ - V2024_03_01("2024-03-01"), + V2021_03_07("2021-03-07"), /** - * Number Lookup preview version {@code 2023-05-01-preview} + * Number Lookup update to public preview {@code 2024-03-01-preview} */ - V2023_05_01_Preview("2023-05-01-preview"); + V2024_03_01_Preview("2024-03-01-preview"); private final String version; @@ -42,6 +42,6 @@ public String getVersion() { */ public static PhoneNumbersServiceVersion getLatest() { - return V2024_03_01; + return V2024_03_01_Preview; } } diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java index dbb73ebd6769..9938bd5675e2 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java @@ -110,7 +110,7 @@ public void buildClientWithConfiguration() { public void buildClientWithServiceVersion() { // Build client with required settings and mock configuration PhoneNumbersClient phoneNumberClient = this.setupBuilderWithHttpClientWithCredential(this.clientBuilder) - .serviceVersion(PhoneNumbersServiceVersion.V2023_05_01_Preview) + .serviceVersion(PhoneNumbersServiceVersion.V2024_03_01_Preview) .buildClient(); // Validate client created with expected settings @@ -227,7 +227,7 @@ public void buildAsyncClientWithServiceVersion() { // Build client with required settings and mock configuration PhoneNumbersAsyncClient phoneNumberAsyncClient = this .setupBuilderWithHttpClientWithCredential(this.clientBuilder) - .serviceVersion(PhoneNumbersServiceVersion.V2023_05_01_Preview) + .serviceVersion(PhoneNumbersServiceVersion.V2024_03_01_Preview) .buildAsyncClient(); // Validate client created with expected settings From 5486811f479c4cb899bd705017f9dff2fcd3369c Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Thu, 22 Feb 2024 11:13:35 -0800 Subject: [PATCH 06/25] fix build issues --- eng/versioning/version_client.txt | 2 +- .../azure/communication/phonenumbers/PhoneNumbersClient.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 586ecf1aee08..3fb3830b54d0 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -74,7 +74,7 @@ com.azure:azure-communication-email;1.0.9;1.1.0-beta.1 com.azure:azure-communication-identity;1.5.1;1.6.0-beta.1 com.azure:azure-communication-jobrouter;1.1.0;1.2.0-beta.1 com.azure:azure-communication-networktraversal;1.1.0-beta.2;1.1.0-beta.3 -com.azure:azure-communication-phonenumbers;1.1.9;1.2.0-beta.1 +com.azure:azure-communication-phonenumbers;1.1.9;1.2.0-beta.2 com.azure:azure-communication-rooms;1.0.7;1.1.0-beta.2 com.azure:azure-communication-sms;1.1.20;1.2.0-beta.1 com.azure:azure-containers-containerregistry;1.2.4;1.3.0-beta.1 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 861a2e1fd2dc..97f085814a6d 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 @@ -721,6 +721,7 @@ public OperatorInformationResult searchOperatorInformation(List phoneNum * @param phoneNumbers The phone number(s) whose operator information should be searched. * @param includeAdditionalOperatorDetails Modifies the search to include additional fields in the response. * Please note: use of this option will affect the cost of the search. + * @param context A {@link Context} representing the request context. * * @return A {@link OperatorInformationResult} which contains the results of the search. */ From b0c5ef8cd62ef93c8f2691096d9bff2f2e951033 Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Thu, 22 Feb 2024 11:46:04 -0800 Subject: [PATCH 07/25] fix linting issue --- .../azure/communication/phonenumbers/PhoneNumbersClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 97f085814a6d..0d43aa45582f 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 @@ -726,7 +726,7 @@ public OperatorInformationResult searchOperatorInformation(List phoneNum * @return A {@link OperatorInformationResult} which contains the results of the search. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response searchOperatorInformation(List phoneNumbers, + public Response searchOperatorInformationWithResponse(List phoneNumbers, boolean includeAdditionalOperatorDetails, Context context) { context = context == null ? Context.NONE : context; From 6b6674d519a42eebb2a3f2d1abc44af6cf29c219 Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Thu, 7 Mar 2024 11:34:50 -0800 Subject: [PATCH 08/25] update to address comments, restore unintentionally modified tests --- ...honeNumbersAsyncClientIntegrationTest.java | 2 +- .../PhoneNumbersClientIntegrationTest.java | 156 +++++++++++++----- .../PhoneNumbersIntegrationTestBase.java | 5 +- 3 files changed, 115 insertions(+), 48 deletions(-) diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java index ee5535f615e4..faa1d025ce62 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java @@ -445,7 +445,7 @@ public void convertCommunicationErrorWithNull(HttpClient httpClient) { @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void searchOperatorInformation(HttpClient httpClient) { + public void searchOperatorInformationSucceeds(HttpClient httpClient) { List phoneNumbers = new ArrayList(); phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); StepVerifier.create( 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 1526d5b51055..03b6ca2653ea 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 @@ -183,12 +183,38 @@ public void beginUpdatePhoneNumberCapabilities(HttpClient httpClient) { @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getTollFreeAreaCodes(HttpClient httpClient) { + public void getTollFreeAreaCodesWithoutContext(HttpClient httpClient) { PagedIterable areaCodesResult = this .getClientWithConnectionString(httpClient, "listAvailableTollFreeAreaCodes") .listAvailableTollFreeAreaCodes("US"); - PhoneNumberAreaCode areaCodes = areaCodesResult.iterator().next(); - assertNotNull(areaCodes); + List expectedAreaCodes = Arrays.asList("888", "877", "866", "855", "844", "800", "833", "88"); + for (PhoneNumberAreaCode areaCode : areaCodesResult) { + assertTrue(expectedAreaCodes.contains(areaCode.getAreaCode())); + } + assertNotNull(areaCodesResult); + } + + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void getTollFreeAreaCodes(HttpClient httpClient) { + PagedIterable areaCodesResult = this + .getClientWithConnectionString(httpClient, "listAvailableTollFreeAreaCodes") + .listAvailableTollFreeAreaCodes("US", Context.NONE); + List expectedAreaCodes = Arrays.asList("888", "877", "866", "855", "844", "800", "833", "88"); + for (PhoneNumberAreaCode areaCode : areaCodesResult) { + assertTrue(expectedAreaCodes.contains(areaCode.getAreaCode())); + } + assertNotNull(areaCodesResult); + } + + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void getTollFreeAreaCodesWrongCountryCode(HttpClient httpClient) { + PhoneNumbersClient client = this.getClientWithConnectionString(httpClient, "listAvailableAreaCodes"); + + assertThrows(RuntimeException.class, + () -> client.listAvailableTollFreeAreaCodes("XX", null).iterator().next(), + "Unable to parse country code."); } @ParameterizedTest @@ -199,18 +225,54 @@ public void getGeographicAreaCodes(HttpClient httpClient) { PagedIterable areaCodesResult = this .getClientWithConnectionString(httpClient, "listAvailableGeographicAreaCodes") .listAvailableGeographicAreaCodes("US", PhoneNumberAssignmentType.PERSON, locality.getLocalizedName(), - locality.getAdministrativeDivision().getAbbreviatedName()); + locality.getAdministrativeDivision().getAbbreviatedName(), Context.NONE); PhoneNumberAreaCode areaCodes = areaCodesResult.iterator().next(); assertNotNull(areaCodes); + assertNotNull(areaCodes.getAreaCode()); } @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getCountries(HttpClient httpClient) { + public void getGeographicAreaCodesWrongLocality(HttpClient httpClient) { + PhoneNumbersClient client = this.getClientWithConnectionString(httpClient, "listAvailableAreaCodes"); + + assertThrows(RuntimeException.class, + () -> client.listAvailableGeographicAreaCodes("US", PhoneNumberAssignmentType.PERSON, "XX", + "XX").iterator().next(), + "No area codes were found for the given parameters"); + } + + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void getCountriesWithoutContext(HttpClient httpClient) { PagedIterable countriesResult = this .getClientWithConnectionString(httpClient, "listAvailableCountries").listAvailableCountries(); PhoneNumberCountry country = countriesResult.iterator().next(); assertNotNull(country); + assertNotNull(country.getCountryCode()); + assertNotNull(country.getLocalizedName()); + } + + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void getCountries(HttpClient httpClient) { + PagedIterable countriesResult = this + .getClientWithConnectionString(httpClient, "listAvailableCountries") + .listAvailableCountries(Context.NONE); + PhoneNumberCountry country = countriesResult.iterator().next(); + assertNotNull(country); + assertNotNull(country.getCountryCode()); + assertNotNull(country.getLocalizedName()); + } + + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void getLocalitiesWithoutContext(HttpClient httpClient) { + PagedIterable localitiesResult = this + .getClientWithConnectionString(httpClient, "listAvailableLocalities") + .listAvailableLocalities("US", null, Context.NONE); + PhoneNumberLocality locality = localitiesResult.iterator().next(); + assertNotNull(locality); } @ParameterizedTest @@ -223,22 +285,33 @@ public void getLocalities(HttpClient httpClient) { assertNotNull(locality); } + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void getLocalitiesWithInvalidAdministrativeDivision(HttpClient httpClient) { + PhoneNumbersClient client = this.getClientWithConnectionString(httpClient, "listAvailableLocalities"); + + assertThrows(CommunicationErrorResponseException.class, + () -> client.listAvailableLocalities("US", "null").iterator().next(), + "No localities were found for the given parameters"); + } + @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void getLocalitiesWithAdministrativeDivision(HttpClient httpClient) { - String localityAdministraiveDivision = this.getClientWithConnectionString(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", null).iterator().next().getAdministrativeDivision().getAbbreviatedName(); + PhoneNumberAdministrativeDivision localityAdministraiveDivision = this.getClientWithConnectionString(httpClient, "listAvailableLocalities") + .listAvailableLocalities("US", null).iterator().next().getAdministrativeDivision(); PagedIterable localitiesResult = this .getClientWithConnectionString(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", localityAdministraiveDivision); + .listAvailableLocalities("US", localityAdministraiveDivision.getAbbreviatedName()); PhoneNumberLocality locality = localitiesResult.iterator().next(); assertNotNull(locality); - assertEquals(locality.getAdministrativeDivision().getAbbreviatedName(), localityAdministraiveDivision); + assertEquals(locality.getAdministrativeDivision().getAbbreviatedName(), localityAdministraiveDivision.getAbbreviatedName()); + assertEquals(locality.getAdministrativeDivision().getLocalizedName(), localityAdministraiveDivision.getLocalizedName()); } @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getOfferings(HttpClient httpClient) { + public void getOfferingsWithoutContext(HttpClient httpClient) { PagedIterable offeringsResult = this .getClientWithConnectionString(httpClient, "listAvailableOfferings") .listAvailableOfferings("US", null, null); @@ -248,60 +321,47 @@ public void getOfferings(HttpClient httpClient) { @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getTollFreeAreaCodesWithAAD(HttpClient httpClient) { + public void getOfferings(HttpClient httpClient) { + PagedIterable offeringsResult = this + .getClientWithConnectionString(httpClient, "listAvailableOfferings") + .listAvailableOfferings("US", null, null, Context.NONE); + PhoneNumberOffering offering = offeringsResult.iterator().next(); + assertNotNull(offering); + } + @@ -353,11 +252,8 @@ public void getTollFreeAreaCodesWithAAD(HttpClient httpClient) { PagedIterable areaCodesResult = this .getClientWithManagedIdentity(httpClient, "listAvailableTollFreeAreaCodes") .listAvailableTollFreeAreaCodes("US"); - PhoneNumberAreaCode areaCodes = areaCodesResult.iterator().next(); - assertNotNull(areaCodes); + List expectedAreaCodes = Arrays.asList("888", "877", "866", "855", "844", "800", "833", "88"); + for (PhoneNumberAreaCode areaCode : areaCodesResult) { + assertTrue(expectedAreaCodes.contains(areaCode.getAreaCode())); + } + assertNotNull(areaCodesResult); } @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getGeographicAreaCodesWithAAD(HttpClient httpClient) { - PhoneNumberLocality locality = this.getClientWithConnectionString(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", null).iterator().next(); - PagedIterable areaCodesResult = this - .getClientWithManagedIdentity(httpClient, "listAvailableGeographicAreaCodes") - .listAvailableGeographicAreaCodes("US", PhoneNumberAssignmentType.PERSON, locality.getLocalizedName(), + @@ -371,7 +267,6 @@ public void getGeographicAreaCodesWithAAD(HttpClient httpClient) { locality.getAdministrativeDivision().getAbbreviatedName()); PhoneNumberAreaCode areaCodes = areaCodesResult.iterator().next(); assertNotNull(areaCodes); + assertNotNull(areaCodes.getAreaCode()); } @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getCountriesWithAAD(HttpClient httpClient) { - PagedIterable countriesResult = this + @@ -381,8 +276,6 @@ public void getCountriesWithAAD(HttpClient httpClient) { .getClientWithManagedIdentity(httpClient, "listAvailableCountries").listAvailableCountries(); PhoneNumberCountry country = countriesResult.iterator().next(); assertNotNull(country); + assertNotNull(country.getCountryCode()); + assertNotNull(country.getLocalizedName()); } @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getLocalitiesWithAAD(HttpClient httpClient) { - PagedIterable localitiesResult = this - .getClientWithManagedIdentity(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", null); - PhoneNumberLocality locality = localitiesResult.iterator().next(); - assertNotNull(locality); - } - - @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getLocalitiesWithAdministrativeDivisionWithAAD(HttpClient httpClient) { - PagedIterable localities = this - .getClientWithManagedIdentity(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", null); - PhoneNumberLocality localityWithAD = localities.iterator().next(); - - PagedIterable localitiesResult = this - .getClientWithManagedIdentity(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", localityWithAD.getAdministrativeDivision().getAbbreviatedName()); + @@ -409,7 +302,6 @@ public void getLocalitiesWithAdministrativeDivisionWithAAD(HttpClient httpClient PhoneNumberLocality locality = localitiesResult.iterator().next(); assertNotNull(locality); assertEquals(locality.getAdministrativeDivision().getAbbreviatedName(), localityWithAD.getAdministrativeDivision().getAbbreviatedName()); + assertEquals(locality.getAdministrativeDivision().getLocalizedName(), localityWithAD.getAdministrativeDivision().getLocalizedName()); } @ParameterizedTest @@ -335,7 +395,15 @@ public void convertCommunicationError(HttpClient httpClient) { @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void searchOperatorInformation(HttpClient httpClient) { + public void convertCommunicationErrorWithNull(HttpClient httpClient) { + CommunicationError communicationError = null; + PhoneNumberError error = PhoneNumberErrorConverter.convert(communicationError); + assertEquals(null, error); + } + + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void searchOperatorInformationSucceeds(HttpClient httpClient) { List phoneNumbers = new ArrayList(); phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); OperatorInformationResult result = this.getClientWithConnectionString(httpClient, "searchOperatorInformation") diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java index aafdf05c8a22..1255b039f334 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java @@ -53,7 +53,7 @@ protected PhoneNumbersClientBuilder getClientBuilderWithConnectionString(HttpCli private void addTestProxyMatchers() { interceptorManager.addMatchers(Arrays.asList( - new CustomMatcher().setHeadersKeyOnlyMatch(Arrays.asList("x-ms-hmac-string-to-sign-base64", "x-ms-content-sha256")))); + new CustomMatcher().setHeadersKeyOnlyMatch(Arrays.asList("x-ms-hmac-string-to-sign-base64")))); } @@ -62,8 +62,7 @@ private void addTestProxySanitizer() { interceptorManager.addSanitizers(Arrays.asList( new TestProxySanitizer("(?<=/phoneNumbers/)([^/?]+)", "REDACTED", TestProxySanitizerType.URL), new TestProxySanitizer("id", null, "REDACTED", TestProxySanitizerType.BODY_KEY), - new TestProxySanitizer("phoneNumber", null, "REDACTED", TestProxySanitizerType.BODY_KEY), - new TestProxySanitizer("$..phoneNumber", null, "REDACTED", TestProxySanitizerType.BODY_KEY))); + new TestProxySanitizer("phoneNumber", null, "REDACTED", TestProxySanitizerType.BODY_KEY))); } protected PhoneNumbersClientBuilder getClientBuilderUsingManagedIdentity(HttpClient httpClient) { From 05a84ea0d4c1538377062d6e1740fb631efb5333 Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Thu, 7 Mar 2024 11:52:25 -0800 Subject: [PATCH 09/25] restore unintentionally modified tests --- ...honeNumbersAsyncClientIntegrationTest.java | 62 ++++++++++++++----- .../PhoneNumbersClientIntegrationTest.java | 56 +++++++++++++++-- .../PhoneNumbersIntegrationTestBase.java | 1 - 3 files changed, 95 insertions(+), 24 deletions(-) diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java index faa1d025ce62..055f0e39f339 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java @@ -264,10 +264,7 @@ public void getTollFreeAreaCodesWithAAD(HttpClient httpClient) { StepVerifier.create( this.getClientWithManagedIdentity(httpClient, "listAvailableTollFreeAreaCodes") .listAvailableTollFreeAreaCodes("US", PhoneNumberAssignmentType.APPLICATION).next()) - .assertNext((PhoneNumberAreaCode areaCodes) -> { - assertNotNull(areaCodes.getAreaCode()); - }) - .verifyComplete(); + .expectAccessibleContext(); } @ParameterizedTest @@ -282,6 +279,7 @@ public void getGeographicAreaCodesWithAAD(HttpClient httpClient) { .next()) .assertNext((PhoneNumberAreaCode areaCodes) -> { assertNotNull(areaCodes); + assertNotNull(areaCodes.getAreaCode()); }) .verifyComplete(); } @@ -320,6 +318,7 @@ public void getLocalitiesAdministrativeDivisionWithAAD(HttpClient httpClient) { .assertNext((PhoneNumberLocality localityWithAD) -> { assertNotNull(localityWithAD); assertEquals(localityWithAD.getAdministrativeDivision().getAbbreviatedName(), locality.getAdministrativeDivision().getAbbreviatedName()); + assertEquals(localityWithAD.getAdministrativeDivision().getLocalizedName(), locality.getAdministrativeDivision().getLocalizedName()); }) .verifyComplete(); } @@ -332,7 +331,10 @@ public void getOfferingsWithAAD(HttpClient httpClient) { .listAvailableOfferings("US", null, null).next()) .assertNext((PhoneNumberOffering offering) -> { assertNotNull(offering); - }) + offering.getCost().getBillingFrequency(); + assertNotNull(BillingFrequency.values()); + assertNotNull(offering.getCost().getCurrencyCode()); + assertNotNull(offering.getCost().getAmount()); }) .verifyComplete(); } @@ -342,7 +344,23 @@ public void getTollFreeAreaCodes(HttpClient httpClient) { StepVerifier.create( this.getClientWithConnectionString(httpClient, "listAvailableTollFreeAreaCodes") .listAvailableTollFreeAreaCodes("US", PhoneNumberAssignmentType.APPLICATION).next()) + .expectAccessibleContext(); + } + + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void getTollFreeAreaCodesWrongCountryCode(HttpClient httpClient) { + StepVerifier.create( + this.getClientWithConnectionString(httpClient, "listAvailableTollFreeAreaCodes") + .listAvailableTollFreeAreaCodes("XX", PhoneNumberAssignmentType.APPLICATION).next()) + .expectError(); + } + + @ParameterizedTest + public void getGeographicAreaCodes(HttpClient httpClient) { + .next()) .assertNext((PhoneNumberAreaCode areaCodes) -> { + assertNotNull(areaCodes); assertNotNull(areaCodes.getAreaCode()); }) .verifyComplete(); @@ -350,18 +368,13 @@ public void getTollFreeAreaCodes(HttpClient httpClient) { @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void getGeographicAreaCodes(HttpClient httpClient) { - PhoneNumberLocality locality = this.getClientWithConnectionString(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", null).blockFirst(); + public void getGeographicAreaCodesWronglocality(HttpClient httpClient) { StepVerifier.create( this.getClientWithConnectionString(httpClient, "listAvailableGeographicAreaCodes") .listAvailableGeographicAreaCodes("US", PhoneNumberAssignmentType.PERSON, - locality.getLocalizedName(), locality.getAdministrativeDivision().getAbbreviatedName()) + "XX", "XX") .next()) - .assertNext((PhoneNumberAreaCode areaCodes) -> { - assertNotNull(areaCodes); - }) - .verifyComplete(); + .expectError(); } @ParameterizedTest @@ -391,19 +404,30 @@ public void getLocalities(HttpClient httpClient) { @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void getLocalitiesAdministrativeDivision(HttpClient httpClient) { - String localityAdministraiveDivision = this.getClientWithConnectionString(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", null).blockFirst().getAdministrativeDivision().getAbbreviatedName(); + PhoneNumberAdministrativeDivision localityAdministraiveDivision = this.getClientWithConnectionString(httpClient, "listAvailableLocalities") + .listAvailableLocalities("US", null).blockFirst().getAdministrativeDivision(); StepVerifier.create( this.getClientWithConnectionString(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", localityAdministraiveDivision).next()) + .listAvailableLocalities("US", localityAdministraiveDivision.getAbbreviatedName()).next()) .assertNext((PhoneNumberLocality locality) -> { assertNotNull(locality); assertEquals(locality.getAdministrativeDivision().getAbbreviatedName(), - localityAdministraiveDivision); + localityAdministraiveDivision.getAbbreviatedName()); + assertEquals(locality.getAdministrativeDivision().getLocalizedName(), + localityAdministraiveDivision.getLocalizedName()); }) .verifyComplete(); } + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void getLocalitiesInvalidAdministrativeDivision(HttpClient httpClient) { + StepVerifier.create( + this.getClientWithConnectionString(httpClient, "listAvailableLocalities") + .listAvailableLocalities("US", "null").next()) + .expectError(); + } + @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void getOfferings(HttpClient httpClient) { @@ -412,6 +436,10 @@ public void getOfferings(HttpClient httpClient) { .listAvailableOfferings("US", null, null).next()) .assertNext((PhoneNumberOffering offering) -> { assertNotNull(offering); + offering.getCost().getBillingFrequency(); + assertNotNull(BillingFrequency.values()); + assertNotNull(offering.getCost().getCurrencyCode()); + assertNotNull(offering.getCost().getAmount()); }) .verifyComplete(); } 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 03b6ca2653ea..fc61e2e8995c 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 @@ -217,6 +217,20 @@ public void getTollFreeAreaCodesWrongCountryCode(HttpClient httpClient) { "Unable to parse country code."); } + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void getGeographicAreaCodesWithoutContext(HttpClient httpClient) { + PhoneNumberLocality locality = this.getClientWithConnectionString(httpClient, "listAvailableLocalities") + .listAvailableLocalities("US", null).iterator().next(); + PagedIterable areaCodesResult = this + .getClientWithConnectionString(httpClient, "listAvailableGeographicAreaCodes") + .listAvailableGeographicAreaCodes("US", PhoneNumberAssignmentType.PERSON, locality.getLocalizedName(), + locality.getAdministrativeDivision().getAbbreviatedName()); + PhoneNumberAreaCode areaCodes = areaCodesResult.iterator().next(); + assertNotNull(areaCodes); + assertNotNull(areaCodes.getAreaCode()); + } + @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void getGeographicAreaCodes(HttpClient httpClient) { @@ -270,7 +284,7 @@ public void getCountries(HttpClient httpClient) { public void getLocalitiesWithoutContext(HttpClient httpClient) { PagedIterable localitiesResult = this .getClientWithConnectionString(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", null, Context.NONE); + .listAvailableLocalities("US", null); PhoneNumberLocality locality = localitiesResult.iterator().next(); assertNotNull(locality); } @@ -280,7 +294,7 @@ public void getLocalitiesWithoutContext(HttpClient httpClient) { public void getLocalities(HttpClient httpClient) { PagedIterable localitiesResult = this .getClientWithConnectionString(httpClient, "listAvailableLocalities") - .listAvailableLocalities("US", null); + .listAvailableLocalities("US", null, Context.NONE); PhoneNumberLocality locality = localitiesResult.iterator().next(); assertNotNull(locality); } @@ -328,7 +342,10 @@ public void getOfferings(HttpClient httpClient) { PhoneNumberOffering offering = offeringsResult.iterator().next(); assertNotNull(offering); } - @@ -353,11 +252,8 @@ public void getTollFreeAreaCodesWithAAD(HttpClient httpClient) { + + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void getTollFreeAreaCodesWithAAD(HttpClient httpClient) { PagedIterable areaCodesResult = this .getClientWithManagedIdentity(httpClient, "listAvailableTollFreeAreaCodes") .listAvailableTollFreeAreaCodes("US"); @@ -340,7 +357,13 @@ public void getOfferings(HttpClient httpClient) { } @ParameterizedTest - @@ -371,7 +267,6 @@ public void getGeographicAreaCodesWithAAD(HttpClient httpClient) { + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void getGeographicAreaCodesWithAAD(HttpClient httpClient) { + PhoneNumberLocality locality = this.getClientWithConnectionString(httpClient, "listAvailableLocalities") + .listAvailableLocalities("US", null).iterator().next(); + PagedIterable areaCodesResult = this + .getClientWithManagedIdentity(httpClient, "listAvailableGeographicAreaCodes") + .listAvailableGeographicAreaCodes("US", PhoneNumberAssignmentType.PERSON, locality.getLocalizedName(), locality.getAdministrativeDivision().getAbbreviatedName()); PhoneNumberAreaCode areaCodes = areaCodesResult.iterator().next(); assertNotNull(areaCodes); @@ -348,7 +371,9 @@ public void getOfferings(HttpClient httpClient) { } @ParameterizedTest - @@ -381,8 +276,6 @@ public void getCountriesWithAAD(HttpClient httpClient) { + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void getCountriesWithAAD(HttpClient httpClient) { + PagedIterable countriesResult = this .getClientWithManagedIdentity(httpClient, "listAvailableCountries").listAvailableCountries(); PhoneNumberCountry country = countriesResult.iterator().next(); assertNotNull(country); @@ -357,7 +382,26 @@ public void getOfferings(HttpClient httpClient) { } @ParameterizedTest - @@ -409,7 +302,6 @@ public void getLocalitiesWithAdministrativeDivisionWithAAD(HttpClient httpClient + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void getLocalitiesWithAAD(HttpClient httpClient) { + PagedIterable localitiesResult = this + .getClientWithManagedIdentity(httpClient, "listAvailableLocalities") + .listAvailableLocalities("US", null); + PhoneNumberLocality locality = localitiesResult.iterator().next(); + assertNotNull(locality); + } + + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void getLocalitiesWithAdministrativeDivisionWithAAD(HttpClient httpClient) { + PagedIterable localities = this + .getClientWithManagedIdentity(httpClient, "listAvailableLocalities") + .listAvailableLocalities("US", null); + PhoneNumberLocality localityWithAD = localities.iterator().next(); + + PagedIterable localitiesResult = this + .getClientWithManagedIdentity(httpClient, "listAvailableLocalities") + .listAvailableLocalities("US", localityWithAD.getAdministrativeDivision().getAbbreviatedName()); PhoneNumberLocality locality = localitiesResult.iterator().next(); assertNotNull(locality); assertEquals(locality.getAdministrativeDivision().getAbbreviatedName(), localityWithAD.getAdministrativeDivision().getAbbreviatedName()); diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java index 1255b039f334..ac819bc9e07f 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java @@ -54,7 +54,6 @@ protected PhoneNumbersClientBuilder getClientBuilderWithConnectionString(HttpCli private void addTestProxyMatchers() { interceptorManager.addMatchers(Arrays.asList( new CustomMatcher().setHeadersKeyOnlyMatch(Arrays.asList("x-ms-hmac-string-to-sign-base64")))); - } private void addTestProxySanitizer() { From 26fc8842b9d899b3d58595ea1ed994ef277eb5ca Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Thu, 7 Mar 2024 11:58:10 -0800 Subject: [PATCH 10/25] restore unintentionally modified tests --- .../PhoneNumbersAsyncClientIntegrationTest.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java index 055f0e39f339..f6eeffb75e13 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java @@ -334,7 +334,8 @@ public void getOfferingsWithAAD(HttpClient httpClient) { offering.getCost().getBillingFrequency(); assertNotNull(BillingFrequency.values()); assertNotNull(offering.getCost().getCurrencyCode()); - assertNotNull(offering.getCost().getAmount()); }) + assertNotNull(offering.getCost().getAmount()); + }) .verifyComplete(); } @@ -357,7 +358,14 @@ public void getTollFreeAreaCodesWrongCountryCode(HttpClient httpClient) { } @ParameterizedTest - public void getGeographicAreaCodes(HttpClient httpClient) { + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void getGeographicAreaCodes(HttpClient httpClient) { + PhoneNumberLocality locality = this.getClientWithConnectionString(httpClient, "listAvailableLocalities") + .listAvailableLocalities("US", null).blockFirst(); + StepVerifier.create( + this.getClientWithConnectionString(httpClient, "listAvailableGeographicAreaCodes") + .listAvailableGeographicAreaCodes("US", PhoneNumberAssignmentType.PERSON, + locality.getLocalizedName(), locality.getAdministrativeDivision().getAbbreviatedName()) .next()) .assertNext((PhoneNumberAreaCode areaCodes) -> { assertNotNull(areaCodes); From 8b796fb710e341476f55ec05dd937ad919dc7c4e Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Thu, 7 Mar 2024 12:02:28 -0800 Subject: [PATCH 11/25] fix version_client --- eng/versioning/version_client.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index b531b3827664..57692445b944 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -77,7 +77,7 @@ com.azure:azure-communication-identity;1.5.2;1.6.0-beta.1 com.azure:azure-communication-jobrouter;1.1.1;1.2.0-beta.1 com.azure:azure-communication-messages;1.0.0;1.1.0-beta.1 com.azure:azure-communication-networktraversal;1.1.0-beta.2;1.1.0-beta.3 -com.azure:azure-communication-phonenumbers;1.1.9;1.2.0-beta.2 +com.azure:azure-communication-phonenumbers;1.1.10;1.2.0-beta.2 com.azure:azure-communication-rooms;1.0.8;1.1.0-beta.2 com.azure:azure-communication-sms;1.1.21;1.2.0-beta.1 com.azure:azure-containers-containerregistry;1.2.5;1.3.0-beta.1 From 5b25f95b92ccfec7a26c8406007142ecf2248267 Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Mon, 11 Mar 2024 11:06:15 -0700 Subject: [PATCH 12/25] fix import statements --- .../phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java | 4 +++- .../phonenumbers/PhoneNumbersClientIntegrationTest.java | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java index f6eeffb75e13..e36dfa1af738 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java @@ -4,6 +4,8 @@ import com.azure.communication.phonenumbers.implementation.converters.PhoneNumberErrorConverter; import com.azure.communication.phonenumbers.implementation.models.CommunicationError; +import com.azure.communication.phonenumbers.models.BillingFrequency; +import com.azure.communication.phonenumbers.models.PhoneNumberAdministrativeDivision; import com.azure.communication.phonenumbers.models.OperatorInformationResult; import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode; import com.azure.communication.phonenumbers.models.PhoneNumberAssignmentType; @@ -335,7 +337,7 @@ public void getOfferingsWithAAD(HttpClient httpClient) { assertNotNull(BillingFrequency.values()); assertNotNull(offering.getCost().getCurrencyCode()); assertNotNull(offering.getCost().getAmount()); - }) + }) .verifyComplete(); } 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 fc61e2e8995c..230c107c8488 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 @@ -4,6 +4,8 @@ import com.azure.communication.phonenumbers.implementation.converters.PhoneNumberErrorConverter; import com.azure.communication.phonenumbers.implementation.models.CommunicationError; +import com.azure.communication.phonenumbers.implementation.models.CommunicationErrorResponseException; +import com.azure.communication.phonenumbers.models.PhoneNumberAdministrativeDivision; import com.azure.communication.phonenumbers.models.OperatorInformationResult; import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode; import com.azure.communication.phonenumbers.models.PhoneNumberAssignmentType; @@ -35,10 +37,13 @@ import java.time.Duration; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; public class PhoneNumbersClientIntegrationTest extends PhoneNumbersIntegrationTestBase { From 69cdcf32435d0712f04aa93fc8d41b9728036880 Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Mon, 11 Mar 2024 14:32:43 -0700 Subject: [PATCH 13/25] update test files --- .../azure-communication-phonenumbers/assets.json | 2 +- .../PhoneNumbersAsyncClientIntegrationTest.java | 8 ++++---- .../phonenumbers/PhoneNumbersClientIntegrationTest.java | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sdk/communication/azure-communication-phonenumbers/assets.json b/sdk/communication/azure-communication-phonenumbers/assets.json index 2874c0ee7cdb..5d37ddafc840 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_aa89446716" + "Tag": "java/communication/azure-communication-phonenumbers_32d1d8523f" } diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java index e36dfa1af738..7f49a6a40cfa 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java @@ -485,7 +485,7 @@ public void convertCommunicationErrorWithNull(HttpClient httpClient) { @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void searchOperatorInformationSucceeds(HttpClient httpClient) { List phoneNumbers = new ArrayList(); - phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); + phoneNumbers.add(getTestPhoneNumber()); StepVerifier.create( this.getClientWithConnectionString(httpClient, "searchOperatorInformation") .searchOperatorInformation(phoneNumbers)) @@ -499,8 +499,8 @@ public void searchOperatorInformationSucceeds(HttpClient httpClient) { @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void searchOperatorInformationOnlyAcceptsOnePhoneNumber(HttpClient httpClient) { List phoneNumbers = new ArrayList(); - phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); - phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); + phoneNumbers.add(getTestPhoneNumber()); + phoneNumbers.add(getTestPhoneNumber()); StepVerifier.create( this.getClientWithConnectionString(httpClient, "searchOperatorInformationOnlyAcceptsOnePhoneNumber") .searchOperatorInformation(phoneNumbers)) @@ -511,7 +511,7 @@ public void searchOperatorInformationOnlyAcceptsOnePhoneNumber(HttpClient httpCl @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void searchOperatorInformationRespectsSearchOptions(HttpClient httpClient) { List phoneNumbers = new ArrayList(); - phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); + phoneNumbers.add(getTestPhoneNumber()); StepVerifier.create( this.getClientWithConnectionString(httpClient, "searchOperatorInformation") .searchOperatorInformationWithResponse(phoneNumbers, false)) 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 230c107c8488..7850abfd3f8b 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 @@ -454,7 +454,7 @@ public void convertCommunicationErrorWithNull(HttpClient httpClient) { @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void searchOperatorInformationSucceeds(HttpClient httpClient) { List phoneNumbers = new ArrayList(); - phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); + phoneNumbers.add(getTestPhoneNumber()); OperatorInformationResult result = this.getClientWithConnectionString(httpClient, "searchOperatorInformation") .searchOperatorInformation(phoneNumbers); assertEquals(phoneNumbers.get(0), result.getValues().get(0).getPhoneNumber()); From fe45ae2cf39e4ca31f6ae3aaaeead3b420ad07f5 Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Mon, 11 Mar 2024 15:27:53 -0700 Subject: [PATCH 14/25] update test files --- sdk/communication/azure-communication-phonenumbers/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/communication/azure-communication-phonenumbers/assets.json b/sdk/communication/azure-communication-phonenumbers/assets.json index 5d37ddafc840..2d13ca4dc1f5 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_32d1d8523f" + "Tag": "java/communication/azure-communication-phonenumbers_80a6c1f2d3" } From 99fc1b83f6fbeff678af66aefaf4f62a42414dbf Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Mon, 11 Mar 2024 16:15:06 -0700 Subject: [PATCH 15/25] update test files --- sdk/communication/azure-communication-phonenumbers/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/communication/azure-communication-phonenumbers/assets.json b/sdk/communication/azure-communication-phonenumbers/assets.json index 2d13ca4dc1f5..c427745a8d36 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_80a6c1f2d3" + "Tag": "java/communication/azure-communication-phonenumbers_565298ea1c" } From 7d83d1305162995b4df007743f761c423afb32ef Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Tue, 12 Mar 2024 09:24:56 -0700 Subject: [PATCH 16/25] update searchOperatorInformation tests to redact phone number --- .../PhoneNumbersAsyncClientIntegrationTest.java | 8 ++++---- .../phonenumbers/PhoneNumbersClientIntegrationTest.java | 2 +- .../phonenumbers/PhoneNumbersIntegrationTestBase.java | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java index 7f49a6a40cfa..e36dfa1af738 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java @@ -485,7 +485,7 @@ public void convertCommunicationErrorWithNull(HttpClient httpClient) { @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void searchOperatorInformationSucceeds(HttpClient httpClient) { List phoneNumbers = new ArrayList(); - phoneNumbers.add(getTestPhoneNumber()); + phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); StepVerifier.create( this.getClientWithConnectionString(httpClient, "searchOperatorInformation") .searchOperatorInformation(phoneNumbers)) @@ -499,8 +499,8 @@ public void searchOperatorInformationSucceeds(HttpClient httpClient) { @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void searchOperatorInformationOnlyAcceptsOnePhoneNumber(HttpClient httpClient) { List phoneNumbers = new ArrayList(); - phoneNumbers.add(getTestPhoneNumber()); - phoneNumbers.add(getTestPhoneNumber()); + phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); + phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); StepVerifier.create( this.getClientWithConnectionString(httpClient, "searchOperatorInformationOnlyAcceptsOnePhoneNumber") .searchOperatorInformation(phoneNumbers)) @@ -511,7 +511,7 @@ public void searchOperatorInformationOnlyAcceptsOnePhoneNumber(HttpClient httpCl @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void searchOperatorInformationRespectsSearchOptions(HttpClient httpClient) { List phoneNumbers = new ArrayList(); - phoneNumbers.add(getTestPhoneNumber()); + phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); StepVerifier.create( this.getClientWithConnectionString(httpClient, "searchOperatorInformation") .searchOperatorInformationWithResponse(phoneNumbers, false)) 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 7850abfd3f8b..230c107c8488 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 @@ -454,7 +454,7 @@ public void convertCommunicationErrorWithNull(HttpClient httpClient) { @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void searchOperatorInformationSucceeds(HttpClient httpClient) { List phoneNumbers = new ArrayList(); - phoneNumbers.add(getTestPhoneNumber()); + phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); OperatorInformationResult result = this.getClientWithConnectionString(httpClient, "searchOperatorInformation") .searchOperatorInformation(phoneNumbers); assertEquals(phoneNumbers.get(0), result.getValues().get(0).getPhoneNumber()); diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java index ac819bc9e07f..f2c77968b32d 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java @@ -61,7 +61,8 @@ private void addTestProxySanitizer() { interceptorManager.addSanitizers(Arrays.asList( new TestProxySanitizer("(?<=/phoneNumbers/)([^/?]+)", "REDACTED", TestProxySanitizerType.URL), new TestProxySanitizer("id", null, "REDACTED", TestProxySanitizerType.BODY_KEY), - new TestProxySanitizer("phoneNumber", null, "REDACTED", TestProxySanitizerType.BODY_KEY))); + new TestProxySanitizer("phoneNumber", null, "REDACTED", TestProxySanitizerType.BODY_KEY), + new TestProxySanitizer("((?:\\u002B)[0-9]{11,})|((?:\\%2B)[0-9]{11,})|((?:[+]?)[0-9]{11,})", "REDACTED", TestProxySanitizerType.BODY_REGEX))); } protected PhoneNumbersClientBuilder getClientBuilderUsingManagedIdentity(HttpClient httpClient) { From 45aac947260d7452c7a2a11e67b5e76f7ded5be3 Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Tue, 12 Mar 2024 10:44:42 -0700 Subject: [PATCH 17/25] update with latest tests --- .../azure-communication-phonenumbers/assets.json | 2 +- .../PhoneNumbersAsyncClientIntegrationTest.java | 4 ++++ .../phonenumbers/PhoneNumbersClientIntegrationTest.java | 2 ++ .../phonenumbers/PhoneNumbersIntegrationTestBase.java | 6 ++++-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sdk/communication/azure-communication-phonenumbers/assets.json b/sdk/communication/azure-communication-phonenumbers/assets.json index c427745a8d36..c940e2e82b3e 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_565298ea1c" + "Tag": "java/communication/azure-communication-phonenumbers_42aeb17d3a" } diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java index e36dfa1af738..73218dd44a20 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java @@ -25,6 +25,7 @@ import com.azure.communication.phonenumbers.models.ReleasePhoneNumberResult; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; +import com.azure.core.test.annotation.RecordWithoutRequestBody; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollerFlux; @@ -482,6 +483,7 @@ public void convertCommunicationErrorWithNull(HttpClient httpClient) { } @ParameterizedTest + @RecordWithoutRequestBody @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void searchOperatorInformationSucceeds(HttpClient httpClient) { List phoneNumbers = new ArrayList(); @@ -496,6 +498,7 @@ public void searchOperatorInformationSucceeds(HttpClient httpClient) { } @ParameterizedTest + @RecordWithoutRequestBody @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void searchOperatorInformationOnlyAcceptsOnePhoneNumber(HttpClient httpClient) { List phoneNumbers = new ArrayList(); @@ -508,6 +511,7 @@ public void searchOperatorInformationOnlyAcceptsOnePhoneNumber(HttpClient httpCl } @ParameterizedTest + @RecordWithoutRequestBody @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void searchOperatorInformationRespectsSearchOptions(HttpClient httpClient) { List phoneNumbers = new ArrayList(); 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 230c107c8488..548c8c53eb2a 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 @@ -26,6 +26,7 @@ import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; +import com.azure.core.test.annotation.RecordWithoutRequestBody; import com.azure.core.test.TestMode; import com.azure.core.util.Context; import com.azure.core.util.polling.LongRunningOperationStatus; @@ -451,6 +452,7 @@ public void convertCommunicationErrorWithNull(HttpClient httpClient) { } @ParameterizedTest + @RecordWithoutRequestBody @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void searchOperatorInformationSucceeds(HttpClient httpClient) { List phoneNumbers = new ArrayList(); diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java index f2c77968b32d..26aa46aa6246 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java @@ -53,7 +53,7 @@ protected PhoneNumbersClientBuilder getClientBuilderWithConnectionString(HttpCli private void addTestProxyMatchers() { interceptorManager.addMatchers(Arrays.asList( - new CustomMatcher().setHeadersKeyOnlyMatch(Arrays.asList("x-ms-hmac-string-to-sign-base64")))); + new CustomMatcher().setExcludedHeaders(Arrays.asList("x-ms-content-sha256", "x-ms-hmac-string-to-sign-base64")))); } private void addTestProxySanitizer() { @@ -62,7 +62,9 @@ private void addTestProxySanitizer() { new TestProxySanitizer("(?<=/phoneNumbers/)([^/?]+)", "REDACTED", TestProxySanitizerType.URL), new TestProxySanitizer("id", null, "REDACTED", TestProxySanitizerType.BODY_KEY), new TestProxySanitizer("phoneNumber", null, "REDACTED", TestProxySanitizerType.BODY_KEY), - new TestProxySanitizer("((?:\\u002B)[0-9]{11,})|((?:\\%2B)[0-9]{11,})|((?:[+]?)[0-9]{11,})", "REDACTED", TestProxySanitizerType.BODY_REGEX))); + new TestProxySanitizer("..phoneNumber", null, "REDACTED", TestProxySanitizerType.BODY_KEY), + new TestProxySanitizer("..nationalFormat", null, "REDACTED", TestProxySanitizerType.BODY_KEY), + new TestProxySanitizer("..internationalFormat", null, "REDACTED", TestProxySanitizerType.BODY_KEY))); } protected PhoneNumbersClientBuilder getClientBuilderUsingManagedIdentity(HttpClient httpClient) { From 4118d600b699c44cd4ded95fca4ff9db1a68b7a4 Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Tue, 12 Mar 2024 11:33:04 -0700 Subject: [PATCH 18/25] update tests and recordings --- .../azure-communication-phonenumbers/assets.json | 2 +- .../PhoneNumbersAsyncClientIntegrationTest.java | 4 ---- .../PhoneNumbersClientIntegrationTest.java | 2 -- .../PhoneNumbersIntegrationTestBase.java | 13 +++++++------ 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/sdk/communication/azure-communication-phonenumbers/assets.json b/sdk/communication/azure-communication-phonenumbers/assets.json index c940e2e82b3e..130b628d7c9e 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_42aeb17d3a" + "Tag": "java/communication/azure-communication-phonenumbers_294a133a28" } diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java index 73218dd44a20..e36dfa1af738 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java @@ -25,7 +25,6 @@ import com.azure.communication.phonenumbers.models.ReleasePhoneNumberResult; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.Response; -import com.azure.core.test.annotation.RecordWithoutRequestBody; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.LongRunningOperationStatus; import com.azure.core.util.polling.PollerFlux; @@ -483,7 +482,6 @@ public void convertCommunicationErrorWithNull(HttpClient httpClient) { } @ParameterizedTest - @RecordWithoutRequestBody @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void searchOperatorInformationSucceeds(HttpClient httpClient) { List phoneNumbers = new ArrayList(); @@ -498,7 +496,6 @@ public void searchOperatorInformationSucceeds(HttpClient httpClient) { } @ParameterizedTest - @RecordWithoutRequestBody @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void searchOperatorInformationOnlyAcceptsOnePhoneNumber(HttpClient httpClient) { List phoneNumbers = new ArrayList(); @@ -511,7 +508,6 @@ public void searchOperatorInformationOnlyAcceptsOnePhoneNumber(HttpClient httpCl } @ParameterizedTest - @RecordWithoutRequestBody @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void searchOperatorInformationRespectsSearchOptions(HttpClient httpClient) { List phoneNumbers = new ArrayList(); 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 548c8c53eb2a..230c107c8488 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 @@ -26,7 +26,6 @@ import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; -import com.azure.core.test.annotation.RecordWithoutRequestBody; import com.azure.core.test.TestMode; import com.azure.core.util.Context; import com.azure.core.util.polling.LongRunningOperationStatus; @@ -452,7 +451,6 @@ public void convertCommunicationErrorWithNull(HttpClient httpClient) { } @ParameterizedTest - @RecordWithoutRequestBody @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void searchOperatorInformationSucceeds(HttpClient httpClient) { List phoneNumbers = new ArrayList(); diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java index 26aa46aa6246..942f4ebfa746 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java @@ -53,18 +53,19 @@ protected PhoneNumbersClientBuilder getClientBuilderWithConnectionString(HttpCli private void addTestProxyMatchers() { interceptorManager.addMatchers(Arrays.asList( - new CustomMatcher().setExcludedHeaders(Arrays.asList("x-ms-content-sha256", "x-ms-hmac-string-to-sign-base64")))); + new CustomMatcher() + .setHeadersKeyOnlyMatch(Arrays.asList("x-ms-content-sha256", "x-ms-hmac-string-to-sign-base64")))); } private void addTestProxySanitizer() { // sanitize phone numbers interceptorManager.addSanitizers(Arrays.asList( new TestProxySanitizer("(?<=/phoneNumbers/)([^/?]+)", "REDACTED", TestProxySanitizerType.URL), - new TestProxySanitizer("id", null, "REDACTED", TestProxySanitizerType.BODY_KEY), - new TestProxySanitizer("phoneNumber", null, "REDACTED", TestProxySanitizerType.BODY_KEY), - new TestProxySanitizer("..phoneNumber", null, "REDACTED", TestProxySanitizerType.BODY_KEY), - new TestProxySanitizer("..nationalFormat", null, "REDACTED", TestProxySanitizerType.BODY_KEY), - new TestProxySanitizer("..internationalFormat", null, "REDACTED", TestProxySanitizerType.BODY_KEY))); + new TestProxySanitizer("$..id", null, "REDACTED", TestProxySanitizerType.BODY_KEY), + new TestProxySanitizer("$..phoneNumbers", null, "REDACTED", TestProxySanitizerType.BODY_KEY), + new TestProxySanitizer("$..phoneNumber", null, "REDACTED", TestProxySanitizerType.BODY_KEY), + new TestProxySanitizer("$..nationalFormat", null, "REDACTED", TestProxySanitizerType.BODY_KEY), + new TestProxySanitizer("$..internationalFormat", null, "REDACTED", TestProxySanitizerType.BODY_KEY))); } protected PhoneNumbersClientBuilder getClientBuilderUsingManagedIdentity(HttpClient httpClient) { From 0d54adc58dae830244b9c792b6a5099cb5762c49 Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Tue, 12 Mar 2024 22:37:25 -0700 Subject: [PATCH 19/25] update test files to redact phoneNumbers in request body for searchOperatorInformation tests --- sdk/communication/azure-communication-phonenumbers/assets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/communication/azure-communication-phonenumbers/assets.json b/sdk/communication/azure-communication-phonenumbers/assets.json index 130b628d7c9e..807b62689b88 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_294a133a28" + "Tag": "java/communication/azure-communication-phonenumbers_6e6b87e6c7" } From 0c9c76c5249a443cc91b447c5ce00452012095ea Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Wed, 13 Mar 2024 11:10:07 -0700 Subject: [PATCH 20/25] remove setters on return type fields --- .../models/PhoneNumberSearchResult.java | 35 ++++--------------- .../swagger/README.md | 3 ++ 2 files changed, 10 insertions(+), 28 deletions(-) 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 12cdffd29a5e..e72051d08df1 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 @@ -4,13 +4,14 @@ package com.azure.communication.phonenumbers.models; -import com.azure.core.annotation.Fluent; +import com.azure.communication.phonenumbers.implementation.models.Error; +import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; import java.util.List; /** The result of a phone number search operation. */ -@Fluent +@Immutable public final class PhoneNumberSearchResult { /* * The search id. @@ -60,14 +61,14 @@ public final class PhoneNumberSearchResult { /* * The error code of the search. */ - @JsonProperty(value = "errorCode") + @JsonProperty(value = "errorCode", access = JsonProperty.Access.WRITE_ONLY) private Integer errorCode; /* * Mapping Error Messages to Codes */ - @JsonProperty(value = "error") - private PhoneNumberSearchResultError error; + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private Error error; /** * Get the searchId property: The search id. @@ -143,34 +144,12 @@ public Integer getErrorCode() { return this.errorCode; } - /** - * Set the errorCode property: The error code of the search. - * - * @param errorCode the errorCode value to set. - * @return the PhoneNumberSearchResult object itself. - */ - public PhoneNumberSearchResult setErrorCode(Integer errorCode) { - this.errorCode = errorCode; - return this; - } - /** * Get the error property: Mapping Error Messages to Codes. * * @return the error value. */ - public PhoneNumberSearchResultError getError() { + public Error getError() { return this.error; } - - /** - * Set the error property: Mapping Error Messages to Codes. - * - * @param error the error value to set. - * @return the PhoneNumberSearchResult object itself. - */ - public PhoneNumberSearchResult setError(PhoneNumberSearchResultError error) { - this.error = error; - return this; - } } diff --git a/sdk/communication/azure-communication-phonenumbers/swagger/README.md b/sdk/communication/azure-communication-phonenumbers/swagger/README.md index bea840923739..d7b70c577d3d 100644 --- a/sdk/communication/azure-communication-phonenumbers/swagger/README.md +++ b/sdk/communication/azure-communication-phonenumbers/swagger/README.md @@ -80,6 +80,8 @@ directive: $["properties"]["phoneNumberType"].readOnly = true; $["properties"]["assignmentType"].readOnly = true; $["properties"]["capabilities"].readOnly = true; + $["properties"]["error"].readOnly = true; + $["properties"]["errorCode"].readOnly = true; ``` ### Rename PhoneNumberOperation to PhoneNumberRawOperation @@ -231,6 +233,7 @@ directive: where: $.definitions.PhoneNumberSearchResult.properties.error.x-ms-enum transform: > $["name"] = "PhoneNumberSearchResultError"; + $[""].readOnly = true; ``` ``` yaml From 6c257f36ef8094a028f8824bb281a2d120aedbe3 Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Wed, 13 Mar 2024 11:55:36 -0700 Subject: [PATCH 21/25] update based on API view comments --- .../azure-communication-phonenumbers/assets.json | 2 +- .../phonenumbers/PhoneNumbersAsyncClient.java | 8 ++++---- .../communication/phonenumbers/PhoneNumbersClient.java | 8 ++++---- .../PhoneNumbersAsyncClientIntegrationTest.java | 8 ++++++-- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/sdk/communication/azure-communication-phonenumbers/assets.json b/sdk/communication/azure-communication-phonenumbers/assets.json index 807b62689b88..5a56ee2179ca 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_6e6b87e6c7" + "Tag": "java/communication/azure-communication-phonenumbers_5e142143d6" } 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 6f5e75729805..c1254ce27033 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 @@ -739,16 +739,16 @@ public Mono searchOperatorInformation(List ph * Searches for operator information for a given list of phone numbers. * * @param phoneNumbers The phone number(s) whose operator information should be searched. - * @param includeAdditionalOperatorDetails Modifies the search to include additional fields in the response. - * Please note: use of this option will affect the cost of the search. + * @param requestOptions Modifies the search to include additional fields in the response. + * Please note: use of options will affect the cost of the search. * * @return A {@link OperatorInformationResult} which contains the results of the search. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> searchOperatorInformationWithResponse(List phoneNumbers, boolean includeAdditionalOperatorDetails) { + public Mono> searchOperatorInformationWithResponse(List phoneNumbers, OperatorInformationOptions requestOptions) { OperatorInformationRequest request = new OperatorInformationRequest(); request.setPhoneNumbers(phoneNumbers); - request.setOptions(new OperatorInformationOptions().setIncludeAdditionalOperatorDetails(includeAdditionalOperatorDetails)); + request.setOptions(requestOptions); return client.operatorInformationSearchWithResponseAsync(request) .onErrorMap(CommunicationErrorResponseException.class, e -> translateException(e)); } 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 0d43aa45582f..c50e6e418687 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 @@ -719,20 +719,20 @@ public OperatorInformationResult searchOperatorInformation(List phoneNum * Searches for operator information for a given list of phone numbers. * * @param phoneNumbers The phone number(s) whose operator information should be searched. - * @param includeAdditionalOperatorDetails Modifies the search to include additional fields in the response. - * Please note: use of this option will affect the cost of the search. + * @param requestOptions Modifies the search to include additional fields in the response. + * Please note: use of options will affect the cost of the search. * @param context A {@link Context} representing the request context. * * @return A {@link OperatorInformationResult} which contains the results of the search. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response searchOperatorInformationWithResponse(List phoneNumbers, - boolean includeAdditionalOperatorDetails, + OperatorInformationOptions requestOptions, Context context) { context = context == null ? Context.NONE : context; OperatorInformationRequest request = new OperatorInformationRequest(); request.setPhoneNumbers(phoneNumbers); - request.setOptions(new OperatorInformationOptions().setIncludeAdditionalOperatorDetails(includeAdditionalOperatorDetails)); + request.setOptions(requestOptions); return client.operatorInformationSearchWithResponse(request, context); } } diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java index e36dfa1af738..41dbbf399649 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java @@ -4,6 +4,7 @@ import com.azure.communication.phonenumbers.implementation.converters.PhoneNumberErrorConverter; import com.azure.communication.phonenumbers.implementation.models.CommunicationError; +import com.azure.communication.phonenumbers.implementation.models.OperatorInformationOptions; import com.azure.communication.phonenumbers.models.BillingFrequency; import com.azure.communication.phonenumbers.models.PhoneNumberAdministrativeDivision; import com.azure.communication.phonenumbers.models.OperatorInformationResult; @@ -512,9 +513,11 @@ public void searchOperatorInformationOnlyAcceptsOnePhoneNumber(HttpClient httpCl public void searchOperatorInformationRespectsSearchOptions(HttpClient httpClient) { List phoneNumbers = new ArrayList(); phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); + OperatorInformationOptions requestOptions = new OperatorInformationOptions(); + requestOptions.setIncludeAdditionalOperatorDetails(false); StepVerifier.create( this.getClientWithConnectionString(httpClient, "searchOperatorInformation") - .searchOperatorInformationWithResponse(phoneNumbers, false)) + .searchOperatorInformationWithResponse(phoneNumbers, requestOptions)) .assertNext((Response result) -> { assertEquals(phoneNumbers.get(0), result.getValue().getValues().get(0).getPhoneNumber()); assertNotNull(result.getValue().getValues().get(0).getNationalFormat()); @@ -525,9 +528,10 @@ public void searchOperatorInformationRespectsSearchOptions(HttpClient httpClient }) .verifyComplete(); + requestOptions.setIncludeAdditionalOperatorDetails(true); StepVerifier.create( this.getClientWithConnectionString(httpClient, "searchOperatorInformation") - .searchOperatorInformationWithResponse(phoneNumbers, true)) + .searchOperatorInformationWithResponse(phoneNumbers, requestOptions)) .assertNext((Response result) -> { assertEquals(phoneNumbers.get(0), result.getValue().getValues().get(0).getPhoneNumber()); assertNotNull(result.getValue().getValues().get(0).getNationalFormat()); From 1027aba84f2ae0365e0b360af69c2faa21beb204 Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Wed, 13 Mar 2024 12:23:05 -0700 Subject: [PATCH 22/25] fix build errors --- .../phonenumbers/PhoneNumbersAsyncClient.java | 2 +- .../phonenumbers/PhoneNumbersClient.java | 2 +- .../models/OperatorInformationRequest.java | 1 + .../models/OperatorInformationResult.java | 34 +++++++++++++++ .../models/OperatorInformationOptions.java | 42 +++++++++++++++++++ .../models/PhoneNumberSearchResult.java | 5 +-- ...honeNumbersAsyncClientIntegrationTest.java | 2 +- .../swagger/README.md | 3 +- 8 files changed, 83 insertions(+), 8 deletions(-) create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationResult.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationOptions.java 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 c1254ce27033..d772c29147de 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 @@ -15,8 +15,8 @@ import com.azure.communication.phonenumbers.implementation.models.PhoneNumberCapabilitiesRequest; import com.azure.communication.phonenumbers.implementation.models.PhoneNumbersUpdateCapabilitiesResponse; import com.azure.communication.phonenumbers.implementation.models.OperatorInformationRequest; -import com.azure.communication.phonenumbers.implementation.models.OperatorInformationOptions; import com.azure.communication.phonenumbers.models.OperatorInformationResult; +import com.azure.communication.phonenumbers.models.OperatorInformationOptions; import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode; import com.azure.communication.phonenumbers.models.PurchasedPhoneNumber; import com.azure.communication.phonenumbers.models.ReleasePhoneNumberResult; 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 c50e6e418687..a1b43dac22d3 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 @@ -8,8 +8,8 @@ import com.azure.communication.phonenumbers.implementation.PhoneNumberAdminClientImpl; import com.azure.communication.phonenumbers.implementation.PhoneNumbersImpl; import com.azure.communication.phonenumbers.implementation.models.OperatorInformationRequest; -import com.azure.communication.phonenumbers.implementation.models.OperatorInformationOptions; import com.azure.communication.phonenumbers.models.OperatorInformationResult; +import com.azure.communication.phonenumbers.models.OperatorInformationOptions; import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode; import com.azure.communication.phonenumbers.models.PhoneNumberAssignmentType; import com.azure.communication.phonenumbers.models.PhoneNumberCapabilities; diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequest.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequest.java index 53f95e9e31a3..e53765d39836 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequest.java @@ -4,6 +4,7 @@ package com.azure.communication.phonenumbers.implementation.models; +import com.azure.communication.phonenumbers.models.OperatorInformationOptions; import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationResult.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationResult.java new file mode 100644 index 000000000000..a59e2f9c7041 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationResult.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.phonenumbers.implementation.models; + +import com.azure.communication.phonenumbers.models.OperatorInformation; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Represents a search result containing format and operator information associated with the requested phone numbers. + */ +@Immutable +public final class OperatorInformationResult { + /* + * Results of a search. + * This array will have one entry per requested phone number which will + * contain the relevant operator information. + */ + @JsonProperty(value = "values", access = JsonProperty.Access.WRITE_ONLY) + private List values; + + /** + * Get the values property: Results of a search. This array will have one entry per requested phone number which + * will contain the relevant operator information. + * + * @return the values value. + */ + public List getValues() { + return this.values; + } +} diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationOptions.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationOptions.java new file mode 100644 index 000000000000..beb3cde0cc08 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationOptions.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.phonenumbers.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents options to modify a search request for operator information. */ +@Fluent +public final class OperatorInformationOptions { + /* + * Includes the fields operatorDetails, numberType, and isoCountryCode in + * the response. Please note: use of this option will result in additional + * costs + */ + @JsonProperty(value = "includeAdditionalOperatorDetails") + private Boolean includeAdditionalOperatorDetails; + + /** + * Get the includeAdditionalOperatorDetails property: Includes the fields operatorDetails, numberType, and + * isoCountryCode in the response. Please note: use of this option will result in additional costs. + * + * @return the includeAdditionalOperatorDetails value. + */ + public Boolean isIncludeAdditionalOperatorDetails() { + return this.includeAdditionalOperatorDetails; + } + + /** + * Set the includeAdditionalOperatorDetails property: Includes the fields operatorDetails, numberType, and + * isoCountryCode in the response. Please note: use of this option will result in additional costs. + * + * @param includeAdditionalOperatorDetails the includeAdditionalOperatorDetails value to set. + * @return the OperatorInformationOptions object itself. + */ + public OperatorInformationOptions setIncludeAdditionalOperatorDetails(Boolean includeAdditionalOperatorDetails) { + this.includeAdditionalOperatorDetails = includeAdditionalOperatorDetails; + return this; + } +} 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 e72051d08df1..81df3852bf70 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 @@ -4,7 +4,6 @@ package com.azure.communication.phonenumbers.models; -import com.azure.communication.phonenumbers.implementation.models.Error; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; @@ -68,7 +67,7 @@ public final class PhoneNumberSearchResult { * Mapping Error Messages to Codes */ @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) - private Error error; + private PhoneNumberSearchResultError error; /** * Get the searchId property: The search id. @@ -149,7 +148,7 @@ public Integer getErrorCode() { * * @return the error value. */ - public Error getError() { + public PhoneNumberSearchResultError getError() { return this.error; } } diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java index 41dbbf399649..ddf3ea567afb 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java @@ -4,10 +4,10 @@ import com.azure.communication.phonenumbers.implementation.converters.PhoneNumberErrorConverter; import com.azure.communication.phonenumbers.implementation.models.CommunicationError; -import com.azure.communication.phonenumbers.implementation.models.OperatorInformationOptions; import com.azure.communication.phonenumbers.models.BillingFrequency; import com.azure.communication.phonenumbers.models.PhoneNumberAdministrativeDivision; import com.azure.communication.phonenumbers.models.OperatorInformationResult; +import com.azure.communication.phonenumbers.models.OperatorInformationOptions; import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode; import com.azure.communication.phonenumbers.models.PhoneNumberAssignmentType; import com.azure.communication.phonenumbers.models.PhoneNumberCapabilities; diff --git a/sdk/communication/azure-communication-phonenumbers/swagger/README.md b/sdk/communication/azure-communication-phonenumbers/swagger/README.md index d7b70c577d3d..a410cc9298a7 100644 --- a/sdk/communication/azure-communication-phonenumbers/swagger/README.md +++ b/sdk/communication/azure-communication-phonenumbers/swagger/README.md @@ -26,7 +26,7 @@ autorest README.md --java --v4 --use=@autorest/java@4.0.2 tag: package-phonenumber-2024-03-01-preview require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/b56afb26c5450157006a3a1d9be57bae429051a2/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,PhoneNumberSearchResultError,OperatorDetails,OperatorInformation,OperatorInformationResult,OperatorNumberType +custom-types: PurchasedPhoneNumber,BillingFrequency,PhoneNumberOperationStatus,PhoneNumberOperationStatusCodes,PhoneNumberOperationType,PhoneNumberAssignmentType,PhoneNumberCapabilities,PhoneNumberCapabilityType,PhoneNumberCost,PhoneNumberSearchResult,PhoneNumberType,PhoneNumberCapability,PhoneNumberAdministrativeDivision,PhoneNumberCountry,PhoneNumberLocality,PhoneNumberOffering,AreaCodeResult,AreaCodes,PhoneNumberAreaCode,PhoneNumberSearchResultError,OperatorDetails,OperatorInformation,OperatorInformationResult,OperatorInformationOptions,OperatorNumberType custom-types-subpackage: models models-subpackage: implementation.models java: true @@ -233,7 +233,6 @@ directive: where: $.definitions.PhoneNumberSearchResult.properties.error.x-ms-enum transform: > $["name"] = "PhoneNumberSearchResultError"; - $[""].readOnly = true; ``` ``` yaml From c2938f9fd0706b531060d312e5b13ddb2f25187c Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Thu, 14 Mar 2024 14:30:14 -0700 Subject: [PATCH 23/25] fix sanitizers, update test recordings --- .../azure-communication-phonenumbers/assets.json | 2 +- .../phonenumbers/PhoneNumbersIntegrationTestBase.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sdk/communication/azure-communication-phonenumbers/assets.json b/sdk/communication/azure-communication-phonenumbers/assets.json index 5a56ee2179ca..407d713a0173 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_5e142143d6" + "Tag": "java/communication/azure-communication-phonenumbers_737e64b52b" } diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java index 942f4ebfa746..43789327783c 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java @@ -62,10 +62,10 @@ private void addTestProxySanitizer() { interceptorManager.addSanitizers(Arrays.asList( new TestProxySanitizer("(?<=/phoneNumbers/)([^/?]+)", "REDACTED", TestProxySanitizerType.URL), new TestProxySanitizer("$..id", null, "REDACTED", TestProxySanitizerType.BODY_KEY), - new TestProxySanitizer("$..phoneNumbers", null, "REDACTED", TestProxySanitizerType.BODY_KEY), new TestProxySanitizer("$..phoneNumber", null, "REDACTED", TestProxySanitizerType.BODY_KEY), new TestProxySanitizer("$..nationalFormat", null, "REDACTED", TestProxySanitizerType.BODY_KEY), - new TestProxySanitizer("$..internationalFormat", null, "REDACTED", TestProxySanitizerType.BODY_KEY))); + new TestProxySanitizer("$..internationalFormat", null, "REDACTED", TestProxySanitizerType.BODY_KEY), + new TestProxySanitizer("((?:\\\\u002B)[0-9]{11,})|((?:\\\\%2B)[0-9]{11,})|((?:[+]?)[0-9]{11,})", "REDACTED", TestProxySanitizerType.BODY_REGEX))); } protected PhoneNumbersClientBuilder getClientBuilderUsingManagedIdentity(HttpClient httpClient) { From b8e617e7d72ad57bbcc38baedd805fc11f15c5e4 Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Thu, 14 Mar 2024 14:38:11 -0700 Subject: [PATCH 24/25] update based on PR comments --- .../azure-communication-phonenumbers/CHANGELOG.md | 13 ++++++------- .../phonenumbers/PhoneNumbersServiceVersion.java | 4 ++-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md b/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md index f5b359a67a67..65ea80cd79af 100644 --- a/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md +++ b/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md @@ -7,13 +7,6 @@ - Format only can be returned for no cost - Additional number details can be returned for a cost -## 1.2.0-beta.1 (2023-09-07) - -### Features Added -- Number Lookup API public preview -- API version `2023-05-01-preview` is the default - - ## 1.1.9 (2023-12-04) ### Other Changes @@ -50,6 +43,12 @@ - Upgraded `azure-core` from `1.42.0` to version `1.43.0`. - Upgraded `azure-communication-common` from `1.2.11` to version `1.2.12`. +## 1.2.0-beta.1 (2023-09-07) + +### Features Added +- Number Lookup API public preview +- API version `2023-05-01-preview` is the default + ## 1.1.5 (2023-08-18) ### Other Changes 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 b30996e3c88e..ac4b94ed4bc3 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 @@ -17,7 +17,7 @@ public enum PhoneNumbersServiceVersion implements ServiceVersion { /** * Number Lookup update to public preview {@code 2024-03-01-preview} */ - V2024_03_01_Preview("2024-03-01-preview"); + V2024_03_01_PREVIEW("2024-03-01-preview"); private final String version; @@ -42,6 +42,6 @@ public String getVersion() { */ public static PhoneNumbersServiceVersion getLatest() { - return V2024_03_01_Preview; + return V2024_03_01_PREVIEW; } } From 90982e9975393de2b1ce66344ff6135e1a1d0826 Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Thu, 14 Mar 2024 14:47:55 -0700 Subject: [PATCH 25/25] fix errors --- .../phonenumbers/PhoneNumbersClientBuilderTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java index 9938bd5675e2..be3f6be43f76 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java @@ -110,7 +110,7 @@ public void buildClientWithConfiguration() { public void buildClientWithServiceVersion() { // Build client with required settings and mock configuration PhoneNumbersClient phoneNumberClient = this.setupBuilderWithHttpClientWithCredential(this.clientBuilder) - .serviceVersion(PhoneNumbersServiceVersion.V2024_03_01_Preview) + .serviceVersion(PhoneNumbersServiceVersion.V2024_03_01_PREVIEW) .buildClient(); // Validate client created with expected settings @@ -227,7 +227,7 @@ public void buildAsyncClientWithServiceVersion() { // Build client with required settings and mock configuration PhoneNumbersAsyncClient phoneNumberAsyncClient = this .setupBuilderWithHttpClientWithCredential(this.clientBuilder) - .serviceVersion(PhoneNumbersServiceVersion.V2024_03_01_Preview) + .serviceVersion(PhoneNumbersServiceVersion.V2024_03_01_PREVIEW) .buildAsyncClient(); // Validate client created with expected settings