diff --git a/eng/.docsettings.yml b/eng/.docsettings.yml
index 6797e4c308ad..6b0f10598579 100644
--- a/eng/.docsettings.yml
+++ b/eng/.docsettings.yml
@@ -128,6 +128,7 @@ known_content_issues:
- ['sdk/communication/azure-communication-sms/swagger/README.md', '#3113']
- ['sdk/communication/azure-communication-administration/swagger/README.md', '#3113']
- ['sdk/communication/azure-communication-identity/swagger/README.md', '#3113']
+ - ['sdk/communication/azure-communication-phonenumbers/swagger/README.md', '#3113']
- ['sdk/cosmos/changelog/README.md', '#3113']
- ['sdk/cosmos/faq/README.md', '#3113']
- ['sdk/cosmos/azure-cosmos-benchmark/README.md', '#3113']
diff --git a/eng/jacoco-test-coverage/pom.xml b/eng/jacoco-test-coverage/pom.xml
index d8ba12ada0e3..968fde356156 100644
--- a/eng/jacoco-test-coverage/pom.xml
+++ b/eng/jacoco-test-coverage/pom.xml
@@ -75,6 +75,11 @@
com.azure
azure-communication-sms
1.0.0-beta.5
+
+
+ com.azure
+ azure-communication-phonenumbers
+ 1.0.0-beta.5
com.azure
diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt
index f85405a4b147..71f854ede7dc 100644
--- a/eng/versioning/version_client.txt
+++ b/eng/versioning/version_client.txt
@@ -50,6 +50,7 @@ com.azure:azure-communication-common;1.0.0-beta.4;1.0.0-beta.5
com.azure:azure-communication-administration;1.0.0-beta.4;1.0.0-beta.5
com.azure:azure-communication-sms;1.0.0-beta.4;1.0.0-beta.5
com.azure:azure-communication-identity;1.0.0-beta.4;1.0.0-beta.5
+com.azure:azure-communication-phonenumbers;1.0.0-beta.5;1.0.0-beta.5
com.azure:azure-core;1.13.0;1.14.0-beta.1
com.azure:azure-core-amqp;2.0.2;2.1.0-beta.1
com.azure:azure-core-amqp-experimental;1.0.0-beta.1;1.0.0-beta.1
diff --git a/sdk/communication/azure-communication-administration/CHANGELOG.md b/sdk/communication/azure-communication-administration/CHANGELOG.md
index 8c16bb288553..333f7c15457a 100644
--- a/sdk/communication/azure-communication-administration/CHANGELOG.md
+++ b/sdk/communication/azure-communication-administration/CHANGELOG.md
@@ -1,13 +1,15 @@
# Release History
## 1.0.0-beta.5 (Unreleased)
+### Breaking Changes
+- PhoneNumbersClient and PhoneNumbersAsyncClient is moved to a new package, `azure.communication.phonenumbers`.
## 1.0.0-beta.4 (Skipped)
### Added
- Added support for Azure Active Directory Authentication.
### Breaking Changes
-- CommunicationIdentityClient and CommunicationIdentityAsyncClient is moved to a new package, `azure-communication-identity`.
+- CommunicationIdentityClient and CommunicationIdentityAsyncClient is moved to a new package, `azure.communication.identity`.
## 1.0.0-beta.3 (2020-11-16)
### Added
diff --git a/sdk/communication/azure-communication-administration/README.md b/sdk/communication/azure-communication-administration/README.md
index 34c58f996b58..2ffd5c8a20f7 100644
--- a/sdk/communication/azure-communication-administration/README.md
+++ b/sdk/communication/azure-communication-administration/README.md
@@ -1,11 +1,10 @@
# Azure Communication Administration client library for Java
-The administration package provides capabilities for Phone Number Administration.
+The administration package previously provided capabilities for User and Token Management and for Phone Number Administration.
-Acquired phone numbers can come with many capabilities, depending on the country, number type and phone plan. Examples of capabilities are SMS inbound and outbound usage, PSTN inbound and outbound usage. Phone numbers can also be assigned to a bot via a webhook URL.
+Now, User and Token Management capabilities have been moved to `azure.communication.identity`.
+Phone Number Administration has been moved to `azure.communication.phonenumbers`.
-[Source code][source] | [Package (Maven)][package] | [API reference documentation][api_documentation]
-| [Product documentation][product_docs]
## Getting started
### Prerequisites
@@ -28,217 +27,8 @@ Acquired phone numbers can come with many capabilities, depending on the country
## Key concepts
-
-### Initializing Phone Number Client
-The PhoneNumberClientBuilder is enabled to use Azure Active Directory Authentication
-
-```java
-String endpoint = "https://.communication.azure.com";
-
-// Create an HttpClient builder of your choice and customize it
-HttpClient httpClient = new NettyAsyncHttpClientBuilder().build();
-
-PhoneNumberClient phoneNumberClient = new PhoneNumberClientBuilder()
- .endpoint(endpoint)
- .credential(new DefaultAzureCredentialBuilder().build())
- .httpClient(httpClient)
- .buildClient();
-```
-
-Using the endpoint and access key from the communication resource to authenticate is also posible.
-
-```java
-// You can find your endpoint and access token from your resource in the Azure Portal
-String endpoint = "https://.communication.azure.com";
-String accessKey = "SECRET";
-
-// Create an HttpClient builder of your choice and customize it
-HttpClient httpClient = new NettyAsyncHttpClientBuilder().build();
-
-PhoneNumberClient phoneNumberClient = new PhoneNumberClientBuilder()
- .endpoint(endpoint)
- .accessKey(accessKey)
- .httpClient(httpClient)
- .buildClient();
-```
-Alternatively, you can provide the entire connection string using the connectionString() function of the PhoneNumberClientBuilder instead of providing the endpoint and access key.
-
-### Phone plans overview
-
-Phone plans come in two types; Geographic and Toll-Free. Geographic phone plans are phone plans associated with a location, whose phone numbers' area codes are associated with the area code of a geographic location. Toll-Free phone plans are phone plans not associated location. For example, in the US, toll-free numbers can come with area codes such as 800 or 888.
-
-All geographic phone plans within the same country are grouped into a phone plan group with a Geographic phone number type. All Toll-Free phone plans within the same country are grouped into a phone plan group.
-
-### Searching and Acquiring numbers
-
-Phone numbers search can be search through the search creation API by providing a phone plan id, an area code and quantity of phone numbers. The provided quantity of phone numbers will be reserved for ten minutes. This search of phone numbers can either be cancelled or purchased. If the search is cancelled, then the phone numbers will become available to others. If the search is purchased, then the phone numbers are acquired for the Azure resources.
-
-### Configuring / Assigning numbers
-
-Phone numbers can be assigned to a callback URL via the configure number API. As part of the configuration, you will need an acquired phone number, callback URL and application id.
-
## Examples
-### Get Countries
-
-
-```java
-PhoneNumberClient phoneNumberClient = createPhoneNumberClient();
-
-PagedIterable phoneNumberCountries = phoneNumberClient
- .listAllSupportedCountries(locale);
-
-for (PhoneNumberCountry phoneNumberCountry
- : phoneNumberCountries) {
- System.out.println("Phone Number Country Code: " + phoneNumberCountry.getCountryCode());
- System.out.println("Phone Number Country Name: " + phoneNumberCountry.getLocalizedName());
-}
-```
-
-### Get Phone Plan Groups
-
-Phone plan groups come in two types, Geographic and Toll-Free.
-
-
-```java
-PagedIterable phonePlanGroups = phoneNumberClient
- .listPhonePlanGroups(countryCode, locale, true);
-
-for (PhonePlanGroup phonePlanGroup
- : phonePlanGroups) {
- System.out.println("Phone Plan GroupId: " + phonePlanGroup.getPhonePlanGroupId());
- System.out.println("Phone Plan NumberType: " + phonePlanGroup.getPhoneNumberType());
-}
-```
-
-### Get Phone Plans
-
-Unlike Toll-Free phone plans, area codes for Geographic Phone Plans are empty. Area codes are found in the Area Codes API.
-
-
-```java
-PagedIterable phonePlans = phoneNumberClient
- .listPhonePlans(countryCode, phonePlanGroupId, locale);
-
-for (PhonePlan phonePlan
- : phonePlans) {
- System.out.println("Phone Plan Id: " + phonePlan.getPhonePlanId());
- System.out.println("Phone Plan Name: " + phonePlan.getLocalizedName());
- System.out.println("Phone Plan Capabilities: " + phonePlan.getCapabilities());
- System.out.println("Phone Plan Area Codes: " + phonePlan.getAreaCodes());
-}
-```
-
-### Get Location Options
-
-For Geographic phone plans, you can query the available geographic locations. The locations options are structured like the geographic hierarchy of a country. For example, the US has states and within each state are cities.
-
-
-```java
-LocationOptions locationOptions = phoneNumberClient
- .getPhonePlanLocationOptions(countryCode, phonePlanGroupId, phonePlanId, locale)
- .getLocationOptions();
-
-System.out.println("Getting LocationOptions for: " + locationOptions.getLabelId());
-for (LocationOptionsDetails locationOptionsDetails
- : locationOptions.getOptions()) {
- System.out.println(locationOptionsDetails.getValue());
- for (LocationOptions locationOptions1
- : locationOptionsDetails.getLocationOptions()) {
- System.out.println("Getting LocationOptions for: " + locationOptions1.getLabelId());
- for (LocationOptionsDetails locationOptionsDetails1
- : locationOptions1.getOptions()) {
- System.out.println(locationOptionsDetails1.getValue());
- }
- }
-}
-```
-
-### Get Area Codes
-
-Fetching area codes for geographic phone plans will require the the location options queries set. You must include the chain of geographic locations traversing down the location options object returned by the GetLocationOptions API.
-
-
-```java
-AreaCodes areaCodes = phoneNumberClient
- .getAllAreaCodes("selection", countryCode, phonePlanId, locationOptions);
-
-for (String areaCode
- : areaCodes.getPrimaryAreaCodes()) {
- System.out.println(areaCode);
-}
-```
-
-### Configure Phone Number
-
-
-```java
-phoneNumberClient.configureNumber(phoneNumber, pstnConfiguration);
-```
-
-## Long Running Operations
-
-The Phone Number Client supports a variety of long running operations that allow indefinite polling time to the functions listed down below.
-
-### Create Search
-
-
-```java
-String phonePlanId = "PHONE_PLAN_ID";
-
-List phonePlanIds = new ArrayList<>();
-phonePlanIds.add(phonePlanId);
-
-CreateReservationOptions createReservationOptions = new CreateReservationOptions();
-createReservationOptions
- .setAreaCode("AREA_CODE_FOR_RESERVATION")
- .setDescription("DESCRIPTION_FOR_RESERVATION")
- .setDisplayName("NAME_FOR_RESERVATION")
- .setPhonePlanIds(phonePlanIds)
- .setQuantity(2);
-
-Duration duration = Duration.ofSeconds(1);
-PhoneNumberClient phoneNumberClient = createPhoneNumberClient();
-
-SyncPoller res =
- phoneNumberClient.beginCreateReservation(createReservationOptions, duration);
-res.waitForCompletion();
-PhoneNumberReservation result = res.getFinalResult();
-
-System.out.println("Reservation Id: " + result.getReservationId());
-for (String phoneNumber: result.getPhoneNumbers()) {
- System.out.println("Phone Number: " + phoneNumber);
-}
-```
-
-### Purchase Search
-
-```java
-Duration duration = Duration.ofSeconds(1);
-String phoneNumberReservationId = "RESERVATION_ID_TO_PURCHASE";
-PhoneNumberClient phoneNumberClient = createPhoneNumberClient();
-
-SyncPoller res =
- phoneNumberClient.beginPurchaseReservation(phoneNumberReservationId, duration);
-res.waitForCompletion();
-```
-
-### Release Phone Numbers
-
-```java
-Duration duration = Duration.ofSeconds(1);
-PhoneNumberIdentifier phoneNumber = new PhoneNumberIdentifier("PHONE_NUMBER_TO_RELEASE");
-List phoneNumbers = new ArrayList<>();
-phoneNumbers.add(phoneNumber);
-PhoneNumberClient phoneNumberClient = createPhoneNumberClient();
-
-SyncPoller res =
- phoneNumberClient.beginReleasePhoneNumbers(phoneNumbers, duration);
-res.waitForCompletion();
-PhoneNumberRelease result = res.getFinalResult();
-System.out.println("Phone number release status: " + result.getStatus());
-```
-
## Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a [Contributor License Agreement (CLA)][cla] declaring that you have the right to, and actually do, grant us the rights to use your contribution.
@@ -264,8 +54,5 @@ Check out other client libraries for Azure communication service
[product_docs]: https://docs.microsoft.com/azure/communication-services/
[package]: https://search.maven.org/artifact/com.azure/azure-communication-administration
[api_documentation]: https://aka.ms/java-docs
-[source]: https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/communication/azure-communication-administration/src
-
-

diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberAsyncClient.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberAsyncClient.java
deleted file mode 100644
index 5a66cc1b1221..000000000000
--- a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberAsyncClient.java
+++ /dev/null
@@ -1,965 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-package com.azure.communication.administration;
-
-import com.azure.communication.administration.implementation.PhoneNumberAdminClientImpl;
-import com.azure.communication.administration.implementation.PhoneNumberAdministrationsImpl;
-import com.azure.communication.administration.models.AcquiredPhoneNumber;
-import com.azure.communication.administration.models.AreaCodes;
-import com.azure.communication.administration.models.CreateReservationOptions;
-import com.azure.communication.administration.models.CreateReservationResponse;
-import com.azure.communication.administration.models.LocationOptionsQuery;
-import com.azure.communication.administration.models.LocationOptionsQueries;
-import com.azure.communication.administration.models.LocationOptionsResponse;
-import com.azure.communication.administration.models.NumberConfiguration;
-import com.azure.communication.administration.models.NumberConfigurationPhoneNumber;
-import com.azure.communication.administration.models.NumberConfigurationResponse;
-import com.azure.communication.administration.models.NumberUpdateCapabilities;
-import com.azure.communication.administration.models.PhoneNumberCountry;
-import com.azure.communication.administration.models.PhoneNumberEntity;
-import com.azure.communication.administration.models.PhoneNumberRelease;
-import com.azure.communication.administration.models.PhonePlan;
-import com.azure.communication.administration.models.PhonePlanGroup;
-import com.azure.communication.administration.models.PstnConfiguration;
-import com.azure.communication.administration.models.ReleaseResponse;
-import com.azure.communication.administration.models.ReleaseRequest;
-import com.azure.communication.administration.models.ReleaseStatus;
-import com.azure.communication.administration.models.UpdateNumberCapabilitiesRequest;
-import com.azure.communication.administration.models.UpdateNumberCapabilitiesResponse;
-import com.azure.communication.administration.models.PhoneNumberReservation;
-import com.azure.communication.administration.models.UpdatePhoneNumberCapabilitiesResponse;
-import com.azure.communication.common.PhoneNumberIdentifier;
-import com.azure.core.annotation.ReturnType;
-import com.azure.core.annotation.ServiceClient;
-import com.azure.core.annotation.ServiceMethod;
-import com.azure.core.http.rest.PagedFlux;
-import com.azure.core.http.rest.Response;
-import com.azure.core.util.Context;
-import com.azure.core.util.FluxUtil;
-import com.azure.core.util.logging.ClientLogger;
-import com.azure.core.util.polling.LongRunningOperationStatus;
-import com.azure.core.util.polling.PollResponse;
-import com.azure.core.util.polling.PollerFlux;
-import com.azure.core.util.polling.PollingContext;
-import reactor.core.publisher.Mono;
-
-import java.time.Duration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.function.BiFunction;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-import static com.azure.core.util.FluxUtil.monoError;
-import static com.azure.core.util.FluxUtil.pagedFluxError;
-
-/**
- * Asynchronous client for Communication service phone number operations
- */
-@ServiceClient(builder = PhoneNumberClientBuilder.class, isAsync = true)
-public final class PhoneNumberAsyncClient {
- private final ClientLogger logger = new ClientLogger(PhoneNumberAsyncClient.class);
- private final PhoneNumberAdministrationsImpl phoneNumberAdministrations;
- private final Duration defaultPollInterval = Duration.ofSeconds(1);
-
- PhoneNumberAsyncClient(PhoneNumberAdminClientImpl phoneNumberAdminClient) {
- this.phoneNumberAdministrations = phoneNumberAdminClient.getPhoneNumberAdministrations();
- }
-
- /**
- * Gets the list of the acquired phone numbers.
- *
- * @param locale A language-locale pairing which will be used to localise the names of countries.
- * @return A {@link PagedFlux} of {@link AcquiredPhoneNumber} instances representing acquired telephone numbers.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listAllPhoneNumbers(String locale) {
- return listAllPhoneNumbers(locale, null);
- }
-
- PagedFlux listAllPhoneNumbers(String locale, Context context) {
- try {
- if (context == null) {
- return phoneNumberAdministrations.getAllPhoneNumbersAsync(locale, null, null);
- } else {
- return phoneNumberAdministrations.getAllPhoneNumbersAsync(locale, null, null, context);
- }
- } catch (RuntimeException ex) {
- return pagedFluxError(logger, ex);
- }
- }
-
- /**
- * Gets a list of the supported area codes.
- *
- * @param locationType The type of location information required by the plan.
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanId The plan id from which to search area codes.
- * @param locationOptions A {@link List} of {@link LocationOptionsQuery} for querying the area codes.
- * @return A {@link Mono} containing a {@link AreaCodes} representing area codes.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getAllAreaCodes(
- String locationType, String countryCode, String phonePlanId, List locationOptions) {
- return getAllAreaCodesWithResponse(locationType, countryCode, phonePlanId, locationOptions)
- .flatMap(FluxUtil::toMono);
- }
-
- /**
- * Gets a list of the supported area codes.
- *
- * @param locationType The type of location information required by the plan.
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanId The plan id from which to search area codes.
- * @param locationOptions A {@link List} of {@link LocationOptionsQuery} for querying the area codes.
- * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue()} value returns
- * a {@link AreaCodes} representing area codes.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getAllAreaCodesWithResponse(
- String locationType, String countryCode, String phonePlanId, List locationOptions) {
- return getAllAreaCodesWithResponse(locationType, countryCode, phonePlanId, locationOptions, null);
- }
-
- Mono> getAllAreaCodesWithResponse(
- String locationType, String countryCode, String phonePlanId, List locationOptions,
- Context context) {
-
- LocationOptionsQueries locationOptionsQueries = new LocationOptionsQueries();
- locationOptionsQueries.setLocationOptions(locationOptions);
-
- try {
-
- Objects.requireNonNull(locationType, "'locationType' cannot be null.");
- Objects.requireNonNull(countryCode, "'countryCode' cannot be null.");
- Objects.requireNonNull(phonePlanId, "'phonePlanId' cannot be null.");
-
- if (context == null) {
- return phoneNumberAdministrations.getAllAreaCodesWithResponseAsync(
- locationType, countryCode, phonePlanId, locationOptionsQueries);
- } else {
- return phoneNumberAdministrations.getAllAreaCodesWithResponseAsync(
- locationType, countryCode, phonePlanId, locationOptionsQueries, context);
- }
- } catch (RuntimeException ex) {
- return monoError(logger, ex);
- }
- }
-
- /**
- * Gets the information for a phone number capabilities update
- *
- * @param capabilitiesId ID of the capabilities update.
- * @return A {@link Mono} containing
- * a {@link UpdatePhoneNumberCapabilitiesResponse} representing the capabilities update.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getCapabilitiesUpdate(String capabilitiesId) {
- return getCapabilitiesUpdateWithResponse(capabilitiesId).flatMap(FluxUtil::toMono);
- }
-
- /**
- * Gets the information for a phone number capabilities update
- *
- * @param capabilitiesId ID of the capabilities update.
- * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue()} value returns
- * a {@link UpdatePhoneNumberCapabilitiesResponse} representing the capabilities update.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getCapabilitiesUpdateWithResponse(
- String capabilitiesId) {
- return getCapabilitiesUpdateWithResponse(capabilitiesId, null);
- }
-
- Mono> getCapabilitiesUpdateWithResponse(
- String capabilitiesId, Context context) {
- try {
- Objects.requireNonNull(capabilitiesId, "'capabilitiesId' cannot be null.");
- if (context == null) {
- return phoneNumberAdministrations.getCapabilitiesUpdateWithResponseAsync(capabilitiesId);
- } else {
- return phoneNumberAdministrations.getCapabilitiesUpdateWithResponseAsync(capabilitiesId, context);
- }
- } catch (RuntimeException ex) {
- return monoError(logger, ex);
- }
- }
-
- /**
- * Adds or removes phone number capabilities.
- *
- * @param phoneNumberCapabilitiesUpdate {@link Map} with the updates to perform
- * @return A {@link Mono} containing
- * a {@link UpdatePhoneNumberCapabilitiesResponse} representing the capabilities update.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono updateCapabilities(
- Map phoneNumberCapabilitiesUpdate) {
- return updateCapabilitiesWithResponse(phoneNumberCapabilitiesUpdate).flatMap(FluxUtil::toMono);
- }
-
- /**
- * Adds or removes phone number capabilities.
- *
- * @param phoneNumberCapabilitiesUpdate {@link Map} with the updates to perform
- * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue()} value returns
- * a {@link UpdatePhoneNumberCapabilitiesResponse} representing the capabilities update.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> updateCapabilitiesWithResponse(
- Map phoneNumberCapabilitiesUpdate) {
- return updateCapabilitiesWithResponse(phoneNumberCapabilitiesUpdate, null);
- }
-
- Mono> updateCapabilitiesWithResponse(
- Map phoneNumberCapabilitiesUpdate, Context context) {
- try {
- Objects.requireNonNull(phoneNumberCapabilitiesUpdate, "'phoneNumberCapabilitiesUpdate' cannot be null.");
- Map capabilitiesMap = new HashMap<>();
- for (Map.Entry entry
- : phoneNumberCapabilitiesUpdate.entrySet()) {
- capabilitiesMap.put(entry.getKey().getPhoneNumber(), entry.getValue());
- }
- UpdateNumberCapabilitiesRequest updateNumberCapabilitiesRequest = new UpdateNumberCapabilitiesRequest();
- updateNumberCapabilitiesRequest.setPhoneNumberCapabilitiesUpdate(capabilitiesMap);
-
- if (context == null) {
- return phoneNumberAdministrations.updateCapabilitiesWithResponseAsync(
- updateNumberCapabilitiesRequest);
- } else {
- return phoneNumberAdministrations.updateCapabilitiesWithResponseAsync(
- updateNumberCapabilitiesRequest, context);
- }
- } catch (RuntimeException ex) {
- return monoError(logger, ex);
- }
- }
-
- /**
- * Gets a list of supported countries.
- *
- * @param locale A language-locale pairing which will be used to localise the names of countries.
- * @return A {@link PagedFlux} of {@link PhoneNumberCountry} instances representing supported countries.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listAllSupportedCountries(String locale) {
- return listAllSupportedCountries(locale, null);
- }
-
- PagedFlux listAllSupportedCountries(String locale, Context context) {
- try {
- if (context == null) {
- return phoneNumberAdministrations.getAllSupportedCountriesAsync(locale, null, null);
- } else {
- return phoneNumberAdministrations.getAllSupportedCountriesAsync(locale, null, null, context);
- }
- } catch (RuntimeException ex) {
- return pagedFluxError(logger, ex);
- }
- }
-
- /**
- * Gets the configuration of a given phone number.
- *
- * @param phoneNumber A {@link PhoneNumberIdentifier} representing the phone number.
- * @return A {@link Mono} containing a {@link NumberConfigurationResponse} representing the configuration.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getNumberConfiguration(PhoneNumberIdentifier phoneNumber) {
- return getNumberConfigurationWithResponse(phoneNumber).flatMap(FluxUtil::toMono);
- }
-
- /**
- * Gets the configuration of a given phone number.
- *
- * @param phoneNumber A {@link PhoneNumberIdentifier} representing the phone number.
- * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue()} value returns
- * a {@link NumberConfigurationResponse} representing the configuration.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getNumberConfigurationWithResponse(
- PhoneNumberIdentifier phoneNumber) {
- return getNumberConfigurationWithResponse(phoneNumber, null);
- }
-
- Mono> getNumberConfigurationWithResponse(
- PhoneNumberIdentifier phoneNumber, Context context) {
- try {
- Objects.requireNonNull(phoneNumber, "'phoneNumber' cannot be null.");
- NumberConfigurationPhoneNumber configurationPhoneNumber = new NumberConfigurationPhoneNumber();
- configurationPhoneNumber.setPhoneNumber(phoneNumber.getPhoneNumber());
-
- if (context == null) {
- return phoneNumberAdministrations.getNumberConfigurationWithResponseAsync(
- configurationPhoneNumber);
- } else {
- return phoneNumberAdministrations.getNumberConfigurationWithResponseAsync(
- configurationPhoneNumber, context);
- }
- } catch (RuntimeException ex) {
- return monoError(logger, ex);
- }
- }
-
- /**
- * Associates a phone number with a PSTN Configuration.
- *
- * @param phoneNumber A {@link PhoneNumberIdentifier} representing the phone number.
- * @param pstnConfiguration A {@link PstnConfiguration} containing the pstn number configuration options.
- * @return A {@link Mono} for the asynchronous return
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono configureNumber(PhoneNumberIdentifier phoneNumber, PstnConfiguration pstnConfiguration) {
- return configureNumberWithResponse(phoneNumber, pstnConfiguration).flatMap(FluxUtil::toMono);
- }
-
- /**
- * Associates a phone number with a PSTN Configuration.
- *
- * @param phoneNumber A {@link PhoneNumberIdentifier} representing the phone number.
- * @param pstnConfiguration A {@link PstnConfiguration} containing the pstn number configuration options.
- * @return A {@link Mono} containing a {@link Response} for the operation.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> configureNumberWithResponse(
- PhoneNumberIdentifier phoneNumber, PstnConfiguration pstnConfiguration) {
- return configureNumberWithResponse(phoneNumber, pstnConfiguration, null);
- }
-
- Mono> configureNumberWithResponse(
- PhoneNumberIdentifier phoneNumber, PstnConfiguration pstnConfiguration, Context context) {
- try {
- Objects.requireNonNull(phoneNumber, "'phoneNumber' cannot be null.");
- Objects.requireNonNull(pstnConfiguration, "'pstnConfiguration' cannot be null.");
-
- NumberConfiguration numberConfiguration = new NumberConfiguration();
- numberConfiguration.setPhoneNumber(phoneNumber.getPhoneNumber()).setPstnConfiguration(pstnConfiguration);
-
- if (context == null) {
- return phoneNumberAdministrations.configureNumberWithResponseAsync(numberConfiguration);
- } else {
- return phoneNumberAdministrations.configureNumberWithResponseAsync(numberConfiguration, context);
- }
- } catch (RuntimeException ex) {
- return monoError(logger, ex);
- }
- }
-
- /**
- * Removes the PSTN Configuration from a phone number.
- *
- * @param phoneNumber A {@link PhoneNumberIdentifier} representing the phone number.
- * @return A {@link Mono} for the asynchronous return
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono unconfigureNumber(PhoneNumberIdentifier phoneNumber) {
- return unconfigureNumberWithResponse(phoneNumber).flatMap(FluxUtil::toMono);
- }
-
- /**
- * Removes the PSTN Configuration from a phone number.
- *
- * @param phoneNumber A {@link PhoneNumberIdentifier} representing the phone number.
- * @return A {@link Mono} containing a {@link Response} for the operation.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> unconfigureNumberWithResponse(PhoneNumberIdentifier phoneNumber) {
- return unconfigureNumberWithResponse(phoneNumber, null);
- }
-
- Mono> unconfigureNumberWithResponse(PhoneNumberIdentifier phoneNumber, Context context) {
- try {
- Objects.requireNonNull(phoneNumber, "'phoneNumber' cannot be null.");
- NumberConfigurationPhoneNumber configurationPhoneNumber = new NumberConfigurationPhoneNumber();
- configurationPhoneNumber.setPhoneNumber(phoneNumber.getPhoneNumber());
-
- if (context == null) {
- return phoneNumberAdministrations.unconfigureNumberWithResponseAsync(configurationPhoneNumber);
- } else {
- return phoneNumberAdministrations.unconfigureNumberWithResponseAsync(configurationPhoneNumber, context);
- }
- } catch (RuntimeException ex) {
- return monoError(logger, ex);
- }
- }
-
- /**
- * Gets a list of phone plan groups for the given country.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param locale A language-locale pairing which will be used to localise the names of countries.
- * @param includeRateInformation Flag to indicate if rate information should be returned.
- * @return A {@link PagedFlux} of {@link PhonePlanGroup} instances representing phone plan groups
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listPhonePlanGroups(
- String countryCode, String locale, Boolean includeRateInformation) {
- return listPhonePlanGroups(countryCode, locale, includeRateInformation, null);
- }
-
- PagedFlux listPhonePlanGroups(
- String countryCode, String locale, Boolean includeRateInformation, Context context) {
- try {
- Objects.requireNonNull(countryCode, "'countryCode' cannot be null.");
- if (context == null) {
- return phoneNumberAdministrations.getPhonePlanGroupsAsync(
- countryCode, locale, includeRateInformation, null, null);
- } else {
- return phoneNumberAdministrations.getPhonePlanGroupsAsync(
- countryCode, locale, includeRateInformation, null, null, context);
- }
- } catch (RuntimeException ex) {
- return pagedFluxError(logger, ex);
- }
- }
-
- /**
- * Gets a list of phone plans for a phone plan group
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId ID of the Phone Plan Group
- * @param locale A language-locale pairing which will be used to localise the names of countries.
- * @return A {@link PagedFlux} of {@link PhonePlan} instances representing phone plans
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listPhonePlans(String countryCode, String phonePlanGroupId, String locale) {
- return listPhonePlans(countryCode, phonePlanGroupId, locale, null);
- }
-
- PagedFlux listPhonePlans(String countryCode, String phonePlanGroupId, String locale, Context context) {
- try {
- Objects.requireNonNull(countryCode, "'countryCode' cannot be null.");
- Objects.requireNonNull(phonePlanGroupId, "'phonePlanGroupId' cannot be null.");
- if (context == null) {
- return phoneNumberAdministrations.getPhonePlansAsync(
- countryCode, phonePlanGroupId, locale, null, null);
- } else {
- return phoneNumberAdministrations.getPhonePlansAsync(
- countryCode, phonePlanGroupId, locale, null, null, context);
- }
- } catch (RuntimeException ex) {
- return pagedFluxError(logger, ex);
- }
- }
-
- /**
- * Gets the location options for a phone plan.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId ID of the Phone Plan Group
- * @param phonePlanId ID of the Phone Plan
- * @param locale A language-locale pairing which will be used to localise the names of countries.
- * @return A {@link Mono} containing a {@link LocationOptionsResponse} representing the location options
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getPhonePlanLocationOptions(
- String countryCode, String phonePlanGroupId, String phonePlanId, String locale) {
- return getPhonePlanLocationOptionsWithResponse(countryCode, phonePlanGroupId, phonePlanId, locale)
- .flatMap(FluxUtil::toMono);
- }
-
- /**
- * Gets the location options for a phone plan.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId ID of the Phone Plan Group
- * @param phonePlanId ID of the Phone Plan
- * @param locale A language-locale pairing which will be used to localise the names of countries.
- * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue()} value returns
- * a {@link LocationOptionsResponse} representing the location options
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getPhonePlanLocationOptionsWithResponse(
- String countryCode, String phonePlanGroupId, String phonePlanId, String locale) {
- return getPhonePlanLocationOptionsWithResponse(
- countryCode, phonePlanGroupId, phonePlanId, locale, null);
- }
-
- Mono> getPhonePlanLocationOptionsWithResponse(
- String countryCode, String phonePlanGroupId, String phonePlanId, String locale, Context context) {
- try {
- Objects.requireNonNull(countryCode, "'countryCode' cannot be null.");
- Objects.requireNonNull(phonePlanGroupId, "'phonePlanGroupId' cannot be null.");
- Objects.requireNonNull(phonePlanId, "'phonePlanId' cannot be null.");
-
- if (context == null) {
- return phoneNumberAdministrations.getPhonePlanLocationOptionsWithResponseAsync(
- countryCode, phonePlanGroupId, phonePlanId, locale);
- } else {
- return phoneNumberAdministrations.getPhonePlanLocationOptionsWithResponseAsync(
- countryCode, phonePlanGroupId, phonePlanId, locale, context);
- }
- } catch (RuntimeException ex) {
- return monoError(logger, ex);
- }
- }
-
- /**
- * Gets a release by ID.
- *
- * @param releaseId ID of the Release
- * @return A {@link Mono} containing a {@link PhoneNumberRelease} representing the release.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getReleaseById(String releaseId) {
- return getReleaseByIdWithResponse(releaseId).flatMap(FluxUtil::toMono);
- }
-
- /**
- * Gets a release by ID.
- *
- * @param releaseId ID of the Release
- * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue()} value returns
- * a {@link PhoneNumberRelease} representing the release.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getReleaseByIdWithResponse(String releaseId) {
- return getReleaseByIdWithResponse(releaseId, null);
- }
-
- Mono> getReleaseByIdWithResponse(String releaseId, Context context) {
- try {
- Objects.requireNonNull(releaseId, "'releaseId' cannot be null.");
- if (context == null) {
- return phoneNumberAdministrations.getReleaseByIdWithResponseAsync(releaseId);
- } else {
- return phoneNumberAdministrations.getReleaseByIdWithResponseAsync(releaseId, context);
- }
- } catch (RuntimeException ex) {
- return monoError(logger, ex);
- }
- }
-
- /**
- * Creates a release for the given phone numbers.
- *
- * @param phoneNumbers {@link List} of {@link PhoneNumberIdentifier} objects with the phone numbers.
- * @return A {@link Mono} containing a {@link ReleaseResponse} representing the release.
- */
- private Mono releasePhoneNumbers(List phoneNumbers) {
- return releasePhoneNumbersWithResponse(phoneNumbers).flatMap(FluxUtil::toMono);
- }
-
- /**
- * Creates a release for the given phone numbers.
- *
- * @param phoneNumbers {@link List} of {@link PhoneNumberIdentifier} objects with the phone numbers.
- * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue()} value returns
- * a {@link ReleaseResponse} representing the release.
- */
- private Mono> releasePhoneNumbersWithResponse(List phoneNumbers) {
- return releasePhoneNumbersWithResponse(phoneNumbers, null);
- }
-
- private Mono> releasePhoneNumbersWithResponse(
- List phoneNumbers, Context context) {
- Objects.requireNonNull(phoneNumbers, "'phoneNumbers' cannot be null.");
-
- List phoneNumberStrings = phoneNumbers
- .stream()
- .map(PhoneNumberIdentifier::getPhoneNumber)
- .collect(Collectors.toList());
- ReleaseRequest releaseRequest = new ReleaseRequest();
- releaseRequest.setPhoneNumbers(phoneNumberStrings);
-
- try {
- if (context == null) {
- return phoneNumberAdministrations.releasePhoneNumbersWithResponseAsync(releaseRequest);
- } else {
- return phoneNumberAdministrations.releasePhoneNumbersWithResponseAsync(releaseRequest, context);
- }
- } catch (RuntimeException ex) {
- return monoError(logger, ex);
- }
- }
-
- /**
- * Gets the list of all releases
- *
- * @return A {@link PagedFlux} of {@link PhoneNumberEntity} instances representing releases.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listAllReleases() {
- return listAllReleases(null);
- }
-
- PagedFlux listAllReleases(Context context) {
- try {
- if (context == null) {
- return phoneNumberAdministrations.getAllReleasesAsync(null, null);
- } else {
- return phoneNumberAdministrations.getAllReleasesAsync(null, null, context);
- }
- } catch (RuntimeException ex) {
- return pagedFluxError(logger, ex);
- }
- }
-
- /**
- * Gets a reservation by ID.
- *
- * @param reservationId ID of the reservation
- * @return A {@link Mono} containing a {@link PhoneNumberReservation} representing the reservation.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getReservationById(String reservationId) {
- return getReservationByIdWithResponse(reservationId).flatMap(FluxUtil::toMono);
- }
-
- /**
- * Gets a reservation by ID.
- *
- * @param reservationId ID of the reservation
- * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue()} value returns
- * a {@link PhoneNumberReservation} representing the reservation.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getReservationByIdWithResponse(String reservationId) {
- return getReservationByIdWithResponse(reservationId, null);
- }
-
- Mono> getReservationByIdWithResponse(String reservationId, Context context) {
- try {
- Objects.requireNonNull(reservationId, "'reservationId' cannot be null.");
- if (context == null) {
- return phoneNumberAdministrations.getSearchByIdWithResponseAsync(reservationId);
- } else {
- return phoneNumberAdministrations.getSearchByIdWithResponseAsync(reservationId, context);
- }
- } catch (RuntimeException ex) {
- return monoError(logger, ex);
- }
- }
-
- /**
- * Create a phone number reservation.
- *
- * @param reservationOptions A {@link CreateReservationOptions} with the reservation options
- * @return A {@link Mono} containing a {@link CreateReservationResponse} representing the reservation.
- */
- private Mono createReservation(CreateReservationOptions reservationOptions) {
- return createReservationWithResponse(reservationOptions).flatMap(FluxUtil::toMono);
- }
-
- /**
- * Create a phone number reservation.
- *
- * @param reservationOptions A {@link CreateReservationOptions} with the reservation options
- * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue()} value returns
- * a {@link CreateReservationResponse} representing the reservation.
- */
- private Mono> createReservationWithResponse(
- CreateReservationOptions reservationOptions) {
- return createReservationWithResponse(reservationOptions, null);
- }
-
- private Mono> createReservationWithResponse(
- CreateReservationOptions reservationOptions, Context context) {
- try {
- Objects.requireNonNull(reservationOptions, "'reservationOptions' cannot be null.");
-
- if (context == null) {
- return phoneNumberAdministrations.createSearchWithResponseAsync(reservationOptions);
- } else {
- return phoneNumberAdministrations.createSearchWithResponseAsync(reservationOptions, context);
- }
- } catch (RuntimeException ex) {
- return monoError(logger, ex);
- }
- }
-
- /**
- * Gets the list of all reservations
- *
- * @return A {@link PagedFlux} of {@link PhoneNumberEntity} instances representing reservations.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux listAllReservations() {
- return listAllReservations(null);
- }
-
- PagedFlux listAllReservations(Context context) {
- try {
- if (context == null) {
- return phoneNumberAdministrations.getAllSearchesAsync(null, null);
- } else {
- return phoneNumberAdministrations.getAllSearchesAsync(null, null, context);
- }
- } catch (RuntimeException ex) {
- return pagedFluxError(logger, ex);
- }
- }
-
- /**
- * Cancels the reservation. This means existing numbers in the reservation will be made available.
- *
- * @param reservationId ID of the reservation
- * @return A {@link Mono} for the asynchronous return
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono cancelReservation(String reservationId) {
- return cancelReservationWithResponse(reservationId).flatMap(FluxUtil::toMono);
- }
-
- /**
- * Cancels the reservation. This means existing numbers in the reservation will be made available.
- *
- * @param reservationId ID of the reservation
- * @return A {@link Mono} containing a {@link Response} for the operation
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> cancelReservationWithResponse(String reservationId) {
- return cancelReservationWithResponse(reservationId, null);
- }
-
- Mono> cancelReservationWithResponse(String reservationId, Context context) {
- try {
- Objects.requireNonNull(reservationId, "'ReservationId' cannot be null.");
-
- if (context == null) {
- return phoneNumberAdministrations.cancelSearchWithResponseAsync(reservationId);
- } else {
- return phoneNumberAdministrations.cancelSearchWithResponseAsync(reservationId, context);
- }
- } catch (RuntimeException ex) {
- return monoError(logger, ex);
- }
- }
-
- /**
- * Purchases the phone number reservation.
- *
- * @param reservationId ID of the reservation
- * @return A {@link Mono} for the asynchronous return
- */
- private Mono purchaseReservation(String reservationId) {
- return purchaseReservationWithResponse(reservationId).flatMap(FluxUtil::toMono);
- }
-
- /**
- * Purchases the phone number reservation.
- *
- * @param reservationId ID of the reservation
- * @return A {@link Mono} containing a {@link Response} for the operation
- */
- private Mono> purchaseReservationWithResponse(String reservationId) {
- return purchaseReservationWithResponse(reservationId, null);
- }
-
- private Mono> purchaseReservationWithResponse(String reservationId, Context context) {
- try {
- Objects.requireNonNull(reservationId, "'reservationId' cannot be null.");
- if (context == null) {
- return phoneNumberAdministrations.purchaseSearchWithResponseAsync(reservationId);
- } else {
- return phoneNumberAdministrations.purchaseSearchWithResponseAsync(reservationId, context);
- }
- } catch (RuntimeException ex) {
- return monoError(logger, ex);
- }
- }
-
- /**
- * Initiates a reservation and returns a {@link PhoneNumberReservation} usable by other functions
- * This function returns a Long Running Operation poller that allows you to
- * wait indefinitely until the operation is complete.
- *
- * @param options A {@link CreateReservationOptions} with the reservation options
- * @param pollInterval The time our long running operation will keep on polling
- * until it gets a result from the server
- * @return A {@link PollerFlux} object with the reservation result
- */
- @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
- public PollerFlux beginCreateReservation(
- CreateReservationOptions options, Duration pollInterval) {
- Objects.requireNonNull(options, "'options' cannot be null.");
-
- if (pollInterval == null) {
- pollInterval = defaultPollInterval;
- }
-
- return new PollerFlux(pollInterval,
- createReservationActivationOperation(options),
- createReservationPollOperation(),
- cancelReservationOperation(),
- createReservationFetchResultOperation());
- }
-
- private Function, Mono>
- createReservationActivationOperation(CreateReservationOptions options) {
- return (pollingContext) -> {
- Mono response = createReservation(options).flatMap(createReservationResponse -> {
- String reservationId = createReservationResponse.getReservationId();
- Mono phoneNumberReservation = getReservationById(reservationId);
- return phoneNumberReservation;
- });
- return response;
- };
- }
-
- private Function, Mono>>
- createReservationPollOperation() {
- return pollingContext ->
- getReservationById(pollingContext.getLatestResponse().getValue().getReservationId())
- .flatMap(getReservationResponse -> {
- ReservationStatus status =
- ReservationStatus.fromString(getReservationResponse.getStatus().toString());
- if (status.equals(ReservationStatus.EXPIRED)
- || status.equals(ReservationStatus.CANCELLED)
- || status.equals(ReservationStatus.RESERVED)) {
- return Mono.just(new PollResponse<>(
- LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, getReservationResponse));
- }
- if (status.equals(ReservationStatus.ERROR)) {
- return Mono.just(new PollResponse<>(
- LongRunningOperationStatus.FAILED, getReservationResponse));
- }
- return Mono.just(new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS,
- getReservationResponse));
- });
- }
-
- private BiFunction,
- PollResponse, Mono>
- cancelReservationOperation() {
- return (pollingContext, firstResponse) -> {
- cancelReservation(pollingContext.getLatestResponse().getValue().getReservationId());
- return Mono.just(pollingContext.getLatestResponse().getValue());
- };
- }
-
- private Function,
- Mono> createReservationFetchResultOperation() {
- return pollingContext -> {
- return Mono.just(pollingContext.getLatestResponse().getValue());
- };
- }
-
- /**
- * Initiates a purchase process and polls until a terminal state is reached
- * This function returns a Long Running Operation poller that allows you to
- * wait indefinitely until the operation is complete.
- *
- * @param reservationId ID of the reservation
- * @param pollInterval The time our long running operation will keep on polling
- * until it gets a result from the server
- * @return A {@link PollerFlux} object.
- */
-
- @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
- public PollerFlux beginPurchaseReservation(String reservationId, Duration pollInterval) {
- Objects.requireNonNull(reservationId, "'ReservationId' can not be null.");
-
- if (pollInterval == null) {
- pollInterval = defaultPollInterval;
- }
-
- return new PollerFlux(pollInterval,
- purchaseReservationActivationOperation(reservationId),
- purchaseReservationPollOperation(reservationId),
- (activationResponse, pollingContext) -> Mono.error(new RuntimeException("Cancellation is not supported")),
- purchaseReservationFetchResultOperation());
- }
-
- private Function,
- Mono> purchaseReservationActivationOperation(String reservationId) {
- return (pollingContext) -> {
- return purchaseReservation(reservationId);
- };
- }
-
- private Function, Mono>>
- purchaseReservationPollOperation(String reservationId) {
- return (pollingContext) -> getReservationById(reservationId)
- .flatMap(getReservationResponse -> {
- ReservationStatus statusResponse =
- ReservationStatus.fromString(getReservationResponse.getStatus().toString());
- if (statusResponse.equals(ReservationStatus.SUCCESS)) {
- return Mono.just(new PollResponse<>(
- LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, null));
- }
- if (statusResponse.equals(ReservationStatus.ERROR)
- || statusResponse.equals(ReservationStatus.EXPIRED)) {
- return Mono.just(new PollResponse<>(
- LongRunningOperationStatus.FAILED, null));
- }
- return Mono.just(new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, null));
- });
- }
-
- private Function,
- Mono> purchaseReservationFetchResultOperation() {
- return pollingContext -> {
- return Mono.empty();
- };
-
- }
-
- /**
- * Releases the given phone numbers.
- * This function returns a Long Running Operation poller that allows you to
- * wait indefinitely until the operation is complete.
- *
- * @param phoneNumbers A list of {@link PhoneNumberIdentifier} with the desired numbers to release
- * @param pollInterval The time our long running operation will keep on polling
- * until it gets a result from the server
- * @return A {@link PollerFlux} object with the release entity
- */
- @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
- public PollerFlux
- beginReleasePhoneNumbers(List phoneNumbers, Duration pollInterval) {
- Objects.requireNonNull(phoneNumbers, "'phoneNumbers' cannot be null.");
-
- if (pollInterval == null) {
- pollInterval = defaultPollInterval;
- }
-
- return new PollerFlux(pollInterval,
- releaseNumbersActivationOperation(phoneNumbers),
- releaseNumbersPollOperation(),
- (activationResponse, pollingContext) ->
- monoError(logger, new RuntimeException("Cancellation is not supported")),
- releaseNumbersFetchResultOperation());
- }
-
- private Function, Mono>
- releaseNumbersActivationOperation(List phoneNumbers) {
- return (pollingContext) -> {
- Mono response = releasePhoneNumbers(phoneNumbers)
- .flatMap(releaseNumberResponse -> {
- String releaseId = releaseNumberResponse.getReleaseId();
- Mono phoneNumberRelease = getReleaseById(releaseId);
- return phoneNumberRelease;
- });
- return response;
- };
- }
-
- private Function, Mono>>
- releaseNumbersPollOperation() {
- return pollingContext ->
- getReleaseById(pollingContext.getLatestResponse().getValue().getReleaseId())
- .flatMap(getReleaseResponse -> {
- ReleaseStatus status = getReleaseResponse.getStatus();
- if (status.equals(ReleaseStatus.COMPLETE)
- || status.equals(ReleaseStatus.EXPIRED)) {
- return Mono.just(new PollResponse<>(
- LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, getReleaseResponse));
- }
- if (status.equals(ReleaseStatus.FAILED)) {
- return Mono.just(new PollResponse<>(
- LongRunningOperationStatus.FAILED, getReleaseResponse));
- }
- return Mono.just(new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, getReleaseResponse));
- });
- }
-
- private Function,
- Mono> releaseNumbersFetchResultOperation() {
- return pollingContext -> {
- return Mono.just(pollingContext.getLatestResponse().getValue());
- };
- }
-}
diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberClient.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberClient.java
deleted file mode 100644
index 492235c52a7f..000000000000
--- a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberClient.java
+++ /dev/null
@@ -1,500 +0,0 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License.
-package com.azure.communication.administration;
-
-import com.azure.communication.administration.models.AcquiredPhoneNumber;
-import com.azure.communication.administration.models.AreaCodes;
-import com.azure.communication.administration.models.CreateReservationOptions;
-import com.azure.communication.administration.models.LocationOptionsQuery;
-import com.azure.communication.administration.models.LocationOptionsResponse;
-import com.azure.communication.administration.models.NumberConfigurationResponse;
-import com.azure.communication.administration.models.NumberUpdateCapabilities;
-import com.azure.communication.administration.models.PhoneNumberCountry;
-import com.azure.communication.administration.models.PhoneNumberEntity;
-import com.azure.communication.administration.models.PhoneNumberRelease;
-import com.azure.communication.administration.models.PhonePlan;
-import com.azure.communication.administration.models.PhonePlanGroup;
-import com.azure.communication.administration.models.PstnConfiguration;
-import com.azure.communication.administration.models.UpdateNumberCapabilitiesResponse;
-import com.azure.communication.administration.models.PhoneNumberReservation;
-import com.azure.communication.administration.models.UpdatePhoneNumberCapabilitiesResponse;
-import com.azure.communication.common.PhoneNumberIdentifier;
-import com.azure.core.annotation.ReturnType;
-import com.azure.core.annotation.ServiceClient;
-import com.azure.core.annotation.ServiceMethod;
-import com.azure.core.http.rest.PagedIterable;
-import com.azure.core.http.rest.Response;
-import com.azure.core.util.Context;
-import com.azure.core.util.polling.SyncPoller;
-
-import java.time.Duration;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Synchronous client for Communication service phone number operations
- */
-@ServiceClient(builder = PhoneNumberClientBuilder.class, isAsync = false)
-public final class PhoneNumberClient {
-
- private final PhoneNumberAsyncClient phoneNumberAsyncClient;
-
- PhoneNumberClient(PhoneNumberAsyncClient phoneNumberAsyncClient) {
- this.phoneNumberAsyncClient = phoneNumberAsyncClient;
- }
-
- /**
- * Gets the list of the acquired phone numbers.
- *
- * @param locale A language-locale pairing which will be used to localise the names of countries.
- * @return A {@link PagedIterable} of {@link AcquiredPhoneNumber} instances representing acquired telephone numbers.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listAllPhoneNumbers(String locale) {
- return new PagedIterable<>(phoneNumberAsyncClient.listAllPhoneNumbers(locale));
- }
-
- /**
- * Gets the list of the acquired phone numbers.
- *
- * @param locale A language-locale pairing which will be used to localise the names of countries.
- * @param context A {@link Context} representing the request context.
- * @return A {@link PagedIterable} of {@link AcquiredPhoneNumber} instances representing acquired telephone numbers.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listAllPhoneNumbers(String locale, Context context) {
- return new PagedIterable<>(phoneNumberAsyncClient.listAllPhoneNumbers(locale, context));
- }
-
- /**
- * Gets a list of the supported area codes.
- *
- * @param locationType The type of location information required by the plan.
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanId The plan id from which to search area codes.
- * @param locationOptions A {@link List} of {@link LocationOptionsQuery} for querying the area codes.
- * @return A {@link AreaCodes} representing area codes.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public AreaCodes getAllAreaCodes(
- String locationType, String countryCode, String phonePlanId, List locationOptions) {
- return phoneNumberAsyncClient.getAllAreaCodes(locationType, countryCode, phonePlanId, locationOptions).block();
- }
-
- /**
- * Gets a list of the supported area codes.
- *
- * @param locationType The type of location information required by the plan.
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanId The plan id from which to search area codes.
- * @param locationOptions A {@link List} of {@link LocationOptionsQuery} for querying the area codes.
- * @param context A {@link Context} representing the request context.
- * @return A {@link Response} whose {@link Response#getValue()} value returns
- * a {@link AreaCodes} representing area codes.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response getAllAreaCodesWithResponse(
- String locationType, String countryCode, String phonePlanId, List locationOptions,
- Context context) {
- return phoneNumberAsyncClient.getAllAreaCodesWithResponse(
- locationType, countryCode, phonePlanId, locationOptions, context).block();
- }
-
- /**
- * Gets the information for a phone number capabilities update
- *
- * @param capabilitiesId ID of the capabilities update.
- * @return A {@link UpdatePhoneNumberCapabilitiesResponse} representing the capabilities update.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public UpdatePhoneNumberCapabilitiesResponse getCapabilitiesUpdate(String capabilitiesId) {
- return phoneNumberAsyncClient.getCapabilitiesUpdate(capabilitiesId).block();
- }
-
- /**
- * Gets the information for a phone number capabilities update
- *
- * @param capabilitiesId ID of the capabilities update.
- * @param context A {@link Context} representing the request context.
- * @return A {@link Response} whose {@link Response#getValue()} value returns
- * a {@link UpdatePhoneNumberCapabilitiesResponse} representing the capabilities update.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response getCapabilitiesUpdateWithResponse(
- String capabilitiesId, Context context) {
- return phoneNumberAsyncClient.getCapabilitiesUpdateWithResponse(capabilitiesId, context).block();
- }
-
- /**
- * Adds or removes phone number capabilities.
- *
- * @param phoneNumberCapabilitiesUpdate {@link Map} with the updates to perform
- * @return A {@link UpdatePhoneNumberCapabilitiesResponse} representing the capabilities update.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public UpdateNumberCapabilitiesResponse updateCapabilities(
- Map phoneNumberCapabilitiesUpdate) {
- return phoneNumberAsyncClient.updateCapabilities(phoneNumberCapabilitiesUpdate).block();
- }
-
- /**
- * Adds or removes phone number capabilities.
- *
- * @param phoneNumberCapabilitiesUpdate {@link Map} with the updates to perform
- * @param context A {@link Context} representing the request context.
- * @return A {@link Response} whose {@link Response#getValue()} value returns
- * a {@link UpdatePhoneNumberCapabilitiesResponse} representing the capabilities update.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response updateCapabilitiesWithResponse(
- Map phoneNumberCapabilitiesUpdate, Context context) {
- return phoneNumberAsyncClient.updateCapabilitiesWithResponse(phoneNumberCapabilitiesUpdate, context).block();
- }
-
- /**
- * Gets a list of supported countries.
- *
- * @param locale A language-locale pairing which will be used to localise the names of countries.
- * @return A {@link PagedIterable} of {@link PhoneNumberCountry} instances representing supported countries.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listAllSupportedCountries(String locale) {
- return new PagedIterable<>(phoneNumberAsyncClient.listAllSupportedCountries(locale));
- }
-
- /**
- * Gets a list of supported countries.
- *
- * @param locale A language-locale pairing which will be used to localise the names of countries.
- * @param context A {@link Context} representing the request context.
- * @return A {@link PagedIterable} of {@link PhoneNumberCountry} instances representing supported countries.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listAllSupportedCountries(String locale, Context context) {
- return new PagedIterable<>(phoneNumberAsyncClient.listAllSupportedCountries(locale, context));
- }
-
- /**
- * Gets the configuration of a given phone number.
- *
- * @param phoneNumber A {@link PhoneNumberIdentifier} representing the phone number.
- * @return A {@link NumberConfigurationResponse} representing the configuration.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public NumberConfigurationResponse getNumberConfiguration(PhoneNumberIdentifier phoneNumber) {
- return phoneNumberAsyncClient.getNumberConfiguration(phoneNumber).block();
- }
-
- /**
- * Gets the configuration of a given phone number.
- *
- * @param phoneNumber A {@link PhoneNumberIdentifier} representing the phone number.
- * @param context A {@link Context} representing the request context.
- * @return A {@link Response} whose {@link Response#getValue()} value returns
- * a {@link NumberConfigurationResponse} representing the configuration.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response getNumberConfigurationWithResponse(
- PhoneNumberIdentifier phoneNumber, Context context) {
- return phoneNumberAsyncClient.getNumberConfigurationWithResponse(phoneNumber, context).block();
- }
-
- /**
- * Associates a phone number with a PSTN Configuration.
- *
- * @param phoneNumber A {@link PhoneNumberIdentifier} representing the phone number.
- * @param pstnConfiguration A {@link PstnConfiguration} containing the pstn number configuration options.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public void configureNumber(PhoneNumberIdentifier phoneNumber, PstnConfiguration pstnConfiguration) {
- phoneNumberAsyncClient.configureNumber(phoneNumber, pstnConfiguration).block();
- }
-
- /**
- * Associates a phone number with a PSTN Configuration.
- *
- * @param phoneNumber A {@link PhoneNumberIdentifier} representing the phone number.
- * @param pstnConfiguration A {@link PstnConfiguration} containing the pstn number configuration options.
- * @param context A {@link Context} representing the request context.
- * @return A {@link Response} for the operation.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response configureNumberWithResponse(
- PhoneNumberIdentifier phoneNumber, PstnConfiguration pstnConfiguration, Context context) {
- return phoneNumberAsyncClient.configureNumberWithResponse(phoneNumber, pstnConfiguration, context).block();
- }
-
- /**
- * Removes the PSTN Configuration from a phone number.
- *
- * @param phoneNumber A {@link PhoneNumberIdentifier} representing the phone number.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public void unconfigureNumber(PhoneNumberIdentifier phoneNumber) {
- phoneNumberAsyncClient.unconfigureNumber(phoneNumber).block();
- }
-
- /**
- * Removes the PSTN Configuration from a phone number.
- *
- * @param phoneNumber A {@link PhoneNumberIdentifier} representing the phone number.
- * @param context A {@link Context} representing the request context.
- * @return A {@link Response} for the operation.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response unconfigureNumberWithResponse(PhoneNumberIdentifier phoneNumber, Context context) {
- return phoneNumberAsyncClient.unconfigureNumberWithResponse(phoneNumber, context).block();
- }
-
- /**
- * Gets a list of phone plan groups for the given country.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param locale A language-locale pairing which will be used to localise the names of countries.
- * @param includeRateInformation Flag to indicate if rate information should be returned.
- * @return A {@link PagedIterable} of {@link PhonePlanGroup} instances representing phone plan groups
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listPhonePlanGroups(
- String countryCode, String locale, Boolean includeRateInformation) {
- return new PagedIterable<>(
- phoneNumberAsyncClient.listPhonePlanGroups(countryCode, locale, includeRateInformation));
- }
-
- /**
- * Gets a list of phone plan groups for the given country.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param locale A language-locale pairing which will be used to localise the names of countries.
- * @param includeRateInformation Flag to indicate if rate information should be returned.
- * @param context A {@link Context} representing the request context.
- * @return A {@link PagedIterable} of {@link PhonePlanGroup} instances representing phone plan groups
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listPhonePlanGroups(
- String countryCode, String locale, Boolean includeRateInformation, Context context) {
- return new PagedIterable<>(
- phoneNumberAsyncClient.listPhonePlanGroups(countryCode, locale, includeRateInformation, context));
- }
-
- /**
- * Gets a list of phone plans for a phone plan group
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId ID of the Phone Plan Group
- * @param locale A language-locale pairing which will be used to localise the names of countries.
- * @return A {@link PagedIterable} of {@link PhonePlan} instances representing phone plans
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listPhonePlans(String countryCode, String phonePlanGroupId, String locale) {
- return new PagedIterable<>(phoneNumberAsyncClient.listPhonePlans(countryCode, phonePlanGroupId, locale));
- }
-
- /**
- * Gets a list of phone plans for a phone plan group
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId ID of the Phone Plan Group
- * @param locale A language-locale pairing which will be used to localise the names of countries.
- * @param context A {@link Context} representing the request context.
- * @return A {@link PagedIterable} of {@link PhonePlan} instances representing phone plans
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listPhonePlans(
- String countryCode, String phonePlanGroupId, String locale, Context context) {
- return new PagedIterable<>(phoneNumberAsyncClient.listPhonePlans(
- countryCode, phonePlanGroupId, locale, context));
- }
-
- /**
- * Gets the location options for a phone plan.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId ID of the Phone Plan Group
- * @param phonePlanId ID of the Phone Plan
- * @param locale A language-locale pairing which will be used to localise the names of countries.
- * @return A {@link LocationOptionsResponse} representing the location options
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public LocationOptionsResponse getPhonePlanLocationOptions(
- String countryCode, String phonePlanGroupId, String phonePlanId, String locale) {
- return phoneNumberAsyncClient.getPhonePlanLocationOptions(countryCode, phonePlanGroupId, phonePlanId, locale)
- .block();
- }
-
- /**
- * Gets the location options for a phone plan.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId ID of the Phone Plan Group
- * @param phonePlanId ID of the Phone Plan
- * @param locale A language-locale pairing which will be used to localise the names of countries.
- * @param context A {@link Context} representing the request context.
- * @return A {@link Response} whose {@link Response#getValue()} value returns
- * a {@link LocationOptionsResponse} representing the location options
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response getPhonePlanLocationOptionsWithResponse(
- String countryCode, String phonePlanGroupId, String phonePlanId, String locale, Context context) {
- return phoneNumberAsyncClient.getPhonePlanLocationOptionsWithResponse(
- countryCode, phonePlanGroupId, phonePlanId, locale, context).block();
- }
-
- /**
- * Gets a release by ID.
- *
- * @param releaseId ID of the Release
- * @return A {@link PhoneNumberRelease} representing the release.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public PhoneNumberRelease getReleaseById(String releaseId) {
- return phoneNumberAsyncClient.getReleaseById(releaseId).block();
- }
-
- /**
- * Gets a release by ID.
- *
- * @param releaseId ID of the Release
- * @param context A {@link Context} representing the request context.
- * @return A {@link Response} whose {@link Response#getValue()} value returns
- * a {@link PhoneNumberRelease} representing the release.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response getReleaseByIdWithResponse(String releaseId, Context context) {
- return phoneNumberAsyncClient.getReleaseByIdWithResponse(releaseId, context).block();
- }
-
- /**
- * Gets the list of all releases
- *
- * @return A {@link PagedIterable} of {@link PhoneNumberEntity} instances representing releases.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listAllReleases() {
- return new PagedIterable<>(phoneNumberAsyncClient.listAllReleases());
- }
-
- /**
- * Gets the list of all releases
- *
- * @param context A {@link Context} representing the request context.
- * @return A {@link PagedIterable} of {@link PhoneNumberEntity} instances representing releases.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listAllReleases(Context context) {
- return new PagedIterable<>(phoneNumberAsyncClient.listAllReleases(context));
- }
-
- /**
- * Gets a reservation by ID.
- *
- * @param reservationId ID of the reservation
- * @return A {@link PhoneNumberReservation} representing the reservation.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public PhoneNumberReservation getReservationById(String reservationId) {
- return phoneNumberAsyncClient.getReservationById(reservationId).block();
- }
-
- /**
- * Gets a reservation by ID.
- *
- * @param reservationId ID of the reservation
- * @param context A {@link Context} representing the request context.
- * @return A {@link Response} whose {@link Response#getValue()} value returns
- * a {@link PhoneNumberReservation} representing the reservation.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response getReservationByIdWithResponse(String reservationId, Context context) {
- return phoneNumberAsyncClient.getReservationByIdWithResponse(reservationId, context).block();
- }
-
- /**
- * Gets the list of all reservations
- *
- * @return A {@link PagedIterable} of {@link PhoneNumberEntity} instances representing reservations.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listAllReservations() {
- return new PagedIterable<>(phoneNumberAsyncClient.listAllReservations());
- }
-
- /**
- * Gets the list of all reservationes
- *
- * @param context A {@link Context} representing the request context.
- * @return A {@link PagedIterable} of {@link PhoneNumberEntity} instances representing reservations.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable listAllReservations(Context context) {
- return new PagedIterable<>(phoneNumberAsyncClient.listAllReservations(context));
- }
-
- /**
- * Cancels the reservation. This means existing numbers in the reservation will be made available.
- *
- * @param reservationId ID of the reservation
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public void cancelReservation(String reservationId) {
- phoneNumberAsyncClient.cancelReservation(reservationId).block();
- }
-
- /**
- * Cancels the reservation. This means existing numbers in the reservation will be made available.
- *
- * @param reservationId ID of the reservation
- * @param context A {@link Context} representing the request context.
- * @return A {@link Response} for the operation
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Response cancelReservationWithResponse(String reservationId, Context context) {
- return phoneNumberAsyncClient.cancelReservationWithResponse(reservationId, context).block();
- }
-
- /**
- * Initiates a reservation and returns a {@link PhoneNumberReservation} usable by other functions
- * This function returns a Long Running Operation poller.
- *
- * @param options A {@link CreateReservationOptions} with the reservation options
- * @param pollInterval The time our long running operation will keep on polling
- * until it gets a result from the server
- * @return A {@link SyncPoller} object with the reservation result
- */
- @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
- public SyncPoller beginCreateReservation(
- CreateReservationOptions options, Duration pollInterval) {
- return phoneNumberAsyncClient.beginCreateReservation(options, pollInterval).getSyncPoller();
- }
-
- /**
- * Initiates a purchase process and polls until a terminal state is reached
- * This function returns a Long Running Operation poller
- *
- * @param reservationId ID of the reservation
- * @param pollInterval The time our long running operation will keep on polling
- * until it gets a result from the server
- * @return A {@link SyncPoller} object with the reservation result
- */
- @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
- public SyncPoller beginPurchaseReservation(
- String reservationId, Duration pollInterval) {
- return phoneNumberAsyncClient.beginPurchaseReservation(reservationId, pollInterval).getSyncPoller();
- }
-
- /**
- * Releases the given phone numbers.
- * This function returns a Long Running Operation poller
- *
- * @param phoneNumbers A list of {@link PhoneNumberIdentifier} with the desired numbers to release
- * @param pollInterval The time our long running operation will keep on polling
- * until it gets a result from the server
- * @return A {@link SyncPoller} object with the reservation result
- */
- @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
- public SyncPoller beginReleasePhoneNumbers(
- List phoneNumbers, Duration pollInterval) {
- return phoneNumberAsyncClient.beginReleasePhoneNumbers(phoneNumbers, pollInterval).getSyncPoller();
- }
-}
diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/implementation/PhoneNumberAdministrationsImpl.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/implementation/PhoneNumberAdministrationsImpl.java
deleted file mode 100644
index 501ebdc46164..000000000000
--- a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/implementation/PhoneNumberAdministrationsImpl.java
+++ /dev/null
@@ -1,2824 +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.administration.implementation;
-
-import com.azure.communication.administration.models.AcquiredPhoneNumber;
-import com.azure.communication.administration.models.AcquiredPhoneNumbers;
-import com.azure.communication.administration.models.AreaCodes;
-import com.azure.communication.administration.models.CreateReservationOptions;
-import com.azure.communication.administration.models.CreateReservationResponse;
-import com.azure.communication.administration.models.ErrorResponseException;
-import com.azure.communication.administration.models.LocationOptionsQueries;
-import com.azure.communication.administration.models.LocationOptionsResponse;
-import com.azure.communication.administration.models.NumberConfiguration;
-import com.azure.communication.administration.models.NumberConfigurationPhoneNumber;
-import com.azure.communication.administration.models.NumberConfigurationResponse;
-import com.azure.communication.administration.models.PhoneNumberCountries;
-import com.azure.communication.administration.models.PhoneNumberCountry;
-import com.azure.communication.administration.models.PhoneNumberEntities;
-import com.azure.communication.administration.models.PhoneNumberEntity;
-import com.azure.communication.administration.models.PhoneNumberRelease;
-import com.azure.communication.administration.models.PhoneNumberReservation;
-import com.azure.communication.administration.models.PhonePlan;
-import com.azure.communication.administration.models.PhonePlanGroup;
-import com.azure.communication.administration.models.PhonePlanGroups;
-import com.azure.communication.administration.models.PhonePlansResponse;
-import com.azure.communication.administration.models.ReleaseRequest;
-import com.azure.communication.administration.models.ReleaseResponse;
-import com.azure.communication.administration.models.UpdateNumberCapabilitiesRequest;
-import com.azure.communication.administration.models.UpdateNumberCapabilitiesResponse;
-import com.azure.communication.administration.models.UpdatePhoneNumberCapabilitiesResponse;
-import com.azure.core.annotation.BodyParam;
-import com.azure.core.annotation.ExpectedResponses;
-import com.azure.core.annotation.Get;
-import com.azure.core.annotation.Host;
-import com.azure.core.annotation.HostParam;
-import com.azure.core.annotation.Patch;
-import com.azure.core.annotation.PathParam;
-import com.azure.core.annotation.Post;
-import com.azure.core.annotation.QueryParam;
-import com.azure.core.annotation.ReturnType;
-import com.azure.core.annotation.ServiceInterface;
-import com.azure.core.annotation.ServiceMethod;
-import com.azure.core.annotation.UnexpectedResponseExceptionType;
-import com.azure.core.http.rest.PagedFlux;
-import com.azure.core.http.rest.PagedIterable;
-import com.azure.core.http.rest.PagedResponse;
-import com.azure.core.http.rest.PagedResponseBase;
-import com.azure.core.http.rest.Response;
-import com.azure.core.http.rest.RestProxy;
-import com.azure.core.util.Context;
-import com.azure.core.util.FluxUtil;
-import reactor.core.publisher.Mono;
-
-/** An instance of this class provides access to all the operations defined in PhoneNumberAdministrations. */
-public final class PhoneNumberAdministrationsImpl {
- /** The proxy service used to perform REST calls. */
- private final PhoneNumberAdministrationsService service;
-
- /** The service client containing this operation class. */
- private final PhoneNumberAdminClientImpl client;
-
- /**
- * Initializes an instance of PhoneNumberAdministrationsImpl.
- *
- * @param client the instance of the service client containing this operation class.
- */
- PhoneNumberAdministrationsImpl(PhoneNumberAdminClientImpl client) {
- this.service = RestProxy.create(PhoneNumberAdministrationsService.class, client.getHttpPipeline());
- this.client = client;
- }
-
- /**
- * The interface defining all the services for PhoneNumberAdminClientPhoneNumberAdministrations to be used by the
- * proxy service to perform REST calls.
- */
- @Host("{endpoint}")
- @ServiceInterface(name = "PhoneNumberAdminClie")
- private interface PhoneNumberAdministrationsService {
- @Get("/administration/phonenumbers/phonenumbers")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getAllPhoneNumbers(
- @HostParam("endpoint") String endpoint,
- @QueryParam("locale") String locale,
- @QueryParam("skip") Integer skip,
- @QueryParam("take") Integer take,
- @QueryParam("api-version") String apiVersion,
- Context context);
-
- @Post("/administration/phonenumbers/countries/{countryCode}/areacodes")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getAllAreaCodes(
- @HostParam("endpoint") String endpoint,
- @QueryParam("locationType") String locationType,
- @PathParam("countryCode") String countryCode,
- @QueryParam("phonePlanId") String phonePlanId,
- @QueryParam("api-version") String apiVersion,
- @BodyParam("application/json") LocationOptionsQueries body,
- Context context);
-
- @Get("/administration/phonenumbers/capabilities/{capabilitiesUpdateId}")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getCapabilitiesUpdate(
- @HostParam("endpoint") String endpoint,
- @PathParam("capabilitiesUpdateId") String capabilitiesUpdateId,
- @QueryParam("api-version") String apiVersion,
- Context context);
-
- @Post("/administration/phonenumbers/capabilities")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> updateCapabilities(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @BodyParam("application/json") UpdateNumberCapabilitiesRequest body,
- Context context);
-
- @Get("/administration/phonenumbers/countries")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getAllSupportedCountries(
- @HostParam("endpoint") String endpoint,
- @QueryParam("locale") String locale,
- @QueryParam("skip") Integer skip,
- @QueryParam("take") Integer take,
- @QueryParam("api-version") String apiVersion,
- Context context);
-
- @Post("/administration/phonenumbers/numberconfiguration")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getNumberConfiguration(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @BodyParam("application/json") NumberConfigurationPhoneNumber body,
- Context context);
-
- @Patch("/administration/phonenumbers/numberconfiguration/configure")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> configureNumber(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @BodyParam("application/json") NumberConfiguration body,
- Context context);
-
- @Patch("/administration/phonenumbers/numberconfiguration/unconfigure")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> unconfigureNumber(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @BodyParam("application/json") NumberConfigurationPhoneNumber body,
- Context context);
-
- @Get("/administration/phonenumbers/countries/{countryCode}/phoneplangroups")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getPhonePlanGroups(
- @HostParam("endpoint") String endpoint,
- @PathParam("countryCode") String countryCode,
- @QueryParam("locale") String locale,
- @QueryParam("includeRateInformation") Boolean includeRateInformation,
- @QueryParam("skip") Integer skip,
- @QueryParam("take") Integer take,
- @QueryParam("api-version") String apiVersion,
- Context context);
-
- @Get("/administration/phonenumbers/countries/{countryCode}/phoneplangroups/{phonePlanGroupId}/phoneplans")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getPhonePlans(
- @HostParam("endpoint") String endpoint,
- @PathParam("countryCode") String countryCode,
- @PathParam("phonePlanGroupId") String phonePlanGroupId,
- @QueryParam("locale") String locale,
- @QueryParam("skip") Integer skip,
- @QueryParam("take") Integer take,
- @QueryParam("api-version") String apiVersion,
- Context context);
-
- @Get(
- "/administration/phonenumbers/countries/{countryCode}/phoneplangroups/{phonePlanGroupId}/phoneplans/{phonePlanId}/locationoptions")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getPhonePlanLocationOptions(
- @HostParam("endpoint") String endpoint,
- @PathParam("countryCode") String countryCode,
- @PathParam("phonePlanGroupId") String phonePlanGroupId,
- @PathParam("phonePlanId") String phonePlanId,
- @QueryParam("locale") String locale,
- @QueryParam("api-version") String apiVersion,
- Context context);
-
- @Get("/administration/phonenumbers/releases/{releaseId}")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getReleaseById(
- @HostParam("endpoint") String endpoint,
- @PathParam("releaseId") String releaseId,
- @QueryParam("api-version") String apiVersion,
- Context context);
-
- @Post("/administration/phonenumbers/releases")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> releasePhoneNumbers(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @BodyParam("application/json") ReleaseRequest body,
- Context context);
-
- @Get("/administration/phonenumbers/releases")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getAllReleases(
- @HostParam("endpoint") String endpoint,
- @QueryParam("skip") Integer skip,
- @QueryParam("take") Integer take,
- @QueryParam("api-version") String apiVersion,
- Context context);
-
- @Get("/administration/phonenumbers/searches/{searchId}")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getSearchById(
- @HostParam("endpoint") String endpoint,
- @PathParam("searchId") String searchId,
- @QueryParam("api-version") String apiVersion,
- Context context);
-
- @Post("/administration/phonenumbers/searches")
- @ExpectedResponses({201})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> createSearch(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @BodyParam("application/json") CreateReservationOptions body,
- Context context);
-
- @Get("/administration/phonenumbers/searches")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getAllSearches(
- @HostParam("endpoint") String endpoint,
- @QueryParam("skip") Integer skip,
- @QueryParam("take") Integer take,
- @QueryParam("api-version") String apiVersion,
- Context context);
-
- @Post("/administration/phonenumbers/searches/{searchId}/cancel")
- @ExpectedResponses({202})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> cancelSearch(
- @HostParam("endpoint") String endpoint,
- @PathParam("searchId") String searchId,
- @QueryParam("api-version") String apiVersion,
- Context context);
-
- @Post("/administration/phonenumbers/searches/{searchId}/purchase")
- @ExpectedResponses({202})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> purchaseSearch(
- @HostParam("endpoint") String endpoint,
- @PathParam("searchId") String searchId,
- @QueryParam("api-version") String apiVersion,
- Context context);
-
- @Get("{nextLink}")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getAllPhoneNumbersNext(
- @PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
-
- @Get("{nextLink}")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getAllSupportedCountriesNext(
- @PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
-
- @Get("{nextLink}")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getPhonePlanGroupsNext(
- @PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
-
- @Get("{nextLink}")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getPhonePlansNext(
- @PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
-
- @Get("{nextLink}")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getAllReleasesNext(
- @PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
-
- @Get("{nextLink}")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(ErrorResponseException.class)
- Mono> getAllSearchesNext(
- @PathParam(value = "nextLink", encoded = true) String nextLink, Context context);
- }
-
- /**
- * Gets the list of the acquired phone numbers.
- *
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 the acquired phone numbers.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getAllPhoneNumbersSinglePageAsync(
- String locale, Integer skip, Integer take) {
- return FluxUtil.withContext(
- context ->
- service.getAllPhoneNumbers(
- this.client.getEndpoint(),
- locale,
- skip,
- take,
- this.client.getApiVersion(),
- context))
- .map(
- res ->
- new PagedResponseBase<>(
- res.getRequest(),
- res.getStatusCode(),
- res.getHeaders(),
- res.getValue().getPhoneNumbers(),
- res.getValue().getNextLink(),
- null));
- }
-
- /**
- * Gets the list of the acquired phone numbers.
- *
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 the acquired phone numbers.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getAllPhoneNumbersSinglePageAsync(
- String locale, Integer skip, Integer take, Context context) {
- return service.getAllPhoneNumbers(
- this.client.getEndpoint(), locale, skip, take, this.client.getApiVersion(), context)
- .map(
- res ->
- new PagedResponseBase<>(
- res.getRequest(),
- res.getStatusCode(),
- res.getHeaders(),
- res.getValue().getPhoneNumbers(),
- res.getValue().getNextLink(),
- null));
- }
-
- /**
- * Gets the list of the acquired phone numbers.
- *
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 the acquired phone numbers.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux getAllPhoneNumbersAsync(String locale, Integer skip, Integer take) {
- return new PagedFlux<>(
- () -> getAllPhoneNumbersSinglePageAsync(locale, skip, take),
- nextLink -> getAllPhoneNumbersNextSinglePageAsync(nextLink));
- }
-
- /**
- * Gets the list of the acquired phone numbers.
- *
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 the acquired phone numbers.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux getAllPhoneNumbersAsync(
- String locale, Integer skip, Integer take, Context context) {
- return new PagedFlux<>(
- () -> getAllPhoneNumbersSinglePageAsync(locale, skip, take, context),
- nextLink -> getAllPhoneNumbersNextSinglePageAsync(nextLink));
- }
-
- /**
- * Gets the list of the acquired phone numbers.
- *
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 the acquired phone numbers.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable getAllPhoneNumbers(String locale, Integer skip, Integer take) {
- return new PagedIterable<>(getAllPhoneNumbersAsync(locale, skip, take));
- }
-
- /**
- * Gets the list of the acquired phone numbers.
- *
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 the acquired phone numbers.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable getAllPhoneNumbers(
- String locale, Integer skip, Integer take, Context context) {
- return new PagedIterable<>(getAllPhoneNumbersAsync(locale, skip, take, context));
- }
-
- /**
- * Gets a list of the supported area codes.
- *
- * @param locationType The type of location information required by the plan.
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanId The plan id from which to search area codes.
- * @param body Represents a list of location option queries, used for fetching area codes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of the supported area codes.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getAllAreaCodesWithResponseAsync(
- String locationType, String countryCode, String phonePlanId, LocationOptionsQueries body) {
- return FluxUtil.withContext(
- context ->
- service.getAllAreaCodes(
- this.client.getEndpoint(),
- locationType,
- countryCode,
- phonePlanId,
- this.client.getApiVersion(),
- body,
- context));
- }
-
- /**
- * Gets a list of the supported area codes.
- *
- * @param locationType The type of location information required by the plan.
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanId The plan id from which to search area codes.
- * @param body Represents a list of location option queries, used for fetching area codes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of the supported area codes.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getAllAreaCodesWithResponseAsync(
- String locationType, String countryCode, String phonePlanId, LocationOptionsQueries body, Context context) {
- return service.getAllAreaCodes(
- this.client.getEndpoint(),
- locationType,
- countryCode,
- phonePlanId,
- this.client.getApiVersion(),
- body,
- context);
- }
-
- /**
- * Gets a list of the supported area codes.
- *
- * @param locationType The type of location information required by the plan.
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanId The plan id from which to search area codes.
- * @param body Represents a list of location option queries, used for fetching area codes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of the supported area codes.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getAllAreaCodesAsync(
- String locationType, String countryCode, String phonePlanId, LocationOptionsQueries body) {
- return getAllAreaCodesWithResponseAsync(locationType, countryCode, phonePlanId, body)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
- }
-
- /**
- * Gets a list of the supported area codes.
- *
- * @param locationType The type of location information required by the plan.
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanId The plan id from which to search area codes.
- * @param body Represents a list of location option queries, used for fetching area codes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of the supported area codes.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getAllAreaCodesAsync(
- String locationType, String countryCode, String phonePlanId, LocationOptionsQueries body, Context context) {
- return getAllAreaCodesWithResponseAsync(locationType, countryCode, phonePlanId, body, context)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
- }
-
- /**
- * Gets a list of the supported area codes.
- *
- * @param locationType The type of location information required by the plan.
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanId The plan id from which to search area codes.
- * @param body Represents a list of location option queries, used for fetching area codes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of the supported area codes.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public AreaCodes getAllAreaCodes(
- String locationType, String countryCode, String phonePlanId, LocationOptionsQueries body) {
- return getAllAreaCodesAsync(locationType, countryCode, phonePlanId, body).block();
- }
-
- /**
- * Gets a list of the supported area codes.
- *
- * @param locationType The type of location information required by the plan.
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanId The plan id from which to search area codes.
- * @param body Represents a list of location option queries, used for fetching area codes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of the supported area codes.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public AreaCodes getAllAreaCodes(
- String locationType, String countryCode, String phonePlanId, LocationOptionsQueries body, Context context) {
- return getAllAreaCodesAsync(locationType, countryCode, phonePlanId, body, context).block();
- }
-
- /**
- * Get capabilities by capabilities update id.
- *
- * @param capabilitiesUpdateId The capabilitiesUpdateId parameter.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return capabilities by capabilities update id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getCapabilitiesUpdateWithResponseAsync(
- String capabilitiesUpdateId) {
- return FluxUtil.withContext(
- context ->
- service.getCapabilitiesUpdate(
- this.client.getEndpoint(), capabilitiesUpdateId, this.client.getApiVersion(), context));
- }
-
- /**
- * Get capabilities by capabilities update id.
- *
- * @param capabilitiesUpdateId The capabilitiesUpdateId parameter.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return capabilities by capabilities update id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getCapabilitiesUpdateWithResponseAsync(
- String capabilitiesUpdateId, Context context) {
- return service.getCapabilitiesUpdate(
- this.client.getEndpoint(), capabilitiesUpdateId, this.client.getApiVersion(), context);
- }
-
- /**
- * Get capabilities by capabilities update id.
- *
- * @param capabilitiesUpdateId The capabilitiesUpdateId parameter.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return capabilities by capabilities update id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getCapabilitiesUpdateAsync(String capabilitiesUpdateId) {
- return getCapabilitiesUpdateWithResponseAsync(capabilitiesUpdateId)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
- }
-
- /**
- * Get capabilities by capabilities update id.
- *
- * @param capabilitiesUpdateId The capabilitiesUpdateId parameter.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return capabilities by capabilities update id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getCapabilitiesUpdateAsync(
- String capabilitiesUpdateId, Context context) {
- return getCapabilitiesUpdateWithResponseAsync(capabilitiesUpdateId, context)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
- }
-
- /**
- * Get capabilities by capabilities update id.
- *
- * @param capabilitiesUpdateId The capabilitiesUpdateId parameter.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return capabilities by capabilities update id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public UpdatePhoneNumberCapabilitiesResponse getCapabilitiesUpdate(String capabilitiesUpdateId) {
- return getCapabilitiesUpdateAsync(capabilitiesUpdateId).block();
- }
-
- /**
- * Get capabilities by capabilities update id.
- *
- * @param capabilitiesUpdateId The capabilitiesUpdateId parameter.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return capabilities by capabilities update id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public UpdatePhoneNumberCapabilitiesResponse getCapabilitiesUpdate(String capabilitiesUpdateId, Context context) {
- return getCapabilitiesUpdateAsync(capabilitiesUpdateId, context).block();
- }
-
- /**
- * Adds or removes phone number capabilities.
- *
- * @param body Represents a numbers capabilities update request.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 number capability update response.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> updateCapabilitiesWithResponseAsync(
- UpdateNumberCapabilitiesRequest body) {
- return FluxUtil.withContext(
- context ->
- service.updateCapabilities(
- this.client.getEndpoint(), this.client.getApiVersion(), body, context));
- }
-
- /**
- * Adds or removes phone number capabilities.
- *
- * @param body Represents a numbers capabilities update request.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 number capability update response.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> updateCapabilitiesWithResponseAsync(
- UpdateNumberCapabilitiesRequest body, Context context) {
- return service.updateCapabilities(this.client.getEndpoint(), this.client.getApiVersion(), body, context);
- }
-
- /**
- * Adds or removes phone number capabilities.
- *
- * @param body Represents a numbers capabilities update request.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 number capability update response.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono updateCapabilitiesAsync(UpdateNumberCapabilitiesRequest body) {
- return updateCapabilitiesWithResponseAsync(body)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
- }
-
- /**
- * Adds or removes phone number capabilities.
- *
- * @param body Represents a numbers capabilities update request.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 number capability update response.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono updateCapabilitiesAsync(
- UpdateNumberCapabilitiesRequest body, Context context) {
- return updateCapabilitiesWithResponseAsync(body, context)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
- }
-
- /**
- * Adds or removes phone number capabilities.
- *
- * @param body Represents a numbers capabilities update request.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 number capability update response.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public UpdateNumberCapabilitiesResponse updateCapabilities(UpdateNumberCapabilitiesRequest body) {
- return updateCapabilitiesAsync(body).block();
- }
-
- /**
- * Adds or removes phone number capabilities.
- *
- * @param body Represents a numbers capabilities update request.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 number capability update response.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public UpdateNumberCapabilitiesResponse updateCapabilities(UpdateNumberCapabilitiesRequest body, Context context) {
- return updateCapabilitiesAsync(body, context).block();
- }
-
- /**
- * Gets a list of supported countries.
- *
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of supported countries.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getAllSupportedCountriesSinglePageAsync(
- String locale, Integer skip, Integer take) {
- return FluxUtil.withContext(
- context ->
- service.getAllSupportedCountries(
- this.client.getEndpoint(),
- locale,
- skip,
- take,
- this.client.getApiVersion(),
- context))
- .map(
- res ->
- new PagedResponseBase<>(
- res.getRequest(),
- res.getStatusCode(),
- res.getHeaders(),
- res.getValue().getCountries(),
- res.getValue().getNextLink(),
- null));
- }
-
- /**
- * Gets a list of supported countries.
- *
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of supported countries.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getAllSupportedCountriesSinglePageAsync(
- String locale, Integer skip, Integer take, Context context) {
- return service.getAllSupportedCountries(
- this.client.getEndpoint(), locale, skip, take, this.client.getApiVersion(), context)
- .map(
- res ->
- new PagedResponseBase<>(
- res.getRequest(),
- res.getStatusCode(),
- res.getHeaders(),
- res.getValue().getCountries(),
- res.getValue().getNextLink(),
- null));
- }
-
- /**
- * Gets a list of supported countries.
- *
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of supported countries.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux getAllSupportedCountriesAsync(String locale, Integer skip, Integer take) {
- return new PagedFlux<>(
- () -> getAllSupportedCountriesSinglePageAsync(locale, skip, take),
- nextLink -> getAllSupportedCountriesNextSinglePageAsync(nextLink));
- }
-
- /**
- * Gets a list of supported countries.
- *
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of supported countries.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux getAllSupportedCountriesAsync(
- String locale, Integer skip, Integer take, Context context) {
- return new PagedFlux<>(
- () -> getAllSupportedCountriesSinglePageAsync(locale, skip, take, context),
- nextLink -> getAllSupportedCountriesNextSinglePageAsync(nextLink));
- }
-
- /**
- * Gets a list of supported countries.
- *
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of supported countries.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable getAllSupportedCountries(String locale, Integer skip, Integer take) {
- return new PagedIterable<>(getAllSupportedCountriesAsync(locale, skip, take));
- }
-
- /**
- * Gets a list of supported countries.
- *
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of supported countries.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable getAllSupportedCountries(
- String locale, Integer skip, Integer take, Context context) {
- return new PagedIterable<>(getAllSupportedCountriesAsync(locale, skip, take, context));
- }
-
- /**
- * Endpoint for getting number configurations.
- *
- * @param body The phone number wrapper representing a number configuration request.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return definition for number configuration.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getNumberConfigurationWithResponseAsync(
- NumberConfigurationPhoneNumber body) {
- return FluxUtil.withContext(
- context ->
- service.getNumberConfiguration(
- this.client.getEndpoint(), this.client.getApiVersion(), body, context));
- }
-
- /**
- * Endpoint for getting number configurations.
- *
- * @param body The phone number wrapper representing a number configuration request.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return definition for number configuration.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getNumberConfigurationWithResponseAsync(
- NumberConfigurationPhoneNumber body, Context context) {
- return service.getNumberConfiguration(this.client.getEndpoint(), this.client.getApiVersion(), body, context);
- }
-
- /**
- * Endpoint for getting number configurations.
- *
- * @param body The phone number wrapper representing a number configuration request.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return definition for number configuration.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getNumberConfigurationAsync(NumberConfigurationPhoneNumber body) {
- return getNumberConfigurationWithResponseAsync(body)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
- }
-
- /**
- * Endpoint for getting number configurations.
- *
- * @param body The phone number wrapper representing a number configuration request.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return definition for number configuration.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getNumberConfigurationAsync(
- NumberConfigurationPhoneNumber body, Context context) {
- return getNumberConfigurationWithResponseAsync(body, context)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
- }
-
- /**
- * Endpoint for getting number configurations.
- *
- * @param body The phone number wrapper representing a number configuration request.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return definition for number configuration.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public NumberConfigurationResponse getNumberConfiguration(NumberConfigurationPhoneNumber body) {
- return getNumberConfigurationAsync(body).block();
- }
-
- /**
- * Endpoint for getting number configurations.
- *
- * @param body The phone number wrapper representing a number configuration request.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return definition for number configuration.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public NumberConfigurationResponse getNumberConfiguration(NumberConfigurationPhoneNumber body, Context context) {
- return getNumberConfigurationAsync(body, context).block();
- }
-
- /**
- * Endpoint for configuring a pstn number.
- *
- * @param body Definition for number configuration.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> configureNumberWithResponseAsync(NumberConfiguration body) {
- return FluxUtil.withContext(
- context ->
- service.configureNumber(this.client.getEndpoint(), this.client.getApiVersion(), body, context));
- }
-
- /**
- * Endpoint for configuring a pstn number.
- *
- * @param body Definition for number configuration.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> configureNumberWithResponseAsync(NumberConfiguration body, Context context) {
- return service.configureNumber(this.client.getEndpoint(), this.client.getApiVersion(), body, context);
- }
-
- /**
- * Endpoint for configuring a pstn number.
- *
- * @param body Definition for number configuration.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono configureNumberAsync(NumberConfiguration body) {
- return configureNumberWithResponseAsync(body).flatMap((Response res) -> Mono.empty());
- }
-
- /**
- * Endpoint for configuring a pstn number.
- *
- * @param body Definition for number configuration.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono configureNumberAsync(NumberConfiguration body, Context context) {
- return configureNumberWithResponseAsync(body, context).flatMap((Response res) -> Mono.empty());
- }
-
- /**
- * Endpoint for configuring a pstn number.
- *
- * @param body Definition for number configuration.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public void configureNumber(NumberConfiguration body) {
- configureNumberAsync(body).block();
- }
-
- /**
- * Endpoint for configuring a pstn number.
- *
- * @param body Definition for number configuration.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public void configureNumber(NumberConfiguration body, Context context) {
- configureNumberAsync(body, context).block();
- }
-
- /**
- * Endpoint for unconfiguring a pstn number by removing the configuration.
- *
- * @param body The phone number wrapper representing a number configuration request.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> unconfigureNumberWithResponseAsync(NumberConfigurationPhoneNumber body) {
- return FluxUtil.withContext(
- context ->
- service.unconfigureNumber(
- this.client.getEndpoint(), this.client.getApiVersion(), body, context));
- }
-
- /**
- * Endpoint for unconfiguring a pstn number by removing the configuration.
- *
- * @param body The phone number wrapper representing a number configuration request.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> unconfigureNumberWithResponseAsync(
- NumberConfigurationPhoneNumber body, Context context) {
- return service.unconfigureNumber(this.client.getEndpoint(), this.client.getApiVersion(), body, context);
- }
-
- /**
- * Endpoint for unconfiguring a pstn number by removing the configuration.
- *
- * @param body The phone number wrapper representing a number configuration request.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono unconfigureNumberAsync(NumberConfigurationPhoneNumber body) {
- return unconfigureNumberWithResponseAsync(body).flatMap((Response res) -> Mono.empty());
- }
-
- /**
- * Endpoint for unconfiguring a pstn number by removing the configuration.
- *
- * @param body The phone number wrapper representing a number configuration request.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono unconfigureNumberAsync(NumberConfigurationPhoneNumber body, Context context) {
- return unconfigureNumberWithResponseAsync(body, context).flatMap((Response res) -> Mono.empty());
- }
-
- /**
- * Endpoint for unconfiguring a pstn number by removing the configuration.
- *
- * @param body The phone number wrapper representing a number configuration request.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public void unconfigureNumber(NumberConfigurationPhoneNumber body) {
- unconfigureNumberAsync(body).block();
- }
-
- /**
- * Endpoint for unconfiguring a pstn number by removing the configuration.
- *
- * @param body The phone number wrapper representing a number configuration request.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public void unconfigureNumber(NumberConfigurationPhoneNumber body, Context context) {
- unconfigureNumberAsync(body, context).block();
- }
-
- /**
- * Gets a list of phone plan groups for the given country.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param includeRateInformation The includeRateInformation parameter.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of phone plan groups for the given country.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getPhonePlanGroupsSinglePageAsync(
- String countryCode, String locale, Boolean includeRateInformation, Integer skip, Integer take) {
- return FluxUtil.withContext(
- context ->
- service.getPhonePlanGroups(
- this.client.getEndpoint(),
- countryCode,
- locale,
- includeRateInformation,
- skip,
- take,
- this.client.getApiVersion(),
- context))
- .map(
- res ->
- new PagedResponseBase<>(
- res.getRequest(),
- res.getStatusCode(),
- res.getHeaders(),
- res.getValue().getPhonePlanGroups(),
- res.getValue().getNextLink(),
- null));
- }
-
- /**
- * Gets a list of phone plan groups for the given country.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param includeRateInformation The includeRateInformation parameter.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of phone plan groups for the given country.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getPhonePlanGroupsSinglePageAsync(
- String countryCode,
- String locale,
- Boolean includeRateInformation,
- Integer skip,
- Integer take,
- Context context) {
- return service.getPhonePlanGroups(
- this.client.getEndpoint(),
- countryCode,
- locale,
- includeRateInformation,
- skip,
- take,
- this.client.getApiVersion(),
- context)
- .map(
- res ->
- new PagedResponseBase<>(
- res.getRequest(),
- res.getStatusCode(),
- res.getHeaders(),
- res.getValue().getPhonePlanGroups(),
- res.getValue().getNextLink(),
- null));
- }
-
- /**
- * Gets a list of phone plan groups for the given country.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param includeRateInformation The includeRateInformation parameter.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of phone plan groups for the given country.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux getPhonePlanGroupsAsync(
- String countryCode, String locale, Boolean includeRateInformation, Integer skip, Integer take) {
- return new PagedFlux<>(
- () -> getPhonePlanGroupsSinglePageAsync(countryCode, locale, includeRateInformation, skip, take),
- nextLink -> getPhonePlanGroupsNextSinglePageAsync(nextLink));
- }
-
- /**
- * Gets a list of phone plan groups for the given country.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param includeRateInformation The includeRateInformation parameter.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of phone plan groups for the given country.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux getPhonePlanGroupsAsync(
- String countryCode,
- String locale,
- Boolean includeRateInformation,
- Integer skip,
- Integer take,
- Context context) {
- return new PagedFlux<>(
- () ->
- getPhonePlanGroupsSinglePageAsync(
- countryCode, locale, includeRateInformation, skip, take, context),
- nextLink -> getPhonePlanGroupsNextSinglePageAsync(nextLink));
- }
-
- /**
- * Gets a list of phone plan groups for the given country.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param includeRateInformation The includeRateInformation parameter.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of phone plan groups for the given country.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable getPhonePlanGroups(
- String countryCode, String locale, Boolean includeRateInformation, Integer skip, Integer take) {
- return new PagedIterable<>(getPhonePlanGroupsAsync(countryCode, locale, includeRateInformation, skip, take));
- }
-
- /**
- * Gets a list of phone plan groups for the given country.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param includeRateInformation The includeRateInformation parameter.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of phone plan groups for the given country.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable getPhonePlanGroups(
- String countryCode,
- String locale,
- Boolean includeRateInformation,
- Integer skip,
- Integer take,
- Context context) {
- return new PagedIterable<>(
- getPhonePlanGroupsAsync(countryCode, locale, includeRateInformation, skip, take, context));
- }
-
- /**
- * Gets a list of phone plans for a phone plan group.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId The phonePlanGroupId parameter.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of phone plans for a phone plan group.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getPhonePlansSinglePageAsync(
- String countryCode, String phonePlanGroupId, String locale, Integer skip, Integer take) {
- return FluxUtil.withContext(
- context ->
- service.getPhonePlans(
- this.client.getEndpoint(),
- countryCode,
- phonePlanGroupId,
- locale,
- skip,
- take,
- this.client.getApiVersion(),
- context))
- .map(
- res ->
- new PagedResponseBase<>(
- res.getRequest(),
- res.getStatusCode(),
- res.getHeaders(),
- res.getValue().getPhonePlans(),
- res.getValue().getNextLink(),
- null));
- }
-
- /**
- * Gets a list of phone plans for a phone plan group.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId The phonePlanGroupId parameter.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of phone plans for a phone plan group.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getPhonePlansSinglePageAsync(
- String countryCode, String phonePlanGroupId, String locale, Integer skip, Integer take, Context context) {
- return service.getPhonePlans(
- this.client.getEndpoint(),
- countryCode,
- phonePlanGroupId,
- locale,
- skip,
- take,
- this.client.getApiVersion(),
- context)
- .map(
- res ->
- new PagedResponseBase<>(
- res.getRequest(),
- res.getStatusCode(),
- res.getHeaders(),
- res.getValue().getPhonePlans(),
- res.getValue().getNextLink(),
- null));
- }
-
- /**
- * Gets a list of phone plans for a phone plan group.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId The phonePlanGroupId parameter.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of phone plans for a phone plan group.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux getPhonePlansAsync(
- String countryCode, String phonePlanGroupId, String locale, Integer skip, Integer take) {
- return new PagedFlux<>(
- () -> getPhonePlansSinglePageAsync(countryCode, phonePlanGroupId, locale, skip, take),
- nextLink -> getPhonePlansNextSinglePageAsync(nextLink));
- }
-
- /**
- * Gets a list of phone plans for a phone plan group.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId The phonePlanGroupId parameter.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of phone plans for a phone plan group.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux getPhonePlansAsync(
- String countryCode, String phonePlanGroupId, String locale, Integer skip, Integer take, Context context) {
- return new PagedFlux<>(
- () -> getPhonePlansSinglePageAsync(countryCode, phonePlanGroupId, locale, skip, take, context),
- nextLink -> getPhonePlansNextSinglePageAsync(nextLink));
- }
-
- /**
- * Gets a list of phone plans for a phone plan group.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId The phonePlanGroupId parameter.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of phone plans for a phone plan group.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable getPhonePlans(
- String countryCode, String phonePlanGroupId, String locale, Integer skip, Integer take) {
- return new PagedIterable<>(getPhonePlansAsync(countryCode, phonePlanGroupId, locale, skip, take));
- }
-
- /**
- * Gets a list of phone plans for a phone plan group.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId The phonePlanGroupId parameter.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of phone plans for a phone plan group.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable getPhonePlans(
- String countryCode, String phonePlanGroupId, String locale, Integer skip, Integer take, Context context) {
- return new PagedIterable<>(getPhonePlansAsync(countryCode, phonePlanGroupId, locale, skip, take, context));
- }
-
- /**
- * Gets a list of location options for a phone plan.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId The phonePlanGroupId parameter.
- * @param phonePlanId The phonePlanId parameter.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of location options for a phone plan.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getPhonePlanLocationOptionsWithResponseAsync(
- String countryCode, String phonePlanGroupId, String phonePlanId, String locale) {
- return FluxUtil.withContext(
- context ->
- service.getPhonePlanLocationOptions(
- this.client.getEndpoint(),
- countryCode,
- phonePlanGroupId,
- phonePlanId,
- locale,
- this.client.getApiVersion(),
- context));
- }
-
- /**
- * Gets a list of location options for a phone plan.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId The phonePlanGroupId parameter.
- * @param phonePlanId The phonePlanId parameter.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of location options for a phone plan.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getPhonePlanLocationOptionsWithResponseAsync(
- String countryCode, String phonePlanGroupId, String phonePlanId, String locale, Context context) {
- return service.getPhonePlanLocationOptions(
- this.client.getEndpoint(),
- countryCode,
- phonePlanGroupId,
- phonePlanId,
- locale,
- this.client.getApiVersion(),
- context);
- }
-
- /**
- * Gets a list of location options for a phone plan.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId The phonePlanGroupId parameter.
- * @param phonePlanId The phonePlanId parameter.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of location options for a phone plan.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getPhonePlanLocationOptionsAsync(
- String countryCode, String phonePlanGroupId, String phonePlanId, String locale) {
- return getPhonePlanLocationOptionsWithResponseAsync(countryCode, phonePlanGroupId, phonePlanId, locale)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
- }
-
- /**
- * Gets a list of location options for a phone plan.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId The phonePlanGroupId parameter.
- * @param phonePlanId The phonePlanId parameter.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of location options for a phone plan.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getPhonePlanLocationOptionsAsync(
- String countryCode, String phonePlanGroupId, String phonePlanId, String locale, Context context) {
- return getPhonePlanLocationOptionsWithResponseAsync(countryCode, phonePlanGroupId, phonePlanId, locale, context)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
- }
-
- /**
- * Gets a list of location options for a phone plan.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId The phonePlanGroupId parameter.
- * @param phonePlanId The phonePlanId parameter.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of location options for a phone plan.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public LocationOptionsResponse getPhonePlanLocationOptions(
- String countryCode, String phonePlanGroupId, String phonePlanId, String locale) {
- return getPhonePlanLocationOptionsAsync(countryCode, phonePlanGroupId, phonePlanId, locale).block();
- }
-
- /**
- * Gets a list of location options for a phone plan.
- *
- * @param countryCode The ISO 3166-2 country code.
- * @param phonePlanGroupId The phonePlanGroupId parameter.
- * @param phonePlanId The phonePlanId parameter.
- * @param locale A language-locale pairing which will be used to localize the names of countries.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of location options for a phone plan.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public LocationOptionsResponse getPhonePlanLocationOptions(
- String countryCode, String phonePlanGroupId, String phonePlanId, String locale, Context context) {
- return getPhonePlanLocationOptionsAsync(countryCode, phonePlanGroupId, phonePlanId, locale, context).block();
- }
-
- /**
- * Gets a release by a release id.
- *
- * @param releaseId Represents the release id.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a release by a release id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getReleaseByIdWithResponseAsync(String releaseId) {
- return FluxUtil.withContext(
- context ->
- service.getReleaseById(
- this.client.getEndpoint(), releaseId, this.client.getApiVersion(), context));
- }
-
- /**
- * Gets a release by a release id.
- *
- * @param releaseId Represents the release id.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a release by a release id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getReleaseByIdWithResponseAsync(String releaseId, Context context) {
- return service.getReleaseById(this.client.getEndpoint(), releaseId, this.client.getApiVersion(), context);
- }
-
- /**
- * Gets a release by a release id.
- *
- * @param releaseId Represents the release id.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a release by a release id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getReleaseByIdAsync(String releaseId) {
- return getReleaseByIdWithResponseAsync(releaseId)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
- }
-
- /**
- * Gets a release by a release id.
- *
- * @param releaseId Represents the release id.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a release by a release id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getReleaseByIdAsync(String releaseId, Context context) {
- return getReleaseByIdWithResponseAsync(releaseId, context)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
- }
-
- /**
- * Gets a release by a release id.
- *
- * @param releaseId Represents the release id.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a release by a release id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public PhoneNumberRelease getReleaseById(String releaseId) {
- return getReleaseByIdAsync(releaseId).block();
- }
-
- /**
- * Gets a release by a release id.
- *
- * @param releaseId Represents the release id.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a release by a release id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public PhoneNumberRelease getReleaseById(String releaseId, Context context) {
- return getReleaseByIdAsync(releaseId, context).block();
- }
-
- /**
- * Creates a release for the given phone numbers.
- *
- * @param body Represents a release request.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 release response.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> releasePhoneNumbersWithResponseAsync(ReleaseRequest body) {
- return FluxUtil.withContext(
- context ->
- service.releasePhoneNumbers(
- this.client.getEndpoint(), this.client.getApiVersion(), body, context));
- }
-
- /**
- * Creates a release for the given phone numbers.
- *
- * @param body Represents a release request.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 release response.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> releasePhoneNumbersWithResponseAsync(ReleaseRequest body, Context context) {
- return service.releasePhoneNumbers(this.client.getEndpoint(), this.client.getApiVersion(), body, context);
- }
-
- /**
- * Creates a release for the given phone numbers.
- *
- * @param body Represents a release request.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 release response.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono releasePhoneNumbersAsync(ReleaseRequest body) {
- return releasePhoneNumbersWithResponseAsync(body)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
- }
-
- /**
- * Creates a release for the given phone numbers.
- *
- * @param body Represents a release request.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 release response.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono releasePhoneNumbersAsync(ReleaseRequest body, Context context) {
- return releasePhoneNumbersWithResponseAsync(body, context)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
- }
-
- /**
- * Creates a release for the given phone numbers.
- *
- * @param body Represents a release request.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 release response.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public ReleaseResponse releasePhoneNumbers(ReleaseRequest body) {
- return releasePhoneNumbersAsync(body).block();
- }
-
- /**
- * Creates a release for the given phone numbers.
- *
- * @param body Represents a release request.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 release response.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public ReleaseResponse releasePhoneNumbers(ReleaseRequest body, Context context) {
- return releasePhoneNumbersAsync(body, context).block();
- }
-
- /**
- * Gets a list of all releases.
- *
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of all releases.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getAllReleasesSinglePageAsync(Integer skip, Integer take) {
- return FluxUtil.withContext(
- context ->
- service.getAllReleases(
- this.client.getEndpoint(), skip, take, this.client.getApiVersion(), context))
- .map(
- res ->
- new PagedResponseBase<>(
- res.getRequest(),
- res.getStatusCode(),
- res.getHeaders(),
- res.getValue().getEntities(),
- res.getValue().getNextLink(),
- null));
- }
-
- /**
- * Gets a list of all releases.
- *
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of all releases.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getAllReleasesSinglePageAsync(
- Integer skip, Integer take, Context context) {
- return service.getAllReleases(this.client.getEndpoint(), skip, take, this.client.getApiVersion(), context)
- .map(
- res ->
- new PagedResponseBase<>(
- res.getRequest(),
- res.getStatusCode(),
- res.getHeaders(),
- res.getValue().getEntities(),
- res.getValue().getNextLink(),
- null));
- }
-
- /**
- * Gets a list of all releases.
- *
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of all releases.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux getAllReleasesAsync(Integer skip, Integer take) {
- return new PagedFlux<>(
- () -> getAllReleasesSinglePageAsync(skip, take),
- nextLink -> getAllReleasesNextSinglePageAsync(nextLink));
- }
-
- /**
- * Gets a list of all releases.
- *
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of all releases.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedFlux getAllReleasesAsync(Integer skip, Integer take, Context context) {
- return new PagedFlux<>(
- () -> getAllReleasesSinglePageAsync(skip, take, context),
- nextLink -> getAllReleasesNextSinglePageAsync(nextLink));
- }
-
- /**
- * Gets a list of all releases.
- *
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of all releases.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable getAllReleases(Integer skip, Integer take) {
- return new PagedIterable<>(getAllReleasesAsync(skip, take));
- }
-
- /**
- * Gets a list of all releases.
- *
- * @param skip An optional parameter for how many entries to skip, for pagination purposes.
- * @param take An optional parameter for how many entries to return, for pagination purposes.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return a list of all releases.
- */
- @ServiceMethod(returns = ReturnType.COLLECTION)
- public PagedIterable getAllReleases(Integer skip, Integer take, Context context) {
- return new PagedIterable<>(getAllReleasesAsync(skip, take, context));
- }
-
- /**
- * Get search by search id.
- *
- * @param searchId The search id to be searched for.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return search by search id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getSearchByIdWithResponseAsync(String searchId) {
- return FluxUtil.withContext(
- context ->
- service.getSearchById(
- this.client.getEndpoint(), searchId, this.client.getApiVersion(), context));
- }
-
- /**
- * Get search by search id.
- *
- * @param searchId The search id to be searched for.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return search by search id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getSearchByIdWithResponseAsync(String searchId, Context context) {
- return service.getSearchById(this.client.getEndpoint(), searchId, this.client.getApiVersion(), context);
- }
-
- /**
- * Get search by search id.
- *
- * @param searchId The search id to be searched for.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return search by search id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getSearchByIdAsync(String searchId) {
- return getSearchByIdWithResponseAsync(searchId)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
- }
-
- /**
- * Get search by search id.
- *
- * @param searchId The search id to be searched for.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return search by search id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getSearchByIdAsync(String searchId, Context context) {
- return getSearchByIdWithResponseAsync(searchId, context)
- .flatMap(
- (Response res) -> {
- if (res.getValue() != null) {
- return Mono.just(res.getValue());
- } else {
- return Mono.empty();
- }
- });
- }
-
- /**
- * Get search by search id.
- *
- * @param searchId The search id to be searched for.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return search by search id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public PhoneNumberReservation getSearchById(String searchId) {
- return getSearchByIdAsync(searchId).block();
- }
-
- /**
- * Get search by search id.
- *
- * @param searchId The search id to be searched for.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException thrown if the request is rejected by server.
- * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return search by search id.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public PhoneNumberReservation getSearchById(String searchId, Context context) {
- return getSearchByIdAsync(searchId, context).block();
- }
-
- /**
- * Creates a phone number search.
- *
- * @param body Represents a search creation option.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 creation response.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> createSearchWithResponseAsync(CreateReservationOptions body) {
- return FluxUtil.withContext(
- context -> service.createSearch(this.client.getEndpoint(), this.client.getApiVersion(), body, context));
- }
-
- /**
- * Creates a phone number search.
- *
- * @param body Represents a search creation option.
- * @param context The context to associate with this operation.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 creation response.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> createSearchWithResponseAsync(
- CreateReservationOptions body, Context context) {
- return service.createSearch(this.client.getEndpoint(), this.client.getApiVersion(), body, context);
- }
-
- /**
- * Creates a phone number search.
- *
- * @param body Represents a search creation option.
- * @throws IllegalArgumentException thrown if parameters fail the validation.
- * @throws ErrorResponseException 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 creation response.
- */
- @ServiceMethod(returns = ReturnType.SINGLE)
- public Mono