From a1c133b6fa1e934570e9fd2c3406de4d37321467 Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Wed, 28 Jun 2023 23:54:26 -0700 Subject: [PATCH 1/9] implementation of number lookup in java SDK --- .../phonenumbers/PhoneNumbersAsyncClient.java | 18 + .../phonenumbers/PhoneNumbersClient.java | 49 +- .../PhoneNumbersServiceVersion.java | 6 +- .../PhoneNumberAdminClientImpl.java | 25 +- .../PhoneNumberAdminClientImplBuilder.java | 235 +++++- .../implementation/PhoneNumbersImpl.java | 751 +++++++++++------- .../models/CommunicationError.java | 2 +- .../models/CommunicationErrorResponse.java | 2 +- .../implementation/models/Error.java | 83 ++ .../models/OfferingsResponse.java | 2 +- .../models/OperatorDetails.java | 90 +++ .../models/OperatorInformation.java | 116 +++ .../models/OperatorInformationRequest.java | 39 + .../models/OperatorInformationResult.java | 43 + .../models/OperatorNumberType.java | 44 + .../models/PhoneNumberAreaCodes.java | 2 +- .../PhoneNumberCapabilitiesRequest.java | 2 +- .../models/PhoneNumberCountries.java | 2 +- .../models/PhoneNumberLocalities.java | 2 +- .../models/PhoneNumberPurchaseRequest.java | 2 +- .../models/PhoneNumberSearchRequest.java | 5 +- .../models/PhoneNumberSearchResultError.java | 84 ++ .../PhoneNumbersGetOperationResponse.java | 6 +- ...rsSearchAvailablePhoneNumbersResponse.java | 6 +- ...honeNumbersUpdateCapabilitiesResponse.java | 6 +- .../models/PurchasedPhoneNumbers.java | 2 +- .../implementation/package-info.java | 4 +- .../phonenumbers/models/BillingFrequency.java | 6 +- .../phonenumbers/models/OperatorDetails.java | 90 +++ .../models/OperatorInformation.java | 116 +++ .../models/OperatorInformationRequest.java | 39 + .../models/OperatorInformationResult.java | 43 + .../models/OperatorNumberType.java | 44 + .../PhoneNumberAdministrativeDivision.java | 2 +- .../models/PhoneNumberAreaCode.java | 2 +- .../models/PhoneNumberAssignmentType.java | 6 +- .../models/PhoneNumberCapabilities.java | 2 +- .../models/PhoneNumberCapabilityType.java | 6 +- .../phonenumbers/models/PhoneNumberCost.java | 2 +- .../models/PhoneNumberCountry.java | 2 +- .../models/PhoneNumberLocality.java | 2 +- .../models/PhoneNumberOffering.java | 2 +- .../models/PhoneNumberOperationStatus.java | 6 +- .../models/PhoneNumberOperationType.java | 6 +- .../models/PhoneNumberSearchResult.java | 59 +- .../phonenumbers/models/PhoneNumberType.java | 6 +- .../models/PurchasedPhoneNumber.java | 2 +- ...honeNumbersAsyncClientIntegrationTest.java | 29 + .../PhoneNumbersClientBuilderTest.java | 4 +- .../PhoneNumbersClientIntegrationTest.java | 13 + .../swagger/README.md | 27 +- 51 files changed, 1776 insertions(+), 368 deletions(-) create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/Error.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorDetails.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformation.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequest.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationResult.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorNumberType.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberSearchResultError.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorDetails.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformation.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationRequest.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationResult.java create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorNumberType.java 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..c83b4ade1256 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,8 @@ 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.models.OperatorInformationRequest; +import com.azure.communication.phonenumbers.models.OperatorInformationResult; import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode; import com.azure.communication.phonenumbers.models.PurchasedPhoneNumber; import com.azure.communication.phonenumbers.models.ReleasePhoneNumberResult; @@ -45,6 +47,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; @@ -715,6 +718,21 @@ 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); + return client.operatorInformationSearchAsync(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..fd6688d41d0e 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,13 @@ // 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.models.OperatorInformationRequest; +import com.azure.communication.phonenumbers.models.OperatorInformationResult; import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode; import com.azure.communication.phonenumbers.models.PhoneNumberAssignmentType; import com.azure.communication.phonenumbers.models.PhoneNumberCapabilities; @@ -104,7 +107,7 @@ public PurchasedPhoneNumber getPurchasedPhoneNumber(String phoneNumber) { * * - * + * *
      * Response<PurchasedPhoneNumber> response = phoneNumberClient
      *         .getPurchasedPhoneNumberWithResponse("+18001234567", Context.NONE);
@@ -112,7 +115,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 +167,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 +201,7 @@ public PagedIterable listPurchasedPhoneNumbers(Context con * * - * + * *
      * PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities()
      *         .setCalling(PhoneNumberCapabilityType.INBOUND)
@@ -218,7 +221,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 +256,7 @@ public SyncPoller beginSearchAvai * - * + * *
      * PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities()
      *         .setCalling(PhoneNumberCapabilityType.INBOUND)
@@ -274,7 +277,7 @@ public SyncPoller beginSearchAvai
      *     System.out.println("Phone number costs:" + searchResult.getCost().getAmount());
      * }
      * 
- * + * * @@ -342,13 +345,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 +409,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 +445,7 @@ public SyncPoller beginReleasePh * * - * + * *
      * PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities();
      * capabilities
@@ -459,7 +462,7 @@ public SyncPoller beginReleasePh
      *     System.out.println("Phone Number SMS capabilities: " + phoneNumber.getCapabilities().getSms());
      * }
      * 
- * + * * * @@ -491,7 +494,7 @@ public SyncPoller beginUpdatePhoneNu * - * + * *
      * PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities();
      * capabilities
@@ -508,7 +511,7 @@ public SyncPoller beginUpdatePhoneNu
      *     System.out.println("Phone Number SMS capabilities: " + phoneNumber.getCapabilities().getSms());
      * }
      * 
