diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 4641e539cd33..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.10;1.2.0-beta.1 +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 diff --git a/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md b/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md index 76530a5a6748..65ea80cd79af 100644 --- a/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md +++ b/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 1.2.0-beta.1 (Unreleased) +## 1.2.0-beta.2 (2024-03-01) ### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes +- Add support for number lookup + - Format only can be returned for no cost + - Additional number details can be returned for a cost ## 1.1.9 (2023-12-04) @@ -46,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/assets.json b/sdk/communication/azure-communication-phonenumbers/assets.json index 3787aed70683..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_154a5685d1" + "Tag": "java/communication/azure-communication-phonenumbers_737e64b52b" } diff --git a/sdk/communication/azure-communication-phonenumbers/pom.xml b/sdk/communication/azure-communication-phonenumbers/pom.xml index bad841ea884e..2973885a784c 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-beta.2 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..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 @@ -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.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; @@ -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,40 @@ 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) {
+        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 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, OperatorInformationOptions requestOptions) {
+        OperatorInformationRequest request = new OperatorInformationRequest();
+        request.setPhoneNumbers(phoneNumbers);
+        request.setOptions(requestOptions);
+        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..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
@@ -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.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;
@@ -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,40 @@ 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) { + 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 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, + OperatorInformationOptions requestOptions, + Context context) { + context = context == null ? Context.NONE : context; + OperatorInformationRequest request = new OperatorInformationRequest(); + request.setPhoneNumbers(phoneNumbers); + request.setOptions(requestOptions); + return client.operatorInformationSearchWithResponse(request, context); + } } 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..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 @@ -12,7 +12,12 @@ public enum PhoneNumbersServiceVersion implements ServiceVersion { /** * Service version {@code 2021-03-07}. */ - V2021_03_07("2021-03-07"); + V2021_03_07("2021-03-07"), + + /** + * Number Lookup update to public preview {@code 2024-03-01-preview} + */ + V2024_03_01_PREVIEW("2024-03-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_PREVIEW; } } 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..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 @@ -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-preview"; } 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..e53765d39836 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequest.java @@ -0,0 +1,66 @@ +// 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.OperatorInformationOptions; +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", required = true) + 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/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/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..d1c40ee27acc --- /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", required = true, 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..d3bbe11c89a8 --- /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; + + /* + * ISO 3166-1 two character ('alpha-2') code associated with the phone + * number. + */ + @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 + */ + @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 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 numberType property: Type of service associated with the phone number. + * + * @return the numberType value. + */ + public OperatorNumberType getNumberType() { + return this.numberType; + } + + /** + * 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/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/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..9f86c3654121 --- /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 unknown for OperatorNumberType. */ + public static final OperatorNumberType UNKNOWN = fromString("unknown"); + + /** 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..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 @@ -9,7 +9,7 @@ import java.time.OffsetDateTime; import java.util.List; -/** The PhoneNumberSearchResult model. */ +/** The result of a phone number search operation. */ @Immutable public final class PhoneNumberSearchResult { /* @@ -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", access = JsonProperty.Access.WRITE_ONLY) + private Integer errorCode; + + /* + * Mapping Error Messages to Codes + */ + @JsonProperty(value = "error", access = JsonProperty.Access.WRITE_ONLY) + private PhoneNumberSearchResultError error; + /** * Get the searchId property: The search id. * @@ -121,4 +133,22 @@ 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; + } + + /** + * Get the error property: Mapping Error Messages to Codes. + * + * @return the error value. + */ + public PhoneNumberSearchResultError getError() { + return this.error; + } } 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..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 @@ -6,6 +6,8 @@ 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.OperatorInformationOptions; import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode; import com.azure.communication.phonenumbers.models.PhoneNumberAssignmentType; import com.azure.communication.phonenumbers.models.PhoneNumberCapabilities; @@ -480,6 +482,67 @@ public void convertCommunicationErrorWithNull(HttpClient httpClient) { assertEquals(null, error); } + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void searchOperatorInformationSucceeds(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())); + OperatorInformationOptions requestOptions = new OperatorInformationOptions(); + requestOptions.setIncludeAdditionalOperatorDetails(false); + StepVerifier.create( + this.getClientWithConnectionString(httpClient, "searchOperatorInformation") + .searchOperatorInformationWithResponse(phoneNumbers, requestOptions)) + .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(); + + requestOptions.setIncludeAdditionalOperatorDetails(true); + StepVerifier.create( + this.getClientWithConnectionString(httpClient, "searchOperatorInformation") + .searchOperatorInformationWithResponse(phoneNumbers, requestOptions)) + .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(); + } + 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..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.V2021_03_07) + .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.V2021_03_07) + .serviceVersion(PhoneNumbersServiceVersion.V2024_03_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..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 @@ -6,6 +6,7 @@ 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; @@ -449,6 +450,16 @@ public void convertCommunicationErrorWithNull(HttpClient httpClient) { 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") + .searchOperatorInformation(phoneNumbers); + assertEquals(phoneNumbers.get(0), result.getValues().get(0).getPhoneNumber()); + } + private SyncPoller beginSearchAvailablePhoneNumbersHelper( HttpClient httpClient, String testName, boolean withContext) { PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities(); 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..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 @@ -53,15 +53,19 @@ 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-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("$..id", 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("((?:\\\\u002B)[0-9]{11,})|((?:\\\\%2B)[0-9]{11,})|((?:[+]?)[0-9]{11,})", "REDACTED", TestProxySanitizerType.BODY_REGEX))); } 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..a410cc9298a7 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-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 +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 @@ -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 @@ -149,7 +151,6 @@ directive: $["properties"]["localizedName"].readOnly = true; ``` - ### Add readonly attribute to PhoneNumberLocalities properties ```yaml directive: @@ -190,4 +191,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"] = ""; +```