- * + * * @@ -695,4 +698,18 @@ 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); + return client.operatorInformationSearch(request); + } } diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersServiceVersion.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersServiceVersion.java index 31e2a47be246..2498fe222326 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersServiceVersion.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersServiceVersion.java @@ -10,9 +10,9 @@ */ public enum PhoneNumbersServiceVersion implements ServiceVersion { /** - * Service version {@code 2021-03-07}. + * Service version {@code 2023-05-01-preview} */ - V2021_03_07("2021-03-07"); + NumberLookupPreview("2023-05-01-preview"); private final String version; @@ -37,6 +37,6 @@ public String getVersion() { */ public static PhoneNumbersServiceVersion getLatest() { - return V2021_03_07; + return NumberLookupPreview; } } 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..8201f31d1fc7 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 = "2023-05-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..d67a5d2510cc 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 @@ -19,6 +19,8 @@ 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.OperatorInformationRequest; +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,135 @@ 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 operator information for a given list of phone numbers. + * + * @param body The phone number(s) whose 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 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 operator information for a given list of phone numbers. + * + * @param body The phone number(s) whose 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 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 operator information for a given list of phone numbers. + * + * @param body The phone number(s) whose 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 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 operator information for a given list of phone numbers. + * + * @param body The phone number(s) whose 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 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 operator information for a given list of phone numbers. + * + * @param body The phone number(s) whose 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 operator information associated with the requested phone numbers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperatorInformationResult operatorInformationSearch(OperatorInformationRequest body) { + return operatorInformationSearchAsync(body).block(); + } + + /** + * Searches for operator information for a given list of phone numbers. + * + * @param body The phone number(s) whose 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 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 +2221,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 +2249,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 +2279,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 +2307,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 +2337,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 +2365,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 +2395,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 +2426,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 +2453,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 24f9ab2b7157..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 @@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The CommunicationError model. */ +/** 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 0c8f43d0a4e7..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 @@ -7,7 +7,7 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The CommunicationErrorResponse model. */ +/** The Communication Services error. */ @Fluent public final class CommunicationErrorResponse { /* 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 4c7737e931bb..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 @@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The OfferingsResponse model. */ +/** Represents a wrapper around a list of offerings. */ @Immutable public final class OfferingsResponse { /* diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorDetails.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorDetails.java new file mode 100644 index 000000000000..aad9601f26dd --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorDetails.java @@ -0,0 +1,90 @@ +// 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 metadata describing the operator of a phone number. */ +@Fluent +public final class OperatorDetails { + /* + * Name of the phone operator + */ + @JsonProperty(value = "name") + private String name; + + /* + * Mobile Network Code + */ + @JsonProperty(value = "mobileNetworkCode") + private String mobileNetworkCode; + + /* + * Mobile Country Code + */ + @JsonProperty(value = "mobileCountryCode") + private String mobileCountryCode; + + /** + * Get the name property: Name of the phone operator. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * Set the name property: Name of the phone operator. + * + * @param name the name value to set. + * @return the OperatorDetails object itself. + */ + public OperatorDetails setName(String name) { + this.name = name; + return this; + } + + /** + * Get the mobileNetworkCode property: Mobile Network Code. + * + * @return the mobileNetworkCode value. + */ + public String getMobileNetworkCode() { + return this.mobileNetworkCode; + } + + /** + * Set the mobileNetworkCode property: Mobile Network Code. + * + * @param mobileNetworkCode the mobileNetworkCode value to set. + * @return the OperatorDetails object itself. + */ + public OperatorDetails setMobileNetworkCode(String mobileNetworkCode) { + this.mobileNetworkCode = mobileNetworkCode; + return this; + } + + /** + * Get the mobileCountryCode property: Mobile Country Code. + * + * @return the mobileCountryCode value. + */ + public String getMobileCountryCode() { + return this.mobileCountryCode; + } + + /** + * Set the mobileCountryCode property: Mobile Country Code. + * + * @param mobileCountryCode the mobileCountryCode value to set. + * @return the OperatorDetails object itself. + */ + public OperatorDetails setMobileCountryCode(String mobileCountryCode) { + this.mobileCountryCode = mobileCountryCode; + return this; + } +} diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformation.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformation.java new file mode 100644 index 000000000000..a1ed177be021 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformation.java @@ -0,0 +1,116 @@ +// 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 metadata about a phone number that is controlled/provided by that phone number's operator. */ +@Fluent +public final class OperatorInformation { + /* + * E.164 formatted string representation of the phone number + */ + @JsonProperty(value = "phoneNumber") + private String phoneNumber; + + /* + * Type of service associated with the phone number + */ + @JsonProperty(value = "numberType") + private OperatorNumberType numberType; + + /* + * ISO country code associated with the phone number. + */ + @JsonProperty(value = "isoCountryCode") + private String isoCountryCode; + + /* + * Represents metadata describing the operator of a phone number + */ + @JsonProperty(value = "operatorDetails") + 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; + } + + /** + * Set the phoneNumber property: E.164 formatted string representation of the phone number. + * + * @param phoneNumber the phoneNumber value to set. + * @return the OperatorInformation object itself. + */ + public OperatorInformation setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get the numberType property: Type of service associated with the phone number. + * + * @return the numberType value. + */ + public OperatorNumberType getNumberType() { + return this.numberType; + } + + /** + * Set the numberType property: Type of service associated with the phone number. + * + * @param numberType the numberType value to set. + * @return the OperatorInformation object itself. + */ + public OperatorInformation setNumberType(OperatorNumberType numberType) { + this.numberType = numberType; + return this; + } + + /** + * Get the isoCountryCode property: ISO country code associated with the phone number. + * + * @return the isoCountryCode value. + */ + public String getIsoCountryCode() { + return this.isoCountryCode; + } + + /** + * Set the isoCountryCode property: ISO country code associated with the phone number. + * + * @param isoCountryCode the isoCountryCode value to set. + * @return the OperatorInformation object itself. + */ + public OperatorInformation setIsoCountryCode(String isoCountryCode) { + this.isoCountryCode = isoCountryCode; + return this; + } + + /** + * Get the operatorDetails property: Represents metadata describing the operator of a phone number. + * + * @return the operatorDetails value. + */ + public OperatorDetails getOperatorDetails() { + return this.operatorDetails; + } + + /** + * Set the operatorDetails property: Represents metadata describing the operator of a phone number. + * + * @param operatorDetails the operatorDetails value to set. + * @return the OperatorInformation object itself. + */ + public OperatorInformation setOperatorDetails(OperatorDetails operatorDetails) { + this.operatorDetails = operatorDetails; + 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..c9ab84e5f110 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationRequest.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.phonenumbers.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a search request for operator information for the given phone numbers. */ +@Fluent +public final class OperatorInformationRequest { + /* + * Phone number(s) whose operator information is being requested + */ + @JsonProperty(value = "phoneNumbers") + private List phoneNumbers; + + /** + * 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; + } +} 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..44083bbec1c4 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationResult.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; +import java.util.List; + +/** Represents a search result containing operator information associated with the requested phone numbers. */ +@Fluent +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") + 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; + } + + /** + * Set the values property: Results of a search. This array will have one entry per requested phone number which + * will contain the relevant operator information. + * + * @param values the values value to set. + * @return the OperatorInformationResult object itself. + */ + public OperatorInformationResult setValues(List values) { + this.values = values; + return this; + } +} diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorNumberType.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorNumberType.java new file mode 100644 index 000000000000..ca02533f5cf2 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/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.implementation.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/implementation/models/PhoneNumberAreaCodes.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/PhoneNumberAreaCodes.java index 0e9488f8fb4d..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 @@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The PhoneNumberAreaCodes model. */ +/** The list of available area codes. */ @Immutable public final class PhoneNumberAreaCodes { /* 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 a652e5fe7801..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 @@ -8,7 +8,7 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The PhoneNumberCapabilitiesRequest model. */ +/** Capabilities of a phone number. */ @Fluent public final class PhoneNumberCapabilitiesRequest { /* 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 3b2f4500d1f4..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 @@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The PhoneNumberCountries model. */ +/** Represents a wrapper around a list of countries. */ @Immutable public final class PhoneNumberCountries { /* 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 ff5701bd4b7d..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 @@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The PhoneNumberLocalities model. */ +/** Represents a wrapper around a list of cities or towns. */ @Immutable public final class PhoneNumberLocalities { /* 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 21a53d735ecb..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 @@ -7,7 +7,7 @@ import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; -/** The PhoneNumberPurchaseRequest model. */ +/** The phone number search purchase request. */ @Fluent public final class PhoneNumberPurchaseRequest { /* 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 5ad15ab05359..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 @@ -10,7 +10,10 @@ 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 public final class PhoneNumberSearchRequest { /* 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/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/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/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 3d93d8bef7b3..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 @@ -9,7 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** The PurchasedPhoneNumbers model. */ +/** The list of purchased phone numbers. */ @Fluent public final class PurchasedPhoneNumbers { /* 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 1b4e8a5376c3..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 @@ -24,7 +24,11 @@ public static BillingFrequency fromString(String name) { return fromString(name, BillingFrequency.class); } - /** @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..ec1d9a3a5a62 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorDetails.java @@ -0,0 +1,90 @@ +// 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 metadata describing the operator of a phone number. */ +@Fluent +public final class OperatorDetails { + /* + * Name of the phone operator + */ + @JsonProperty(value = "name") + private String name; + + /* + * Mobile Network Code + */ + @JsonProperty(value = "mobileNetworkCode") + private String mobileNetworkCode; + + /* + * Mobile Country Code + */ + @JsonProperty(value = "mobileCountryCode") + private String mobileCountryCode; + + /** + * Get the name property: Name of the phone operator. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * Set the name property: Name of the phone operator. + * + * @param name the name value to set. + * @return the OperatorDetails object itself. + */ + public OperatorDetails setName(String name) { + this.name = name; + return this; + } + + /** + * Get the mobileNetworkCode property: Mobile Network Code. + * + * @return the mobileNetworkCode value. + */ + public String getMobileNetworkCode() { + return this.mobileNetworkCode; + } + + /** + * Set the mobileNetworkCode property: Mobile Network Code. + * + * @param mobileNetworkCode the mobileNetworkCode value to set. + * @return the OperatorDetails object itself. + */ + public OperatorDetails setMobileNetworkCode(String mobileNetworkCode) { + this.mobileNetworkCode = mobileNetworkCode; + return this; + } + + /** + * Get the mobileCountryCode property: Mobile Country Code. + * + * @return the mobileCountryCode value. + */ + public String getMobileCountryCode() { + return this.mobileCountryCode; + } + + /** + * Set the mobileCountryCode property: Mobile Country Code. + * + * @param mobileCountryCode the mobileCountryCode value to set. + * @return the OperatorDetails object itself. + */ + public OperatorDetails setMobileCountryCode(String mobileCountryCode) { + this.mobileCountryCode = mobileCountryCode; + return this; + } +} 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..0cf661402570 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformation.java @@ -0,0 +1,116 @@ +// 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 metadata about a phone number that is controlled/provided by that phone number's operator. */ +@Fluent +public final class OperatorInformation { + /* + * E.164 formatted string representation of the phone number + */ + @JsonProperty(value = "phoneNumber") + private String phoneNumber; + + /* + * Type of service associated with the phone number + */ + @JsonProperty(value = "numberType") + private OperatorNumberType numberType; + + /* + * ISO country code associated with the phone number. + */ + @JsonProperty(value = "isoCountryCode") + private String isoCountryCode; + + /* + * Represents metadata describing the operator of a phone number + */ + @JsonProperty(value = "operatorDetails") + 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; + } + + /** + * Set the phoneNumber property: E.164 formatted string representation of the phone number. + * + * @param phoneNumber the phoneNumber value to set. + * @return the OperatorInformation object itself. + */ + public OperatorInformation setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get the numberType property: Type of service associated with the phone number. + * + * @return the numberType value. + */ + public OperatorNumberType getNumberType() { + return this.numberType; + } + + /** + * Set the numberType property: Type of service associated with the phone number. + * + * @param numberType the numberType value to set. + * @return the OperatorInformation object itself. + */ + public OperatorInformation setNumberType(OperatorNumberType numberType) { + this.numberType = numberType; + return this; + } + + /** + * Get the isoCountryCode property: ISO country code associated with the phone number. + * + * @return the isoCountryCode value. + */ + public String getIsoCountryCode() { + return this.isoCountryCode; + } + + /** + * Set the isoCountryCode property: ISO country code associated with the phone number. + * + * @param isoCountryCode the isoCountryCode value to set. + * @return the OperatorInformation object itself. + */ + public OperatorInformation setIsoCountryCode(String isoCountryCode) { + this.isoCountryCode = isoCountryCode; + return this; + } + + /** + * Get the operatorDetails property: Represents metadata describing the operator of a phone number. + * + * @return the operatorDetails value. + */ + public OperatorDetails getOperatorDetails() { + return this.operatorDetails; + } + + /** + * Set the operatorDetails property: Represents metadata describing the operator of a phone number. + * + * @param operatorDetails the operatorDetails value to set. + * @return the OperatorInformation object itself. + */ + public OperatorInformation setOperatorDetails(OperatorDetails operatorDetails) { + this.operatorDetails = operatorDetails; + return this; + } +} diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationRequest.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationRequest.java new file mode 100644 index 000000000000..cdcddc35fe4d --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationRequest.java @@ -0,0 +1,39 @@ +// 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; +import java.util.List; + +/** Represents a search request for operator information for the given phone numbers. */ +@Fluent +public final class OperatorInformationRequest { + /* + * Phone number(s) whose operator information is being requested + */ + @JsonProperty(value = "phoneNumbers") + private List phoneNumbers; + + /** + * 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; + } +} 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..b55439907f9c --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationResult.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a search result containing operator information associated with the requested phone numbers. */ +@Fluent +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") + 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; + } + + /** + * Set the values property: Results of a search. This array will have one entry per requested phone number which + * will contain the relevant operator information. + * + * @param values the values value to set. + * @return the OperatorInformationResult object itself. + */ + public OperatorInformationResult setValues(List values) { + this.values = values; + return this; + } +} 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 f9f465ef07d1..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,7 +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 5a54a579000d..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,7 +27,11 @@ public static PhoneNumberAssignmentType fromString(String name) { return fromString(name, PhoneNumberAssignmentType.class); } - /** @return known PhoneNumberAssignmentType values. */ + /** + * Gets known PhoneNumberAssignmentType values. + * + * @return known PhoneNumberAssignmentType values. + */ public static Collection values() { return values(PhoneNumberAssignmentType.class); } 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 9b657ac09bd9..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,7 +33,11 @@ public static PhoneNumberCapabilityType fromString(String name) { return fromString(name, PhoneNumberCapabilityType.class); } - /** @return known PhoneNumberCapabilityType values. */ + /** + * Gets known PhoneNumberCapabilityType values. + * + * @return known PhoneNumberCapabilityType values. + */ public static Collection values() { return values(PhoneNumberCapabilityType.class); } 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 cef1da493ca8..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,7 +34,11 @@ public static PhoneNumberOperationType fromString(String name) { return fromString(name, PhoneNumberOperationType.class); } - /** @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..0f90940a0010 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResult.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResult.java @@ -4,13 +4,14 @@ package com.azure.communication.phonenumbers.models; -import com.azure.core.annotation.Immutable; +import com.azure.communication.phonenumbers.implementation.models.PhoneNumberSearchResultError; +import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; import java.util.List; -/** The PhoneNumberSearchResult model. */ -@Immutable +/** The result of a phone number search operation. */ +@Fluent public final class PhoneNumberSearchResult { /* * The search id. @@ -57,6 +58,18 @@ public final class PhoneNumberSearchResult { @JsonProperty(value = "searchExpiresBy", required = true, access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime searchExpiresBy; + /* + * The error code of the search. + */ + @JsonProperty(value = "errorCode") + private Integer errorCode; + + /* + * Mapping Error Messages to Codes + */ + @JsonProperty(value = "error") + private PhoneNumberSearchResultError error; + /** * Get the searchId property: The search id. * @@ -121,4 +134,44 @@ public PhoneNumberCost getCost() { public OffsetDateTime getSearchExpiresBy() { return this.searchExpiresBy; } + + /** + * Get the errorCode property: The error code of the search. + * + * @return the errorCode value. + */ + public Integer getErrorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The error code of the search. + * + * @param errorCode the errorCode value to set. + * @return the PhoneNumberSearchResult object itself. + */ + public PhoneNumberSearchResult setErrorCode(Integer errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Get the error property: Mapping Error Messages to Codes. + * + * @return the error value. + */ + public PhoneNumberSearchResultError getError() { + return this.error; + } + + /** + * Set the error property: Mapping Error Messages to Codes. + * + * @param error the error value to set. + * @return the PhoneNumberSearchResult object itself. + */ + public PhoneNumberSearchResult setError(PhoneNumberSearchResultError error) { + this.error = error; + return this; + } } diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberType.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberType.java index 5a2746fdf269..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,7 +27,11 @@ public static PhoneNumberType fromString(String name) { return fromString(name, PhoneNumberType.class); } - /** @return known PhoneNumberType values. */ + /** + * Gets known PhoneNumberType values. + * + * @return known PhoneNumberType values. + */ public static Collection values() { return values(PhoneNumberType.class); } 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 b6e8dcd57af2..8e04139e938c 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 @@ -2,6 +2,7 @@ // Licensed under the MIT License. package com.azure.communication.phonenumbers; +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; @@ -29,6 +30,8 @@ import reactor.test.StepVerifier; import java.time.Duration; +import java.util.List; +import java.util.ArrayList; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -410,6 +413,32 @@ public void getOfferings(HttpClient httpClient) { .verifyComplete(); } + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void searchOperatorInformation(HttpClient httpClient) { + List phoneNumbers = new ArrayList(); + phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); + StepVerifier.create( + this.getClientWithConnectionString(httpClient, "searchOperatorInformation") + .searchOperatorInformation(phoneNumbers)) + .assertNext((OperatorInformationResult result) -> { + assertEquals(phoneNumbers.get(0), result.getValues().get(0).getPhoneNumber()); + }) + .verifyComplete(); + } + + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void searchOperatorInformationOnlyAcceptsOnePhoneNumber(HttpClient httpClient) { + List phoneNumbers = new ArrayList(); + phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); + phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); + StepVerifier.create( + this.getClientWithConnectionString(httpClient, "searchOperatorInformationOnlyAcceptsOnePhoneNumber") + .searchOperatorInformation(phoneNumbers)) + .verifyError(); + } + private PollerFlux beginSearchAvailablePhoneNumbersHelper( HttpClient httpClient, String testName, 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..8537922490a2 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.NumberLookupPreview) .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.NumberLookupPreview) .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 fbf6c4c09e03..1deb4f830d89 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 @@ -2,6 +2,7 @@ // Licensed under the MIT License. package com.azure.communication.phonenumbers; +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; @@ -30,6 +31,8 @@ import org.junit.jupiter.params.provider.MethodSource; import java.time.Duration; +import java.util.ArrayList; +import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @@ -308,6 +311,16 @@ public void getOfferingsWithAAD(HttpClient httpClient) { assertNotNull(offering); } + @ParameterizedTest + @MethodSource("com.azure.core.test.TestBase#getHttpClients") + public void searchOperatorInformation(HttpClient httpClient) { + List phoneNumbers = new ArrayList(); + phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber())); + OperatorInformationResult result = this.getClientWithConnectionString(httpClient, "searchOperatorInformation") + .searchOperatorInformation(phoneNumbers); + assertEquals(phoneNumbers.get(0), result.getValues().get(0).getPhoneNumber()); + } + private SyncPoller beginSearchAvailablePhoneNumbersHelper( HttpClient httpClient, String testName, boolean withContext) { PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities(); diff --git a/sdk/communication/azure-communication-phonenumbers/swagger/README.md b/sdk/communication/azure-communication-phonenumbers/swagger/README.md index 0f02dacaea86..ae4373b6677f 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-2023-05-01-preview +require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/4d2e746ac1e094f87bfe0807b1d51b375a6c5517/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,OperatorDetails,OperatorInformation,OperatorInformationRequest,OperatorInformationResult,OperatorNumberType custom-types-subpackage: models models-subpackage: implementation.models java: true @@ -190,4 +190,25 @@ directive: transform: > $["properties"]["localizedName"].readOnly = true; $["properties"]["countryCode"].readOnly = true; +``` + +### Change a generic error to more specific name +``` yaml +directive: + from: swagger-document + where: $.definitions.PhoneNumberSearchResult.properties.error.x-ms-enum + transform: > + $["name"] = "PhoneNumberSearchResultError"; +``` + +### Change a generic error to more specific name +``` yaml +directive: + from: swagger-document + where: $.parameters.Endpoint + debug: true + transform: > + $lib.log($); + $["format"] = ""; + $lib.log($); ``` \ No newline at end of file From 0df893a47597dbf4f551cda797eac8d57593374a Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Thu, 29 Jun 2023 00:06:38 -0700 Subject: [PATCH 2/9] fix readme to remove debug logging --- .../azure-communication-phonenumbers/swagger/README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sdk/communication/azure-communication-phonenumbers/swagger/README.md b/sdk/communication/azure-communication-phonenumbers/swagger/README.md index ae4373b6677f..9833a899967b 100644 --- a/sdk/communication/azure-communication-phonenumbers/swagger/README.md +++ b/sdk/communication/azure-communication-phonenumbers/swagger/README.md @@ -208,7 +208,4 @@ directive: where: $.parameters.Endpoint debug: true transform: > - $lib.log($); - $["format"] = ""; - $lib.log($); -``` \ No newline at end of file + $["format"] = ""; \ No newline at end of file From b298f7ee804babb9ef73c37be92f2cb67ee91982 Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Fri, 30 Jun 2023 21:49:24 -0700 Subject: [PATCH 3/9] fix autorest generation swagger mismatch issue --- .../models/PhoneNumberSearchResult.java | 57 +------------------ .../swagger/README.md | 22 +------ 2 files changed, 4 insertions(+), 75 deletions(-) diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResult.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResult.java index 0f90940a0010..0b8092a2f9af 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResult.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResult.java @@ -4,14 +4,13 @@ package com.azure.communication.phonenumbers.models; -import com.azure.communication.phonenumbers.implementation.models.PhoneNumberSearchResultError; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; import java.util.List; /** The result of a phone number search operation. */ -@Fluent +@Immutable public final class PhoneNumberSearchResult { /* * The search id. @@ -58,18 +57,6 @@ public final class PhoneNumberSearchResult { @JsonProperty(value = "searchExpiresBy", required = true, access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime searchExpiresBy; - /* - * The error code of the search. - */ - @JsonProperty(value = "errorCode") - private Integer errorCode; - - /* - * Mapping Error Messages to Codes - */ - @JsonProperty(value = "error") - private PhoneNumberSearchResultError error; - /** * Get the searchId property: The search id. * @@ -134,44 +121,4 @@ public PhoneNumberCost getCost() { public OffsetDateTime getSearchExpiresBy() { return this.searchExpiresBy; } - - /** - * Get the errorCode property: The error code of the search. - * - * @return the errorCode value. - */ - public Integer getErrorCode() { - return this.errorCode; - } - - /** - * Set the errorCode property: The error code of the search. - * - * @param errorCode the errorCode value to set. - * @return the PhoneNumberSearchResult object itself. - */ - public PhoneNumberSearchResult setErrorCode(Integer errorCode) { - this.errorCode = errorCode; - return this; - } - - /** - * Get the error property: Mapping Error Messages to Codes. - * - * @return the error value. - */ - public PhoneNumberSearchResultError getError() { - return this.error; - } - - /** - * Set the error property: Mapping Error Messages to Codes. - * - * @param error the error value to set. - * @return the PhoneNumberSearchResult object itself. - */ - public PhoneNumberSearchResult setError(PhoneNumberSearchResultError error) { - this.error = error; - return this; - } } diff --git a/sdk/communication/azure-communication-phonenumbers/swagger/README.md b/sdk/communication/azure-communication-phonenumbers/swagger/README.md index 9833a899967b..36e919b84960 100644 --- a/sdk/communication/azure-communication-phonenumbers/swagger/README.md +++ b/sdk/communication/azure-communication-phonenumbers/swagger/README.md @@ -24,7 +24,7 @@ autorest README.md --java --v4 --use=@autorest/java@4.0.2 ### Code generation settings ``` yaml tag: package-phonenumber-2023-05-01-preview -require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/4d2e746ac1e094f87bfe0807b1d51b375a6c5517/specification/communication/data-plane/PhoneNumbers/readme.md +require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/2d4881cf7101773b8c677a267b53d915b30a8c6c/specification/communication/data-plane/PhoneNumbers/readme.md override-client-name: PhoneNumberAdminClient custom-types: PurchasedPhoneNumber,BillingFrequency,PhoneNumberOperationStatus,PhoneNumberOperationStatusCodes,PhoneNumberOperationType,PhoneNumberAssignmentType,PhoneNumberCapabilities,PhoneNumberCapabilityType,PhoneNumberCost,PhoneNumberSearchResult,PhoneNumberType,PhoneNumberCapability,PhoneNumberAdministrativeDivision,PhoneNumberCountry,PhoneNumberLocality,PhoneNumberOffering,AreaCodeResult,AreaCodes,PhoneNumberAreaCode,OperatorDetails,OperatorInformation,OperatorInformationRequest,OperatorInformationResult,OperatorNumberType custom-types-subpackage: models @@ -190,22 +190,4 @@ directive: transform: > $["properties"]["localizedName"].readOnly = true; $["properties"]["countryCode"].readOnly = true; -``` - -### Change a generic error to more specific name -``` yaml -directive: - from: swagger-document - where: $.definitions.PhoneNumberSearchResult.properties.error.x-ms-enum - transform: > - $["name"] = "PhoneNumberSearchResultError"; -``` - -### Change a generic error to more specific name -``` yaml -directive: - from: swagger-document - where: $.parameters.Endpoint - debug: true - transform: > - $["format"] = ""; \ No newline at end of file +``` \ No newline at end of file From 21b7b07c1f4879bf3e7d5c493055512165105887 Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Mon, 10 Jul 2023 19:28:09 -0700 Subject: [PATCH 4/9] update autorest generation and yaml directives --- .../models/PhoneNumberSearchResult.java | 57 ++++++++++++++++++- .../swagger/README.md | 20 ++++++- 2 files changed, 73 insertions(+), 4 deletions(-) diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResult.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResult.java index 0b8092a2f9af..0f90940a0010 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResult.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResult.java @@ -4,13 +4,14 @@ package com.azure.communication.phonenumbers.models; -import com.azure.core.annotation.Immutable; +import com.azure.communication.phonenumbers.implementation.models.PhoneNumberSearchResultError; +import com.azure.core.annotation.Fluent; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; import java.util.List; /** The result of a phone number search operation. */ -@Immutable +@Fluent public final class PhoneNumberSearchResult { /* * The search id. @@ -57,6 +58,18 @@ public final class PhoneNumberSearchResult { @JsonProperty(value = "searchExpiresBy", required = true, access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime searchExpiresBy; + /* + * The error code of the search. + */ + @JsonProperty(value = "errorCode") + private Integer errorCode; + + /* + * Mapping Error Messages to Codes + */ + @JsonProperty(value = "error") + private PhoneNumberSearchResultError error; + /** * Get the searchId property: The search id. * @@ -121,4 +134,44 @@ public PhoneNumberCost getCost() { public OffsetDateTime getSearchExpiresBy() { return this.searchExpiresBy; } + + /** + * Get the errorCode property: The error code of the search. + * + * @return the errorCode value. + */ + public Integer getErrorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The error code of the search. + * + * @param errorCode the errorCode value to set. + * @return the PhoneNumberSearchResult object itself. + */ + public PhoneNumberSearchResult setErrorCode(Integer errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Get the error property: Mapping Error Messages to Codes. + * + * @return the error value. + */ + public PhoneNumberSearchResultError getError() { + return this.error; + } + + /** + * Set the error property: Mapping Error Messages to Codes. + * + * @param error the error value to set. + * @return the PhoneNumberSearchResult object itself. + */ + public PhoneNumberSearchResult setError(PhoneNumberSearchResultError error) { + this.error = error; + return this; + } } diff --git a/sdk/communication/azure-communication-phonenumbers/swagger/README.md b/sdk/communication/azure-communication-phonenumbers/swagger/README.md index 36e919b84960..5562d38dded1 100644 --- a/sdk/communication/azure-communication-phonenumbers/swagger/README.md +++ b/sdk/communication/azure-communication-phonenumbers/swagger/README.md @@ -24,7 +24,7 @@ autorest README.md --java --v4 --use=@autorest/java@4.0.2 ### Code generation settings ``` yaml tag: package-phonenumber-2023-05-01-preview -require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/2d4881cf7101773b8c677a267b53d915b30a8c6c/specification/communication/data-plane/PhoneNumbers/readme.md +require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/4d2e746ac1e094f87bfe0807b1d51b375a6c5517/specification/communication/data-plane/PhoneNumbers/readme.md override-client-name: PhoneNumberAdminClient custom-types: PurchasedPhoneNumber,BillingFrequency,PhoneNumberOperationStatus,PhoneNumberOperationStatusCodes,PhoneNumberOperationType,PhoneNumberAssignmentType,PhoneNumberCapabilities,PhoneNumberCapabilityType,PhoneNumberCost,PhoneNumberSearchResult,PhoneNumberType,PhoneNumberCapability,PhoneNumberAdministrativeDivision,PhoneNumberCountry,PhoneNumberLocality,PhoneNumberOffering,AreaCodeResult,AreaCodes,PhoneNumberAreaCode,OperatorDetails,OperatorInformation,OperatorInformationRequest,OperatorInformationResult,OperatorNumberType custom-types-subpackage: models @@ -190,4 +190,20 @@ directive: transform: > $["properties"]["localizedName"].readOnly = true; $["properties"]["countryCode"].readOnly = true; -``` \ No newline at end of file +``` + +``` yaml +directive: + from: swagger-document + where: $.definitions.PhoneNumberSearchResult.properties.error.x-ms-enum + transform: > + $["name"] = "PhoneNumberSearchResultError"; +``` + +``` yaml +directive: + from: swagger-document + where: $.parameters.Endpoint + transform: > + $["format"] = ""; +``` From b417dae56eda7c80b908839e9371b117793ba90e Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Mon, 10 Jul 2023 20:06:42 -0700 Subject: [PATCH 5/9] update service version --- .../phonenumbers/PhoneNumbersServiceVersion.java | 11 ++++++++--- .../phonenumbers/PhoneNumbersClientBuilderTest.java | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersServiceVersion.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersServiceVersion.java index 2498fe222326..f23d91da3c4e 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersServiceVersion.java +++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/PhoneNumbersServiceVersion.java @@ -10,9 +10,14 @@ */ public enum PhoneNumbersServiceVersion implements ServiceVersion { /** - * Service version {@code 2023-05-01-preview} + * Latest stable service version {@code 2021-03-07} */ - NumberLookupPreview("2023-05-01-preview"); + V2021_03_07("2021-03-07"), + + /** + * Number Lookup preview version {@code 2023-05-01-preview} + */ + V2023_05_01_Preview("2023-05-01-preview"); private final String version; @@ -37,6 +42,6 @@ public String getVersion() { */ public static PhoneNumbersServiceVersion getLatest() { - return NumberLookupPreview; + return V2023_05_01_Preview; } } diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java index 8537922490a2..dbb73ebd6769 100644 --- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java +++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientBuilderTest.java @@ -110,7 +110,7 @@ public void buildClientWithConfiguration() { public void buildClientWithServiceVersion() { // Build client with required settings and mock configuration PhoneNumbersClient phoneNumberClient = this.setupBuilderWithHttpClientWithCredential(this.clientBuilder) - .serviceVersion(PhoneNumbersServiceVersion.NumberLookupPreview) + .serviceVersion(PhoneNumbersServiceVersion.V2023_05_01_Preview) .buildClient(); // Validate client created with expected settings @@ -227,7 +227,7 @@ public void buildAsyncClientWithServiceVersion() { // Build client with required settings and mock configuration PhoneNumbersAsyncClient phoneNumberAsyncClient = this .setupBuilderWithHttpClientWithCredential(this.clientBuilder) - .serviceVersion(PhoneNumbersServiceVersion.NumberLookupPreview) + .serviceVersion(PhoneNumbersServiceVersion.V2023_05_01_Preview) .buildAsyncClient(); // Validate client created with expected settings From 3ba05c8d9f8856c5e48b7e8a23afc349ae3799ce Mon Sep 17 00:00:00 2001 From: Erica Sponsler Date: Fri, 21 Jul 2023 16:15:11 -0700 Subject: [PATCH 6/9] fix public/private type generation, update changelog --- .../CHANGELOG.md | 8 +- .../phonenumbers/PhoneNumbersAsyncClient.java | 38 +++--- .../phonenumbers/PhoneNumbersClient.java | 2 +- .../implementation/PhoneNumbersImpl.java | 2 +- .../models/OperatorDetails.java | 90 -------------- .../models/OperatorInformation.java | 116 ------------------ .../models/OperatorInformationResult.java | 43 ------- .../models/OperatorNumberType.java | 44 ------- .../phonenumbers/models/OperatorDetails.java | 43 +------ .../models/OperatorInformation.java | 61 ++------- .../models/OperatorInformationRequest.java | 39 ------ .../models/OperatorInformationResult.java | 18 +-- .../swagger/README.md | 37 +++++- 13 files changed, 74 insertions(+), 467 deletions(-) delete mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorDetails.java delete mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformation.java delete mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationResult.java delete mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorNumberType.java delete mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationRequest.java diff --git a/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md b/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md index bc5839420cb0..5655be70f912 100644 --- a/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md +++ b/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md @@ -3,12 +3,8 @@ ## 1.2.0-beta.1 (Unreleased) ### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes +- Number Lookup API public preview +- API version `2023-05-01-preview` is the default ## 1.1.2 (2023-05-23) 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 c83b4ade1256..f154f4dc89fe 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,7 +14,7 @@ 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.models.OperatorInformationRequest; +import com.azure.communication.phonenumbers.implementation.models.OperatorInformationRequest; import com.azure.communication.phonenumbers.models.OperatorInformationResult; import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode; import com.azure.communication.phonenumbers.models.PurchasedPhoneNumber; @@ -64,7 +64,7 @@ * * - * + * *
  * PhoneNumbersAsyncClient phoneNumberAsyncClient = new PhoneNumbersClientBuilder()
  *         .endpoint(endpoint)
@@ -72,7 +72,7 @@
  *         .httpClient(httpClient)
  *         .buildAsyncClient();
  * 
- * + * * * * @see PhoneNumbersClientBuilder @@ -102,13 +102,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 @@ -136,7 +136,7 @@ public Mono getPurchasedPhoneNumber(String phoneNumber) { * * - * + * *
      * Response<PurchasedPhoneNumber> response = phoneNumberAsyncClient
      *         .getPurchasedPhoneNumberWithResponse("+18001234567").block();
@@ -144,7 +144,7 @@ public Mono getPurchasedPhoneNumber(String phoneNumber) {
      * System.out.println("Phone Number Value: " + phoneNumber.getPhoneNumber());
      * System.out.println("Phone Number Country Code: " + phoneNumber.getCountryCode());
      * 
- * + * * * @@ -173,14 +173,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 @@ -204,7 +204,7 @@ public PagedFlux listPurchasedPhoneNumbers() { * * - * + * *
      * PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities()
      *         .setCalling(PhoneNumberCapabilityType.INBOUND)
@@ -224,7 +224,7 @@ public PagedFlux listPurchasedPhoneNumbers() {
      *     System.out.println("Phone number costs:" + searchResult.getCost().getAmount());
      * }
      * 
- * + * * * @@ -255,7 +255,7 @@ public PollerFlux beginSearchAvai * - * + * *
      * PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities()
      *         .setCalling(PhoneNumberCapabilityType.INBOUND)
@@ -275,7 +275,7 @@ public PollerFlux beginSearchAvai
      *     System.out.println("Phone number costs:" + searchResult.getCost().getAmount());
      * }
      * 
- * + * * @@ -409,13 +409,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. @@ -475,13 +475,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 @@ -537,7 +537,7 @@ private Function, Mono - * + * *
      * PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities();
      * capabilities
@@ -554,7 +554,7 @@ private Function, Mono
-     * 
+     *
      * 
      *
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 fd6688d41d0e..114279f161fd 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
@@ -7,7 +7,7 @@
 
 import com.azure.communication.phonenumbers.implementation.PhoneNumberAdminClientImpl;
 import com.azure.communication.phonenumbers.implementation.PhoneNumbersImpl;
-import com.azure.communication.phonenumbers.models.OperatorInformationRequest;
+import com.azure.communication.phonenumbers.implementation.models.OperatorInformationRequest;
 import com.azure.communication.phonenumbers.models.OperatorInformationResult;
 import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode;
 import com.azure.communication.phonenumbers.models.PhoneNumberAssignmentType;
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 d67a5d2510cc..dd7afc9ecafc 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,7 +20,6 @@
 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.OperatorInformationRequest;
 import com.azure.communication.phonenumbers.models.OperatorInformationResult;
 import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode;
 import com.azure.communication.phonenumbers.models.PhoneNumberAssignmentType;
diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorDetails.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorDetails.java
deleted file mode 100644
index aad9601f26dd..000000000000
--- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorDetails.java
+++ /dev/null
@@ -1,90 +0,0 @@
-// 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 metadata describing the operator of a phone number. */
-@Fluent
-public final class OperatorDetails {
-    /*
-     * Name of the phone operator
-     */
-    @JsonProperty(value = "name")
-    private String name;
-
-    /*
-     * Mobile Network Code
-     */
-    @JsonProperty(value = "mobileNetworkCode")
-    private String mobileNetworkCode;
-
-    /*
-     * Mobile Country Code
-     */
-    @JsonProperty(value = "mobileCountryCode")
-    private String mobileCountryCode;
-
-    /**
-     * Get the name property: Name of the phone operator.
-     *
-     * @return the name value.
-     */
-    public String getName() {
-        return this.name;
-    }
-
-    /**
-     * Set the name property: Name of the phone operator.
-     *
-     * @param name the name value to set.
-     * @return the OperatorDetails object itself.
-     */
-    public OperatorDetails setName(String name) {
-        this.name = name;
-        return this;
-    }
-
-    /**
-     * Get the mobileNetworkCode property: Mobile Network Code.
-     *
-     * @return the mobileNetworkCode value.
-     */
-    public String getMobileNetworkCode() {
-        return this.mobileNetworkCode;
-    }
-
-    /**
-     * Set the mobileNetworkCode property: Mobile Network Code.
-     *
-     * @param mobileNetworkCode the mobileNetworkCode value to set.
-     * @return the OperatorDetails object itself.
-     */
-    public OperatorDetails setMobileNetworkCode(String mobileNetworkCode) {
-        this.mobileNetworkCode = mobileNetworkCode;
-        return this;
-    }
-
-    /**
-     * Get the mobileCountryCode property: Mobile Country Code.
-     *
-     * @return the mobileCountryCode value.
-     */
-    public String getMobileCountryCode() {
-        return this.mobileCountryCode;
-    }
-
-    /**
-     * Set the mobileCountryCode property: Mobile Country Code.
-     *
-     * @param mobileCountryCode the mobileCountryCode value to set.
-     * @return the OperatorDetails object itself.
-     */
-    public OperatorDetails setMobileCountryCode(String mobileCountryCode) {
-        this.mobileCountryCode = mobileCountryCode;
-        return this;
-    }
-}
diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformation.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformation.java
deleted file mode 100644
index a1ed177be021..000000000000
--- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformation.java
+++ /dev/null
@@ -1,116 +0,0 @@
-// 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 metadata about a phone number that is controlled/provided by that phone number's operator. */
-@Fluent
-public final class OperatorInformation {
-    /*
-     * E.164 formatted string representation of the phone number
-     */
-    @JsonProperty(value = "phoneNumber")
-    private String phoneNumber;
-
-    /*
-     * Type of service associated with the phone number
-     */
-    @JsonProperty(value = "numberType")
-    private OperatorNumberType numberType;
-
-    /*
-     * ISO country code associated with the phone number.
-     */
-    @JsonProperty(value = "isoCountryCode")
-    private String isoCountryCode;
-
-    /*
-     * Represents metadata describing the operator of a phone number
-     */
-    @JsonProperty(value = "operatorDetails")
-    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;
-    }
-
-    /**
-     * Set the phoneNumber property: E.164 formatted string representation of the phone number.
-     *
-     * @param phoneNumber the phoneNumber value to set.
-     * @return the OperatorInformation object itself.
-     */
-    public OperatorInformation setPhoneNumber(String phoneNumber) {
-        this.phoneNumber = phoneNumber;
-        return this;
-    }
-
-    /**
-     * Get the numberType property: Type of service associated with the phone number.
-     *
-     * @return the numberType value.
-     */
-    public OperatorNumberType getNumberType() {
-        return this.numberType;
-    }
-
-    /**
-     * Set the numberType property: Type of service associated with the phone number.
-     *
-     * @param numberType the numberType value to set.
-     * @return the OperatorInformation object itself.
-     */
-    public OperatorInformation setNumberType(OperatorNumberType numberType) {
-        this.numberType = numberType;
-        return this;
-    }
-
-    /**
-     * Get the isoCountryCode property: ISO country code associated with the phone number.
-     *
-     * @return the isoCountryCode value.
-     */
-    public String getIsoCountryCode() {
-        return this.isoCountryCode;
-    }
-
-    /**
-     * Set the isoCountryCode property: ISO country code associated with the phone number.
-     *
-     * @param isoCountryCode the isoCountryCode value to set.
-     * @return the OperatorInformation object itself.
-     */
-    public OperatorInformation setIsoCountryCode(String isoCountryCode) {
-        this.isoCountryCode = isoCountryCode;
-        return this;
-    }
-
-    /**
-     * Get the operatorDetails property: Represents metadata describing the operator of a phone number.
-     *
-     * @return the operatorDetails value.
-     */
-    public OperatorDetails getOperatorDetails() {
-        return this.operatorDetails;
-    }
-
-    /**
-     * Set the operatorDetails property: Represents metadata describing the operator of a phone number.
-     *
-     * @param operatorDetails the operatorDetails value to set.
-     * @return the OperatorInformation object itself.
-     */
-    public OperatorInformation setOperatorDetails(OperatorDetails operatorDetails) {
-        this.operatorDetails = operatorDetails;
-        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
deleted file mode 100644
index 44083bbec1c4..000000000000
--- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorInformationResult.java
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-// Code generated by Microsoft (R) AutoRest Code Generator.
-
-package com.azure.communication.phonenumbers.implementation.models;
-
-import com.azure.core.annotation.Fluent;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.util.List;
-
-/** Represents a search result containing operator information associated with the requested phone numbers. */
-@Fluent
-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")
-    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;
-    }
-
-    /**
-     * Set the values property: Results of a search. This array will have one entry per requested phone number which
-     * will contain the relevant operator information.
-     *
-     * @param values the values value to set.
-     * @return the OperatorInformationResult object itself.
-     */
-    public OperatorInformationResult setValues(List values) {
-        this.values = values;
-        return this;
-    }
-}
diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorNumberType.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorNumberType.java
deleted file mode 100644
index ca02533f5cf2..000000000000
--- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/implementation/models/OperatorNumberType.java
+++ /dev/null
@@ -1,44 +0,0 @@
-// 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 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/OperatorDetails.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorDetails.java
index ec1d9a3a5a62..fb69c89585fc 100644
--- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorDetails.java
+++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorDetails.java
@@ -4,28 +4,28 @@
 
 package com.azure.communication.phonenumbers.models;
 
-import com.azure.core.annotation.Fluent;
+import com.azure.core.annotation.Immutable;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 /** Represents metadata describing the operator of a phone number. */
-@Fluent
+@Immutable
 public final class OperatorDetails {
     /*
      * Name of the phone operator
      */
-    @JsonProperty(value = "name")
+    @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY)
     private String name;
 
     /*
      * Mobile Network Code
      */
-    @JsonProperty(value = "mobileNetworkCode")
+    @JsonProperty(value = "mobileNetworkCode", access = JsonProperty.Access.WRITE_ONLY)
     private String mobileNetworkCode;
 
     /*
      * Mobile Country Code
      */
-    @JsonProperty(value = "mobileCountryCode")
+    @JsonProperty(value = "mobileCountryCode", access = JsonProperty.Access.WRITE_ONLY)
     private String mobileCountryCode;
 
     /**
@@ -37,17 +37,6 @@ public String getName() {
         return this.name;
     }
 
-    /**
-     * Set the name property: Name of the phone operator.
-     *
-     * @param name the name value to set.
-     * @return the OperatorDetails object itself.
-     */
-    public OperatorDetails setName(String name) {
-        this.name = name;
-        return this;
-    }
-
     /**
      * Get the mobileNetworkCode property: Mobile Network Code.
      *
@@ -57,17 +46,6 @@ public String getMobileNetworkCode() {
         return this.mobileNetworkCode;
     }
 
-    /**
-     * Set the mobileNetworkCode property: Mobile Network Code.
-     *
-     * @param mobileNetworkCode the mobileNetworkCode value to set.
-     * @return the OperatorDetails object itself.
-     */
-    public OperatorDetails setMobileNetworkCode(String mobileNetworkCode) {
-        this.mobileNetworkCode = mobileNetworkCode;
-        return this;
-    }
-
     /**
      * Get the mobileCountryCode property: Mobile Country Code.
      *
@@ -76,15 +54,4 @@ public OperatorDetails setMobileNetworkCode(String mobileNetworkCode) {
     public String getMobileCountryCode() {
         return this.mobileCountryCode;
     }
-
-    /**
-     * Set the mobileCountryCode property: Mobile Country Code.
-     *
-     * @param mobileCountryCode the mobileCountryCode value to set.
-     * @return the OperatorDetails object itself.
-     */
-    public OperatorDetails setMobileCountryCode(String mobileCountryCode) {
-        this.mobileCountryCode = mobileCountryCode;
-        return this;
-    }
 }
diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformation.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformation.java
index 0cf661402570..966aec4ce2e0 100644
--- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformation.java
+++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformation.java
@@ -4,34 +4,35 @@
 
 package com.azure.communication.phonenumbers.models;
 
-import com.azure.core.annotation.Fluent;
+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. */
-@Fluent
+@Immutable
 public final class OperatorInformation {
     /*
      * E.164 formatted string representation of the phone number
      */
-    @JsonProperty(value = "phoneNumber")
+    @JsonProperty(value = "phoneNumber", access = JsonProperty.Access.WRITE_ONLY)
     private String phoneNumber;
 
     /*
      * Type of service associated with the phone number
      */
-    @JsonProperty(value = "numberType")
+    @JsonProperty(value = "numberType", access = JsonProperty.Access.WRITE_ONLY)
     private OperatorNumberType numberType;
 
     /*
-     * ISO country code associated with the phone number.
+     * ISO 3166-1 two character ('alpha-2') code associated with the phone
+     * number.
      */
-    @JsonProperty(value = "isoCountryCode")
+    @JsonProperty(value = "isoCountryCode", access = JsonProperty.Access.WRITE_ONLY)
     private String isoCountryCode;
 
     /*
      * Represents metadata describing the operator of a phone number
      */
-    @JsonProperty(value = "operatorDetails")
+    @JsonProperty(value = "operatorDetails", access = JsonProperty.Access.WRITE_ONLY)
     private OperatorDetails operatorDetails;
 
     /**
@@ -43,17 +44,6 @@ public String getPhoneNumber() {
         return this.phoneNumber;
     }
 
-    /**
-     * Set the phoneNumber property: E.164 formatted string representation of the phone number.
-     *
-     * @param phoneNumber the phoneNumber value to set.
-     * @return the OperatorInformation object itself.
-     */
-    public OperatorInformation setPhoneNumber(String phoneNumber) {
-        this.phoneNumber = phoneNumber;
-        return this;
-    }
-
     /**
      * Get the numberType property: Type of service associated with the phone number.
      *
@@ -64,18 +54,7 @@ public OperatorNumberType getNumberType() {
     }
 
     /**
-     * Set the numberType property: Type of service associated with the phone number.
-     *
-     * @param numberType the numberType value to set.
-     * @return the OperatorInformation object itself.
-     */
-    public OperatorInformation setNumberType(OperatorNumberType numberType) {
-        this.numberType = numberType;
-        return this;
-    }
-
-    /**
-     * Get the isoCountryCode property: ISO country code associated with the phone number.
+     * Get the isoCountryCode property: ISO 3166-1 two character ('alpha-2') code associated with the phone number.
      *
      * @return the isoCountryCode value.
      */
@@ -83,17 +62,6 @@ public String getIsoCountryCode() {
         return this.isoCountryCode;
     }
 
-    /**
-     * Set the isoCountryCode property: ISO country code associated with the phone number.
-     *
-     * @param isoCountryCode the isoCountryCode value to set.
-     * @return the OperatorInformation object itself.
-     */
-    public OperatorInformation setIsoCountryCode(String isoCountryCode) {
-        this.isoCountryCode = isoCountryCode;
-        return this;
-    }
-
     /**
      * Get the operatorDetails property: Represents metadata describing the operator of a phone number.
      *
@@ -102,15 +70,4 @@ public OperatorInformation setIsoCountryCode(String isoCountryCode) {
     public OperatorDetails getOperatorDetails() {
         return this.operatorDetails;
     }
-
-    /**
-     * Set the operatorDetails property: Represents metadata describing the operator of a phone number.
-     *
-     * @param operatorDetails the operatorDetails value to set.
-     * @return the OperatorInformation object itself.
-     */
-    public OperatorInformation setOperatorDetails(OperatorDetails operatorDetails) {
-        this.operatorDetails = operatorDetails;
-        return this;
-    }
 }
diff --git a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationRequest.java b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationRequest.java
deleted file mode 100644
index cdcddc35fe4d..000000000000
--- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/OperatorInformationRequest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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;
-import java.util.List;
-
-/** Represents a search request for operator information for the given phone numbers. */
-@Fluent
-public final class OperatorInformationRequest {
-    /*
-     * Phone number(s) whose operator information is being requested
-     */
-    @JsonProperty(value = "phoneNumbers")
-    private List phoneNumbers;
-
-    /**
-     * 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;
-    }
-}
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
index b55439907f9c..140169396450 100644
--- 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
@@ -4,19 +4,19 @@
 
 package com.azure.communication.phonenumbers.models;
 
-import com.azure.core.annotation.Fluent;
+import com.azure.core.annotation.Immutable;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import java.util.List;
 
 /** Represents a search result containing operator information associated with the requested phone numbers. */
-@Fluent
+@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")
+    @JsonProperty(value = "values", access = JsonProperty.Access.WRITE_ONLY)
     private List values;
 
     /**
@@ -28,16 +28,4 @@ public final class OperatorInformationResult {
     public List getValues() {
         return this.values;
     }
-
-    /**
-     * Set the values property: Results of a search. This array will have one entry per requested phone number which
-     * will contain the relevant operator information.
-     *
-     * @param values the values value to set.
-     * @return the OperatorInformationResult object itself.
-     */
-    public OperatorInformationResult setValues(List values) {
-        this.values = values;
-        return this;
-    }
 }
diff --git a/sdk/communication/azure-communication-phonenumbers/swagger/README.md b/sdk/communication/azure-communication-phonenumbers/swagger/README.md
index 5562d38dded1..152af6f746f9 100644
--- a/sdk/communication/azure-communication-phonenumbers/swagger/README.md
+++ b/sdk/communication/azure-communication-phonenumbers/swagger/README.md
@@ -24,9 +24,9 @@ autorest README.md --java --v4 --use=@autorest/java@4.0.2
 ### Code generation settings
 ``` yaml
 tag: package-phonenumber-2023-05-01-preview
-require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/4d2e746ac1e094f87bfe0807b1d51b375a6c5517/specification/communication/data-plane/PhoneNumbers/readme.md
+require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/dbd87dc39174b98d12566902c709a4b3af90c375/specification/communication/data-plane/PhoneNumbers/readme.md
 override-client-name: PhoneNumberAdminClient
-custom-types: PurchasedPhoneNumber,BillingFrequency,PhoneNumberOperationStatus,PhoneNumberOperationStatusCodes,PhoneNumberOperationType,PhoneNumberAssignmentType,PhoneNumberCapabilities,PhoneNumberCapabilityType,PhoneNumberCost,PhoneNumberSearchResult,PhoneNumberType,PhoneNumberCapability,PhoneNumberAdministrativeDivision,PhoneNumberCountry,PhoneNumberLocality,PhoneNumberOffering,AreaCodeResult,AreaCodes,PhoneNumberAreaCode,OperatorDetails,OperatorInformation,OperatorInformationRequest,OperatorInformationResult,OperatorNumberType
+custom-types: PurchasedPhoneNumber,BillingFrequency,PhoneNumberOperationStatus,PhoneNumberOperationStatusCodes,PhoneNumberOperationType,PhoneNumberAssignmentType,PhoneNumberCapabilities,PhoneNumberCapabilityType,PhoneNumberCost,PhoneNumberSearchResult,PhoneNumberType,PhoneNumberCapability,PhoneNumberAdministrativeDivision,PhoneNumberCountry,PhoneNumberLocality,PhoneNumberOffering,AreaCodeResult,AreaCodes,PhoneNumberAreaCode,OperatorDetails,OperatorInformation,OperatorInformationResult,OperatorNumberType
 custom-types-subpackage: models
 models-subpackage: implementation.models
 java: true
@@ -149,7 +149,6 @@ directive:
       $["properties"]["localizedName"].readOnly = true;
 ```
 
-
 ### Add readonly attribute to PhoneNumberLocalities properties
 ```yaml
 directive:
@@ -192,6 +191,38 @@ directive:
       $["properties"]["countryCode"].readOnly = true;
 ```
 
+### 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;
+```
+
+### Add readonly attribute to OperatorInformationResult properties
+```yaml
+directive:
+  - from: swagger-document
+    where: $.definitions.OperatorInformationResult
+    transform: >
+      $["properties"]["values"].readOnly = true;
+```
+
 ``` yaml
 directive:
   from: swagger-document

From 9a21aac9f016631045df263012943e9cd54fc740 Mon Sep 17 00:00:00 2001
From: Erica Sponsler 
Date: Fri, 21 Jul 2023 16:52:08 -0700
Subject: [PATCH 7/9] fix checkstyle issues

---
 .../models/PhoneNumberSearchResult.java       |  1 -
 .../models/PhoneNumberSearchResultError.java  | 84 +++++++++++++++++++
 ...honeNumbersAsyncClientIntegrationTest.java |  2 +-
 .../PhoneNumbersClientIntegrationTest.java    |  2 +-
 .../swagger/README.md                         |  2 +-
 5 files changed, 87 insertions(+), 4 deletions(-)
 create mode 100644 sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResultError.java

diff --git a/sdk/communication/azure-communication-phonenumbers/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 0f90940a0010..12cdffd29a5e 100644
--- a/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResult.java
+++ b/sdk/communication/azure-communication-phonenumbers/src/main/java/com/azure/communication/phonenumbers/models/PhoneNumberSearchResult.java
@@ -4,7 +4,6 @@
 
 package com.azure.communication.phonenumbers.models;
 
-import com.azure.communication.phonenumbers.implementation.models.PhoneNumberSearchResultError;
 import com.azure.core.annotation.Fluent;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import java.time.OffsetDateTime;
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/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersAsyncClientIntegrationTest.java
index b195a2fdd86f..75b27d48be34 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
@@ -422,7 +422,7 @@ public void searchOperatorInformation(HttpClient httpClient) {
                 this.getClientWithConnectionString(httpClient, "searchOperatorInformation")
                         .searchOperatorInformation(phoneNumbers))
                 .assertNext((OperatorInformationResult result) -> {
-                        assertEquals(phoneNumbers.get(0), result.getValues().get(0).getPhoneNumber());
+                    assertEquals(phoneNumbers.get(0), result.getValues().get(0).getPhoneNumber());
                 })
                 .verifyComplete();
     }
diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientIntegrationTest.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersClientIntegrationTest.java
index 8e8c93df411b..86a2f4667097 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
@@ -315,7 +315,7 @@ public void getOfferingsWithAAD(HttpClient httpClient) {
     @MethodSource("com.azure.core.test.TestBase#getHttpClients")
     public void searchOperatorInformation(HttpClient httpClient) {
         List phoneNumbers = new ArrayList();
-		phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber()));
+        phoneNumbers.add(redactIfPlaybackMode(getTestPhoneNumber()));
         OperatorInformationResult result = this.getClientWithConnectionString(httpClient, "searchOperatorInformation")
                 .searchOperatorInformation(phoneNumbers);
         assertEquals(phoneNumbers.get(0), result.getValues().get(0).getPhoneNumber());
diff --git a/sdk/communication/azure-communication-phonenumbers/swagger/README.md b/sdk/communication/azure-communication-phonenumbers/swagger/README.md
index 152af6f746f9..84110262d0bc 100644
--- a/sdk/communication/azure-communication-phonenumbers/swagger/README.md
+++ b/sdk/communication/azure-communication-phonenumbers/swagger/README.md
@@ -26,7 +26,7 @@ autorest README.md --java --v4 --use=@autorest/java@4.0.2
 tag: package-phonenumber-2023-05-01-preview
 require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/dbd87dc39174b98d12566902c709a4b3af90c375/specification/communication/data-plane/PhoneNumbers/readme.md
 override-client-name: PhoneNumberAdminClient
-custom-types: PurchasedPhoneNumber,BillingFrequency,PhoneNumberOperationStatus,PhoneNumberOperationStatusCodes,PhoneNumberOperationType,PhoneNumberAssignmentType,PhoneNumberCapabilities,PhoneNumberCapabilityType,PhoneNumberCost,PhoneNumberSearchResult,PhoneNumberType,PhoneNumberCapability,PhoneNumberAdministrativeDivision,PhoneNumberCountry,PhoneNumberLocality,PhoneNumberOffering,AreaCodeResult,AreaCodes,PhoneNumberAreaCode,OperatorDetails,OperatorInformation,OperatorInformationResult,OperatorNumberType
+custom-types: PurchasedPhoneNumber,BillingFrequency,PhoneNumberOperationStatus,PhoneNumberOperationStatusCodes,PhoneNumberOperationType,PhoneNumberAssignmentType,PhoneNumberCapabilities,PhoneNumberCapabilityType,PhoneNumberCost,PhoneNumberSearchResult,PhoneNumberType,PhoneNumberCapability,PhoneNumberAdministrativeDivision,PhoneNumberCountry,PhoneNumberLocality,PhoneNumberOffering,AreaCodeResult,AreaCodes,PhoneNumberAreaCode,PhoneNumberSearchResultError,OperatorDetails,OperatorInformation,OperatorInformationResult,OperatorNumberType
 custom-types-subpackage: models
 models-subpackage: implementation.models
 java: true

From 40721b9c2deffbcfc7e4ed8005eacbd1414dabf8 Mon Sep 17 00:00:00 2001
From: Erica Sponsler 
Date: Mon, 24 Jul 2023 22:37:52 -0700
Subject: [PATCH 8/9] update test recordings

---
 sdk/communication/azure-communication-phonenumbers/assets.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sdk/communication/azure-communication-phonenumbers/assets.json b/sdk/communication/azure-communication-phonenumbers/assets.json
index e0ed42788980..80cafa7834cb 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_3083b8b6c8"
+  "Tag": "java/communication/azure-communication-phonenumbers_e52a158728"
 }

From 81bec081382309e190a1632cb823560277509710 Mon Sep 17 00:00:00 2001
From: Erica Sponsler 
Date: Wed, 26 Jul 2023 13:41:19 -0700
Subject: [PATCH 9/9] update test base to redact phonenumbers in
 operatorInformation response, update test recordings

---
 .../azure-communication-phonenumbers/assets.json            | 2 +-
 .../phonenumbers/PhoneNumbersIntegrationTestBase.java       | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/sdk/communication/azure-communication-phonenumbers/assets.json b/sdk/communication/azure-communication-phonenumbers/assets.json
index 80cafa7834cb..6927bef02db0 100644
--- a/sdk/communication/azure-communication-phonenumbers/assets.json
+++ b/sdk/communication/azure-communication-phonenumbers/assets.json
@@ -2,5 +2,5 @@
   "AssetsRepo": "Azure/azure-sdk-assets",
   "AssetsRepoPrefixPath": "java",
   "TagPrefix": "java/communication/azure-communication-phonenumbers",
-  "Tag": "java/communication/azure-communication-phonenumbers_e52a158728"
+  "Tag": "java/communication/azure-communication-phonenumbers_04198d656b"
 }
diff --git a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java
index ac819bc9e07f..aafdf05c8a22 100644
--- a/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java
+++ b/sdk/communication/azure-communication-phonenumbers/src/test/java/com/azure/communication/phonenumbers/PhoneNumbersIntegrationTestBase.java
@@ -53,7 +53,8 @@ protected PhoneNumbersClientBuilder getClientBuilderWithConnectionString(HttpCli
 
     private void addTestProxyMatchers() {
         interceptorManager.addMatchers(Arrays.asList(
-            new CustomMatcher().setHeadersKeyOnlyMatch(Arrays.asList("x-ms-hmac-string-to-sign-base64"))));
+            new CustomMatcher().setHeadersKeyOnlyMatch(Arrays.asList("x-ms-hmac-string-to-sign-base64", "x-ms-content-sha256"))));
+
     }
 
     private void addTestProxySanitizer() {
@@ -61,7 +62,8 @@ private void addTestProxySanitizer() {
         interceptorManager.addSanitizers(Arrays.asList(
             new TestProxySanitizer("(?<=/phoneNumbers/)([^/?]+)", "REDACTED", TestProxySanitizerType.URL),
             new TestProxySanitizer("id", null, "REDACTED", TestProxySanitizerType.BODY_KEY),
-            new TestProxySanitizer("phoneNumber", null, "REDACTED", TestProxySanitizerType.BODY_KEY)));
+            new TestProxySanitizer("phoneNumber", null, "REDACTED", TestProxySanitizerType.BODY_KEY),
+            new TestProxySanitizer("$..phoneNumber", null, "REDACTED", TestProxySanitizerType.BODY_KEY)));
     }
 
     protected PhoneNumbersClientBuilder getClientBuilderUsingManagedIdentity(HttpClient httpClient) {