From 4b5ee6198b922d91a8a4a6ab8e38e42d3bbddebb Mon Sep 17 00:00:00 2001 From: Wayne Mo Date: Tue, 22 Sep 2020 16:34:16 -0700 Subject: [PATCH 1/6] Add Phone Number functionality to azure-communication-administration --- .../pom.xml | 29 + .../PhoneNumberAsyncClient.java | 620 ++++ .../administration/PhoneNumberClient.java | 524 +++ .../PhoneNumberClientBuilder.java | 264 ++ .../PhoneNumberServiceVersion.java | 39 + .../PhoneNumberAdminClientImpl.java | 83 + .../PhoneNumberAdminClientImplBuilder.java | 64 + .../PhoneNumberAdministrationsImpl.java | 2820 +++++++++++++++++ .../models/AcquiredPhoneNumber.java | 178 ++ .../models/AcquiredPhoneNumbers.java | 65 + .../models/ActivationState.java | 43 + .../administration/models/AreaCodes.java | 91 + .../models/AssignmentStatus.java | 46 + .../models/CapabilitiesUpdateStatus.java | 40 + .../administration/models/Capability.java | 100 + .../administration/models/CarrierDetails.java | 64 + .../models/CreateSearchOptions.java | 169 + .../models/CreateSearchResponse.java | 38 + .../administration/models/CurrencyType.java | 31 + .../administration/models/ErrorBody.java | 64 + .../administration/models/ErrorResponse.java | 38 + .../models/ErrorResponseException.java | 37 + .../models/LocationOptions.java | 91 + .../models/LocationOptionsDetails.java | 91 + .../models/LocationOptionsQueries.java | 39 + .../models/LocationOptionsQuery.java | 66 + .../models/LocationOptionsResponse.java | 38 + .../administration/models/LocationType.java | 37 + .../models/NumberConfiguration.java | 64 + .../NumberConfigurationPhoneNumber.java | 38 + .../models/NumberConfigurationResponse.java | 38 + .../models/NumberUpdateCapabilities.java | 65 + .../models/PhoneNumberCountries.java | 65 + .../models/PhoneNumberCountry.java | 64 + .../models/PhoneNumberEntities.java | 65 + .../models/PhoneNumberEntity.java | 196 ++ .../models/PhoneNumberRelease.java | 148 + .../models/PhoneNumberReleaseDetails.java | 64 + .../models/PhoneNumberReleaseStatus.java | 40 + .../models/PhoneNumberSearch.java | 329 ++ .../models/PhoneNumberType.java | 40 + .../administration/models/PhonePlan.java | 172 + .../administration/models/PhonePlanGroup.java | 168 + .../models/PhonePlanGroups.java | 65 + .../models/PhonePlansResponse.java | 65 + .../models/PstnConfiguration.java | 90 + .../models/RateInformation.java | 90 + .../administration/models/ReleaseRequest.java | 39 + .../models/ReleaseResponse.java | 38 + .../administration/models/ReleaseStatus.java | 43 + .../administration/models/SearchStatus.java | 67 + .../UpdateNumberCapabilitiesRequest.java | 43 + .../UpdateNumberCapabilitiesResponse.java | 38 + ...UpdatePhoneNumberCapabilitiesResponse.java | 120 + .../PhoneNumberAsyncClientPlaybackTest.java | 359 +++ .../PhoneNumberClientBuilderTest.java | 499 +++ .../PhoneNumberClientPlaybackTest.java | 340 ++ .../PhoneNumberPlaybackTestBase.java | 105 + .../org.mockito.plugins.MockMaker | 1 + .../session-records/cancelSearch.json | 20 + .../cancelSearchWithResponse.json | 20 + .../session-records/configureNumber.json | 21 + .../configureNumberWithResponse.json | 21 + .../session-records/createSearch.json | 23 + .../createSearchWithResponse.json | 23 + .../session-records/getAllAreaCodes.json | 23 + .../getAllAreaCodesWithResponse.json | 23 + .../getCapabilitiesUpdate.json | 22 + .../getCapabilitiesUpdateWithResponse.json | 22 + .../getNumberConfiguration.json | 23 + .../getNumberConfigurationWithResponse.json | 23 + .../getPhonePlanLocationOptions.json | 22 + .../session-records/getSearchById.json | 22 + .../getSearchByIdWithResponse.json | 22 + .../session-records/listAllPhoneNumbers.json | 22 + .../session-records/listAllReleases.json | 22 + .../session-records/listAllSearches.json | 22 + .../listAllSupportedCountries.json | 22 + .../session-records/listPhonePlanGroups.json | 22 + .../session-records/listPhonePlans.json | 22 + .../session-records/purchaseSearch.json | 20 + .../purchaseSearchWithResponse.json | 20 + .../session-records/releasePhoneNumbers.json | 23 + .../releasePhoneNumbersWithResponse.json | 23 + .../session-records/unconfigureNumber.json | 21 + .../unconfigureNumberWithResponse.json | 21 + .../session-records/updateCapabilities.json | 23 + .../updateCapabilitiesWithResponse.json | 23 + .../swagger/PNM_Swagger.json | 2060 ++++++++++++ .../swagger/README.md | 39 +- 90 files changed, 12090 insertions(+), 12 deletions(-) create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberAsyncClient.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberClient.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberClientBuilder.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberServiceVersion.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/implementation/PhoneNumberAdminClientImpl.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/implementation/PhoneNumberAdminClientImplBuilder.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/implementation/PhoneNumberAdministrationsImpl.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/AcquiredPhoneNumber.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/AcquiredPhoneNumbers.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ActivationState.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/AreaCodes.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/AssignmentStatus.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CapabilitiesUpdateStatus.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/Capability.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CarrierDetails.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CreateSearchOptions.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CreateSearchResponse.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CurrencyType.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ErrorBody.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ErrorResponse.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ErrorResponseException.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptions.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptionsDetails.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptionsQueries.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptionsQuery.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptionsResponse.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationType.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/NumberConfiguration.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/NumberConfigurationPhoneNumber.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/NumberConfigurationResponse.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/NumberUpdateCapabilities.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberCountries.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberCountry.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberEntities.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberEntity.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberRelease.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberReleaseDetails.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberReleaseStatus.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberSearch.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberType.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhonePlan.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhonePlanGroup.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhonePlanGroups.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhonePlansResponse.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PstnConfiguration.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/RateInformation.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ReleaseRequest.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ReleaseResponse.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ReleaseStatus.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/SearchStatus.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/UpdateNumberCapabilitiesRequest.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/UpdateNumberCapabilitiesResponse.java create mode 100644 sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/UpdatePhoneNumberCapabilitiesResponse.java create mode 100644 sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientPlaybackTest.java create mode 100644 sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientBuilderTest.java create mode 100644 sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientPlaybackTest.java create mode 100644 sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberPlaybackTestBase.java create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/cancelSearch.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/cancelSearchWithResponse.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/configureNumber.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/configureNumberWithResponse.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/createSearch.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/createSearchWithResponse.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/getAllAreaCodes.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/getAllAreaCodesWithResponse.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/getCapabilitiesUpdate.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/getCapabilitiesUpdateWithResponse.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/getNumberConfiguration.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/getNumberConfigurationWithResponse.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/getPhonePlanLocationOptions.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/getSearchById.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/getSearchByIdWithResponse.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/listAllPhoneNumbers.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/listAllReleases.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/listAllSearches.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/listAllSupportedCountries.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/listPhonePlanGroups.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/listPhonePlans.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/purchaseSearch.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/purchaseSearchWithResponse.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/releasePhoneNumbers.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/releasePhoneNumbersWithResponse.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/unconfigureNumber.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/unconfigureNumberWithResponse.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/updateCapabilities.json create mode 100644 sdk/communication/azure-communication-administration/src/test/resources/session-records/updateCapabilitiesWithResponse.json create mode 100644 sdk/communication/azure-communication-administration/swagger/PNM_Swagger.json diff --git a/sdk/communication/azure-communication-administration/pom.xml b/sdk/communication/azure-communication-administration/pom.xml index d40089187036..1d6d335b3795 100644 --- a/sdk/communication/azure-communication-administration/pom.xml +++ b/sdk/communication/azure-communication-administration/pom.xml @@ -100,6 +100,12 @@ 1.4.2 test + + org.mockito + mockito-core + 3.3.3 + test + @@ -128,4 +134,27 @@ + + + + is.jdk.11 + + [9,) + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M3 + + + --add-opens com.azure.communication.administration/com.azure.communication.administration=ALL-UNNAMED + + + + + + + \ No newline at end of file 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 new file mode 100644 index 000000000000..7a7af34262d0 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberAsyncClient.java @@ -0,0 +1,620 @@ +// 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.models.AcquiredPhoneNumber; +import com.azure.communication.administration.models.AreaCodes; +import com.azure.communication.administration.models.CreateSearchOptions; +import com.azure.communication.administration.models.CreateSearchResponse; +import com.azure.communication.administration.models.LocationOptionsQueries; +import com.azure.communication.administration.models.LocationOptionsQuery; +import com.azure.communication.administration.models.LocationOptionsResponse; +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.ReleaseRequest; +import com.azure.communication.administration.models.ReleaseResponse; +import com.azure.communication.administration.models.UpdateNumberCapabilitiesResponse; +import com.azure.communication.administration.models.NumberConfiguration; +import com.azure.communication.administration.models.PhoneNumberSearch; +import com.azure.communication.administration.models.UpdateNumberCapabilitiesRequest; +import com.azure.communication.administration.models.UpdatePhoneNumberCapabilitiesResponse; +import com.azure.communication.common.PhoneNumber; +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 reactor.core.publisher.Mono; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * Asynchronous client for Communication service phone number operations + */ +@ServiceClient(builder = PhoneNumberClientBuilder.class, isAsync = true) +public final class PhoneNumberAsyncClient { + + private final PhoneNumberAdminClientImpl phoneNumberAdminClient; + + PhoneNumberAsyncClient(PhoneNumberAdminClientImpl phoneNumberAdminClient) { + this.phoneNumberAdminClient = phoneNumberAdminClient; + } + + /** + * 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 phoneNumberAdminClient.getPhoneNumberAdministrations().getAllPhoneNumbersAsync( + locale, null, null); + } + + PagedFlux listAllPhoneNumbers(String locale, Context context) { + return phoneNumberAdminClient.getPhoneNumberAdministrations().getAllPhoneNumbersAsync( + locale, null, null, 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 Mono} containing a {@link AreaCodes} representing area codes. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getAllAreaCodes( + String locationType, String countryCode, String phonePlanId, List locationOptions) { + LocationOptionsQueries locationOptionsQueries = new LocationOptionsQueries(); + locationOptionsQueries.setLocationOptions(locationOptions); + return phoneNumberAdminClient.getPhoneNumberAdministrations().getAllAreaCodesAsync( + locationType, countryCode, phonePlanId, locationOptionsQueries); + } + + /** + * 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) { + LocationOptionsQueries locationOptionsQueries = new LocationOptionsQueries(); + locationOptionsQueries.setLocationOptions(locationOptions); + return phoneNumberAdminClient.getPhoneNumberAdministrations().getAllAreaCodesWithResponseAsync( + locationType, countryCode, phonePlanId, locationOptionsQueries); + } + + Mono> getAllAreaCodesWithResponse( + String locationType, String countryCode, String phonePlanId, List locationOptions, + Context context) { + LocationOptionsQueries locationOptionsQueries = new LocationOptionsQueries(); + locationOptionsQueries.setLocationOptions(locationOptions); + return phoneNumberAdminClient.getPhoneNumberAdministrations().getAllAreaCodesWithResponseAsync( + locationType, countryCode, phonePlanId, locationOptionsQueries, context); + } + + /** + * 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 phoneNumberAdminClient.getPhoneNumberAdministrations().getCapabilitiesUpdateAsync(capabilitiesId); + } + + /** + * 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 phoneNumberAdminClient.getPhoneNumberAdministrations() + .getCapabilitiesUpdateWithResponseAsync(capabilitiesId); + } + + Mono> getCapabilitiesUpdateWithResponse( + String capabilitiesId, Context context) { + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .getCapabilitiesUpdateWithResponseAsync(capabilitiesId, context); + } + + /** + * 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) { + Map capabilitiesMap = new HashMap<>(); + for (Map.Entry entry : phoneNumberCapabilitiesUpdate.entrySet()) { + capabilitiesMap.put(entry.getKey().getValue(), entry.getValue()); + } + + UpdateNumberCapabilitiesRequest updateNumberCapabilitiesRequest = new UpdateNumberCapabilitiesRequest(); + updateNumberCapabilitiesRequest.setPhoneNumberCapabilitiesUpdate(capabilitiesMap); + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .updateCapabilitiesAsync(updateNumberCapabilitiesRequest); + } + + /** + * 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) { + Map capabilitiesMap = new HashMap<>(); + for (Map.Entry entry : phoneNumberCapabilitiesUpdate.entrySet()) { + capabilitiesMap.put(entry.getKey().getValue(), entry.getValue()); + } + + UpdateNumberCapabilitiesRequest updateNumberCapabilitiesRequest = new UpdateNumberCapabilitiesRequest(); + updateNumberCapabilitiesRequest.setPhoneNumberCapabilitiesUpdate(capabilitiesMap); + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .updateCapabilitiesWithResponseAsync(updateNumberCapabilitiesRequest); + } + + Mono> updateCapabilitiesWithResponse( + Map phoneNumberCapabilitiesUpdate, Context context) { + Map capabilitiesMap = new HashMap<>(); + for (Map.Entry entry : phoneNumberCapabilitiesUpdate.entrySet()) { + capabilitiesMap.put(entry.getKey().getValue(), entry.getValue()); + } + + UpdateNumberCapabilitiesRequest updateNumberCapabilitiesRequest = new UpdateNumberCapabilitiesRequest(); + updateNumberCapabilitiesRequest.setPhoneNumberCapabilitiesUpdate(capabilitiesMap); + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .updateCapabilitiesWithResponseAsync(updateNumberCapabilitiesRequest, context); + } + + /** + * 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 phoneNumberAdminClient.getPhoneNumberAdministrations() + .getAllSupportedCountriesAsync(locale, null, null); + } + + PagedFlux listAllSupportedCountries(String locale, Context context) { + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .getAllSupportedCountriesAsync(locale, null, null, context); + } + + + /** + * Gets the configuration of a given phone number. + * + * @param phoneNumber A {@link PhoneNumber} representing the phone number. + * @return A {@link Mono} containing a {@link NumberConfigurationResponse} representing the configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getNumberConfiguration(PhoneNumber phoneNumber) { + NumberConfigurationPhoneNumber configurationPhoneNumber = new NumberConfigurationPhoneNumber(); + configurationPhoneNumber.setPhoneNumber(phoneNumber.getValue()); + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .getNumberConfigurationAsync(configurationPhoneNumber); + } + + /** + * Gets the configuration of a given phone number. + * + * @param phoneNumber A {@link PhoneNumber} 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(PhoneNumber phoneNumber) { + NumberConfigurationPhoneNumber configurationPhoneNumber = new NumberConfigurationPhoneNumber(); + configurationPhoneNumber.setPhoneNumber(phoneNumber.getValue()); + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .getNumberConfigurationWithResponseAsync(configurationPhoneNumber); + } + + Mono> getNumberConfigurationWithResponse( + PhoneNumber phoneNumber, Context context) { + NumberConfigurationPhoneNumber configurationPhoneNumber = new NumberConfigurationPhoneNumber(); + configurationPhoneNumber.setPhoneNumber(phoneNumber.getValue()); + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .getNumberConfigurationWithResponseAsync(configurationPhoneNumber, context); + } + + /** + * Associates a phone number with a PSTN Configuration. + * + * @param phoneNumber A {@link PhoneNumber} 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(PhoneNumber phoneNumber, PstnConfiguration pstnConfiguration) { + NumberConfiguration numberConfiguration = new NumberConfiguration(); + numberConfiguration.setPhoneNumber(phoneNumber.getValue()).setPstnConfiguration(pstnConfiguration); + return phoneNumberAdminClient.getPhoneNumberAdministrations().configureNumberAsync(numberConfiguration); + } + + /** + * Associates a phone number with a PSTN Configuration. + * + * @param phoneNumber A {@link PhoneNumber} 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( + PhoneNumber phoneNumber, PstnConfiguration pstnConfiguration) { + NumberConfiguration numberConfiguration = new NumberConfiguration(); + numberConfiguration.setPhoneNumber(phoneNumber.getValue()).setPstnConfiguration(pstnConfiguration); + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .configureNumberWithResponseAsync(numberConfiguration); + } + + Mono> configureNumberWithResponse( + PhoneNumber phoneNumber, PstnConfiguration pstnConfiguration, Context context) { + NumberConfiguration numberConfiguration = new NumberConfiguration(); + numberConfiguration.setPhoneNumber(phoneNumber.getValue()).setPstnConfiguration(pstnConfiguration); + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .configureNumberWithResponseAsync(numberConfiguration, context); + } + + /** + * Removes the PSTN Configuration from a phone number. + * + * @param phoneNumber A {@link PhoneNumber} representing the phone number. + * @return A {@link Mono} for the asynchronous return + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono unconfigureNumber(PhoneNumber phoneNumber) { + NumberConfigurationPhoneNumber configurationPhoneNumber = new NumberConfigurationPhoneNumber(); + configurationPhoneNumber.setPhoneNumber(phoneNumber.getValue()); + return phoneNumberAdminClient.getPhoneNumberAdministrations().unconfigureNumberAsync(configurationPhoneNumber); + } + + /** + * Removes the PSTN Configuration from a phone number. + * + * @param phoneNumber A {@link PhoneNumber} representing the phone number. + * @return A {@link Mono} containing a {@link Response} for the operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> unconfigureNumberWithResponse(PhoneNumber phoneNumber) { + NumberConfigurationPhoneNumber configurationPhoneNumber = new NumberConfigurationPhoneNumber(); + configurationPhoneNumber.setPhoneNumber(phoneNumber.getValue()); + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .unconfigureNumberWithResponseAsync(configurationPhoneNumber); + } + + Mono> unconfigureNumberWithResponse(PhoneNumber phoneNumber, Context context) { + NumberConfigurationPhoneNumber configurationPhoneNumber = new NumberConfigurationPhoneNumber(); + configurationPhoneNumber.setPhoneNumber(phoneNumber.getValue()); + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .unconfigureNumberWithResponseAsync(configurationPhoneNumber, context); + } + + /** + * 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 phoneNumberAdminClient.getPhoneNumberAdministrations().getPhonePlanGroupsAsync( + countryCode, locale, includeRateInformation, null, null); + } + + PagedFlux listPhonePlanGroups( + String countryCode, String locale, Boolean includeRateInformation, Context context) { + return phoneNumberAdminClient.getPhoneNumberAdministrations().getPhonePlanGroupsAsync( + countryCode, locale, includeRateInformation, null, null, 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 PagedFlux} of {@link PhonePlan} instances representing phone plans + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listPhonePlans(String countryCode, String phonePlanGroupId, String locale) { + return phoneNumberAdminClient.getPhoneNumberAdministrations().getPhonePlansAsync( + countryCode, phonePlanGroupId, locale, null, null); + } + + PagedFlux listPhonePlans(String countryCode, String phonePlanGroupId, String locale, Context context) { + return phoneNumberAdminClient.getPhoneNumberAdministrations().getPhonePlansAsync( + countryCode, phonePlanGroupId, locale, null, null, 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 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 phoneNumberAdminClient.getPhoneNumberAdministrations().getPhonePlanLocationOptionsAsync( + countryCode, phonePlanGroupId, phonePlanId, locale); + } + + Mono getPhonePlanLocationOptions( + String countryCode, String phonePlanGroupId, String phonePlanId, String locale, Context context) { + return phoneNumberAdminClient.getPhoneNumberAdministrations().getPhonePlanLocationOptionsAsync( + countryCode, phonePlanGroupId, phonePlanId, 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 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 phoneNumberAdminClient.getPhoneNumberAdministrations().getPhonePlanLocationOptionsWithResponseAsync( + countryCode, phonePlanGroupId, phonePlanId, locale); + } + + Mono> getPhonePlanLocationOptionsWithResponse( + String countryCode, String phonePlanGroupId, String phonePlanId, String locale, Context context) { + return phoneNumberAdminClient.getPhoneNumberAdministrations().getPhonePlanLocationOptionsWithResponseAsync( + countryCode, phonePlanGroupId, phonePlanId, locale, context); + } + + /** + * 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 phoneNumberAdminClient.getPhoneNumberAdministrations().getReleaseByIdAsync(releaseId); + } + + /** + * 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 phoneNumberAdminClient.getPhoneNumberAdministrations().getReleaseByIdWithResponseAsync(releaseId); + } + + Mono> getReleaseByIdWithResponse(String releaseId, Context context) { + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .getReleaseByIdWithResponseAsync(releaseId, context); + } + + /** + * Creates a release for the given phone numbers. + * + * @param phoneNumbers {@link List} of {@link PhoneNumber} objects with the phone numbers. + * @return A {@link Mono} containing a {@link ReleaseResponse} representing the release. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono releasePhoneNumbers(List phoneNumbers) { + List phoneNumberStrings = phoneNumbers.stream().map(PhoneNumber::getValue).collect(Collectors.toList()); + ReleaseRequest releaseRequest = new ReleaseRequest(); + releaseRequest.setPhoneNumbers(phoneNumberStrings); + return phoneNumberAdminClient.getPhoneNumberAdministrations().releasePhoneNumbersAsync(releaseRequest); + } + + /** + * Creates a release for the given phone numbers. + * + * @param phoneNumbers {@link List} of {@link PhoneNumber} 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> releasePhoneNumbersWithResponse(List phoneNumbers) { + List phoneNumberStrings = phoneNumbers.stream().map(PhoneNumber::getValue).collect(Collectors.toList()); + ReleaseRequest releaseRequest = new ReleaseRequest(); + releaseRequest.setPhoneNumbers(phoneNumberStrings); + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .releasePhoneNumbersWithResponseAsync(releaseRequest); + } + + Mono> releasePhoneNumbersWithResponse(List phoneNumbers, Context context) { + List phoneNumberStrings = phoneNumbers.stream().map(PhoneNumber::getValue).collect(Collectors.toList()); + ReleaseRequest releaseRequest = new ReleaseRequest(); + releaseRequest.setPhoneNumbers(phoneNumberStrings); + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .releasePhoneNumbersWithResponseAsync(releaseRequest, context); + } + + /** + * Gets the list of all releases + * + * @return A {@link PagedFlux} of {@link PhoneNumberEntity} instances representing releases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAllReleases() { + return phoneNumberAdminClient.getPhoneNumberAdministrations().getAllReleasesAsync(null, null); + } + + PagedFlux listAllReleases(Context context) { + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .getAllReleasesAsync(null, null, context); + } + + /** + * Gets a search by ID. + * + * @param searchId ID of the search + * @return A {@link Mono} containing a {@link PhoneNumberSearch} representing the search. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono getSearchById(String searchId) { + return phoneNumberAdminClient.getPhoneNumberAdministrations().getSearchByIdAsync(searchId); + } + + /** + * Gets a search by ID. + * + * @param searchId ID of the search + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue()} value returns + * a {@link PhoneNumberSearch} representing the search. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getSearchByIdWithResponse(String searchId) { + return phoneNumberAdminClient.getPhoneNumberAdministrations().getSearchByIdWithResponseAsync(searchId); + } + + Mono> getSearchByIdWithResponse(String searchId, Context context) { + return phoneNumberAdminClient.getPhoneNumberAdministrations().getSearchByIdWithResponseAsync(searchId, context); + } + + /** + * Create a phone number search. + * + * @param searchOptions A {@link CreateSearchOptions} with the search options + * @return A {@link Mono} containing a {@link CreateSearchResponse} representing the search. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono createSearch(CreateSearchOptions searchOptions) { + return phoneNumberAdminClient.getPhoneNumberAdministrations().createSearchAsync(searchOptions); + } + + /** + * Create a phone number search. + * + * @param searchOptions A {@link CreateSearchOptions} with the search options + * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue()} value returns + * a {@link CreateSearchResponse} representing the search. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> createSearchWithResponse(CreateSearchOptions searchOptions) { + return phoneNumberAdminClient.getPhoneNumberAdministrations().createSearchWithResponseAsync(searchOptions); + } + + Mono> createSearchWithResponse(CreateSearchOptions searchOptions, Context context) { + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .createSearchWithResponseAsync(searchOptions, context); + } + + /** + * Gets the list of all searches + * + * @return A {@link PagedFlux} of {@link PhoneNumberEntity} instances representing searches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux listAllSearches() { + return phoneNumberAdminClient.getPhoneNumberAdministrations().getAllSearchesAsync(null, null); + } + + PagedFlux listAllSearches(Context context) { + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .getAllSearchesAsync(null, null, context); + } + + /** + * Cancels the search. This means existing numbers in the search will be made available. + * + * @param searchId ID of the search + * @return A {@link Mono} for the asynchronous return + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono cancelSearch(String searchId) { + return phoneNumberAdminClient.getPhoneNumberAdministrations().cancelSearchAsync(searchId); + } + + /** + * Cancels the search. This means existing numbers in the search will be made available. + * + * @param searchId ID of the search + * @return A {@link Mono} containing a {@link Response} for the operation + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> cancelSearchWithResponse(String searchId) { + return phoneNumberAdminClient.getPhoneNumberAdministrations().cancelSearchWithResponseAsync(searchId); + } + + Mono> cancelSearchWithResponse(String searchId, Context context) { + return phoneNumberAdminClient.getPhoneNumberAdministrations().cancelSearchWithResponseAsync(searchId, context); + } + + /** + * Purchases the phone number search. + * + * @param searchId ID of the search + * @return A {@link Mono} for the asynchronous return + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono purchaseSearch(String searchId) { + return phoneNumberAdminClient.getPhoneNumberAdministrations().purchaseSearchAsync(searchId); + } + + /** + * Purchases the phone number search. + * + * @param searchId ID of the search + * @return A {@link Mono} containing a {@link Response} for the operation + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> purchaseSearchWithResponse(String searchId) { + return phoneNumberAdminClient.getPhoneNumberAdministrations().purchaseSearchWithResponseAsync(searchId); + } + + Mono> purchaseSearchWithResponse(String searchId, Context context) { + return phoneNumberAdminClient.getPhoneNumberAdministrations() + .purchaseSearchWithResponseAsync(searchId, context); + } +} 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 new file mode 100644 index 000000000000..f06a4dcbb5f6 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberClient.java @@ -0,0 +1,524 @@ +// 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.CreateSearchOptions; +import com.azure.communication.administration.models.CreateSearchResponse; +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.ReleaseResponse; +import com.azure.communication.administration.models.UpdateNumberCapabilitiesResponse; +import com.azure.communication.administration.models.PhoneNumberSearch; +import com.azure.communication.administration.models.UpdatePhoneNumberCapabilitiesResponse; +import com.azure.communication.common.PhoneNumber; +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 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 PhoneNumber} representing the phone number. + * @return A {@link NumberConfigurationResponse} representing the configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NumberConfigurationResponse getNumberConfiguration(PhoneNumber phoneNumber) { + return phoneNumberAsyncClient.getNumberConfiguration(phoneNumber).block(); + } + + /** + * Gets the configuration of a given phone number. + * + * @param phoneNumber A {@link PhoneNumber} 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( + PhoneNumber phoneNumber, Context context) { + return phoneNumberAsyncClient.getNumberConfigurationWithResponse(phoneNumber, context).block(); + } + + /** + * Associates a phone number with a PSTN Configuration. + * + * @param phoneNumber A {@link PhoneNumber} representing the phone number. + * @param pstnConfiguration A {@link PstnConfiguration} containing the pstn number configuration options. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void configureNumber(PhoneNumber phoneNumber, PstnConfiguration pstnConfiguration) { + phoneNumberAsyncClient.configureNumber(phoneNumber, pstnConfiguration).block(); + } + + /** + * Associates a phone number with a PSTN Configuration. + * + * @param phoneNumber A {@link PhoneNumber} 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( + PhoneNumber phoneNumber, PstnConfiguration pstnConfiguration, Context context) { + return phoneNumberAsyncClient.configureNumberWithResponse(phoneNumber, pstnConfiguration, context).block(); + } + + /** + * Removes the PSTN Configuration from a phone number. + * + * @param phoneNumber A {@link PhoneNumber} representing the phone number. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void unconfigureNumber(PhoneNumber phoneNumber) { + phoneNumberAsyncClient.unconfigureNumber(phoneNumber).block(); + } + + /** + * Removes the PSTN Configuration from a phone number. + * + * @param phoneNumber A {@link PhoneNumber} 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(PhoneNumber 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(); + } + + /** + * Creates a release for the given phone numbers. + * + * @param phoneNumbers {@link List} of {@link PhoneNumber} objects with the phone numbers. + * @return A {@link ReleaseResponse} representing the release. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ReleaseResponse releasePhoneNumbers(List phoneNumbers) { + return phoneNumberAsyncClient.releasePhoneNumbers(phoneNumbers).block(); + } + + /** + * Creates a release for the given phone numbers. + * + * @param phoneNumbers {@link List} of {@link PhoneNumber} objects with the phone numbers. + * @param context A {@link Context} representing the request context. + * @return A {@link Response} whose {@link Response#getValue()} value returns + * a {@link ReleaseResponse} representing the release. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response releasePhoneNumbersWithResponse(List phoneNumbers, Context context) { + return phoneNumberAsyncClient.releasePhoneNumbersWithResponse(phoneNumbers, 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 search by ID. + * + * @param searchId ID of the search + * @return A {@link PhoneNumberSearch} representing the search. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PhoneNumberSearch getSearchById(String searchId) { + return phoneNumberAsyncClient.getSearchById(searchId).block(); + } + + /** + * Gets a search by ID. + * + * @param searchId ID of the search + * @param context A {@link Context} representing the request context. + * @return A {@link Response} whose {@link Response#getValue()} value returns + * a {@link PhoneNumberSearch} representing the search. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getSearchByIdWithResponse(String searchId, Context context) { + return phoneNumberAsyncClient.getSearchByIdWithResponse(searchId, context).block(); + } + + /** + * Create a phone number search. + * + * @param searchOptions A {@link CreateSearchOptions} with the search options + * @return A {@link CreateSearchResponse} representing the search. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CreateSearchResponse createSearch(CreateSearchOptions searchOptions) { + return phoneNumberAsyncClient.createSearch(searchOptions).block(); + } + + /** + * Create a phone number search. + * + * @param searchOptions A {@link CreateSearchOptions} with the search options + * @param context A {@link Context} representing the request context. + * @return A {@link Response} whose {@link Response#getValue()} value returns + * a {@link CreateSearchResponse} representing the search. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createSearchWithResponse(CreateSearchOptions searchOptions, Context context) { + return phoneNumberAsyncClient.createSearchWithResponse(searchOptions, context).block(); + } + + /** + * Gets the list of all searches + * + * @return A {@link PagedIterable} of {@link PhoneNumberEntity} instances representing searches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAllSearches() { + return new PagedIterable<>(phoneNumberAsyncClient.listAllSearches()); + } + + /** + * Gets the list of all searches + * + * @param context A {@link Context} representing the request context. + * @return A {@link PagedIterable} of {@link PhoneNumberEntity} instances representing searches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAllSearches(Context context) { + return new PagedIterable<>(phoneNumberAsyncClient.listAllSearches(context)); + } + + /** + * Cancels the search. This means existing numbers in the search will be made available. + * + * @param searchId ID of the search + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void cancelSearch(String searchId) { + phoneNumberAsyncClient.cancelSearch(searchId).block(); + } + + /** + * Cancels the search. This means existing numbers in the search will be made available. + * + * @param searchId ID of the search + * @param context A {@link Context} representing the request context. + * @return A {@link Response} for the operation + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelSearchWithResponse(String searchId, Context context) { + return phoneNumberAsyncClient.cancelSearchWithResponse(searchId, context).block(); + } + + /** + * Purchases the phone number search. + * + * @param searchId ID of the search + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void purchaseSearch(String searchId) { + phoneNumberAsyncClient.purchaseSearch(searchId).block(); + } + + /** + * Purchases the phone number search. + * + * @param searchId ID of the search + * @param context A {@link Context} representing the request context. + * @return A {@link Response} for the operation + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response purchaseSearchWithResponse(String searchId, Context context) { + return phoneNumberAsyncClient.purchaseSearchWithResponse(searchId, context).block(); + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberClientBuilder.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberClientBuilder.java new file mode 100644 index 000000000000..0587a79fa379 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberClientBuilder.java @@ -0,0 +1,264 @@ +// 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.PhoneNumberAdminClientImplBuilder; +import com.azure.communication.common.CommunicationClientCredential; +import com.azure.communication.common.HmacAuthenticationPolicy; +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * Builder for creating clients of Communication Service phone number configuration + */ +@ServiceClientBuilder(serviceClients = {PhoneNumberClient.class, PhoneNumberAsyncClient.class}) +public final class PhoneNumberClientBuilder { + private static final Map PROPERTIES = + CoreUtils.getProperties("azure-communication-administration.properties"); + private static final String SDK_NAME = "name"; + private static final String SDK_VERSION = "version"; + + private final ClientLogger logger = new ClientLogger(PhoneNumberClientBuilder.class); + + private PhoneNumberServiceVersion version; + private String endpoint; + private HttpPipeline pipeline; + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private CommunicationClientCredential credential; + private Configuration configuration; + private final List additionalPolicies = new ArrayList<>(); + + /** + * Set endpoint of the service + * + * @param endpoint url of the service + * @return The updated {@link PhoneNumberClientBuilder} object. + * @throws NullPointerException If {@code endpoint} is {@code null}. + */ + public PhoneNumberClientBuilder endpoint(String endpoint) { + this.endpoint = Objects.requireNonNull(endpoint, "'endpoint' cannot be null."); + return this; + } + + /** + * Sets the HTTP pipeline to use for the service client + *

+ * If {@code pipeline} is set, all other settings aside from + * {@link PhoneNumberClientBuilder#endpoint(String) endpoint} are ignored. + * + * @param pipeline HttpPipeline to use + * @return The updated {@link PhoneNumberClientBuilder} object. + */ + public PhoneNumberClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = Objects.requireNonNull(pipeline, "'pipeline' cannot be null."); + return this; + } + + /** + * Set HttpClient to use + * + * @param httpClient HttpClient to use + * @return The updated {@link PhoneNumberClientBuilder} object. + * @throws NullPointerException If {@code httpClient} is {@code null}. + */ + public PhoneNumberClientBuilder httpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging configuration for HTTP requests and responses. + * + *

If logLevel is not provided, default value of {@link HttpLogDetailLevel#NONE} is set.

+ * + * @param httpLogOptions The logging configuration to use when sending and receiving HTTP requests/responses. + * @return the updated {@link PhoneNumberClientBuilder} object. + */ + public PhoneNumberClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = httpLogOptions; + return this; + } + + /** + * Set CommunicationClientCredential for authorization + * + * @param credential valid CommunicationClientCredential object + * @return The updated {@link PhoneNumberClientBuilder} object. + * @throws NullPointerException If {@code credential} is {@code null}. + */ + public PhoneNumberClientBuilder credential(CommunicationClientCredential credential) { + this.credential = Objects.requireNonNull(credential, "'credential' cannot be null."); + return this; + } + + /** + * Sets the configuration object used to retrieve environment configuration values during building of the client. + * + * @param configuration Configuration store used to retrieve environment configurations. + * @return The updated {@link PhoneNumberClientBuilder} object. + */ + public PhoneNumberClientBuilder configuration(Configuration configuration) { + this.configuration = configuration; + return this; + } + + /** + * Adds a policy to the set of existing policies that are executed after required policies. + * + * @param policy The retry policy for service requests. + * @return The updated {@link PhoneNumberClientBuilder} object. + * @throws NullPointerException If {@code policy} is {@code null}. + */ + public PhoneNumberClientBuilder addPolicy(HttpPipelinePolicy policy) { + this.additionalPolicies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Sets the {@link PhoneNumberServiceVersion} that is used when making API requests. + *

+ * If a service version is not provided, the service version that will be used will be the latest known service + * version based on the version of the client library being used. If no service version is specified, updating to a + * newer version the client library will have the result of potentially moving to a newer service version. + * + * @param version {@link PhoneNumberServiceVersion} of the service to be used when making requests. + * @return The updated {@link PhoneNumberClientBuilder} object. + */ + public PhoneNumberClientBuilder serviceVersion(PhoneNumberServiceVersion version) { + this.version = version; + return this; + } + + /** + * Create synchronous client applying CommunicationClientCredentialPolicy, + * UserAgentPolicy, RetryPolicy, and CookiePolicy. + * Additional HttpPolicies specified by additionalPolicies will be applied after them + * + * @return {@link PhoneNumberClient} instance + */ + public PhoneNumberClient buildClient() { + return new PhoneNumberClient(this.buildAsyncClient()); + } + + /** + * Create asynchronous client applying CommunicationClientCredentialPolicy, + * UserAgentPolicy, RetryPolicy, and CookiePolicy. + * Additional HttpPolicies specified by additionalPolicies will be applied after them + * + * @return {@link PhoneNumberAsyncClient} instance + */ + public PhoneNumberAsyncClient buildAsyncClient() { + this.validateRequiredFields(); + + if (this.version != null) { + logger.info("Build client for service version" + this.version.getVersion()); + } + + return this.createPhoneNumberAsyncClient(this.createPhoneNumberAdminClient()); + } + + PhoneNumberAsyncClient createPhoneNumberAsyncClient(PhoneNumberAdminClientImpl phoneNumberAdminClient) { + return new PhoneNumberAsyncClient(phoneNumberAdminClient); + } + + HmacAuthenticationPolicy createAuthenticationPolicy(CommunicationClientCredential communicationClientCredential) { + return new HmacAuthenticationPolicy(communicationClientCredential); + } + + UserAgentPolicy createUserAgentPolicy( + String applicationId, String sdkName, String sdkVersion, Configuration configuration) { + return new UserAgentPolicy(applicationId, sdkName, sdkVersion, configuration); + } + + RetryPolicy createRetryPolicy() { + return new RetryPolicy(); + } + + CookiePolicy createCookiePolicy() { + return new CookiePolicy(); + } + + HttpLoggingPolicy createHttpLoggingPolicy(HttpLogOptions httpLogOptions) { + return new HttpLoggingPolicy(httpLogOptions); + } + + HttpLogOptions createDefaultHttpLogOptions() { + return new HttpLogOptions(); + } + + private void validateRequiredFields() { + Objects.requireNonNull(this.endpoint); + + if (this.pipeline == null) { + Objects.requireNonNull(this.credential); + Objects.requireNonNull(this.httpClient); + } + } + + private PhoneNumberAdminClientImpl createPhoneNumberAdminClient() { + PhoneNumberAdminClientImplBuilder clientBuilder = new PhoneNumberAdminClientImplBuilder(); + return clientBuilder + .endpoint(this.endpoint) + .pipeline(this.createHttpPipeline()) + .buildClient(); + } + + private HttpPipeline createHttpPipeline() { + if (this.pipeline != null) { + return this.pipeline; + } + + List policyList = new ArrayList<>(); + + // Add required policies + policyList.add(this.createAuthenticationPolicy(this.credential)); + policyList.add(this.createUserAgentPolicy( + this.getHttpLogOptions().getApplicationId(), + PROPERTIES.get(SDK_NAME), + PROPERTIES.get(SDK_VERSION), + this.configuration + )); + policyList.add(this.createRetryPolicy()); + policyList.add(this.createCookiePolicy()); + + // Add additional policies + if (this.additionalPolicies.size() > 0) { + policyList.addAll(this.additionalPolicies); + } + + // Add logging policy + policyList.add(this.createHttpLoggingPolicy(this.getHttpLogOptions())); + + return new HttpPipelineBuilder() + .policies(policyList.toArray(new HttpPipelinePolicy[0])) + .httpClient(this.httpClient) + .build(); + } + + private HttpLogOptions getHttpLogOptions() { + if (this.httpLogOptions == null) { + this.httpLogOptions = this.createDefaultHttpLogOptions(); + } + + return this.httpLogOptions; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberServiceVersion.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberServiceVersion.java new file mode 100644 index 000000000000..ed642f3eae24 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/PhoneNumberServiceVersion.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.communication.administration; + +import com.azure.core.util.ServiceVersion; + +/** + * The versions of Phone Number Admin Service supported by this client library. + */ +public enum PhoneNumberServiceVersion implements ServiceVersion { + V2020_07_20_PREVIEW_1("2020-07-20-preview1"); + + private final String version; + + PhoneNumberServiceVersion(String version) { + + this.version = version; + } + + /** + * {@inheritDoc} + */ + @Override + public String getVersion() { + + return this.version; + } + + /** + * Gets the latest service version supported by this client library + * + * @return the latest {@link PhoneNumberServiceVersion} + */ + public static PhoneNumberServiceVersion getLatest() { + + return V2020_07_20_PREVIEW_1; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/implementation/PhoneNumberAdminClientImpl.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/implementation/PhoneNumberAdminClientImpl.java new file mode 100644 index 000000000000..9911c4c2de4f --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/implementation/PhoneNumberAdminClientImpl.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.administration.implementation; + +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; + +/** Initializes a new instance of the PhoneNumberAdminClient type. */ +public final class PhoneNumberAdminClientImpl { + /** The endpoint of the Azure Communication resource. */ + private final String endpoint; + + /** + * Gets The endpoint of the Azure Communication resource. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The PhoneNumberAdministrationsImpl object to access its operations. */ + private final PhoneNumberAdministrationsImpl phoneNumberAdministrations; + + /** + * Gets the PhoneNumberAdministrationsImpl object to access its operations. + * + * @return the PhoneNumberAdministrationsImpl object. + */ + public PhoneNumberAdministrationsImpl getPhoneNumberAdministrations() { + return this.phoneNumberAdministrations; + } + + /** Initializes an instance of PhoneNumberAdminClient client. */ + PhoneNumberAdminClientImpl(String endpoint) { + this( + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(), + endpoint); + } + + /** + * Initializes an instance of PhoneNumberAdminClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + */ + PhoneNumberAdminClientImpl(HttpPipeline httpPipeline, String endpoint) { + this.httpPipeline = httpPipeline; + this.endpoint = endpoint; + this.apiVersion = "2020-07-20-preview1"; + this.phoneNumberAdministrations = new PhoneNumberAdministrationsImpl(this); + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/implementation/PhoneNumberAdminClientImplBuilder.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/implementation/PhoneNumberAdminClientImplBuilder.java new file mode 100644 index 000000000000..3f4cf3ffd2c3 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/implementation/PhoneNumberAdminClientImplBuilder.java @@ -0,0 +1,64 @@ +// 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.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; + +/** A builder for creating a new instance of the PhoneNumberAdminClient type. */ +@ServiceClientBuilder(serviceClients = {PhoneNumberAdminClientImpl.class}) +public final class PhoneNumberAdminClientImplBuilder { + /* + * The endpoint of the Azure Communication resource. + */ + private String endpoint; + + /** + * Sets The endpoint of the Azure Communication resource. + * + * @param endpoint the endpoint value. + * @return the PhoneNumberAdminClientImplBuilder. + */ + public PhoneNumberAdminClientImplBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the PhoneNumberAdminClientImplBuilder. + */ + public PhoneNumberAdminClientImplBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /** + * Builds an instance of PhoneNumberAdminClientImpl with the provided parameters. + * + * @return an instance of PhoneNumberAdminClientImpl. + */ + public PhoneNumberAdminClientImpl buildClient() { + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + PhoneNumberAdminClientImpl client = new PhoneNumberAdminClientImpl(pipeline, endpoint); + return client; + } +} 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 new file mode 100644 index 000000000000..6c426d5b931e --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/implementation/PhoneNumberAdministrationsImpl.java @@ -0,0 +1,2820 @@ +// 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.CreateSearchOptions; +import com.azure.communication.administration.models.CreateSearchResponse; +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.PhoneNumberSearch; +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({202}) + @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({202}) + @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") CreateSearchOptions 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 localise 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 PhoneNumberSearch 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 PhoneNumberSearch 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(CreateSearchOptions 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( + CreateSearchOptions 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 createSearchAsync(CreateSearchOptions body) { + return createSearchWithResponseAsync(body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 createSearchAsync(CreateSearchOptions body, Context context) { + return createSearchWithResponseAsync(body, context) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 CreateSearchResponse createSearch(CreateSearchOptions body) { + return createSearchAsync(body).block(); + } + + /** + * 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 CreateSearchResponse createSearch(CreateSearchOptions body, Context context) { + return createSearchAsync(body, context).block(); + } + + /** + * Gets a list of all searches. + * + * @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 searches. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllSearchesSinglePageAsync(Integer skip, Integer take) { + return FluxUtil.withContext( + context -> + service.getAllSearches( + 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 searches. + * + * @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 searches. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllSearchesSinglePageAsync( + Integer skip, Integer take, Context context) { + return service.getAllSearches(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 searches. + * + * @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 searches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getAllSearchesAsync(Integer skip, Integer take) { + return new PagedFlux<>( + () -> getAllSearchesSinglePageAsync(skip, take), + nextLink -> getAllSearchesNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all searches. + * + * @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 searches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedFlux getAllSearchesAsync(Integer skip, Integer take, Context context) { + return new PagedFlux<>( + () -> getAllSearchesSinglePageAsync(skip, take, context), + nextLink -> getAllSearchesNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all searches. + * + * @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 searches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getAllSearches(Integer skip, Integer take) { + return new PagedIterable<>(getAllSearchesAsync(skip, take)); + } + + /** + * Gets a list of all searches. + * + * @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 searches. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable getAllSearches(Integer skip, Integer take, Context context) { + return new PagedIterable<>(getAllSearchesAsync(skip, take, context)); + } + + /** + * Cancels the search. This means existing numbers in the search will be made available. + * + * @param searchId The search id to be canceled. + * @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> cancelSearchWithResponseAsync(String searchId) { + return FluxUtil.withContext( + context -> + service.cancelSearch( + this.client.getEndpoint(), searchId, this.client.getApiVersion(), context)); + } + + /** + * Cancels the search. This means existing numbers in the search will be made available. + * + * @param searchId The search id to be canceled. + * @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> cancelSearchWithResponseAsync(String searchId, Context context) { + return service.cancelSearch(this.client.getEndpoint(), searchId, this.client.getApiVersion(), context); + } + + /** + * Cancels the search. This means existing numbers in the search will be made available. + * + * @param searchId The search id to be canceled. + * @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 cancelSearchAsync(String searchId) { + return cancelSearchWithResponseAsync(searchId).flatMap((Response res) -> Mono.empty()); + } + + /** + * Cancels the search. This means existing numbers in the search will be made available. + * + * @param searchId The search id to be canceled. + * @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 cancelSearchAsync(String searchId, Context context) { + return cancelSearchWithResponseAsync(searchId, context).flatMap((Response res) -> Mono.empty()); + } + + /** + * Cancels the search. This means existing numbers in the search will be made available. + * + * @param searchId The search id to be canceled. + * @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 cancelSearch(String searchId) { + cancelSearchAsync(searchId).block(); + } + + /** + * Cancels the search. This means existing numbers in the search will be made available. + * + * @param searchId The search id to be canceled. + * @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 cancelSearch(String searchId, Context context) { + cancelSearchAsync(searchId, context).block(); + } + + /** + * Purchases the phone number search. + * + * @param searchId The search id to be purchased. + * @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> purchaseSearchWithResponseAsync(String searchId) { + return FluxUtil.withContext( + context -> + service.purchaseSearch( + this.client.getEndpoint(), searchId, this.client.getApiVersion(), context)); + } + + /** + * Purchases the phone number search. + * + * @param searchId The search id to be purchased. + * @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> purchaseSearchWithResponseAsync(String searchId, Context context) { + return service.purchaseSearch(this.client.getEndpoint(), searchId, this.client.getApiVersion(), context); + } + + /** + * Purchases the phone number search. + * + * @param searchId The search id to be purchased. + * @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 purchaseSearchAsync(String searchId) { + return purchaseSearchWithResponseAsync(searchId).flatMap((Response res) -> Mono.empty()); + } + + /** + * Purchases the phone number search. + * + * @param searchId The search id to be purchased. + * @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 purchaseSearchAsync(String searchId, Context context) { + return purchaseSearchWithResponseAsync(searchId, context).flatMap((Response res) -> Mono.empty()); + } + + /** + * Purchases the phone number search. + * + * @param searchId The search id to be purchased. + * @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 purchaseSearch(String searchId) { + purchaseSearchAsync(searchId).block(); + } + + /** + * Purchases the phone number search. + * + * @param searchId The search id to be purchased. + * @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 purchaseSearch(String searchId, Context context) { + purchaseSearchAsync(searchId, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 a wrapper of list of phone numbers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllPhoneNumbersNextSinglePageAsync(String nextLink) { + return FluxUtil.withContext(context -> service.getAllPhoneNumbersNext(nextLink, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().getPhoneNumbers(), + res.getValue().getNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 a wrapper of list of phone numbers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllPhoneNumbersNextSinglePageAsync( + String nextLink, Context context) { + return service.getAllPhoneNumbersNext(nextLink, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().getPhoneNumbers(), + res.getValue().getNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 represents a wrapper around a list of countries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllSupportedCountriesNextSinglePageAsync(String nextLink) { + return FluxUtil.withContext(context -> service.getAllSupportedCountriesNext(nextLink, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().getCountries(), + res.getValue().getNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 represents a wrapper around a list of countries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllSupportedCountriesNextSinglePageAsync( + String nextLink, Context context) { + return service.getAllSupportedCountriesNext(nextLink, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().getCountries(), + res.getValue().getNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 represents a wrapper of list of plan groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPhonePlanGroupsNextSinglePageAsync(String nextLink) { + return FluxUtil.withContext(context -> service.getPhonePlanGroupsNext(nextLink, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().getPhonePlanGroups(), + res.getValue().getNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 represents a wrapper of list of plan groups. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPhonePlanGroupsNextSinglePageAsync(String nextLink, Context context) { + return service.getPhonePlanGroupsNext(nextLink, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().getPhonePlanGroups(), + res.getValue().getNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 represents a wrapper around a list of countries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPhonePlansNextSinglePageAsync(String nextLink) { + return FluxUtil.withContext(context -> service.getPhonePlansNext(nextLink, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().getPhonePlans(), + res.getValue().getNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 represents a wrapper around a list of countries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getPhonePlansNextSinglePageAsync(String nextLink, Context context) { + return service.getPhonePlansNext(nextLink, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().getPhonePlans(), + res.getValue().getNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 represents a list of searchs or releases, as part of the response when fetching all searches or releases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllReleasesNextSinglePageAsync(String nextLink) { + return FluxUtil.withContext(context -> service.getAllReleasesNext(nextLink, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().getEntities(), + res.getValue().getNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 represents a list of searchs or releases, as part of the response when fetching all searches or releases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllReleasesNextSinglePageAsync(String nextLink, Context context) { + return service.getAllReleasesNext(nextLink, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().getEntities(), + res.getValue().getNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 represents a list of searchs or releases, as part of the response when fetching all searches or releases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllSearchesNextSinglePageAsync(String nextLink) { + return FluxUtil.withContext(context -> service.getAllSearchesNext(nextLink, context)) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().getEntities(), + res.getValue().getNextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink 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 represents a list of searchs or releases, as part of the response when fetching all searches or releases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getAllSearchesNextSinglePageAsync(String nextLink, Context context) { + return service.getAllSearchesNext(nextLink, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().getEntities(), + res.getValue().getNextLink(), + null)); + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/AcquiredPhoneNumber.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/AcquiredPhoneNumber.java new file mode 100644 index 000000000000..b82cb0d0f22e --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/AcquiredPhoneNumber.java @@ -0,0 +1,178 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The AcquiredPhoneNumber model. */ +@Fluent +public final class AcquiredPhoneNumber { + /* + * String of the E.164 format of the phone number + */ + @JsonProperty(value = "phoneNumber", required = true) + private String phoneNumber; + + /* + * The set of all acquired capabilities of the phone number. + */ + @JsonProperty(value = "acquiredCapabilities", required = true) + private List acquiredCapabilities; + + /* + * The set of all available capabilities that can be acquired for this + * phone number. + */ + @JsonProperty(value = "availableCapabilities", required = true) + private List availableCapabilities; + + /* + * The assignment status of the phone number. Conveys what type of entity + * the number is assigned to. + */ + @JsonProperty(value = "assignmentStatus") + private AssignmentStatus assignmentStatus; + + /* + * The name of the place of the phone number. + */ + @JsonProperty(value = "placeName") + private String placeName; + + /* + * The activation state of the phone number. Can be "Activated", + * "AssignmentPending", "AssignmentFailed", "UpdatePending", "UpdateFailed" + */ + @JsonProperty(value = "activationState") + private ActivationState activationState; + + /** + * Get the phoneNumber property: String of the E.164 format of the phone number. + * + * @return the phoneNumber value. + */ + public String getPhoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: String of the E.164 format of the phone number. + * + * @param phoneNumber the phoneNumber value to set. + * @return the AcquiredPhoneNumber object itself. + */ + public AcquiredPhoneNumber setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get the acquiredCapabilities property: The set of all acquired capabilities of the phone number. + * + * @return the acquiredCapabilities value. + */ + public List getAcquiredCapabilities() { + return this.acquiredCapabilities; + } + + /** + * Set the acquiredCapabilities property: The set of all acquired capabilities of the phone number. + * + * @param acquiredCapabilities the acquiredCapabilities value to set. + * @return the AcquiredPhoneNumber object itself. + */ + public AcquiredPhoneNumber setAcquiredCapabilities(List acquiredCapabilities) { + this.acquiredCapabilities = acquiredCapabilities; + return this; + } + + /** + * Get the availableCapabilities property: The set of all available capabilities that can be acquired for this phone + * number. + * + * @return the availableCapabilities value. + */ + public List getAvailableCapabilities() { + return this.availableCapabilities; + } + + /** + * Set the availableCapabilities property: The set of all available capabilities that can be acquired for this phone + * number. + * + * @param availableCapabilities the availableCapabilities value to set. + * @return the AcquiredPhoneNumber object itself. + */ + public AcquiredPhoneNumber setAvailableCapabilities(List availableCapabilities) { + this.availableCapabilities = availableCapabilities; + return this; + } + + /** + * Get the assignmentStatus property: The assignment status of the phone number. Conveys what type of entity the + * number is assigned to. + * + * @return the assignmentStatus value. + */ + public AssignmentStatus getAssignmentStatus() { + return this.assignmentStatus; + } + + /** + * Set the assignmentStatus property: The assignment status of the phone number. Conveys what type of entity the + * number is assigned to. + * + * @param assignmentStatus the assignmentStatus value to set. + * @return the AcquiredPhoneNumber object itself. + */ + public AcquiredPhoneNumber setAssignmentStatus(AssignmentStatus assignmentStatus) { + this.assignmentStatus = assignmentStatus; + return this; + } + + /** + * Get the placeName property: The name of the place of the phone number. + * + * @return the placeName value. + */ + public String getPlaceName() { + return this.placeName; + } + + /** + * Set the placeName property: The name of the place of the phone number. + * + * @param placeName the placeName value to set. + * @return the AcquiredPhoneNumber object itself. + */ + public AcquiredPhoneNumber setPlaceName(String placeName) { + this.placeName = placeName; + return this; + } + + /** + * Get the activationState property: The activation state of the phone number. Can be "Activated", + * "AssignmentPending", "AssignmentFailed", "UpdatePending", "UpdateFailed". + * + * @return the activationState value. + */ + public ActivationState getActivationState() { + return this.activationState; + } + + /** + * Set the activationState property: The activation state of the phone number. Can be "Activated", + * "AssignmentPending", "AssignmentFailed", "UpdatePending", "UpdateFailed". + * + * @param activationState the activationState value to set. + * @return the AcquiredPhoneNumber object itself. + */ + public AcquiredPhoneNumber setActivationState(ActivationState activationState) { + this.activationState = activationState; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/AcquiredPhoneNumbers.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/AcquiredPhoneNumbers.java new file mode 100644 index 000000000000..eaa0871220be --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/AcquiredPhoneNumbers.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.administration.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The AcquiredPhoneNumbers model. */ +@Fluent +public final class AcquiredPhoneNumbers { + /* + * Represents a list of phone numbers + */ + @JsonProperty(value = "phoneNumbers") + private List phoneNumbers; + + /* + * Represents the URL link to the next page + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the phoneNumbers property: Represents a list of phone numbers. + * + * @return the phoneNumbers value. + */ + public List getPhoneNumbers() { + return this.phoneNumbers; + } + + /** + * Set the phoneNumbers property: Represents a list of phone numbers. + * + * @param phoneNumbers the phoneNumbers value to set. + * @return the AcquiredPhoneNumbers object itself. + */ + public AcquiredPhoneNumbers setPhoneNumbers(List phoneNumbers) { + this.phoneNumbers = phoneNumbers; + return this; + } + + /** + * Get the nextLink property: Represents the URL link to the next page. + * + * @return the nextLink value. + */ + public String getNextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Represents the URL link to the next page. + * + * @param nextLink the nextLink value to set. + * @return the AcquiredPhoneNumbers object itself. + */ + public AcquiredPhoneNumbers setNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ActivationState.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ActivationState.java new file mode 100644 index 000000000000..533bdbeffddf --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ActivationState.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.administration.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ActivationState. */ +public final class ActivationState extends ExpandableStringEnum { + /** Static value Activated for ActivationState. */ + public static final ActivationState ACTIVATED = fromString("Activated"); + + /** Static value AssignmentPending for ActivationState. */ + public static final ActivationState ASSIGNMENT_PENDING = fromString("AssignmentPending"); + + /** Static value AssignmentFailed for ActivationState. */ + public static final ActivationState ASSIGNMENT_FAILED = fromString("AssignmentFailed"); + + /** Static value UpdatePending for ActivationState. */ + public static final ActivationState UPDATE_PENDING = fromString("UpdatePending"); + + /** Static value UpdateFailed for ActivationState. */ + public static final ActivationState UPDATE_FAILED = fromString("UpdateFailed"); + + /** + * Creates or finds a ActivationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActivationState. + */ + @JsonCreator + public static ActivationState fromString(String name) { + return fromString(name, ActivationState.class); + } + + /** @return known ActivationState values. */ + public static Collection values() { + return values(ActivationState.class); + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/AreaCodes.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/AreaCodes.java new file mode 100644 index 000000000000..07a2c5a49268 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/AreaCodes.java @@ -0,0 +1,91 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The AreaCodes model. */ +@Fluent +public final class AreaCodes { + /* + * Represents the list of primary area codes. + */ + @JsonProperty(value = "primaryAreaCodes") + private List primaryAreaCodes; + + /* + * Represents the list of secondary area codes. + */ + @JsonProperty(value = "secondaryAreaCodes") + private List secondaryAreaCodes; + + /* + * Represents the URL link to the next page + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the primaryAreaCodes property: Represents the list of primary area codes. + * + * @return the primaryAreaCodes value. + */ + public List getPrimaryAreaCodes() { + return this.primaryAreaCodes; + } + + /** + * Set the primaryAreaCodes property: Represents the list of primary area codes. + * + * @param primaryAreaCodes the primaryAreaCodes value to set. + * @return the AreaCodes object itself. + */ + public AreaCodes setPrimaryAreaCodes(List primaryAreaCodes) { + this.primaryAreaCodes = primaryAreaCodes; + return this; + } + + /** + * Get the secondaryAreaCodes property: Represents the list of secondary area codes. + * + * @return the secondaryAreaCodes value. + */ + public List getSecondaryAreaCodes() { + return this.secondaryAreaCodes; + } + + /** + * Set the secondaryAreaCodes property: Represents the list of secondary area codes. + * + * @param secondaryAreaCodes the secondaryAreaCodes value to set. + * @return the AreaCodes object itself. + */ + public AreaCodes setSecondaryAreaCodes(List secondaryAreaCodes) { + this.secondaryAreaCodes = secondaryAreaCodes; + return this; + } + + /** + * Get the nextLink property: Represents the URL link to the next page. + * + * @return the nextLink value. + */ + public String getNextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Represents the URL link to the next page. + * + * @param nextLink the nextLink value to set. + * @return the AreaCodes object itself. + */ + public AreaCodes setNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/AssignmentStatus.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/AssignmentStatus.java new file mode 100644 index 000000000000..c4b7cf567a0e --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/AssignmentStatus.java @@ -0,0 +1,46 @@ +// 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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AssignmentStatus. */ +public final class AssignmentStatus extends ExpandableStringEnum { + /** Static value Unassigned for AssignmentStatus. */ + public static final AssignmentStatus UNASSIGNED = fromString("Unassigned"); + + /** Static value Unknown for AssignmentStatus. */ + public static final AssignmentStatus UNKNOWN = fromString("Unknown"); + + /** Static value UserAssigned for AssignmentStatus. */ + public static final AssignmentStatus USER_ASSIGNED = fromString("UserAssigned"); + + /** Static value ConferenceAssigned for AssignmentStatus. */ + public static final AssignmentStatus CONFERENCE_ASSIGNED = fromString("ConferenceAssigned"); + + /** Static value FirstPartyAppAssigned for AssignmentStatus. */ + public static final AssignmentStatus FIRST_PARTY_APP_ASSIGNED = fromString("FirstPartyAppAssigned"); + + /** Static value ThirdPartyAppAssigned for AssignmentStatus. */ + public static final AssignmentStatus THIRD_PARTY_APP_ASSIGNED = fromString("ThirdPartyAppAssigned"); + + /** + * Creates or finds a AssignmentStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding AssignmentStatus. + */ + @JsonCreator + public static AssignmentStatus fromString(String name) { + return fromString(name, AssignmentStatus.class); + } + + /** @return known AssignmentStatus values. */ + public static Collection values() { + return values(AssignmentStatus.class); + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CapabilitiesUpdateStatus.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CapabilitiesUpdateStatus.java new file mode 100644 index 000000000000..b9829df4aad8 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CapabilitiesUpdateStatus.java @@ -0,0 +1,40 @@ +// 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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CapabilitiesUpdateStatus. */ +public final class CapabilitiesUpdateStatus extends ExpandableStringEnum { + /** Static value Pending for CapabilitiesUpdateStatus. */ + public static final CapabilitiesUpdateStatus PENDING = fromString("Pending"); + + /** Static value InProgress for CapabilitiesUpdateStatus. */ + public static final CapabilitiesUpdateStatus IN_PROGRESS = fromString("InProgress"); + + /** Static value Complete for CapabilitiesUpdateStatus. */ + public static final CapabilitiesUpdateStatus COMPLETE = fromString("Complete"); + + /** Static value Error for CapabilitiesUpdateStatus. */ + public static final CapabilitiesUpdateStatus ERROR = fromString("Error"); + + /** + * Creates or finds a CapabilitiesUpdateStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding CapabilitiesUpdateStatus. + */ + @JsonCreator + public static CapabilitiesUpdateStatus fromString(String name) { + return fromString(name, CapabilitiesUpdateStatus.class); + } + + /** @return known CapabilitiesUpdateStatus values. */ + public static Collection values() { + return values(CapabilitiesUpdateStatus.class); + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/Capability.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/Capability.java new file mode 100644 index 000000000000..43fcd66f8423 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/Capability.java @@ -0,0 +1,100 @@ +// 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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Capability. */ +public final class Capability extends ExpandableStringEnum { + /** Static value UserAssignment for Capability. */ + public static final Capability USER_ASSIGNMENT = fromString("UserAssignment"); + + /** Static value FirstPartyVoiceAppAssignment for Capability. */ + public static final Capability FIRST_PARTY_VOICE_APP_ASSIGNMENT = fromString("FirstPartyVoiceAppAssignment"); + + /** Static value ConferenceAssignment for Capability. */ + public static final Capability CONFERENCE_ASSIGNMENT = fromString("ConferenceAssignment"); + + /** Static value P2PSmsEnabled for Capability. */ + public static final Capability P2PSMS_ENABLED = fromString("P2PSmsEnabled"); + + /** Static value Geographic for Capability. */ + public static final Capability GEOGRAPHIC = fromString("Geographic"); + + /** Static value NonGeographic for Capability. */ + public static final Capability NON_GEOGRAPHIC = fromString("NonGeographic"); + + /** Static value TollCalling for Capability. */ + public static final Capability TOLL_CALLING = fromString("TollCalling"); + + /** Static value TollFreeCalling for Capability. */ + public static final Capability TOLL_FREE_CALLING = fromString("TollFreeCalling"); + + /** Static value Premium for Capability. */ + public static final Capability PREMIUM = fromString("Premium"); + + /** Static value P2PSmsCapable for Capability. */ + public static final Capability P2PSMS_CAPABLE = fromString("P2PSmsCapable"); + + /** Static value A2PSmsCapable for Capability. */ + public static final Capability A2PSMS_CAPABLE = fromString("A2PSmsCapable"); + + /** Static value A2PSmsEnabled for Capability. */ + public static final Capability A2PSMS_ENABLED = fromString("A2PSmsEnabled"); + + /** Static value Calling for Capability. */ + public static final Capability CALLING = fromString("Calling"); + + /** Static value TollFree for Capability. */ + public static final Capability TOLL_FREE = fromString("TollFree"); + + /** Static value FirstPartyAppAssignment for Capability. */ + public static final Capability FIRST_PARTY_APP_ASSIGNMENT = fromString("FirstPartyAppAssignment"); + + /** Static value ThirdPartyAppAssignment for Capability. */ + public static final Capability THIRD_PARTY_APP_ASSIGNMENT = fromString("ThirdPartyAppAssignment"); + + /** Static value Azure for Capability. */ + public static final Capability AZURE = fromString("Azure"); + + /** Static value Office365 for Capability. */ + public static final Capability OFFICE365 = fromString("Office365"); + + /** Static value InboundCalling for Capability. */ + public static final Capability INBOUND_CALLING = fromString("InboundCalling"); + + /** Static value OutboundCalling for Capability. */ + public static final Capability OUTBOUND_CALLING = fromString("OutboundCalling"); + + /** Static value InboundA2PSms for Capability. */ + public static final Capability INBOUND_A2PSMS = fromString("InboundA2PSms"); + + /** Static value OutboundA2PSms for Capability. */ + public static final Capability OUTBOUND_A2PSMS = fromString("OutboundA2PSms"); + + /** Static value InboundP2PSms for Capability. */ + public static final Capability INBOUND_P2PSMS = fromString("InboundP2PSms"); + + /** Static value OutboundP2PSms for Capability. */ + public static final Capability OUTBOUND_P2PSMS = fromString("OutboundP2PSms"); + + /** + * Creates or finds a Capability from its string representation. + * + * @param name a name to look for. + * @return the corresponding Capability. + */ + @JsonCreator + public static Capability fromString(String name) { + return fromString(name, Capability.class); + } + + /** @return known Capability values. */ + public static Collection values() { + return values(Capability.class); + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CarrierDetails.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CarrierDetails.java new file mode 100644 index 000000000000..afa3e2b753cb --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CarrierDetails.java @@ -0,0 +1,64 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CarrierDetails model. */ +@Fluent +public final class CarrierDetails { + /* + * Name of carrier details + */ + @JsonProperty(value = "name") + private String name; + + /* + * Display name of carrier details + */ + @JsonProperty(value = "localizedName") + private String localizedName; + + /** + * Get the name property: Name of carrier details. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * Set the name property: Name of carrier details. + * + * @param name the name value to set. + * @return the CarrierDetails object itself. + */ + public CarrierDetails setName(String name) { + this.name = name; + return this; + } + + /** + * Get the localizedName property: Display name of carrier details. + * + * @return the localizedName value. + */ + public String getLocalizedName() { + return this.localizedName; + } + + /** + * Set the localizedName property: Display name of carrier details. + * + * @param localizedName the localizedName value to set. + * @return the CarrierDetails object itself. + */ + public CarrierDetails setLocalizedName(String localizedName) { + this.localizedName = localizedName; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CreateSearchOptions.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CreateSearchOptions.java new file mode 100644 index 000000000000..8bd128dc3db0 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CreateSearchOptions.java @@ -0,0 +1,169 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The CreateSearchOptions model. */ +@Fluent +public final class CreateSearchOptions { + /* + * Display name of the search. + */ + @JsonProperty(value = "displayName", required = true) + private String displayName; + + /* + * Description of the search. + */ + @JsonProperty(value = "description", required = true) + private String description; + + /* + * The plan subtype ids from which to create the search. + */ + @JsonProperty(value = "phonePlanIds", required = true) + private List phonePlanIds; + + /* + * The area code from which to create the search. + */ + @JsonProperty(value = "areaCode", required = true) + private String areaCode; + + /* + * The quantity of phone numbers to request. + */ + @JsonProperty(value = "quantity") + private Integer quantity; + + /* + * The location options of the search. + */ + @JsonProperty(value = "locationOptions") + private List locationOptions; + + /** + * Get the displayName property: Display name of the search. + * + * @return the displayName value. + */ + public String getDisplayName() { + return this.displayName; + } + + /** + * Set the displayName property: Display name of the search. + * + * @param displayName the displayName value to set. + * @return the CreateSearchOptions object itself. + */ + public CreateSearchOptions setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the description property: Description of the search. + * + * @return the description value. + */ + public String getDescription() { + return this.description; + } + + /** + * Set the description property: Description of the search. + * + * @param description the description value to set. + * @return the CreateSearchOptions object itself. + */ + public CreateSearchOptions setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the phonePlanIds property: The plan subtype ids from which to create the search. + * + * @return the phonePlanIds value. + */ + public List getPhonePlanIds() { + return this.phonePlanIds; + } + + /** + * Set the phonePlanIds property: The plan subtype ids from which to create the search. + * + * @param phonePlanIds the phonePlanIds value to set. + * @return the CreateSearchOptions object itself. + */ + public CreateSearchOptions setPhonePlanIds(List phonePlanIds) { + this.phonePlanIds = phonePlanIds; + return this; + } + + /** + * Get the areaCode property: The area code from which to create the search. + * + * @return the areaCode value. + */ + public String getAreaCode() { + return this.areaCode; + } + + /** + * Set the areaCode property: The area code from which to create the search. + * + * @param areaCode the areaCode value to set. + * @return the CreateSearchOptions object itself. + */ + public CreateSearchOptions setAreaCode(String areaCode) { + this.areaCode = areaCode; + return this; + } + + /** + * Get the quantity property: The quantity of phone numbers to request. + * + * @return the quantity value. + */ + public Integer getQuantity() { + return this.quantity; + } + + /** + * Set the quantity property: The quantity of phone numbers to request. + * + * @param quantity the quantity value to set. + * @return the CreateSearchOptions object itself. + */ + public CreateSearchOptions setQuantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get the locationOptions property: The location options of the search. + * + * @return the locationOptions value. + */ + public List getLocationOptions() { + return this.locationOptions; + } + + /** + * Set the locationOptions property: The location options of the search. + * + * @param locationOptions the locationOptions value to set. + * @return the CreateSearchOptions object itself. + */ + public CreateSearchOptions setLocationOptions(List locationOptions) { + this.locationOptions = locationOptions; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CreateSearchResponse.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CreateSearchResponse.java new file mode 100644 index 000000000000..24fb02f36a9d --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CreateSearchResponse.java @@ -0,0 +1,38 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CreateSearchResponse model. */ +@Fluent +public final class CreateSearchResponse { + /* + * The search id of the search that was created. + */ + @JsonProperty(value = "searchId", required = true) + private String searchId; + + /** + * Get the searchId property: The search id of the search that was created. + * + * @return the searchId value. + */ + public String getSearchId() { + return this.searchId; + } + + /** + * Set the searchId property: The search id of the search that was created. + * + * @param searchId the searchId value to set. + * @return the CreateSearchResponse object itself. + */ + public CreateSearchResponse setSearchId(String searchId) { + this.searchId = searchId; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CurrencyType.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CurrencyType.java new file mode 100644 index 000000000000..cefdf7a18989 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/CurrencyType.java @@ -0,0 +1,31 @@ +// 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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CurrencyType. */ +public final class CurrencyType extends ExpandableStringEnum { + /** Static value USD for CurrencyType. */ + public static final CurrencyType USD = fromString("USD"); + + /** + * Creates or finds a CurrencyType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CurrencyType. + */ + @JsonCreator + public static CurrencyType fromString(String name) { + return fromString(name, CurrencyType.class); + } + + /** @return known CurrencyType values. */ + public static Collection values() { + return values(CurrencyType.class); + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ErrorBody.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ErrorBody.java new file mode 100644 index 000000000000..a229cee9d740 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ErrorBody.java @@ -0,0 +1,64 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ErrorBody model. */ +@Fluent +public final class ErrorBody { + /* + * The error code in the error response. + */ + @JsonProperty(value = "code") + private String code; + + /* + * The error message in the error response. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the code property: The error code in the error response. + * + * @return the code value. + */ + public String getCode() { + return this.code; + } + + /** + * Set the code property: The error code in the error response. + * + * @param code the code value to set. + * @return the ErrorBody object itself. + */ + public ErrorBody setCode(String code) { + this.code = code; + return this; + } + + /** + * Get the message property: The error message in the error response. + * + * @return the message value. + */ + public String getMessage() { + return this.message; + } + + /** + * Set the message property: The error message in the error response. + * + * @param message the message value to set. + * @return the ErrorBody object itself. + */ + public ErrorBody setMessage(String message) { + this.message = message; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ErrorResponse.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ErrorResponse.java new file mode 100644 index 000000000000..85c489097da1 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ErrorResponse.java @@ -0,0 +1,38 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ErrorResponse model. */ +@Fluent +public final class ErrorResponse { + /* + * Represents a service error response body. + */ + @JsonProperty(value = "error") + private ErrorBody error; + + /** + * Get the error property: Represents a service error response body. + * + * @return the error value. + */ + public ErrorBody getError() { + return this.error; + } + + /** + * Set the error property: Represents a service error response body. + * + * @param error the error value to set. + * @return the ErrorResponse object itself. + */ + public ErrorResponse setError(ErrorBody error) { + this.error = error; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ErrorResponseException.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ErrorResponseException.java new file mode 100644 index 000000000000..4cff9caa20d2 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ErrorResponseException.java @@ -0,0 +1,37 @@ +// 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.models; + +import com.azure.core.exception.HttpResponseException; +import com.azure.core.http.HttpResponse; + +/** Exception thrown for an invalid response with ErrorResponse information. */ +public final class ErrorResponseException extends HttpResponseException { + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + */ + public ErrorResponseException(String message, HttpResponse response) { + super(message, response); + } + + /** + * Initializes a new instance of the ErrorResponseException class. + * + * @param message the exception message or the response content if a message is not available. + * @param response the HTTP response. + * @param value the deserialized response value. + */ + public ErrorResponseException(String message, HttpResponse response, ErrorResponse value) { + super(message, response, value); + } + + @Override + public ErrorResponse getValue() { + return (ErrorResponse) super.getValue(); + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptions.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptions.java new file mode 100644 index 000000000000..dbc78f5762f5 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptions.java @@ -0,0 +1,91 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The LocationOptions model. */ +@Fluent +public final class LocationOptions { + /* + * The label id of the location. + */ + @JsonProperty(value = "labelId") + private String labelId; + + /* + * The display name of the location. + */ + @JsonProperty(value = "labelName") + private String labelName; + + /* + * The underlying location option details. + */ + @JsonProperty(value = "options") + private List options; + + /** + * Get the labelId property: The label id of the location. + * + * @return the labelId value. + */ + public String getLabelId() { + return this.labelId; + } + + /** + * Set the labelId property: The label id of the location. + * + * @param labelId the labelId value to set. + * @return the LocationOptions object itself. + */ + public LocationOptions setLabelId(String labelId) { + this.labelId = labelId; + return this; + } + + /** + * Get the labelName property: The display name of the location. + * + * @return the labelName value. + */ + public String getLabelName() { + return this.labelName; + } + + /** + * Set the labelName property: The display name of the location. + * + * @param labelName the labelName value to set. + * @return the LocationOptions object itself. + */ + public LocationOptions setLabelName(String labelName) { + this.labelName = labelName; + return this; + } + + /** + * Get the options property: The underlying location option details. + * + * @return the options value. + */ + public List getOptions() { + return this.options; + } + + /** + * Set the options property: The underlying location option details. + * + * @param options the options value to set. + * @return the LocationOptions object itself. + */ + public LocationOptions setOptions(List options) { + this.options = options; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptionsDetails.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptionsDetails.java new file mode 100644 index 000000000000..8a9ce15d8a91 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptionsDetails.java @@ -0,0 +1,91 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The LocationOptionsDetails model. */ +@Fluent +public final class LocationOptionsDetails { + /* + * The name of the location options + */ + @JsonProperty(value = "name") + private String name; + + /* + * The abbreviated name of the location options + */ + @JsonProperty(value = "value") + private String value; + + /* + * The underlying location options + */ + @JsonProperty(value = "locationOptions") + private List locationOptions; + + /** + * Get the name property: The name of the location options. + * + * @return the name value. + */ + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the location options. + * + * @param name the name value to set. + * @return the LocationOptionsDetails object itself. + */ + public LocationOptionsDetails setName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The abbreviated name of the location options. + * + * @return the value value. + */ + public String getValue() { + return this.value; + } + + /** + * Set the value property: The abbreviated name of the location options. + * + * @param value the value value to set. + * @return the LocationOptionsDetails object itself. + */ + public LocationOptionsDetails setValue(String value) { + this.value = value; + return this; + } + + /** + * Get the locationOptions property: The underlying location options. + * + * @return the locationOptions value. + */ + public List getLocationOptions() { + return this.locationOptions; + } + + /** + * Set the locationOptions property: The underlying location options. + * + * @param locationOptions the locationOptions value to set. + * @return the LocationOptionsDetails object itself. + */ + public LocationOptionsDetails setLocationOptions(List locationOptions) { + this.locationOptions = locationOptions; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptionsQueries.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptionsQueries.java new file mode 100644 index 000000000000..02d3cbb48656 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptionsQueries.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.administration.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The LocationOptionsQueries model. */ +@Fluent +public final class LocationOptionsQueries { + /* + * Represents the underlying list of countries. + */ + @JsonProperty(value = "locationOptions") + private List locationOptions; + + /** + * Get the locationOptions property: Represents the underlying list of countries. + * + * @return the locationOptions value. + */ + public List getLocationOptions() { + return this.locationOptions; + } + + /** + * Set the locationOptions property: Represents the underlying list of countries. + * + * @param locationOptions the locationOptions value to set. + * @return the LocationOptionsQueries object itself. + */ + public LocationOptionsQueries setLocationOptions(List locationOptions) { + this.locationOptions = locationOptions; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptionsQuery.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptionsQuery.java new file mode 100644 index 000000000000..ba93c6d33e7f --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptionsQuery.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.administration.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The LocationOptionsQuery model. */ +@Fluent +public final class LocationOptionsQuery { + /* + * Represents the location option label id, returned from the + * GetLocationOptions API. + */ + @JsonProperty(value = "labelId") + private String labelId; + + /* + * Represents the location options value, returned from the + * GetLocationOptions API. + */ + @JsonProperty(value = "optionsValue") + private String optionsValue; + + /** + * Get the labelId property: Represents the location option label id, returned from the GetLocationOptions API. + * + * @return the labelId value. + */ + public String getLabelId() { + return this.labelId; + } + + /** + * Set the labelId property: Represents the location option label id, returned from the GetLocationOptions API. + * + * @param labelId the labelId value to set. + * @return the LocationOptionsQuery object itself. + */ + public LocationOptionsQuery setLabelId(String labelId) { + this.labelId = labelId; + return this; + } + + /** + * Get the optionsValue property: Represents the location options value, returned from the GetLocationOptions API. + * + * @return the optionsValue value. + */ + public String getOptionsValue() { + return this.optionsValue; + } + + /** + * Set the optionsValue property: Represents the location options value, returned from the GetLocationOptions API. + * + * @param optionsValue the optionsValue value to set. + * @return the LocationOptionsQuery object itself. + */ + public LocationOptionsQuery setOptionsValue(String optionsValue) { + this.optionsValue = optionsValue; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptionsResponse.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptionsResponse.java new file mode 100644 index 000000000000..18d35ee096e0 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationOptionsResponse.java @@ -0,0 +1,38 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The LocationOptionsResponse model. */ +@Fluent +public final class LocationOptionsResponse { + /* + * Represents a location options. + */ + @JsonProperty(value = "locationOptions") + private LocationOptions locationOptions; + + /** + * Get the locationOptions property: Represents a location options. + * + * @return the locationOptions value. + */ + public LocationOptions getLocationOptions() { + return this.locationOptions; + } + + /** + * Set the locationOptions property: Represents a location options. + * + * @param locationOptions the locationOptions value to set. + * @return the LocationOptionsResponse object itself. + */ + public LocationOptionsResponse setLocationOptions(LocationOptions locationOptions) { + this.locationOptions = locationOptions; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationType.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationType.java new file mode 100644 index 000000000000..5e4ef143e8a2 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/LocationType.java @@ -0,0 +1,37 @@ +// 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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LocationType. */ +public final class LocationType extends ExpandableStringEnum { + /** Static value CivicAddress for LocationType. */ + public static final LocationType CIVIC_ADDRESS = fromString("CivicAddress"); + + /** Static value NotRequired for LocationType. */ + public static final LocationType NOT_REQUIRED = fromString("NotRequired"); + + /** Static value Selection for LocationType. */ + public static final LocationType SELECTION = fromString("Selection"); + + /** + * Creates or finds a LocationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding LocationType. + */ + @JsonCreator + public static LocationType fromString(String name) { + return fromString(name, LocationType.class); + } + + /** @return known LocationType values. */ + public static Collection values() { + return values(LocationType.class); + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/NumberConfiguration.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/NumberConfiguration.java new file mode 100644 index 000000000000..a214ff5ad7d1 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/NumberConfiguration.java @@ -0,0 +1,64 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The NumberConfiguration model. */ +@Fluent +public final class NumberConfiguration { + /* + * Definition for pstn number configuration + */ + @JsonProperty(value = "pstnConfiguration", required = true) + private PstnConfiguration pstnConfiguration; + + /* + * The phone number to configure + */ + @JsonProperty(value = "phoneNumber", required = true) + private String phoneNumber; + + /** + * Get the pstnConfiguration property: Definition for pstn number configuration. + * + * @return the pstnConfiguration value. + */ + public PstnConfiguration getPstnConfiguration() { + return this.pstnConfiguration; + } + + /** + * Set the pstnConfiguration property: Definition for pstn number configuration. + * + * @param pstnConfiguration the pstnConfiguration value to set. + * @return the NumberConfiguration object itself. + */ + public NumberConfiguration setPstnConfiguration(PstnConfiguration pstnConfiguration) { + this.pstnConfiguration = pstnConfiguration; + return this; + } + + /** + * Get the phoneNumber property: The phone number to configure. + * + * @return the phoneNumber value. + */ + public String getPhoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: The phone number to configure. + * + * @param phoneNumber the phoneNumber value to set. + * @return the NumberConfiguration object itself. + */ + public NumberConfiguration setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/NumberConfigurationPhoneNumber.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/NumberConfigurationPhoneNumber.java new file mode 100644 index 000000000000..a62271718e97 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/NumberConfigurationPhoneNumber.java @@ -0,0 +1,38 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The NumberConfigurationPhoneNumber model. */ +@Fluent +public final class NumberConfigurationPhoneNumber { + /* + * The phone number in the E.164 format + */ + @JsonProperty(value = "phoneNumber", required = true) + private String phoneNumber; + + /** + * Get the phoneNumber property: The phone number in the E.164 format. + * + * @return the phoneNumber value. + */ + public String getPhoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: The phone number in the E.164 format. + * + * @param phoneNumber the phoneNumber value to set. + * @return the NumberConfigurationPhoneNumber object itself. + */ + public NumberConfigurationPhoneNumber setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/NumberConfigurationResponse.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/NumberConfigurationResponse.java new file mode 100644 index 000000000000..57a4b370b8e6 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/NumberConfigurationResponse.java @@ -0,0 +1,38 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The NumberConfigurationResponse model. */ +@Fluent +public final class NumberConfigurationResponse { + /* + * Definition for pstn number configuration + */ + @JsonProperty(value = "pstnConfiguration", required = true) + private PstnConfiguration pstnConfiguration; + + /** + * Get the pstnConfiguration property: Definition for pstn number configuration. + * + * @return the pstnConfiguration value. + */ + public PstnConfiguration getPstnConfiguration() { + return this.pstnConfiguration; + } + + /** + * Set the pstnConfiguration property: Definition for pstn number configuration. + * + * @param pstnConfiguration the pstnConfiguration value to set. + * @return the NumberConfigurationResponse object itself. + */ + public NumberConfigurationResponse setPstnConfiguration(PstnConfiguration pstnConfiguration) { + this.pstnConfiguration = pstnConfiguration; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/NumberUpdateCapabilities.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/NumberUpdateCapabilities.java new file mode 100644 index 000000000000..48ef2683c883 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/NumberUpdateCapabilities.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.administration.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The NumberUpdateCapabilities model. */ +@Fluent +public final class NumberUpdateCapabilities { + /* + * Capabilities to be added to a phone number + */ + @JsonProperty(value = "add") + private List add; + + /* + * Capabilities to be removed from a phone number + */ + @JsonProperty(value = "remove") + private List remove; + + /** + * Get the add property: Capabilities to be added to a phone number. + * + * @return the add value. + */ + public List getAdd() { + return this.add; + } + + /** + * Set the add property: Capabilities to be added to a phone number. + * + * @param add the add value to set. + * @return the NumberUpdateCapabilities object itself. + */ + public NumberUpdateCapabilities setAdd(List add) { + this.add = add; + return this; + } + + /** + * Get the remove property: Capabilities to be removed from a phone number. + * + * @return the remove value. + */ + public List getRemove() { + return this.remove; + } + + /** + * Set the remove property: Capabilities to be removed from a phone number. + * + * @param remove the remove value to set. + * @return the NumberUpdateCapabilities object itself. + */ + public NumberUpdateCapabilities setRemove(List remove) { + this.remove = remove; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberCountries.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberCountries.java new file mode 100644 index 000000000000..f08a194045e3 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberCountries.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.administration.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The PhoneNumberCountries model. */ +@Fluent +public final class PhoneNumberCountries { + /* + * Represents the underlying list of countries. + */ + @JsonProperty(value = "countries") + private List countries; + + /* + * Represents the URL link to the next page + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the countries property: Represents the underlying list of countries. + * + * @return the countries value. + */ + public List getCountries() { + return this.countries; + } + + /** + * Set the countries property: Represents the underlying list of countries. + * + * @param countries the countries value to set. + * @return the PhoneNumberCountries object itself. + */ + public PhoneNumberCountries setCountries(List countries) { + this.countries = countries; + return this; + } + + /** + * Get the nextLink property: Represents the URL link to the next page. + * + * @return the nextLink value. + */ + public String getNextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Represents the URL link to the next page. + * + * @param nextLink the nextLink value to set. + * @return the PhoneNumberCountries object itself. + */ + public PhoneNumberCountries setNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberCountry.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberCountry.java new file mode 100644 index 000000000000..6306b338624d --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberCountry.java @@ -0,0 +1,64 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PhoneNumberCountry model. */ +@Fluent +public final class PhoneNumberCountry { + /* + * Represents the name of the country. + */ + @JsonProperty(value = "localizedName", required = true) + private String localizedName; + + /* + * Represents the abbreviated name of the country. + */ + @JsonProperty(value = "countryCode", required = true) + private String countryCode; + + /** + * Get the localizedName property: Represents the name of the country. + * + * @return the localizedName value. + */ + public String getLocalizedName() { + return this.localizedName; + } + + /** + * Set the localizedName property: Represents the name of the country. + * + * @param localizedName the localizedName value to set. + * @return the PhoneNumberCountry object itself. + */ + public PhoneNumberCountry setLocalizedName(String localizedName) { + this.localizedName = localizedName; + return this; + } + + /** + * Get the countryCode property: Represents the abbreviated name of the country. + * + * @return the countryCode value. + */ + public String getCountryCode() { + return this.countryCode; + } + + /** + * Set the countryCode property: Represents the abbreviated name of the country. + * + * @param countryCode the countryCode value to set. + * @return the PhoneNumberCountry object itself. + */ + public PhoneNumberCountry setCountryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberEntities.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberEntities.java new file mode 100644 index 000000000000..08cbb112b1f6 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberEntities.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.administration.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The PhoneNumberEntities model. */ +@Fluent +public final class PhoneNumberEntities { + /* + * The underlying list of entities. + */ + @JsonProperty(value = "entities") + private List entities; + + /* + * Represents the URL link to the next page + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the entities property: The underlying list of entities. + * + * @return the entities value. + */ + public List getEntities() { + return this.entities; + } + + /** + * Set the entities property: The underlying list of entities. + * + * @param entities the entities value to set. + * @return the PhoneNumberEntities object itself. + */ + public PhoneNumberEntities setEntities(List entities) { + this.entities = entities; + return this; + } + + /** + * Get the nextLink property: Represents the URL link to the next page. + * + * @return the nextLink value. + */ + public String getNextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Represents the URL link to the next page. + * + * @param nextLink the nextLink value to set. + * @return the PhoneNumberEntities object itself. + */ + public PhoneNumberEntities setNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberEntity.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberEntity.java new file mode 100644 index 000000000000..f5a09462d894 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberEntity.java @@ -0,0 +1,196 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The PhoneNumberEntity model. */ +@Fluent +public final class PhoneNumberEntity { + /* + * The id of the entity. It is the search id of a searc. It is the release + * id of a release. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Date and time the entity is created. + */ + @JsonProperty(value = "createdAt") + private OffsetDateTime createdAt; + + /* + * Name of the entity. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Quantity of requested phone numbers in the entity. + */ + @JsonProperty(value = "quantity") + private Integer quantity; + + /* + * Quantity of acquired phone numbers in the entity. + */ + @JsonProperty(value = "quantityObtained") + private Integer quantityObtained; + + /* + * Status of the entity. + */ + @JsonProperty(value = "status") + private String status; + + /* + * The Firm Order Confirmation date of the phone number entity. + */ + @JsonProperty(value = "focDate") + private OffsetDateTime focDate; + + /** + * Get the id property: The id of the entity. It is the search id of a searc. It is the release id of a release. + * + * @return the id value. + */ + public String getId() { + return this.id; + } + + /** + * Set the id property: The id of the entity. It is the search id of a searc. It is the release id of a release. + * + * @param id the id value to set. + * @return the PhoneNumberEntity object itself. + */ + public PhoneNumberEntity setId(String id) { + this.id = id; + return this; + } + + /** + * Get the createdAt property: Date and time the entity is created. + * + * @return the createdAt value. + */ + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Set the createdAt property: Date and time the entity is created. + * + * @param createdAt the createdAt value to set. + * @return the PhoneNumberEntity object itself. + */ + public PhoneNumberEntity setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get the displayName property: Name of the entity. + * + * @return the displayName value. + */ + public String getDisplayName() { + return this.displayName; + } + + /** + * Set the displayName property: Name of the entity. + * + * @param displayName the displayName value to set. + * @return the PhoneNumberEntity object itself. + */ + public PhoneNumberEntity setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the quantity property: Quantity of requested phone numbers in the entity. + * + * @return the quantity value. + */ + public Integer getQuantity() { + return this.quantity; + } + + /** + * Set the quantity property: Quantity of requested phone numbers in the entity. + * + * @param quantity the quantity value to set. + * @return the PhoneNumberEntity object itself. + */ + public PhoneNumberEntity setQuantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get the quantityObtained property: Quantity of acquired phone numbers in the entity. + * + * @return the quantityObtained value. + */ + public Integer getQuantityObtained() { + return this.quantityObtained; + } + + /** + * Set the quantityObtained property: Quantity of acquired phone numbers in the entity. + * + * @param quantityObtained the quantityObtained value to set. + * @return the PhoneNumberEntity object itself. + */ + public PhoneNumberEntity setQuantityObtained(Integer quantityObtained) { + this.quantityObtained = quantityObtained; + return this; + } + + /** + * Get the status property: Status of the entity. + * + * @return the status value. + */ + public String getStatus() { + return this.status; + } + + /** + * Set the status property: Status of the entity. + * + * @param status the status value to set. + * @return the PhoneNumberEntity object itself. + */ + public PhoneNumberEntity setStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the focDate property: The Firm Order Confirmation date of the phone number entity. + * + * @return the focDate value. + */ + public OffsetDateTime getFocDate() { + return this.focDate; + } + + /** + * Set the focDate property: The Firm Order Confirmation date of the phone number entity. + * + * @param focDate the focDate value to set. + * @return the PhoneNumberEntity object itself. + */ + public PhoneNumberEntity setFocDate(OffsetDateTime focDate) { + this.focDate = focDate; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberRelease.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberRelease.java new file mode 100644 index 000000000000..7e63ad267cf7 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberRelease.java @@ -0,0 +1,148 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** The PhoneNumberRelease model. */ +@Fluent +public final class PhoneNumberRelease { + /* + * The id of the release. + */ + @JsonProperty(value = "releaseId") + private String releaseId; + + /* + * The creation time of the release. + */ + @JsonProperty(value = "createdAt") + private OffsetDateTime createdAt; + + /* + * The release status. + */ + @JsonProperty(value = "status") + private ReleaseStatus status; + + /* + * The underlying error message of a release. + */ + @JsonProperty(value = "errorMessage") + private String errorMessage; + + /* + * The list of phone numbers in the release, mapped to its individual + * statuses. + */ + @JsonProperty(value = "phoneNumberReleaseStatusDetails") + private Map phoneNumberReleaseStatusDetails; + + /** + * Get the releaseId property: The id of the release. + * + * @return the releaseId value. + */ + public String getReleaseId() { + return this.releaseId; + } + + /** + * Set the releaseId property: The id of the release. + * + * @param releaseId the releaseId value to set. + * @return the PhoneNumberRelease object itself. + */ + public PhoneNumberRelease setReleaseId(String releaseId) { + this.releaseId = releaseId; + return this; + } + + /** + * Get the createdAt property: The creation time of the release. + * + * @return the createdAt value. + */ + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Set the createdAt property: The creation time of the release. + * + * @param createdAt the createdAt value to set. + * @return the PhoneNumberRelease object itself. + */ + public PhoneNumberRelease setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get the status property: The release status. + * + * @return the status value. + */ + public ReleaseStatus getStatus() { + return this.status; + } + + /** + * Set the status property: The release status. + * + * @param status the status value to set. + * @return the PhoneNumberRelease object itself. + */ + public PhoneNumberRelease setStatus(ReleaseStatus status) { + this.status = status; + return this; + } + + /** + * Get the errorMessage property: The underlying error message of a release. + * + * @return the errorMessage value. + */ + public String getErrorMessage() { + return this.errorMessage; + } + + /** + * Set the errorMessage property: The underlying error message of a release. + * + * @param errorMessage the errorMessage value to set. + * @return the PhoneNumberRelease object itself. + */ + public PhoneNumberRelease setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Get the phoneNumberReleaseStatusDetails property: The list of phone numbers in the release, mapped to its + * individual statuses. + * + * @return the phoneNumberReleaseStatusDetails value. + */ + public Map getPhoneNumberReleaseStatusDetails() { + return this.phoneNumberReleaseStatusDetails; + } + + /** + * Set the phoneNumberReleaseStatusDetails property: The list of phone numbers in the release, mapped to its + * individual statuses. + * + * @param phoneNumberReleaseStatusDetails the phoneNumberReleaseStatusDetails value to set. + * @return the PhoneNumberRelease object itself. + */ + public PhoneNumberRelease setPhoneNumberReleaseStatusDetails( + Map phoneNumberReleaseStatusDetails) { + this.phoneNumberReleaseStatusDetails = phoneNumberReleaseStatusDetails; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberReleaseDetails.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberReleaseDetails.java new file mode 100644 index 000000000000..dad53e32db90 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberReleaseDetails.java @@ -0,0 +1,64 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PhoneNumberReleaseDetails model. */ +@Fluent +public final class PhoneNumberReleaseDetails { + /* + * The release status of a phone number. + */ + @JsonProperty(value = "status") + private PhoneNumberReleaseStatus status; + + /* + * The error code in the case the status is error. + */ + @JsonProperty(value = "errorCode") + private Integer errorCode; + + /** + * Get the status property: The release status of a phone number. + * + * @return the status value. + */ + public PhoneNumberReleaseStatus getStatus() { + return this.status; + } + + /** + * Set the status property: The release status of a phone number. + * + * @param status the status value to set. + * @return the PhoneNumberReleaseDetails object itself. + */ + public PhoneNumberReleaseDetails setStatus(PhoneNumberReleaseStatus status) { + this.status = status; + return this; + } + + /** + * Get the errorCode property: The error code in the case the status is error. + * + * @return the errorCode value. + */ + public Integer getErrorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The error code in the case the status is error. + * + * @param errorCode the errorCode value to set. + * @return the PhoneNumberReleaseDetails object itself. + */ + public PhoneNumberReleaseDetails setErrorCode(Integer errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberReleaseStatus.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberReleaseStatus.java new file mode 100644 index 000000000000..a06a27bf32ec --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberReleaseStatus.java @@ -0,0 +1,40 @@ +// 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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PhoneNumberReleaseStatus. */ +public final class PhoneNumberReleaseStatus extends ExpandableStringEnum { + /** Static value Pending for PhoneNumberReleaseStatus. */ + public static final PhoneNumberReleaseStatus PENDING = fromString("Pending"); + + /** Static value Success for PhoneNumberReleaseStatus. */ + public static final PhoneNumberReleaseStatus SUCCESS = fromString("Success"); + + /** Static value Error for PhoneNumberReleaseStatus. */ + public static final PhoneNumberReleaseStatus ERROR = fromString("Error"); + + /** Static value InProgress for PhoneNumberReleaseStatus. */ + public static final PhoneNumberReleaseStatus IN_PROGRESS = fromString("InProgress"); + + /** + * Creates or finds a PhoneNumberReleaseStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PhoneNumberReleaseStatus. + */ + @JsonCreator + public static PhoneNumberReleaseStatus fromString(String name) { + return fromString(name, PhoneNumberReleaseStatus.class); + } + + /** @return known PhoneNumberReleaseStatus values. */ + public static Collection values() { + return values(PhoneNumberReleaseStatus.class); + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberSearch.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberSearch.java new file mode 100644 index 000000000000..98906c63700b --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberSearch.java @@ -0,0 +1,329 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The PhoneNumberSearch model. */ +@Fluent +public final class PhoneNumberSearch { + /* + * The id of the search. + */ + @JsonProperty(value = "searchId") + private String searchId; + + /* + * The name of the search. + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The creation time of the search. + */ + @JsonProperty(value = "createdAt") + private OffsetDateTime createdAt; + + /* + * The description of the search. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The phone plan ids of the search. + */ + @JsonProperty(value = "phonePlanIds") + private List phonePlanIds; + + /* + * The area code of the search. + */ + @JsonProperty(value = "areaCode") + private String areaCode; + + /* + * The quantity of phone numbers in the search. + */ + @JsonProperty(value = "quantity") + private Integer quantity; + + /* + * The location options of the search. + */ + @JsonProperty(value = "locationOptions") + private List locationOptions; + + /* + * The status of the search. + */ + @JsonProperty(value = "status") + private SearchStatus status; + + /* + * The list of phone numbers in the search, in the case the status is + * reserved or success. + */ + @JsonProperty(value = "phoneNumbers") + private List phoneNumbers; + + /* + * The date that search expires and the numbers become available. + */ + @JsonProperty(value = "reservationExpiryDate") + private OffsetDateTime reservationExpiryDate; + + /* + * The error code of the search. + */ + @JsonProperty(value = "errorCode") + private Integer errorCode; + + /** + * Get the searchId property: The id of the search. + * + * @return the searchId value. + */ + public String getSearchId() { + return this.searchId; + } + + /** + * Set the searchId property: The id of the search. + * + * @param searchId the searchId value to set. + * @return the PhoneNumberSearch object itself. + */ + public PhoneNumberSearch setSearchId(String searchId) { + this.searchId = searchId; + return this; + } + + /** + * Get the displayName property: The name of the search. + * + * @return the displayName value. + */ + public String getDisplayName() { + return this.displayName; + } + + /** + * Set the displayName property: The name of the search. + * + * @param displayName the displayName value to set. + * @return the PhoneNumberSearch object itself. + */ + public PhoneNumberSearch setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the createdAt property: The creation time of the search. + * + * @return the createdAt value. + */ + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Set the createdAt property: The creation time of the search. + * + * @param createdAt the createdAt value to set. + * @return the PhoneNumberSearch object itself. + */ + public PhoneNumberSearch setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get the description property: The description of the search. + * + * @return the description value. + */ + public String getDescription() { + return this.description; + } + + /** + * Set the description property: The description of the search. + * + * @param description the description value to set. + * @return the PhoneNumberSearch object itself. + */ + public PhoneNumberSearch setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the phonePlanIds property: The phone plan ids of the search. + * + * @return the phonePlanIds value. + */ + public List getPhonePlanIds() { + return this.phonePlanIds; + } + + /** + * Set the phonePlanIds property: The phone plan ids of the search. + * + * @param phonePlanIds the phonePlanIds value to set. + * @return the PhoneNumberSearch object itself. + */ + public PhoneNumberSearch setPhonePlanIds(List phonePlanIds) { + this.phonePlanIds = phonePlanIds; + return this; + } + + /** + * Get the areaCode property: The area code of the search. + * + * @return the areaCode value. + */ + public String getAreaCode() { + return this.areaCode; + } + + /** + * Set the areaCode property: The area code of the search. + * + * @param areaCode the areaCode value to set. + * @return the PhoneNumberSearch object itself. + */ + public PhoneNumberSearch setAreaCode(String areaCode) { + this.areaCode = areaCode; + return this; + } + + /** + * Get the quantity property: The quantity of phone numbers in the search. + * + * @return the quantity value. + */ + public Integer getQuantity() { + return this.quantity; + } + + /** + * Set the quantity property: The quantity of phone numbers in the search. + * + * @param quantity the quantity value to set. + * @return the PhoneNumberSearch object itself. + */ + public PhoneNumberSearch setQuantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get the locationOptions property: The location options of the search. + * + * @return the locationOptions value. + */ + public List getLocationOptions() { + return this.locationOptions; + } + + /** + * Set the locationOptions property: The location options of the search. + * + * @param locationOptions the locationOptions value to set. + * @return the PhoneNumberSearch object itself. + */ + public PhoneNumberSearch setLocationOptions(List locationOptions) { + this.locationOptions = locationOptions; + return this; + } + + /** + * Get the status property: The status of the search. + * + * @return the status value. + */ + public SearchStatus getStatus() { + return this.status; + } + + /** + * Set the status property: The status of the search. + * + * @param status the status value to set. + * @return the PhoneNumberSearch object itself. + */ + public PhoneNumberSearch setStatus(SearchStatus status) { + this.status = status; + return this; + } + + /** + * Get the phoneNumbers property: The list of phone numbers in the search, in the case the status is reserved or + * success. + * + * @return the phoneNumbers value. + */ + public List getPhoneNumbers() { + return this.phoneNumbers; + } + + /** + * Set the phoneNumbers property: The list of phone numbers in the search, in the case the status is reserved or + * success. + * + * @param phoneNumbers the phoneNumbers value to set. + * @return the PhoneNumberSearch object itself. + */ + public PhoneNumberSearch setPhoneNumbers(List phoneNumbers) { + this.phoneNumbers = phoneNumbers; + return this; + } + + /** + * Get the reservationExpiryDate property: The date that search expires and the numbers become available. + * + * @return the reservationExpiryDate value. + */ + public OffsetDateTime getReservationExpiryDate() { + return this.reservationExpiryDate; + } + + /** + * Set the reservationExpiryDate property: The date that search expires and the numbers become available. + * + * @param reservationExpiryDate the reservationExpiryDate value to set. + * @return the PhoneNumberSearch object itself. + */ + public PhoneNumberSearch setReservationExpiryDate(OffsetDateTime reservationExpiryDate) { + this.reservationExpiryDate = reservationExpiryDate; + return this; + } + + /** + * Get the errorCode property: The error code of the search. + * + * @return the errorCode value. + */ + public Integer getErrorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: The error code of the search. + * + * @param errorCode the errorCode value to set. + * @return the PhoneNumberSearch object itself. + */ + public PhoneNumberSearch setErrorCode(Integer errorCode) { + this.errorCode = errorCode; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberType.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberType.java new file mode 100644 index 000000000000..71f93a5e9d61 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhoneNumberType.java @@ -0,0 +1,40 @@ +// 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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PhoneNumberType. */ +public final class PhoneNumberType extends ExpandableStringEnum { + /** Static value Unknown for PhoneNumberType. */ + public static final PhoneNumberType UNKNOWN = fromString("Unknown"); + + /** Static value Geographic for PhoneNumberType. */ + public static final PhoneNumberType GEOGRAPHIC = fromString("Geographic"); + + /** Static value TollFree for PhoneNumberType. */ + public static final PhoneNumberType TOLL_FREE = fromString("TollFree"); + + /** Static value Indirect for PhoneNumberType. */ + public static final PhoneNumberType INDIRECT = fromString("Indirect"); + + /** + * Creates or finds a PhoneNumberType from its string representation. + * + * @param name a name to look for. + * @return the corresponding PhoneNumberType. + */ + @JsonCreator + public static PhoneNumberType fromString(String name) { + return fromString(name, PhoneNumberType.class); + } + + /** @return known PhoneNumberType values. */ + public static Collection values() { + return values(PhoneNumberType.class); + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhonePlan.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhonePlan.java new file mode 100644 index 000000000000..1918bffaba1c --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhonePlan.java @@ -0,0 +1,172 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The PhonePlan model. */ +@Fluent +public final class PhonePlan { + /* + * The phone plan id + */ + @JsonProperty(value = "phonePlanId", required = true) + private String phonePlanId; + + /* + * The name of the phone plan + */ + @JsonProperty(value = "localizedName", required = true) + private String localizedName; + + /* + * The location type of the phone plan. + */ + @JsonProperty(value = "locationType", required = true) + private LocationType locationType; + + /* + * The list of available area codes in the phone plan. + */ + @JsonProperty(value = "areaCodes") + private List areaCodes; + + /* + * Capabilities of the phone plan. + */ + @JsonProperty(value = "capabilities") + private List capabilities; + + /* + * The maximum number of phone numbers one can acquire in a search in this + * phone plan. + */ + @JsonProperty(value = "maximumSearchSize") + private Integer maximumSearchSize; + + /** + * Get the phonePlanId property: The phone plan id. + * + * @return the phonePlanId value. + */ + public String getPhonePlanId() { + return this.phonePlanId; + } + + /** + * Set the phonePlanId property: The phone plan id. + * + * @param phonePlanId the phonePlanId value to set. + * @return the PhonePlan object itself. + */ + public PhonePlan setPhonePlanId(String phonePlanId) { + this.phonePlanId = phonePlanId; + return this; + } + + /** + * Get the localizedName property: The name of the phone plan. + * + * @return the localizedName value. + */ + public String getLocalizedName() { + return this.localizedName; + } + + /** + * Set the localizedName property: The name of the phone plan. + * + * @param localizedName the localizedName value to set. + * @return the PhonePlan object itself. + */ + public PhonePlan setLocalizedName(String localizedName) { + this.localizedName = localizedName; + return this; + } + + /** + * Get the locationType property: The location type of the phone plan. + * + * @return the locationType value. + */ + public LocationType getLocationType() { + return this.locationType; + } + + /** + * Set the locationType property: The location type of the phone plan. + * + * @param locationType the locationType value to set. + * @return the PhonePlan object itself. + */ + public PhonePlan setLocationType(LocationType locationType) { + this.locationType = locationType; + return this; + } + + /** + * Get the areaCodes property: The list of available area codes in the phone plan. + * + * @return the areaCodes value. + */ + public List getAreaCodes() { + return this.areaCodes; + } + + /** + * Set the areaCodes property: The list of available area codes in the phone plan. + * + * @param areaCodes the areaCodes value to set. + * @return the PhonePlan object itself. + */ + public PhonePlan setAreaCodes(List areaCodes) { + this.areaCodes = areaCodes; + return this; + } + + /** + * Get the capabilities property: Capabilities of the phone plan. + * + * @return the capabilities value. + */ + public List getCapabilities() { + return this.capabilities; + } + + /** + * Set the capabilities property: Capabilities of the phone plan. + * + * @param capabilities the capabilities value to set. + * @return the PhonePlan object itself. + */ + public PhonePlan setCapabilities(List capabilities) { + this.capabilities = capabilities; + return this; + } + + /** + * Get the maximumSearchSize property: The maximum number of phone numbers one can acquire in a search in this phone + * plan. + * + * @return the maximumSearchSize value. + */ + public Integer getMaximumSearchSize() { + return this.maximumSearchSize; + } + + /** + * Set the maximumSearchSize property: The maximum number of phone numbers one can acquire in a search in this phone + * plan. + * + * @param maximumSearchSize the maximumSearchSize value to set. + * @return the PhonePlan object itself. + */ + public PhonePlan setMaximumSearchSize(Integer maximumSearchSize) { + this.maximumSearchSize = maximumSearchSize; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhonePlanGroup.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhonePlanGroup.java new file mode 100644 index 000000000000..1fc16d36ed2e --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhonePlanGroup.java @@ -0,0 +1,168 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PhonePlanGroup model. */ +@Fluent +public final class PhonePlanGroup { + /* + * The id of the plan group + */ + @JsonProperty(value = "phonePlanGroupId", required = true) + private String phonePlanGroupId; + + /* + * The phone number type of the plan group + */ + @JsonProperty(value = "phoneNumberType") + private PhoneNumberType phoneNumberType; + + /* + * The name of the plan group. + */ + @JsonProperty(value = "localizedName", required = true) + private String localizedName; + + /* + * The description of the plan group. + */ + @JsonProperty(value = "localizedDescription", required = true) + private String localizedDescription; + + /* + * Represents carrier details. + */ + @JsonProperty(value = "carrierDetails") + private CarrierDetails carrierDetails; + + /* + * Represents a wrapper of rate information + */ + @JsonProperty(value = "rateInformation") + private RateInformation rateInformation; + + /** + * Get the phonePlanGroupId property: The id of the plan group. + * + * @return the phonePlanGroupId value. + */ + public String getPhonePlanGroupId() { + return this.phonePlanGroupId; + } + + /** + * Set the phonePlanGroupId property: The id of the plan group. + * + * @param phonePlanGroupId the phonePlanGroupId value to set. + * @return the PhonePlanGroup object itself. + */ + public PhonePlanGroup setPhonePlanGroupId(String phonePlanGroupId) { + this.phonePlanGroupId = phonePlanGroupId; + return this; + } + + /** + * Get the phoneNumberType property: The phone number type of the plan group. + * + * @return the phoneNumberType value. + */ + public PhoneNumberType getPhoneNumberType() { + return this.phoneNumberType; + } + + /** + * Set the phoneNumberType property: The phone number type of the plan group. + * + * @param phoneNumberType the phoneNumberType value to set. + * @return the PhonePlanGroup object itself. + */ + public PhonePlanGroup setPhoneNumberType(PhoneNumberType phoneNumberType) { + this.phoneNumberType = phoneNumberType; + return this; + } + + /** + * Get the localizedName property: The name of the plan group. + * + * @return the localizedName value. + */ + public String getLocalizedName() { + return this.localizedName; + } + + /** + * Set the localizedName property: The name of the plan group. + * + * @param localizedName the localizedName value to set. + * @return the PhonePlanGroup object itself. + */ + public PhonePlanGroup setLocalizedName(String localizedName) { + this.localizedName = localizedName; + return this; + } + + /** + * Get the localizedDescription property: The description of the plan group. + * + * @return the localizedDescription value. + */ + public String getLocalizedDescription() { + return this.localizedDescription; + } + + /** + * Set the localizedDescription property: The description of the plan group. + * + * @param localizedDescription the localizedDescription value to set. + * @return the PhonePlanGroup object itself. + */ + public PhonePlanGroup setLocalizedDescription(String localizedDescription) { + this.localizedDescription = localizedDescription; + return this; + } + + /** + * Get the carrierDetails property: Represents carrier details. + * + * @return the carrierDetails value. + */ + public CarrierDetails getCarrierDetails() { + return this.carrierDetails; + } + + /** + * Set the carrierDetails property: Represents carrier details. + * + * @param carrierDetails the carrierDetails value to set. + * @return the PhonePlanGroup object itself. + */ + public PhonePlanGroup setCarrierDetails(CarrierDetails carrierDetails) { + this.carrierDetails = carrierDetails; + return this; + } + + /** + * Get the rateInformation property: Represents a wrapper of rate information. + * + * @return the rateInformation value. + */ + public RateInformation getRateInformation() { + return this.rateInformation; + } + + /** + * Set the rateInformation property: Represents a wrapper of rate information. + * + * @param rateInformation the rateInformation value to set. + * @return the PhonePlanGroup object itself. + */ + public PhonePlanGroup setRateInformation(RateInformation rateInformation) { + this.rateInformation = rateInformation; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhonePlanGroups.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhonePlanGroups.java new file mode 100644 index 000000000000..832702aee3a7 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhonePlanGroups.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.administration.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The PhonePlanGroups model. */ +@Fluent +public final class PhonePlanGroups { + /* + * The underlying list of phone plan groups. + */ + @JsonProperty(value = "phonePlanGroups") + private List phonePlanGroups; + + /* + * Represents the URL link to the next page + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the phonePlanGroups property: The underlying list of phone plan groups. + * + * @return the phonePlanGroups value. + */ + public List getPhonePlanGroups() { + return this.phonePlanGroups; + } + + /** + * Set the phonePlanGroups property: The underlying list of phone plan groups. + * + * @param phonePlanGroups the phonePlanGroups value to set. + * @return the PhonePlanGroups object itself. + */ + public PhonePlanGroups setPhonePlanGroups(List phonePlanGroups) { + this.phonePlanGroups = phonePlanGroups; + return this; + } + + /** + * Get the nextLink property: Represents the URL link to the next page. + * + * @return the nextLink value. + */ + public String getNextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Represents the URL link to the next page. + * + * @param nextLink the nextLink value to set. + * @return the PhonePlanGroups object itself. + */ + public PhonePlanGroups setNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhonePlansResponse.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhonePlansResponse.java new file mode 100644 index 000000000000..382518af6485 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PhonePlansResponse.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.administration.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The PhonePlansResponse model. */ +@Fluent +public final class PhonePlansResponse { + /* + * Represents the underlying list of phone plans. + */ + @JsonProperty(value = "phonePlans") + private List phonePlans; + + /* + * Represents the URL link to the next page + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the phonePlans property: Represents the underlying list of phone plans. + * + * @return the phonePlans value. + */ + public List getPhonePlans() { + return this.phonePlans; + } + + /** + * Set the phonePlans property: Represents the underlying list of phone plans. + * + * @param phonePlans the phonePlans value to set. + * @return the PhonePlansResponse object itself. + */ + public PhonePlansResponse setPhonePlans(List phonePlans) { + this.phonePlans = phonePlans; + return this; + } + + /** + * Get the nextLink property: Represents the URL link to the next page. + * + * @return the nextLink value. + */ + public String getNextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Represents the URL link to the next page. + * + * @param nextLink the nextLink value to set. + * @return the PhonePlansResponse object itself. + */ + public PhonePlansResponse setNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PstnConfiguration.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PstnConfiguration.java new file mode 100644 index 000000000000..fc6c8c672d61 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/PstnConfiguration.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.administration.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PstnConfiguration model. */ +@Fluent +public final class PstnConfiguration { + /* + * The webhook URL on the phone number configuration. + */ + @JsonProperty(value = "callbackUrl", required = true) + private String callbackUrl; + + /* + * The application id of the application to which to configure + */ + @JsonProperty(value = "applicationId") + private String applicationId; + + /* + * Routable TargetId for the ACS Number + */ + @JsonProperty(value = "azurePstnTargetId") + private String azurePstnTargetId; + + /** + * Get the callbackUrl property: The webhook URL on the phone number configuration. + * + * @return the callbackUrl value. + */ + public String getCallbackUrl() { + return this.callbackUrl; + } + + /** + * Set the callbackUrl property: The webhook URL on the phone number configuration. + * + * @param callbackUrl the callbackUrl value to set. + * @return the PstnConfiguration object itself. + */ + public PstnConfiguration setCallbackUrl(String callbackUrl) { + this.callbackUrl = callbackUrl; + return this; + } + + /** + * Get the applicationId property: The application id of the application to which to configure. + * + * @return the applicationId value. + */ + public String getApplicationId() { + return this.applicationId; + } + + /** + * Set the applicationId property: The application id of the application to which to configure. + * + * @param applicationId the applicationId value to set. + * @return the PstnConfiguration object itself. + */ + public PstnConfiguration setApplicationId(String applicationId) { + this.applicationId = applicationId; + return this; + } + + /** + * Get the azurePstnTargetId property: Routable TargetId for the ACS Number. + * + * @return the azurePstnTargetId value. + */ + public String getAzurePstnTargetId() { + return this.azurePstnTargetId; + } + + /** + * Set the azurePstnTargetId property: Routable TargetId for the ACS Number. + * + * @param azurePstnTargetId the azurePstnTargetId value to set. + * @return the PstnConfiguration object itself. + */ + public PstnConfiguration setAzurePstnTargetId(String azurePstnTargetId) { + this.azurePstnTargetId = azurePstnTargetId; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/RateInformation.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/RateInformation.java new file mode 100644 index 000000000000..7c11e571b156 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/RateInformation.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.administration.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The RateInformation model. */ +@Fluent +public final class RateInformation { + /* + * The monthly rate of a phone plan group + */ + @JsonProperty(value = "monthlyRate") + private Double monthlyRate; + + /* + * The currency of a phone plan group + */ + @JsonProperty(value = "currencyType") + private CurrencyType currencyType; + + /* + * The error code of a phone plan group + */ + @JsonProperty(value = "rateErrorMessage") + private String rateErrorMessage; + + /** + * Get the monthlyRate property: The monthly rate of a phone plan group. + * + * @return the monthlyRate value. + */ + public Double getMonthlyRate() { + return this.monthlyRate; + } + + /** + * Set the monthlyRate property: The monthly rate of a phone plan group. + * + * @param monthlyRate the monthlyRate value to set. + * @return the RateInformation object itself. + */ + public RateInformation setMonthlyRate(Double monthlyRate) { + this.monthlyRate = monthlyRate; + return this; + } + + /** + * Get the currencyType property: The currency of a phone plan group. + * + * @return the currencyType value. + */ + public CurrencyType getCurrencyType() { + return this.currencyType; + } + + /** + * Set the currencyType property: The currency of a phone plan group. + * + * @param currencyType the currencyType value to set. + * @return the RateInformation object itself. + */ + public RateInformation setCurrencyType(CurrencyType currencyType) { + this.currencyType = currencyType; + return this; + } + + /** + * Get the rateErrorMessage property: The error code of a phone plan group. + * + * @return the rateErrorMessage value. + */ + public String getRateErrorMessage() { + return this.rateErrorMessage; + } + + /** + * Set the rateErrorMessage property: The error code of a phone plan group. + * + * @param rateErrorMessage the rateErrorMessage value to set. + * @return the RateInformation object itself. + */ + public RateInformation setRateErrorMessage(String rateErrorMessage) { + this.rateErrorMessage = rateErrorMessage; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ReleaseRequest.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ReleaseRequest.java new file mode 100644 index 000000000000..eab5aecf8451 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ReleaseRequest.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.administration.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The ReleaseRequest model. */ +@Fluent +public final class ReleaseRequest { + /* + * The list of phone numbers in the release request. + */ + @JsonProperty(value = "phoneNumbers", required = true) + private List phoneNumbers; + + /** + * Get the phoneNumbers property: The list of phone numbers in the release request. + * + * @return the phoneNumbers value. + */ + public List getPhoneNumbers() { + return this.phoneNumbers; + } + + /** + * Set the phoneNumbers property: The list of phone numbers in the release request. + * + * @param phoneNumbers the phoneNumbers value to set. + * @return the ReleaseRequest object itself. + */ + public ReleaseRequest setPhoneNumbers(List phoneNumbers) { + this.phoneNumbers = phoneNumbers; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ReleaseResponse.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ReleaseResponse.java new file mode 100644 index 000000000000..c7d3f5fe394e --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ReleaseResponse.java @@ -0,0 +1,38 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ReleaseResponse model. */ +@Fluent +public final class ReleaseResponse { + /* + * The release id of a created release. + */ + @JsonProperty(value = "releaseId", required = true) + private String releaseId; + + /** + * Get the releaseId property: The release id of a created release. + * + * @return the releaseId value. + */ + public String getReleaseId() { + return this.releaseId; + } + + /** + * Set the releaseId property: The release id of a created release. + * + * @param releaseId the releaseId value to set. + * @return the ReleaseResponse object itself. + */ + public ReleaseResponse setReleaseId(String releaseId) { + this.releaseId = releaseId; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ReleaseStatus.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ReleaseStatus.java new file mode 100644 index 000000000000..bc1cc16cccba --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/ReleaseStatus.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.administration.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ReleaseStatus. */ +public final class ReleaseStatus extends ExpandableStringEnum { + /** Static value Pending for ReleaseStatus. */ + public static final ReleaseStatus PENDING = fromString("Pending"); + + /** Static value InProgress for ReleaseStatus. */ + public static final ReleaseStatus IN_PROGRESS = fromString("InProgress"); + + /** Static value Complete for ReleaseStatus. */ + public static final ReleaseStatus COMPLETE = fromString("Complete"); + + /** Static value Failed for ReleaseStatus. */ + public static final ReleaseStatus FAILED = fromString("Failed"); + + /** Static value Expired for ReleaseStatus. */ + public static final ReleaseStatus EXPIRED = fromString("Expired"); + + /** + * Creates or finds a ReleaseStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ReleaseStatus. + */ + @JsonCreator + public static ReleaseStatus fromString(String name) { + return fromString(name, ReleaseStatus.class); + } + + /** @return known ReleaseStatus values. */ + public static Collection values() { + return values(ReleaseStatus.class); + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/SearchStatus.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/SearchStatus.java new file mode 100644 index 000000000000..86cd985758e7 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/SearchStatus.java @@ -0,0 +1,67 @@ +// 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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SearchStatus. */ +public final class SearchStatus extends ExpandableStringEnum { + /** Static value Pending for SearchStatus. */ + public static final SearchStatus PENDING = fromString("Pending"); + + /** Static value InProgress for SearchStatus. */ + public static final SearchStatus IN_PROGRESS = fromString("InProgress"); + + /** Static value Reserved for SearchStatus. */ + public static final SearchStatus RESERVED = fromString("Reserved"); + + /** Static value Expired for SearchStatus. */ + public static final SearchStatus EXPIRED = fromString("Expired"); + + /** Static value Expiring for SearchStatus. */ + public static final SearchStatus EXPIRING = fromString("Expiring"); + + /** Static value Completing for SearchStatus. */ + public static final SearchStatus COMPLETING = fromString("Completing"); + + /** Static value Refreshing for SearchStatus. */ + public static final SearchStatus REFRESHING = fromString("Refreshing"); + + /** Static value Success for SearchStatus. */ + public static final SearchStatus SUCCESS = fromString("Success"); + + /** Static value Manual for SearchStatus. */ + public static final SearchStatus MANUAL = fromString("Manual"); + + /** Static value Cancelled for SearchStatus. */ + public static final SearchStatus CANCELLED = fromString("Cancelled"); + + /** Static value Cancelling for SearchStatus. */ + public static final SearchStatus CANCELLING = fromString("Cancelling"); + + /** Static value Error for SearchStatus. */ + public static final SearchStatus ERROR = fromString("Error"); + + /** Static value PurchasePending for SearchStatus. */ + public static final SearchStatus PURCHASE_PENDING = fromString("PurchasePending"); + + /** + * Creates or finds a SearchStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SearchStatus. + */ + @JsonCreator + public static SearchStatus fromString(String name) { + return fromString(name, SearchStatus.class); + } + + /** @return known SearchStatus values. */ + public static Collection values() { + return values(SearchStatus.class); + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/UpdateNumberCapabilitiesRequest.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/UpdateNumberCapabilitiesRequest.java new file mode 100644 index 000000000000..665d707b482a --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/UpdateNumberCapabilitiesRequest.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.communication.administration.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The UpdateNumberCapabilitiesRequest model. */ +@Fluent +public final class UpdateNumberCapabilitiesRequest { + /* + * The map of phone numbers to the capabilities update applied to the phone + * number. + */ + @JsonProperty(value = "phoneNumberCapabilitiesUpdate", required = true) + private Map phoneNumberCapabilitiesUpdate; + + /** + * Get the phoneNumberCapabilitiesUpdate property: The map of phone numbers to the capabilities update applied to + * the phone number. + * + * @return the phoneNumberCapabilitiesUpdate value. + */ + public Map getPhoneNumberCapabilitiesUpdate() { + return this.phoneNumberCapabilitiesUpdate; + } + + /** + * Set the phoneNumberCapabilitiesUpdate property: The map of phone numbers to the capabilities update applied to + * the phone number. + * + * @param phoneNumberCapabilitiesUpdate the phoneNumberCapabilitiesUpdate value to set. + * @return the UpdateNumberCapabilitiesRequest object itself. + */ + public UpdateNumberCapabilitiesRequest setPhoneNumberCapabilitiesUpdate( + Map phoneNumberCapabilitiesUpdate) { + this.phoneNumberCapabilitiesUpdate = phoneNumberCapabilitiesUpdate; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/UpdateNumberCapabilitiesResponse.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/UpdateNumberCapabilitiesResponse.java new file mode 100644 index 000000000000..552c88e68753 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/UpdateNumberCapabilitiesResponse.java @@ -0,0 +1,38 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The UpdateNumberCapabilitiesResponse model. */ +@Fluent +public final class UpdateNumberCapabilitiesResponse { + /* + * The capabilities id + */ + @JsonProperty(value = "capabilitiesUpdateId", required = true) + private String capabilitiesUpdateId; + + /** + * Get the capabilitiesUpdateId property: The capabilities id. + * + * @return the capabilitiesUpdateId value. + */ + public String getCapabilitiesUpdateId() { + return this.capabilitiesUpdateId; + } + + /** + * Set the capabilitiesUpdateId property: The capabilities id. + * + * @param capabilitiesUpdateId the capabilitiesUpdateId value to set. + * @return the UpdateNumberCapabilitiesResponse object itself. + */ + public UpdateNumberCapabilitiesResponse setCapabilitiesUpdateId(String capabilitiesUpdateId) { + this.capabilitiesUpdateId = capabilitiesUpdateId; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/UpdatePhoneNumberCapabilitiesResponse.java b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/UpdatePhoneNumberCapabilitiesResponse.java new file mode 100644 index 000000000000..1c572ae06d72 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/main/java/com/azure/communication/administration/models/UpdatePhoneNumberCapabilitiesResponse.java @@ -0,0 +1,120 @@ +// 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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** The UpdatePhoneNumberCapabilitiesResponse model. */ +@Fluent +public final class UpdatePhoneNumberCapabilitiesResponse { + /* + * The id of the phone number capabilties update + */ + @JsonProperty(value = "capabilitiesUpdateId") + private String capabilitiesUpdateId; + + /* + * The time the capabilities update was created + */ + @JsonProperty(value = "createdAt") + private OffsetDateTime createdAt; + + /* + * Status of the capabilities update. + */ + @JsonProperty(value = "capabilitiesUpdateStatus") + private CapabilitiesUpdateStatus capabilitiesUpdateStatus; + + /* + * The capabilities update for each of a set of phone numbers. + */ + @JsonProperty(value = "phoneNumberCapabilitiesUpdates") + private Map phoneNumberCapabilitiesUpdates; + + /** + * Get the capabilitiesUpdateId property: The id of the phone number capabilties update. + * + * @return the capabilitiesUpdateId value. + */ + public String getCapabilitiesUpdateId() { + return this.capabilitiesUpdateId; + } + + /** + * Set the capabilitiesUpdateId property: The id of the phone number capabilties update. + * + * @param capabilitiesUpdateId the capabilitiesUpdateId value to set. + * @return the UpdatePhoneNumberCapabilitiesResponse object itself. + */ + public UpdatePhoneNumberCapabilitiesResponse setCapabilitiesUpdateId(String capabilitiesUpdateId) { + this.capabilitiesUpdateId = capabilitiesUpdateId; + return this; + } + + /** + * Get the createdAt property: The time the capabilities update was created. + * + * @return the createdAt value. + */ + public OffsetDateTime getCreatedAt() { + return this.createdAt; + } + + /** + * Set the createdAt property: The time the capabilities update was created. + * + * @param createdAt the createdAt value to set. + * @return the UpdatePhoneNumberCapabilitiesResponse object itself. + */ + public UpdatePhoneNumberCapabilitiesResponse setCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get the capabilitiesUpdateStatus property: Status of the capabilities update. + * + * @return the capabilitiesUpdateStatus value. + */ + public CapabilitiesUpdateStatus getCapabilitiesUpdateStatus() { + return this.capabilitiesUpdateStatus; + } + + /** + * Set the capabilitiesUpdateStatus property: Status of the capabilities update. + * + * @param capabilitiesUpdateStatus the capabilitiesUpdateStatus value to set. + * @return the UpdatePhoneNumberCapabilitiesResponse object itself. + */ + public UpdatePhoneNumberCapabilitiesResponse setCapabilitiesUpdateStatus( + CapabilitiesUpdateStatus capabilitiesUpdateStatus) { + this.capabilitiesUpdateStatus = capabilitiesUpdateStatus; + return this; + } + + /** + * Get the phoneNumberCapabilitiesUpdates property: The capabilities update for each of a set of phone numbers. + * + * @return the phoneNumberCapabilitiesUpdates value. + */ + public Map getPhoneNumberCapabilitiesUpdates() { + return this.phoneNumberCapabilitiesUpdates; + } + + /** + * Set the phoneNumberCapabilitiesUpdates property: The capabilities update for each of a set of phone numbers. + * + * @param phoneNumberCapabilitiesUpdates the phoneNumberCapabilitiesUpdates value to set. + * @return the UpdatePhoneNumberCapabilitiesResponse object itself. + */ + public UpdatePhoneNumberCapabilitiesResponse setPhoneNumberCapabilitiesUpdates( + Map phoneNumberCapabilitiesUpdates) { + this.phoneNumberCapabilitiesUpdates = phoneNumberCapabilitiesUpdates; + return this; + } +} diff --git a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientPlaybackTest.java b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientPlaybackTest.java new file mode 100644 index 000000000000..f8d38728940a --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientPlaybackTest.java @@ -0,0 +1,359 @@ +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.Capability; +import com.azure.communication.administration.models.CreateSearchOptions; +import com.azure.communication.administration.models.CreateSearchResponse; +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.PhoneNumberSearch; +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.UpdateNumberCapabilitiesResponse; +import com.azure.communication.administration.models.UpdatePhoneNumberCapabilitiesResponse; +import com.azure.communication.common.PhoneNumber; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class PhoneNumberAsyncClientPlaybackTest extends PhoneNumberPlaybackTestBase { + @Test() + public void listAllPhoneNumbers() { + PagedFlux pagedFlux = this.getClient().listAllPhoneNumbers(LOCALE); + + assertNotNull(pagedFlux.blockFirst().getPhoneNumber()); + } + + @Test() + public void listPhonePlanGroups() { + PagedFlux pagedFlux = + this.getClient().listPhonePlanGroups(COUNTRY_CODE, LOCALE, true); + + assertNotNull(pagedFlux.blockFirst().getPhonePlanGroupId()); + } + + @Test() + public void listPhonePlans() { + PagedFlux pagedFlux = + this.getClient().listPhonePlans(COUNTRY_CODE, PHONE_PLAN_GROUP_ID, LOCALE); + + assertNotNull(pagedFlux.blockFirst().getPhonePlanId()); + } + + @Test() + public void listAllReleases() { + PagedFlux pagedFlux = this.getClient().listAllReleases(); + + assertNotNull(pagedFlux.blockFirst().getId()); + } + + @Test() + public void listAllSearches() { + PagedFlux pagedFlux = this.getClient().listAllSearches(); + + assertNotNull(pagedFlux.blockFirst().getId()); + } + + @Test() + public void listAllSupportedCountries() { + PagedFlux pagedFlux = this.getClient().listAllSupportedCountries(LOCALE); + + assertNotNull(pagedFlux.blockFirst().getCountryCode()); + } + + @Test() + public void getPhonePlanLocationOptions() { + Mono mono = + this.getClient().getPhonePlanLocationOptions(COUNTRY_CODE, PHONE_PLAN_GROUP_ID, PHONE_PLAN_ID, LOCALE); + + assertNotNull(mono.block().getLocationOptions().getLabelId()); + } + + @Test() + public void getAllAreaCodes() { + List locationOptions = new ArrayList<>(); + LocationOptionsQuery query = new LocationOptionsQuery(); + query.setLabelId("state"); + query.setOptionsValue(LOCATION_OPTION_STATE); + locationOptions.add(query); + + query = new LocationOptionsQuery(); + query.setLabelId("city"); + query.setOptionsValue(LOCATION_OPTION_CITY); + locationOptions.add(query); + + Mono mono = + this.getClient().getAllAreaCodes("selection", COUNTRY_CODE, PHONE_PLAN_ID, locationOptions); + + assertTrue(mono.block().getPrimaryAreaCodes().size() > 0); + } + + @Test() + public void getAllAreaCodesWithResponse() { + List locationOptions = new ArrayList<>(); + LocationOptionsQuery query = new LocationOptionsQuery(); + query.setLabelId("state"); + query.setOptionsValue(LOCATION_OPTION_STATE); + locationOptions.add(query); + + query = new LocationOptionsQuery(); + query.setLabelId("city"); + query.setOptionsValue(LOCATION_OPTION_CITY); + locationOptions.add(query); + + Mono> mono = this.getClient().getAllAreaCodesWithResponse( + "selection", COUNTRY_CODE, PHONE_PLAN_ID, locationOptions, Context.NONE); + + Response response = mono.block(); + assertEquals(200, response.getStatusCode()); + assertTrue(response.getValue().getPrimaryAreaCodes().size() > 0); + } + + @Test() + public void updateCapabilities() { + List capabilitiesToAdd = new ArrayList<>(); + capabilitiesToAdd.add(Capability.INBOUND_CALLING); + + NumberUpdateCapabilities update = new NumberUpdateCapabilities(); + update.setAdd(capabilitiesToAdd); + + Map updateMap = new HashMap<>(); + updateMap.put(new PhoneNumber(PHONENUMBER_FOR_CAPABILITIES), update); + + Mono mono = this.getClient().updateCapabilities(updateMap); + + assertNotNull(mono.block().getCapabilitiesUpdateId()); + } + + @Test() + public void updateCapabilitiesWithResponse() { + List capabilitiesToAdd = new ArrayList<>(); + capabilitiesToAdd.add(Capability.INBOUND_CALLING); + + NumberUpdateCapabilities update = new NumberUpdateCapabilities(); + update.setAdd(capabilitiesToAdd); + + Map updateMap = new HashMap<>(); + updateMap.put(new PhoneNumber(PHONENUMBER_FOR_CAPABILITIES), update); + + Mono> mono = + this.getClient().updateCapabilitiesWithResponse(updateMap, Context.NONE); + + Response response = mono.block(); + assertEquals(200, response.getStatusCode()); + assertNotNull(response.getValue().getCapabilitiesUpdateId()); + } + + @Test() + public void getCapabilitiesUpdate() { + Mono mono = + this.getClient().getCapabilitiesUpdate(CAPABILITIES_ID); + assertNotNull(mono.block().getCapabilitiesUpdateId()); + } + + @Test() + public void getCapabilitiesUpdateWithResponse() { + Mono> mono = + this.getClient().getCapabilitiesUpdateWithResponse(CAPABILITIES_ID, Context.NONE); + + Response response = mono.block(); + assertEquals(200, response.getStatusCode()); + assertNotNull(response.getValue().getCapabilitiesUpdateId()); + } + + @Test() + public void createSearch() { + List phonePlanIds = new ArrayList<>(); + phonePlanIds.add(PHONE_PLAN_ID); + + CreateSearchOptions createSearchOptions = new CreateSearchOptions(); + createSearchOptions + .setAreaCode(AREA_CODE_FOR_SEARCH) + .setDescription("testsearch20200014") + .setDisplayName("testsearch20200014") + .setPhonePlanIds(phonePlanIds) + .setQuantity(1); + + Mono mono = this.getClient().createSearch(createSearchOptions); + + assertNotNull(mono.block().getSearchId()); + } + + @Test() + public void createSearchWithResponse() { + List phonePlanIds = new ArrayList<>(); + phonePlanIds.add(PHONE_PLAN_ID); + + CreateSearchOptions createSearchOptions = new CreateSearchOptions(); + createSearchOptions + .setAreaCode(AREA_CODE_FOR_SEARCH) + .setDescription("testsearch20200014") + .setDisplayName("testsearch20200014") + .setPhonePlanIds(phonePlanIds) + .setQuantity(1); + + Mono> mono = + this.getClient().createSearchWithResponse(createSearchOptions, Context.NONE); + + Response response = mono.block(); + + assertEquals(201, response.getStatusCode()); + assertNotNull(response.getValue().getSearchId()); + } + + @Test() + public void getSearchById() { + Mono mono = this.getClient().getSearchById(SEARCH_ID); + + assertEquals(SEARCH_ID, mono.block().getSearchId()); + } + + @Test() + public void getSearchByIdWithResponse() { + Mono> mono = this.getClient().getSearchByIdWithResponse(SEARCH_ID, Context.NONE); + + Response response = mono.block(); + assertEquals(200, response.getStatusCode()); + assertEquals(SEARCH_ID, response.getValue().getSearchId()); + } + + @Test() + public void purchaseSearch() { + Mono mono = this.getClient().purchaseSearch(SEARCH_ID_TO_PURCHASE); + mono.block(); + } + + @Test() + public void purchaseSearchWithResponse() { + Mono> mono = this.getClient().purchaseSearchWithResponse(SEARCH_ID_TO_PURCHASE, Context.NONE); + + Response response = mono.block(); + assertEquals(202, response.getStatusCode()); + } + + @Test() + public void cancelSearch() { + Mono mono = this.getClient().cancelSearch(SEARCH_ID_TO_CANCEL); + mono.block(); + } + + @Test() + public void cancelSearchWithResponse() { + Mono> mono = this.getClient().cancelSearchWithResponse(SEARCH_ID_TO_CANCEL, Context.NONE); + + Response response = mono.block(); + assertEquals(202, response.getStatusCode()); + } + + @Test() + public void configureNumber() { + PhoneNumber number = new PhoneNumber(PHONENUMBER_TO_CONFIGURE); + PstnConfiguration pstnConfiguration = new PstnConfiguration(); + pstnConfiguration.setApplicationId("ApplicationId"); + pstnConfiguration.setAzurePstnTargetId("AzurePstnTargetId"); + pstnConfiguration.setCallbackUrl("https://callbackurl"); + + Mono mono = this.getClient().configureNumber(number, pstnConfiguration); + + mono.block(); + } + + @Test() + public void configureNumberWithResponse() { + PhoneNumber number = new PhoneNumber(PHONENUMBER_TO_CONFIGURE); + PstnConfiguration pstnConfiguration = new PstnConfiguration(); + pstnConfiguration.setApplicationId("ApplicationId"); + pstnConfiguration.setAzurePstnTargetId("AzurePstnTargetId"); + pstnConfiguration.setCallbackUrl("https://callbackurl"); + + Mono> mono = this.getClient().configureNumberWithResponse(number, pstnConfiguration, Context.NONE); + + Response response = mono.block(); + assertEquals(202, response.getStatusCode()); + } + + @Test() + public void getNumberConfiguration() { + PhoneNumber number = new PhoneNumber(PHONENUMBER_TO_GET_CONFIG); + + Mono mono = this.getClient().getNumberConfiguration(number); + + assertEquals("ApplicationId", mono.block().getPstnConfiguration().getApplicationId()); + } + + @Test() + public void getNumberConfigurationWithResponse() { + PhoneNumber number = new PhoneNumber(PHONENUMBER_TO_GET_CONFIG); + + Mono> mono = + this.getClient().getNumberConfigurationWithResponse(number, Context.NONE); + + Response response = mono.block(); + assertEquals(200, response.getStatusCode()); + assertEquals("ApplicationId", response.getValue().getPstnConfiguration().getApplicationId()); + } + + @Test() + public void unconfigureNumber() { + PhoneNumber number = new PhoneNumber(PHONENUMBER_TO_UNCONFIGURE); + + Mono mono = this.getClient().unconfigureNumber(number); + + mono.block(); + } + + @Test() + public void unconfigureNumberWithResponse() { + PhoneNumber number = new PhoneNumber(PHONENUMBER_TO_UNCONFIGURE); + + Mono> mono = this.getClient().unconfigureNumberWithResponse(number, Context.NONE); + + Response response = mono.block(); + assertEquals(202, response.getStatusCode()); + } + + @Test() + public void releasePhoneNumbers() { + List phoneNumbers = new ArrayList<>(); + phoneNumbers.add(new PhoneNumber(PHONENUMBER_TO_RELEASE)); + + Mono mono = this.getClient().releasePhoneNumbers(phoneNumbers); + + assertNotNull(mono.block().getReleaseId()); + } + + @Test() + public void releasePhoneNumbersWithResponse() { + List phoneNumbers = new ArrayList<>(); + phoneNumbers.add(new PhoneNumber(PHONENUMBER_TO_RELEASE)); + + Mono> mono = + this.getClient().releasePhoneNumbersWithResponse(phoneNumbers, Context.NONE); + + Response response = mono.block(); + assertEquals(200, response.getStatusCode()); + assertNotNull(response.getValue().getReleaseId()); + } + + private PhoneNumberAsyncClient getClient() { + return super.getClientBuilder().buildAsyncClient(); + } +} diff --git a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientBuilderTest.java b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientBuilderTest.java new file mode 100644 index 000000000000..a888f041bcca --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientBuilderTest.java @@ -0,0 +1,499 @@ +// 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.common.CommunicationClientCredential; +import com.azure.communication.common.HmacAuthenticationPolicy; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.policy.*; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.parallel.Execution; +import org.junit.jupiter.api.parallel.ExecutionMode; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import org.mockito.stubbing.Answer; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicReference; + + +import static org.junit.jupiter.api.Assertions.*; +import static org.mockito.Mockito.*; + +@Execution(value = ExecutionMode.SAME_THREAD) +public class PhoneNumberClientBuilderTest { + private static final String ENDPOINT = "https://mycommunication.eastus.dev.communications.azure.net/"; + private static final Map PROPERTIES = + CoreUtils.getProperties("azure-communication-administration.properties"); + private static final String SDK_NAME = "name"; + private static final String SDK_VERSION = "version"; + + private CommunicationClientCredential credential; + private HttpClient httpClient; + private PhoneNumberClientBuilder clientBuilder; + + @BeforeEach + void setUp() { + this.credential = mock(CommunicationClientCredential.class); + this.httpClient = mock(HttpClient.class); + this.clientBuilder = Mockito.spy(new PhoneNumberClientBuilder()); + } + + @AfterEach + void tearDown() { + Mockito.framework().clearInlineMocks(); + } + + @Test() + public void buildClientWithHttpClientWithCredential() { + ClientBuilderSpyHelper spyHelper = new ClientBuilderSpyHelper(this.clientBuilder); + + // Build client with required settings + PhoneNumberClient phoneNumberClient = + this.setupBuilderWithHttpClientWithCredential(this.clientBuilder).buildClient(); + + // Validate client created with expected settings + assertNotNull(phoneNumberClient); + validateRequiredSettings(spyHelper); + } + + @Test() + public void buildClientWithCustomPipeline() { + ClientBuilderSpyHelper spyHelper = new ClientBuilderSpyHelper(this.clientBuilder); + HttpPipeline httpPipeline = mock(HttpPipeline.class); + + // Build client with custom pipeline + PhoneNumberClient phoneNumberClient = + this.setupBuilderCustomPipeline(httpPipeline).buildClient(); + + // Validate client created with expected settings + assertNotNull(phoneNumberClient); + validateCustomPipeline(spyHelper, httpPipeline); + } + + @Test() + public void buildClientWithLogOptions() { + ClientBuilderSpyHelper spyHelper = new ClientBuilderSpyHelper(this.clientBuilder); + HttpLogOptions logOptions = mock(HttpLogOptions.class); + + // Build client with required settings and mock log options + PhoneNumberClient phoneNumberClient = this.setupBuilderWithHttpClientWithCredential(this.clientBuilder) + .httpLogOptions(logOptions) + .buildClient(); + + // Validate client created with expected settings + assertNotNull(phoneNumberClient); + validateLogOptions(spyHelper, logOptions); + } + + @Test() + public void buildClientWithConfiguration() { + ClientBuilderSpyHelper spyHelper = new ClientBuilderSpyHelper(this.clientBuilder); + Configuration configuration = mock(Configuration.class); + + // Build client with required settings and mock configuration + PhoneNumberClient phoneNumberClient = this.setupBuilderWithHttpClientWithCredential(this.clientBuilder) + .configuration(configuration) + .buildClient(); + + // Validate client created with expected settings + assertNotNull(phoneNumberClient); + validateConfiguration(spyHelper, configuration); + } + + @Test() + public void buildClientWithOneAdditionalPolicy() { + ClientBuilderSpyHelper spyHelper = new ClientBuilderSpyHelper(this.clientBuilder); + List additionalPolicies = new ArrayList<>(); + additionalPolicies.add(mock(HttpPipelinePolicy.class)); + + // Build client with required settings and mock policies + PhoneNumberClient phoneNumberClient = + this.setupBuilderWithPolicies(this.clientBuilder, additionalPolicies) + .buildClient(); + + // Validate client created with expected settings + assertNotNull(phoneNumberClient); + validateAdditionalPolicies(spyHelper, additionalPolicies); + } + + @Test() + public void buildClientWithMultipleAdditionalPolicies() { + ClientBuilderSpyHelper spyHelper = new ClientBuilderSpyHelper(this.clientBuilder); + List additionalPolicies = new ArrayList<>(); + additionalPolicies.add(mock(HttpPipelinePolicy.class)); + additionalPolicies.add(mock(HttpPipelinePolicy.class)); + additionalPolicies.add(mock(HttpPipelinePolicy.class)); + + // Build client with required settings and mock policies + PhoneNumberClient phoneNumberClient = + this.setupBuilderWithPolicies(this.clientBuilder, additionalPolicies) + .buildClient(); + + // Validate client created with expected settings + assertNotNull(phoneNumberClient); + validateAdditionalPolicies(spyHelper, additionalPolicies); + } + + @Test() + public void buildClientNoEndpoint() { + assertThrows(NullPointerException.class, () -> { + this.clientBuilder.buildClient(); + }); + } + + @Test() + public void buildClientNoPipelineNoHttpClient() { + assertThrows(NullPointerException.class, () -> { + this.clientBuilder.endpoint(ENDPOINT).credential(this.credential).buildClient(); + }); + } + + @Test() + public void buildClientNoPipelineNoCredentials() { + assertThrows(NullPointerException.class, () -> { + this.clientBuilder.endpoint(ENDPOINT).httpClient(this.httpClient).buildClient(); + }); + } + + @Test() + public void buildAsyncClientWithHttpClientWithCredential() { + ClientBuilderSpyHelper spyHelper = new ClientBuilderSpyHelper(this.clientBuilder); + + // Build client with required settings + PhoneNumberAsyncClient phoneNumberAsyncClient = + this.setupBuilderWithHttpClientWithCredential(this.clientBuilder).buildAsyncClient(); + + // Validate client created with expected settings + assertNotNull(phoneNumberAsyncClient); + validateRequiredSettings(spyHelper); + } + + @Test() + public void buildAsyncClientWithCustomPipeline() { + ClientBuilderSpyHelper spyHelper = new ClientBuilderSpyHelper(this.clientBuilder); + HttpPipeline httpPipeline = mock(HttpPipeline.class); + + // Build client with custom pipeline + PhoneNumberAsyncClient phoneNumberAsyncClient = + this.setupBuilderCustomPipeline(httpPipeline).buildAsyncClient(); + + // Validate client created with expected settings + assertNotNull(phoneNumberAsyncClient); + validateCustomPipeline(spyHelper, httpPipeline); + } + + @Test() + public void buildAsyncClientWithLogOptions() { + ClientBuilderSpyHelper spyHelper = new ClientBuilderSpyHelper(this.clientBuilder); + HttpLogOptions logOptions = mock(HttpLogOptions.class); + + // Build client with required settings and mock log options + PhoneNumberAsyncClient phoneNumberAsyncClient = + this.setupBuilderWithHttpClientWithCredential(this.clientBuilder) + .httpLogOptions(logOptions) + .buildAsyncClient(); + + // Validate client created with expected settings + assertNotNull(phoneNumberAsyncClient); + validateLogOptions(spyHelper, logOptions); + } + + @Test() + public void buildAsyncClientWithConfiguration() { + ClientBuilderSpyHelper spyHelper = new ClientBuilderSpyHelper(this.clientBuilder); + Configuration configuration = mock(Configuration.class); + + // Build client with required settings and mock configuration + PhoneNumberAsyncClient phoneNumberAsyncClient = + this.setupBuilderWithHttpClientWithCredential(this.clientBuilder) + .configuration(configuration) + .buildAsyncClient(); + + // Validate client created with expected settings + assertNotNull(phoneNumberAsyncClient); + validateConfiguration(spyHelper, configuration); + } + + @Test() + public void buildAsyncClientWithOneAdditionalPolicy() { + ClientBuilderSpyHelper spyHelper = new ClientBuilderSpyHelper(this.clientBuilder); + List additionalPolicies = new ArrayList<>(); + additionalPolicies.add(mock(HttpPipelinePolicy.class)); + + // Build client with required settings and mock policies + PhoneNumberAsyncClient phoneNumberAsyncClient = + this.setupBuilderWithPolicies(this.clientBuilder, additionalPolicies) + .buildAsyncClient(); + + // Validate client created with expected settings + assertNotNull(phoneNumberAsyncClient); + validateAdditionalPolicies(spyHelper, additionalPolicies); + } + + @Test() + public void buildAsyncClientWithMultipleAdditionalPolicies() { + ClientBuilderSpyHelper spyHelper = new ClientBuilderSpyHelper(this.clientBuilder); + List additionalPolicies = new ArrayList<>(); + additionalPolicies.add(mock(HttpPipelinePolicy.class)); + additionalPolicies.add(mock(HttpPipelinePolicy.class)); + additionalPolicies.add(mock(HttpPipelinePolicy.class)); + + // Build client with required settings and mock policies + PhoneNumberAsyncClient phoneNumberAsyncClient = + this.setupBuilderWithPolicies(this.clientBuilder, additionalPolicies) + .buildAsyncClient(); + + // Validate client created with expected settings + assertNotNull(phoneNumberAsyncClient); + validateAdditionalPolicies(spyHelper, additionalPolicies); + } + + @Test() + public void buildAsyncClientNoEndpoint() { + assertThrows(NullPointerException.class, () -> { + this.clientBuilder.buildClient(); + }); + } + + @Test() + public void buildAsyncClientNoPipelineNoHttpClient() { + assertThrows(NullPointerException.class, () -> { + this.clientBuilder.endpoint(ENDPOINT).credential(this.credential).buildClient(); + }); + } + + @Test() + public void buildAsyncClientNoPipelineNoCredentials() { + assertThrows(NullPointerException.class, () -> { + this.clientBuilder.endpoint(ENDPOINT).httpClient(this.httpClient).buildClient(); + }); + } + + @Test() + public void setEndpointNull() { + assertThrows(NullPointerException.class, () -> { + this.clientBuilder.endpoint(null); + }); + } + + @Test() + public void setPipelineNull() { + assertThrows(NullPointerException.class, () -> { + this.clientBuilder.pipeline(null); + }); + } + + @Test() + public void setHttpClientNull() { + assertThrows(NullPointerException.class, () -> { + this.clientBuilder.httpClient(null); + }); + } + + @Test() + public void setCredentialNull() { + assertThrows(NullPointerException.class, () -> { + this.clientBuilder.credential(null); + }); + } + + @Test() + public void addPolicyNull() { + assertThrows(NullPointerException.class, () -> { + this.clientBuilder.addPolicy(null); + }); + } + + private PhoneNumberClientBuilder setupBuilderWithHttpClientWithCredential(PhoneNumberClientBuilder clientBuilder) { + return clientBuilder + .endpoint(ENDPOINT) + .httpClient(this.httpClient) + .credential(this.credential); + } + + private PhoneNumberClientBuilder setupBuilderWithPolicies( + PhoneNumberClientBuilder clientBuilder, List policies) { + clientBuilder = this.setupBuilderWithHttpClientWithCredential(clientBuilder); + for (HttpPipelinePolicy policy : policies) { + clientBuilder.addPolicy(policy); + } + + return clientBuilder; + } + + private PhoneNumberClientBuilder setupBuilderCustomPipeline(HttpPipeline pipeline) { + return clientBuilder + .endpoint(ENDPOINT) + .pipeline(pipeline); + } + + private void validateRequiredSettings(ClientBuilderSpyHelper spyHelper) { + // Inspect client setup + spyHelper.capturePhoneNumberAdminClientImpl(); + spyHelper.captureHttpPipelineSettings(); + PhoneNumberAdminClientImpl phoneNumberManagementClient = spyHelper.phoneNumberAdminClientArg.getValue(); + CommunicationClientCredential communicationClientCredential = spyHelper.credentialArg.getValue(); + + // Validate required settings + assertEquals(ENDPOINT, phoneNumberManagementClient.getEndpoint()); + assertEquals(this.httpClient, phoneNumberManagementClient.getHttpPipeline().getHttpClient()); + assertEquals(this.credential, communicationClientCredential); + + // Validate HttpPipelinePolicy settings + assertEquals(5, phoneNumberManagementClient.getHttpPipeline().getPolicyCount()); + assertEquals(spyHelper.authenticationPolicyRef.get(), phoneNumberManagementClient.getHttpPipeline().getPolicy(0)); + assertEquals(spyHelper.userAgentPolicyRef.get(), phoneNumberManagementClient.getHttpPipeline().getPolicy(1)); + assertEquals(spyHelper.retryPolicyRef.get(), phoneNumberManagementClient.getHttpPipeline().getPolicy(2)); + assertEquals(spyHelper.cookiePolicyRef.get(), phoneNumberManagementClient.getHttpPipeline().getPolicy(3)); + assertEquals(spyHelper.httpLoggingPolicyRef.get(), phoneNumberManagementClient.getHttpPipeline().getPolicy(4)); + + // Validate HttpLogOptions + assertEquals(spyHelper.defaultHttpLogOptionsRef.get(), spyHelper.httpLogOptionsArg.getValue()); + + // Validate UserAgentPolicy settings + assertEquals(spyHelper.defaultHttpLogOptionsRef.get().getApplicationId(), spyHelper.uaPolicyAppIdArg.getValue()); + assertEquals(PROPERTIES.get((SDK_NAME)), spyHelper.uaPolicySdkNameArg.getValue()); + assertEquals(PROPERTIES.get((SDK_VERSION)), spyHelper.uaPolicySdkVersionArg.getValue()); + assertNull(spyHelper.uaPolicyConfigArg.getValue()); + } + + private void validateCustomPipeline(ClientBuilderSpyHelper spyHelper, HttpPipeline expectedPipeline) { + // Inspect client setup + spyHelper.capturePhoneNumberAdminClientImpl(); + PhoneNumberAdminClientImpl phoneNumberAdminClient = spyHelper.phoneNumberAdminClientArg.getValue(); + + // Validate http pipeline used + assertEquals(expectedPipeline, phoneNumberAdminClient.getHttpPipeline()); + } + + private void validateLogOptions(ClientBuilderSpyHelper spyHelper, HttpLogOptions expectedLogOptions) { + // Inspect client setup + spyHelper.captureHttpPipelineSettings(); + HttpLogOptions actualLogOptions = spyHelper.httpLogOptionsArg.getValue(); + + // Validate log options used + assertEquals(expectedLogOptions, actualLogOptions); + } + + private void validateConfiguration(ClientBuilderSpyHelper spyHelper, Configuration expectedConfiguration) { + // Inspect client setup + spyHelper.captureHttpPipelineSettings(); + Configuration actualConfiguration = spyHelper.uaPolicyConfigArg.getValue(); + + // Validate configuration used + assertEquals(expectedConfiguration, actualConfiguration); + } + + private void validateAdditionalPolicies(ClientBuilderSpyHelper spyHelper, List policies) { + // Inspect client setup + spyHelper.capturePhoneNumberAdminClientImpl(); + PhoneNumberAdminClientImpl phoneNumberManagementClient = spyHelper.phoneNumberAdminClientArg.getValue(); + + // Validate HttpPipelinePolicy settings + int expectedPolicyCount = 5 + policies.size(); + int lastPolicyIndex = expectedPolicyCount - 1; + int customPolicyIndex = 4; + + assertEquals(expectedPolicyCount, phoneNumberManagementClient.getHttpPipeline().getPolicyCount()); + assertEquals(spyHelper.authenticationPolicyRef.get(), phoneNumberManagementClient.getHttpPipeline().getPolicy(0)); + assertEquals(spyHelper.userAgentPolicyRef.get(), phoneNumberManagementClient.getHttpPipeline().getPolicy(1)); + assertEquals(spyHelper.retryPolicyRef.get(), phoneNumberManagementClient.getHttpPipeline().getPolicy(2)); + assertEquals(spyHelper.cookiePolicyRef.get(), phoneNumberManagementClient.getHttpPipeline().getPolicy(3)); + assertEquals(spyHelper.httpLoggingPolicyRef.get(), phoneNumberManagementClient.getHttpPipeline().getPolicy(lastPolicyIndex)); + + for (HttpPipelinePolicy policy : policies) { + assertEquals(policy, phoneNumberManagementClient.getHttpPipeline().getPolicy(customPolicyIndex)); + customPolicyIndex++; + } + } + + private class ClientBuilderSpyHelper { + final PhoneNumberClientBuilder clientBuilder; + + final AtomicReference authenticationPolicyRef = new AtomicReference<>(); + final AtomicReference userAgentPolicyRef = new AtomicReference<>(); + final AtomicReference retryPolicyRef = new AtomicReference<>(); + final AtomicReference cookiePolicyRef = new AtomicReference<>(); + final AtomicReference httpLoggingPolicyRef = new AtomicReference<>(); + final AtomicReference defaultHttpLogOptionsRef = new AtomicReference<>(); + final ArgumentCaptor phoneNumberAdminClientArg = + ArgumentCaptor.forClass(PhoneNumberAdminClientImpl.class); + final ArgumentCaptor credentialArg = + ArgumentCaptor.forClass(CommunicationClientCredential.class); + final ArgumentCaptor uaPolicyAppIdArg = ArgumentCaptor.forClass(String.class); + final ArgumentCaptor uaPolicySdkNameArg = ArgumentCaptor.forClass(String.class); + final ArgumentCaptor uaPolicySdkVersionArg = ArgumentCaptor.forClass(String.class); + final ArgumentCaptor uaPolicyConfigArg = ArgumentCaptor.forClass(Configuration.class); + final ArgumentCaptor httpLogOptionsArg = ArgumentCaptor.forClass(HttpLogOptions.class); + + ClientBuilderSpyHelper(PhoneNumberClientBuilder clientBuilder) { + this.clientBuilder = clientBuilder; + this.initializeSpies(); + } + + private void initializeSpies() { + Answer createCommunicationClientCredentialPolicy = (invocation) -> { + this.authenticationPolicyRef.set((HmacAuthenticationPolicy) invocation.callRealMethod()); + return this.authenticationPolicyRef.get(); + }; + doAnswer(createCommunicationClientCredentialPolicy).when(this.clientBuilder).createAuthenticationPolicy(any()); + + Answer createUserAgentPolicy = (invocation) -> { + this.userAgentPolicyRef.set(mock(UserAgentPolicy.class)); + return this.userAgentPolicyRef.get(); + }; + doAnswer(createUserAgentPolicy).when(this.clientBuilder).createUserAgentPolicy(any(), any(), any(), any()); + + Answer createRetryPolicy = (invocation) -> { + this.retryPolicyRef.set((RetryPolicy) invocation.callRealMethod()); + return this.retryPolicyRef.get(); + }; + doAnswer(createRetryPolicy).when(this.clientBuilder).createRetryPolicy(); + + Answer createCookiePolicy = (invocation) -> { + this.cookiePolicyRef.set((CookiePolicy) invocation.callRealMethod()); + return this.cookiePolicyRef.get(); + }; + doAnswer(createCookiePolicy).when(this.clientBuilder).createCookiePolicy(); + + Answer createHttpLoggingPolicy = (invocation) -> { + this.httpLoggingPolicyRef.set((HttpLoggingPolicy) invocation.callRealMethod()); + return this.httpLoggingPolicyRef.get(); + }; + doAnswer(createHttpLoggingPolicy).when(this.clientBuilder).createHttpLoggingPolicy(any()); + + Answer createDefaultHttpLogOptions = (invocation) -> { + this.defaultHttpLogOptionsRef.set((HttpLogOptions) invocation.callRealMethod()); + return this.defaultHttpLogOptionsRef.get(); + }; + doAnswer(createDefaultHttpLogOptions).when(this.clientBuilder).createDefaultHttpLogOptions(); + } + + void capturePhoneNumberAdminClientImpl() { + verify(this.clientBuilder, times(1)) + .createPhoneNumberAsyncClient(this.phoneNumberAdminClientArg.capture()); + } + + void captureHttpPipelineSettings() { + verify(this.clientBuilder, times(1)) + .createAuthenticationPolicy(this.credentialArg.capture()); + verify(this.clientBuilder, times(1)) + .createUserAgentPolicy( + this.uaPolicyAppIdArg.capture(), + this.uaPolicySdkNameArg.capture(), + this.uaPolicySdkVersionArg.capture(), + this.uaPolicyConfigArg.capture()); + verify(this.clientBuilder, times(1)) + .createHttpLoggingPolicy(this.httpLogOptionsArg.capture()); + } + } +} diff --git a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientPlaybackTest.java b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientPlaybackTest.java new file mode 100644 index 000000000000..3c723e6b30ba --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientPlaybackTest.java @@ -0,0 +1,340 @@ +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.Capability; +import com.azure.communication.administration.models.CreateSearchOptions; +import com.azure.communication.administration.models.CreateSearchResponse; +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.PhoneNumberSearch; +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.UpdateNumberCapabilitiesResponse; +import com.azure.communication.administration.models.UpdatePhoneNumberCapabilitiesResponse; +import com.azure.communication.common.PhoneNumber; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class PhoneNumberClientPlaybackTest extends PhoneNumberPlaybackTestBase { + @Test() + public void listAllPhoneNumbers() { + PagedIterable pagedIterable = this.getClient().listAllPhoneNumbers(LOCALE); + + assertNotNull(pagedIterable.iterator().next().getPhoneNumber()); + } + + @Test() + public void listPhonePlanGroups() { + PagedIterable pagedIterable = + this.getClient().listPhonePlanGroups(COUNTRY_CODE, LOCALE, true); + + assertNotNull(pagedIterable.iterator().next().getPhonePlanGroupId()); + } + + @Test() + public void listPhonePlans() { + PagedIterable pagedIterable = + this.getClient().listPhonePlans(COUNTRY_CODE, PHONE_PLAN_GROUP_ID, LOCALE); + + assertNotNull(pagedIterable.iterator().next().getPhonePlanId()); + } + + @Test() + public void listAllReleases() { + PagedIterable pagedIterable = this.getClient().listAllReleases(); + + assertNotNull(pagedIterable.iterator().next().getId()); + } + + @Test() + public void listAllSearches() { + PagedIterable pagedIterable = this.getClient().listAllSearches(); + + assertNotNull(pagedIterable.iterator().next().getId()); + } + + @Test() + public void listAllSupportedCountries() { + PagedIterable pagedIterable = this.getClient().listAllSupportedCountries(LOCALE); + + assertNotNull(pagedIterable.iterator().next().getCountryCode()); + } + + @Test() + public void getPhonePlanLocationOptions() { + LocationOptionsResponse response = + this.getClient().getPhonePlanLocationOptions(COUNTRY_CODE, PHONE_PLAN_GROUP_ID, PHONE_PLAN_ID, LOCALE); + + assertNotNull(response.getLocationOptions().getLabelId()); + } + + @Test() + public void getAllAreaCodes() { + List locationOptions = new ArrayList<>(); + LocationOptionsQuery query = new LocationOptionsQuery(); + query.setLabelId("state"); + query.setOptionsValue(LOCATION_OPTION_STATE); + locationOptions.add(query); + + query = new LocationOptionsQuery(); + query.setLabelId("city"); + query.setOptionsValue(LOCATION_OPTION_CITY); + locationOptions.add(query); + + AreaCodes areaCodes = + this.getClient().getAllAreaCodes("selection", COUNTRY_CODE, PHONE_PLAN_ID, locationOptions); + + assertTrue(areaCodes.getPrimaryAreaCodes().size() > 0); + } + + @Test() + public void getAllAreaCodesWithResponse() { + List locationOptions = new ArrayList<>(); + LocationOptionsQuery query = new LocationOptionsQuery(); + query.setLabelId("state"); + query.setOptionsValue(LOCATION_OPTION_STATE); + locationOptions.add(query); + + query = new LocationOptionsQuery(); + query.setLabelId("city"); + query.setOptionsValue(LOCATION_OPTION_CITY); + locationOptions.add(query); + + Response areaCodesResponse = this.getClient().getAllAreaCodesWithResponse( + "selection", COUNTRY_CODE, PHONE_PLAN_ID, locationOptions, Context.NONE); + + assertEquals(200, areaCodesResponse.getStatusCode()); + assertTrue(areaCodesResponse.getValue().getPrimaryAreaCodes().size() > 0); + } + + @Test() + public void updateCapabilities() { + List capabilitiesToAdd = new ArrayList<>(); + capabilitiesToAdd.add(Capability.INBOUND_CALLING); + + NumberUpdateCapabilities update = new NumberUpdateCapabilities(); + update.setAdd(capabilitiesToAdd); + + Map updateMap = new HashMap<>(); + updateMap.put(new PhoneNumber(PHONENUMBER_FOR_CAPABILITIES), update); + + UpdateNumberCapabilitiesResponse updateResponse = this.getClient().updateCapabilities(updateMap); + + assertNotNull(updateResponse.getCapabilitiesUpdateId()); + } + + @Test() + public void updateCapabilitiesWithResponse() { + List capabilitiesToAdd = new ArrayList<>(); + capabilitiesToAdd.add(Capability.INBOUND_CALLING); + + NumberUpdateCapabilities update = new NumberUpdateCapabilities(); + update.setAdd(capabilitiesToAdd); + + Map updateMap = new HashMap<>(); + updateMap.put(new PhoneNumber(PHONENUMBER_FOR_CAPABILITIES), update); + + Response response = + this.getClient().updateCapabilitiesWithResponse(updateMap, Context.NONE); + + assertEquals(200, response.getStatusCode()); + assertNotNull(response.getValue().getCapabilitiesUpdateId()); + } + + @Test() + public void getCapabilitiesUpdate() { + UpdatePhoneNumberCapabilitiesResponse updateResponse = + this.getClient().getCapabilitiesUpdate(CAPABILITIES_ID); + + assertNotNull(updateResponse.getCapabilitiesUpdateId()); + } + + @Test() + public void getCapabilitiesUpdateWithResponse() { + Response response = + this.getClient().getCapabilitiesUpdateWithResponse(CAPABILITIES_ID, Context.NONE); + + assertEquals(200, response.getStatusCode()); + assertNotNull(response.getValue().getCapabilitiesUpdateId()); + } + + @Test() + public void createSearch() { + List phonePlanIds = new ArrayList<>(); + phonePlanIds.add(PHONE_PLAN_ID); + + CreateSearchOptions createSearchOptions = new CreateSearchOptions(); + createSearchOptions + .setAreaCode(AREA_CODE_FOR_SEARCH) + .setDescription("318362fa-2b19-4062-92af-fa0673914f30") + .setDisplayName("318362fa-2b19-4062-92af-fa0673914f30") + .setPhonePlanIds(phonePlanIds) + .setQuantity(1); + + CreateSearchResponse createSearchResponse = this.getClient().createSearch(createSearchOptions); + + assertNotNull(createSearchResponse.getSearchId()); + } + + @Test() + public void createSearchWithResponse() { + List phonePlanIds = new ArrayList<>(); + phonePlanIds.add(PHONE_PLAN_ID); + + CreateSearchOptions createSearchOptions = new CreateSearchOptions(); + createSearchOptions + .setAreaCode(AREA_CODE_FOR_SEARCH) + .setDescription("318362fa-2b19-4062-92af-fa0673914f30") + .setDisplayName("318362fa-2b19-4062-92af-fa0673914f30") + .setPhonePlanIds(phonePlanIds) + .setQuantity(1); + + Response response = + this.getClient().createSearchWithResponse(createSearchOptions, Context.NONE); + + assertEquals(201, response.getStatusCode()); + assertNotNull(response.getValue().getSearchId()); + } + + @Test() + public void getSearchById() { + PhoneNumberSearch search = this.getClient().getSearchById(SEARCH_ID); + + assertEquals(SEARCH_ID, search.getSearchId()); + } + + @Test() + public void getSearchByIdWithResponse() { + Response response = this.getClient().getSearchByIdWithResponse(SEARCH_ID, Context.NONE); + + assertEquals(200, response.getStatusCode()); + assertEquals(SEARCH_ID, response.getValue().getSearchId()); + } + + @Test() + public void purchaseSearch() { + this.getClient().purchaseSearch(SEARCH_ID_TO_PURCHASE); + } + + @Test() + public void purchaseSearchWithResponse() { + Response response = this.getClient().purchaseSearchWithResponse(SEARCH_ID_TO_PURCHASE, Context.NONE); + + assertEquals(202, response.getStatusCode()); + } + + @Test() + public void cancelSearch() { + this.getClient().cancelSearch(SEARCH_ID_TO_CANCEL); + } + + @Test() + public void cancelSearchWithResponse() { + Response response = this.getClient().cancelSearchWithResponse(SEARCH_ID_TO_CANCEL, Context.NONE); + + assertEquals(202, response.getStatusCode()); + } + + @Test() + public void configureNumber() { + PhoneNumber number = new PhoneNumber(PHONENUMBER_TO_CONFIGURE); + PstnConfiguration pstnConfiguration = new PstnConfiguration(); + pstnConfiguration.setApplicationId("ApplicationId"); + pstnConfiguration.setAzurePstnTargetId("AzurePstnTargetId"); + pstnConfiguration.setCallbackUrl("https://callbackurl"); + + this.getClient().configureNumber(number, pstnConfiguration); + } + + @Test() + public void configureNumberWithResponse() { + PhoneNumber number = new PhoneNumber(PHONENUMBER_TO_CONFIGURE); + PstnConfiguration pstnConfiguration = new PstnConfiguration(); + pstnConfiguration.setApplicationId("ApplicationId"); + pstnConfiguration.setAzurePstnTargetId("AzurePstnTargetId"); + pstnConfiguration.setCallbackUrl("https://callbackurl"); + + Response response = this.getClient().configureNumberWithResponse(number, pstnConfiguration, Context.NONE); + + assertEquals(202, response.getStatusCode()); + } + + @Test() + public void getNumberConfiguration() { + PhoneNumber number = new PhoneNumber(PHONENUMBER_TO_GET_CONFIG); + + NumberConfigurationResponse numberConfig = this.getClient().getNumberConfiguration(number); + + assertEquals("ApplicationId", numberConfig.getPstnConfiguration().getApplicationId()); + } + + @Test() + public void getNumberConfigurationWithResponse() { + PhoneNumber number = new PhoneNumber(PHONENUMBER_TO_GET_CONFIG); + + Response response = + this.getClient().getNumberConfigurationWithResponse(number, Context.NONE); + + assertEquals(200, response.getStatusCode()); + assertEquals("ApplicationId", response.getValue().getPstnConfiguration().getApplicationId()); + } + + @Test() + public void unconfigureNumber() { + PhoneNumber number = new PhoneNumber(PHONENUMBER_TO_UNCONFIGURE); + this.getClient().unconfigureNumber(number); + } + + @Test() + public void unconfigureNumberWithResponse() { + PhoneNumber number = new PhoneNumber(PHONENUMBER_TO_UNCONFIGURE); + + Response response = this.getClient().unconfigureNumberWithResponse(number, Context.NONE); + + assertEquals(202, response.getStatusCode()); + } + + @Test() + public void releasePhoneNumbers() { + List phoneNumbers = new ArrayList<>(); + phoneNumbers.add(new PhoneNumber(PHONENUMBER_TO_RELEASE)); + + ReleaseResponse releaseResponse = this.getClient().releasePhoneNumbers(phoneNumbers); + + assertNotNull(releaseResponse.getReleaseId()); + } + + @Test() + public void releasePhoneNumbersWithResponse() { + List phoneNumbers = new ArrayList<>(); + phoneNumbers.add(new PhoneNumber(PHONENUMBER_TO_RELEASE)); + + Response response = + this.getClient().releasePhoneNumbersWithResponse(phoneNumbers, Context.NONE); + + assertEquals(200, response.getStatusCode()); + assertNotNull(response.getValue().getReleaseId()); + } + + private PhoneNumberClient getClient() { + return super.getClientBuilder().buildClient(); + } +} diff --git a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberPlaybackTestBase.java b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberPlaybackTestBase.java new file mode 100644 index 000000000000..8b657473f2cb --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberPlaybackTestBase.java @@ -0,0 +1,105 @@ +package com.azure.communication.administration; + +import com.azure.communication.common.CommunicationClientCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.netty.NettyAsyncHttpClientBuilder; +import com.azure.core.test.TestBase; +import com.azure.core.test.TestMode; +import com.azure.core.util.Configuration; + +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +import static org.junit.jupiter.api.Assertions.fail; + +public class PhoneNumberPlaybackTestBase extends TestBase { + private static final String PLAYBACK_ACCESS_KEY = "QWNjZXNzS2V5"; + private static final String PLAYBACK_ENDPOINT = "https://REDACTED.communication.azure.com"; + private static final String ENV_ACCESS_KEY = + Configuration.getGlobalConfiguration().get("COMMUNICATION_SERVICE_ACCESS_KEY"); + private static final String ENV_ENDPOINT = + Configuration.getGlobalConfiguration().get("COMMUNICATION_SERVICE_ENDPOINT"); + + protected static final String COUNTRY_CODE = + Configuration.getGlobalConfiguration().get("COUNTRY_CODE", "US"); + protected static final String LOCALE = + Configuration.getGlobalConfiguration().get("LOCALE", "en-us"); + protected static final String PHONE_PLAN_GROUP_ID = + Configuration.getGlobalConfiguration().get( + "PHONE_PLAN_GROUP_ID", "phone-plan-group-id-1"); + protected static final String PHONE_PLAN_ID = + Configuration.getGlobalConfiguration().get( + "PHONE_PLAN_ID", "phone-plan-id-1"); + protected static final String AREA_CODE_FOR_SEARCH = + Configuration.getGlobalConfiguration().get( + "AREA_CODE_FOR_SEARCH", "777"); + protected static final String SEARCH_ID = + Configuration.getGlobalConfiguration().get( + "SEARCH_ID", "search-id-1"); + protected static final String SEARCH_ID_TO_PURCHASE = + Configuration.getGlobalConfiguration().get( + "SEARCH_ID_TO_PURCHASE", "search-id-1"); + protected static final String SEARCH_ID_TO_CANCEL = + Configuration.getGlobalConfiguration().get( + "SEARCH_ID_TO_CANCEL", "search-id-2"); + protected static final String PHONENUMBER_TO_CONFIGURE = + Configuration.getGlobalConfiguration().get( + "PHONENUMBER_TO_CONFIGURE", "+17771234567"); + protected static final String PHONENUMBER_TO_GET_CONFIG = + Configuration.getGlobalConfiguration().get( + "PHONENUMBER_TO_GET_CONFIG", "+17771234567"); + protected static final String PHONENUMBER_TO_UNCONFIGURE = + Configuration.getGlobalConfiguration().get( + "PHONENUMBER_TO_UNCONFIGURE", "+17771234567"); + protected static final String PHONENUMBER_TO_RELEASE = + Configuration.getGlobalConfiguration().get( + "PHONENUMBER_TO_RELEASE", "+17771234567"); + protected static final String PHONENUMBER_FOR_CAPABILITIES = + Configuration.getGlobalConfiguration().get( + "PHONENUMBER_FOR_CAPABILITIES", "+17771234567"); + protected static final String CAPABILITIES_ID = + Configuration.getGlobalConfiguration().get( + "CAPABILITIES_ID", "capabilities-id-1"); + protected static final String LOCATION_OPTION_STATE = + Configuration.getGlobalConfiguration().get("LOCATION_OPTION_STATE", "CA"); + protected static final String LOCATION_OPTION_CITY = + Configuration.getGlobalConfiguration().get("LOCATION_OPTION_CITY", "NOAM-US-CA-LA"); + + protected PhoneNumberClientBuilder getClientBuilder() { + String endpoint; + HttpClient httpClient; + CommunicationClientCredential credential; + + if (getTestMode() == TestMode.PLAYBACK) { + httpClient = interceptorManager.getPlaybackClient(); + endpoint = PLAYBACK_ENDPOINT; + credential = this.createCommunicationClientCredential(PLAYBACK_ACCESS_KEY); + } else { + httpClient = new NettyAsyncHttpClientBuilder().build(); + endpoint = ENV_ENDPOINT; + credential = this.createCommunicationClientCredential(ENV_ACCESS_KEY); + } + + PhoneNumberClientBuilder builder = new PhoneNumberClientBuilder(); + builder + .httpClient(httpClient) + .endpoint(endpoint) + .credential(credential); + + if (getTestMode() == TestMode.RECORD) { + builder.addPolicy(interceptorManager.getRecordPolicy()); + } + + return builder; + } + + private CommunicationClientCredential createCommunicationClientCredential(String accessKey) { + try { + return new CommunicationClientCredential(accessKey); + } catch (NoSuchAlgorithmException | InvalidKeyException e) { + fail(e); + } + + return null; + } +} diff --git a/sdk/communication/azure-communication-administration/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/sdk/communication/azure-communication-administration/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 000000000000..1f0955d450f0 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/cancelSearch.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/cancelSearch.json new file mode 100644 index 000000000000..9c0d08a14216 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/cancelSearch.json @@ -0,0 +1,20 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/searches/search-id-2/cancel?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)" + }, + "Response" : { + "X-Processing-Time" : "2180ms", + "MS-CV" : "JyEciUCXxUCL6kA2f2qtFA.0", + "retry-after" : "0", + "X-Azure-Ref" : "0AX9pXwAAAAA/zlY4jVBMSKp3gq0ZdwsBWVZSMzBFREdFMDMxMQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "Content-Length" : "0", + "StatusCode" : "202", + "Date" : "Tue, 22 Sep 2020 04:35:15 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/cancelSearchWithResponse.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/cancelSearchWithResponse.json new file mode 100644 index 000000000000..b828efcf0e0e --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/cancelSearchWithResponse.json @@ -0,0 +1,20 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/searches/search-id-2/cancel?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)" + }, + "Response" : { + "X-Processing-Time" : "2180ms", + "MS-CV" : "JyEciUCXxUCL6kA2f2qtFA.0", + "retry-after" : "0", + "X-Azure-Ref" : "0AX9pXwAAAAA/zlY4jVBMSKp3gq0ZdwsBWVZSMzBFREdFMDMxMQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "Content-Length" : "0", + "StatusCode" : "202", + "Date" : "Tue, 22 Sep 2020 04:35:15 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/configureNumber.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/configureNumber.json new file mode 100644 index 000000000000..010d7f6bb53a --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/configureNumber.json @@ -0,0 +1,21 @@ +{ + "networkCallRecords" : [ { + "Method" : "PATCH", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/numberconfiguration/configure?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Processing-Time" : "111ms", + "MS-CV" : "AlNcymYci0KnUJlpFYJ7SQ.0", + "retry-after" : "0", + "X-Azure-Ref" : "0R3xpXwAAAADR0b9AJJ/fT4MZwVQ912XOWVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "Content-Length" : "0", + "StatusCode" : "202", + "Date" : "Tue, 22 Sep 2020 04:23:34 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/configureNumberWithResponse.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/configureNumberWithResponse.json new file mode 100644 index 000000000000..0b187667e67d --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/configureNumberWithResponse.json @@ -0,0 +1,21 @@ +{ + "networkCallRecords" : [ { + "Method" : "PATCH", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/numberconfiguration/configure?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Processing-Time" : "219ms", + "MS-CV" : "rVm/RharrEerHY2hUzKDSw.0", + "retry-after" : "0", + "X-Azure-Ref" : "0RXxpXwAAAAA/H8wY0GrvSaITi8Q5Mz9xWVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "Content-Length" : "0", + "StatusCode" : "202", + "Date" : "Tue, 22 Sep 2020 04:23:33 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/createSearch.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/createSearch.json new file mode 100644 index 000000000000..1167abf595c5 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/createSearch.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/searches?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "1529ms", + "MS-CV" : "TPdtsisaOU+qG8InRKRMsg.0", + "retry-after" : "0", + "X-Azure-Ref" : "0VXxpXwAAAABia5b180wgQ6BE18LRI25tWVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "201", + "Body" : "{\"searchId\":\"4b300fc8-d36c-4c10-a9ba-a296aa5ee305\"}", + "Date" : "Tue, 22 Sep 2020 04:23:50 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/createSearchWithResponse.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/createSearchWithResponse.json new file mode 100644 index 000000000000..31d6fd2c714f --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/createSearchWithResponse.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/searches?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "1908ms", + "MS-CV" : "iCPTyFxnGUasIRC0sjS6EA.0", + "retry-after" : "0", + "X-Azure-Ref" : "0UnxpXwAAAABYXg8D9ghBTbGgsb0s0ChSWVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "201", + "Body" : "{\"searchId\":\"5689cba3-0436-4917-8ce9-8841b2b2ee35\"}", + "Date" : "Tue, 22 Sep 2020 04:23:47 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/getAllAreaCodes.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getAllAreaCodes.json new file mode 100644 index 000000000000..195014d6b397 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getAllAreaCodes.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/countries/US/areacodes?locationType=selection&phonePlanId=phone-plan-id-1&api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "362ms", + "MS-CV" : "jTeh0Fpbsk+k+jEWqBqOEA.0", + "retry-after" : "0", + "X-Azure-Ref" : "0OnxpXwAAAAAFVOX2n/WcTqriYkoY9JuzWVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"primaryAreaCodes\":[\"777\"],\"secondaryAreaCodes\":[],\"nextLink\":null}", + "Date" : "Tue, 22 Sep 2020 04:23:22 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/getAllAreaCodesWithResponse.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getAllAreaCodesWithResponse.json new file mode 100644 index 000000000000..bec8e8e4e1d2 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getAllAreaCodesWithResponse.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/countries/US/areacodes?locationType=selection&phonePlanId=phone-plan-id-1&api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "863ms", + "MS-CV" : "7R1y2WeJ/EacjqqAUpikYQ.0", + "retry-after" : "0", + "X-Azure-Ref" : "0L3xpXwAAAABWTkQohIqGSb2EzUfQZaGlWVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"primaryAreaCodes\":[\"777\"],\"secondaryAreaCodes\":[],\"nextLink\":null}", + "Date" : "Tue, 22 Sep 2020 04:23:11 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/getCapabilitiesUpdate.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getCapabilitiesUpdate.json new file mode 100644 index 000000000000..b21b46a18167 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getCapabilitiesUpdate.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/capabilities/capabilities-id-1?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "1367ms", + "MS-CV" : "4EZnktsXRkWOjvW/rNuVjg.0", + "retry-after" : "0", + "X-Azure-Ref" : "0ioJpXwAAAAAZGoNaTEV1Q55RcXGoYnOZWVZSMzBFREdFMDQxMwA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"capabilitiesUpdateId\":\"capabilities-id-1\",\"createdAt\":\"2020-09-22T04:23:52.1185774+00:00\",\"capabilitiesUpdateStatus\":\"Complete\",\"phoneNumberCapabilitiesUpdates\":{\"+17771234567\":{\"add\":[\"InboundCalling\"],\"remove\":[]}}}", + "Date" : "Tue, 22 Sep 2020 04:50:19 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/getCapabilitiesUpdateWithResponse.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getCapabilitiesUpdateWithResponse.json new file mode 100644 index 000000000000..b21b46a18167 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getCapabilitiesUpdateWithResponse.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/capabilities/capabilities-id-1?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "1367ms", + "MS-CV" : "4EZnktsXRkWOjvW/rNuVjg.0", + "retry-after" : "0", + "X-Azure-Ref" : "0ioJpXwAAAAAZGoNaTEV1Q55RcXGoYnOZWVZSMzBFREdFMDQxMwA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"capabilitiesUpdateId\":\"capabilities-id-1\",\"createdAt\":\"2020-09-22T04:23:52.1185774+00:00\",\"capabilitiesUpdateStatus\":\"Complete\",\"phoneNumberCapabilitiesUpdates\":{\"+17771234567\":{\"add\":[\"InboundCalling\"],\"remove\":[]}}}", + "Date" : "Tue, 22 Sep 2020 04:50:19 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/getNumberConfiguration.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getNumberConfiguration.json new file mode 100644 index 000000000000..b209d46bf039 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getNumberConfiguration.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/numberconfiguration?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "111ms", + "MS-CV" : "VkbtYeLW/UCu3cmO0mlLow.0", + "retry-after" : "0", + "X-Azure-Ref" : "0RXxpXwAAAAAip43zYy9hQKnfk3RZ1OJ6WVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"pstnConfiguration\":{\"callbackUrl\":\"https://callbackurl\",\"applicationId\":\"ApplicationId\",\"azurePstnTargetId\":\"AzurePstnTargetId\"}}", + "Date" : "Tue, 22 Sep 2020 04:23:33 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/getNumberConfigurationWithResponse.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getNumberConfigurationWithResponse.json new file mode 100644 index 000000000000..8a93a955abb1 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getNumberConfigurationWithResponse.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/numberconfiguration?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "111ms", + "MS-CV" : "VkbtYeLW/UCu3cmO0mlLow.0", + "retry-after" : "0", + "X-Azure-Ref" : "0RXxpXwAAAAAip43zYy9hQKnfk3RZ1OJ6WVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"pstnConfiguration\":{\"callbackUrl\":\"https://callbackurl\",\"applicationId\":\"ApplicationId\",\"azurePstnTargetId\":\"AzurePstnTargetId\"}}", + "Date" : "Tue, 22 Sep 2020 04:23:33 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/getPhonePlanLocationOptions.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getPhonePlanLocationOptions.json new file mode 100644 index 000000000000..cef33c707e21 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getPhonePlanLocationOptions.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/countries/US/phoneplangroups/phone-plan-group-id-1/phoneplans/phone-plan-id-1/locationoptions?locale=en-us&api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "533ms", + "MS-CV" : "9kRv2Vx7c06HdPknQfPDlQ.0", + "retry-after" : "0", + "X-Azure-Ref" : "0RHxpXwAAAAAZigu1u8ssSKmjffwMtBCwWVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"locationOptions\":{\"labelId\":\"state\",\"labelName\":\"State\",\"options\":[{\"name\":\"AK\",\"value\":\"AK\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Anchorage\",\"value\":\"NOAM-US-AK-AN\",\"locationOptions\":[]}]}]},{\"name\":\"AL\",\"value\":\"AL\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Birmingham\",\"value\":\"NOAM-US-AL-BI\",\"locationOptions\":[]},{\"name\":\"Huntsville\",\"value\":\"NOAM-US-AL-HN\",\"locationOptions\":[]},{\"name\":\"Mobile\",\"value\":\"NOAM-US-AL-MO\",\"locationOptions\":[]},{\"name\":\"Montgomery\",\"value\":\"NOAM-US-AL-MN\",\"locationOptions\":[]}]}]},{\"name\":\"AR\",\"value\":\"AR\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Fort Smith\",\"value\":\"NOAM-US-AR-FS\",\"locationOptions\":[]},{\"name\":\"Jonesboro\",\"value\":\"NOAM-US-AR-JO\",\"locationOptions\":[]},{\"name\":\"Little Rock\",\"value\":\"NOAM-US-AR-LR\",\"locationOptions\":[]}]}]},{\"name\":\"AZ\",\"value\":\"AZ\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Phoenix\",\"value\":\"NOAM-US-AZ-PH\",\"locationOptions\":[]}]}]},{\"name\":\"CA\",\"value\":\"CA\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Fresno\",\"value\":\"NOAM-US-CA-FR\",\"locationOptions\":[]},{\"name\":\"Los Angeles\",\"value\":\"NOAM-US-CA-LA\",\"locationOptions\":[]},{\"name\":\"Riverside\",\"value\":\"NOAM-US-CA-RI\",\"locationOptions\":[]},{\"name\":\"Sacramento\",\"value\":\"NOAM-US-CA-SA\",\"locationOptions\":[]},{\"name\":\"Salinas\",\"value\":\"NOAM-US-CA-SL\",\"locationOptions\":[]},{\"name\":\"San Diego\",\"value\":\"NOAM-US-CA-SD\",\"locationOptions\":[]},{\"name\":\"San Jose\",\"value\":\"NOAM-US-CA-SJ\",\"locationOptions\":[]},{\"name\":\"Santa Barbara\",\"value\":\"NOAM-US-CA-SB\",\"locationOptions\":[]},{\"name\":\"Santa Clarita\",\"value\":\"NOAM-US-CA-SC\",\"locationOptions\":[]},{\"name\":\"Santa Rosa\",\"value\":\"NOAM-US-CA-SR\",\"locationOptions\":[]},{\"name\":\"Stockton\",\"value\":\"NOAM-US-CA-ST\",\"locationOptions\":[]}]}]},{\"name\":\"CL\",\"value\":\"CL\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Washington DC\",\"value\":\"NOAM-US-CL-DC\",\"locationOptions\":[]}]}]},{\"name\":\"CO\",\"value\":\"CO\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Denver\",\"value\":\"NOAM-US-CO-DE\",\"locationOptions\":[]},{\"name\":\"Grand Junction\",\"value\":\"NOAM-US-CO-GJ\",\"locationOptions\":[]},{\"name\":\"Pueblo\",\"value\":\"NOAM-US-CO-PU\",\"locationOptions\":[]}]}]},{\"name\":\"CT\",\"value\":\"CT\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Bridgeport\",\"value\":\"NOAM-US-CT-BR\",\"locationOptions\":[]},{\"name\":\"Hartford\",\"value\":\"NOAM-US-CT-HA\",\"locationOptions\":[]}]}]},{\"name\":\"DE\",\"value\":\"DE\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Wilmington\",\"value\":\"NOAM-US-DE-WI\",\"locationOptions\":[]}]}]},{\"name\":\"FL\",\"value\":\"FL\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Cape Coral\",\"value\":\"NOAM-US-FL-CC\",\"locationOptions\":[]},{\"name\":\"Daytona Beach\",\"value\":\"NOAM-US-FL-DB\",\"locationOptions\":[]},{\"name\":\"Fort Lauderdale\",\"value\":\"NOAM-US-FL-FL\",\"locationOptions\":[]},{\"name\":\"Gainesville\",\"value\":\"NOAM-US-FL-GA\",\"locationOptions\":[]},{\"name\":\"Jacksonville\",\"value\":\"NOAM-US-FL-JA\",\"locationOptions\":[]},{\"name\":\"Lakeland\",\"value\":\"NOAM-US-FL-LA\",\"locationOptions\":[]},{\"name\":\"Miami\",\"value\":\"NOAM-US-FL-MI\",\"locationOptions\":[]},{\"name\":\"Orlando\",\"value\":\"NOAM-US-FL-OR\",\"locationOptions\":[]},{\"name\":\"Port St Lucie\",\"value\":\"NOAM-US-FL-PS\",\"locationOptions\":[]},{\"name\":\"Sarasota\",\"value\":\"NOAM-US-FL-SA\",\"locationOptions\":[]},{\"name\":\"Tallahassee\",\"value\":\"NOAM-US-FL-TA\",\"locationOptions\":[]},{\"name\":\"West Palm Beach\",\"value\":\"NOAM-US-FL-WP\",\"locationOptions\":[]}]}]},{\"name\":\"GA\",\"value\":\"GA\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Albany\",\"value\":\"NOAM-US-GA-AL\",\"locationOptions\":[]},{\"name\":\"Atlanta\",\"value\":\"NOAM-US-GA-AT\",\"locationOptions\":[]},{\"name\":\"Augusta\",\"value\":\"NOAM-US-GA-AU\",\"locationOptions\":[]},{\"name\":\"Macon\",\"value\":\"NOAM-US-GA-MA\",\"locationOptions\":[]},{\"name\":\"Savannah\",\"value\":\"NOAM-US-GA-SA\",\"locationOptions\":[]}]}]},{\"name\":\"HI\",\"value\":\"HI\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Honolulu\",\"value\":\"NOAM-US-HI-HO\",\"locationOptions\":[]}]}]},{\"name\":\"IA\",\"value\":\"IA\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Cedar Rapids\",\"value\":\"NOAM-US-IA-CR\",\"locationOptions\":[]},{\"name\":\"Davenport\",\"value\":\"NOAM-US-IA-DA\",\"locationOptions\":[]},{\"name\":\"Mason City\",\"value\":\"NOAM-US-IA-MC\",\"locationOptions\":[]}]}]},{\"name\":\"ID\",\"value\":\"ID\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Boise\",\"value\":\"NOAM-US-ID-BO\",\"locationOptions\":[]}]}]},{\"name\":\"IL\",\"value\":\"IL\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Alton\",\"value\":\"NOAM-US-IL-AL\",\"locationOptions\":[]},{\"name\":\"Aurora\",\"value\":\"NOAM-US-IL-AU\",\"locationOptions\":[]},{\"name\":\"Big Rock\",\"value\":\"NOAM-US-IL-BK\",\"locationOptions\":[]},{\"name\":\"Champaign\",\"value\":\"NOAM-US-IL-CA\",\"locationOptions\":[]},{\"name\":\"Chicago\",\"value\":\"NOAM-US-IL-CH\",\"locationOptions\":[]},{\"name\":\"Cicero\",\"value\":\"NOAM-US-IL-CI\",\"locationOptions\":[]},{\"name\":\"Rock Island\",\"value\":\"NOAM-US-IL-RI\",\"locationOptions\":[]},{\"name\":\"Waukegan\",\"value\":\"NOAM-US-IL-WK\",\"locationOptions\":[]}]}]},{\"name\":\"IN\",\"value\":\"IN\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Evansville\",\"value\":\"NOAM-US-IN-EV\",\"locationOptions\":[]},{\"name\":\"Fort Wayne\",\"value\":\"NOAM-US-IN-FW\",\"locationOptions\":[]},{\"name\":\"Gary\",\"value\":\"NOAM-US-IN-GA\",\"locationOptions\":[]},{\"name\":\"Indianapolis\",\"value\":\"NOAM-US-IN-IN\",\"locationOptions\":[]},{\"name\":\"South Bend\",\"value\":\"NOAM-US-IN-SB\",\"locationOptions\":[]}]}]},{\"name\":\"KS\",\"value\":\"KS\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Dodge City\",\"value\":\"NOAM-US-KS-DC\",\"locationOptions\":[]},{\"name\":\"Kansas City\",\"value\":\"NOAM-US-KS-KS\",\"locationOptions\":[]},{\"name\":\"Topeka\",\"value\":\"NOAM-US-KS-TO\",\"locationOptions\":[]},{\"name\":\"Wichita\",\"value\":\"NOAM-US-KS-WI\",\"locationOptions\":[]}]}]},{\"name\":\"KY\",\"value\":\"KY\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Ashland\",\"value\":\"NOAM-US-KY-AS\",\"locationOptions\":[]},{\"name\":\"Lexington\",\"value\":\"NOAM-US-KY-LE\",\"locationOptions\":[]},{\"name\":\"Louisville\",\"value\":\"NOAM-US-KY-LO\",\"locationOptions\":[]}]}]},{\"name\":\"LA\",\"value\":\"LA\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Baton Rouge\",\"value\":\"NOAM-US-LA-BR\",\"locationOptions\":[]},{\"name\":\"Lafayette\",\"value\":\"NOAM-US-LA-LA\",\"locationOptions\":[]},{\"name\":\"New Orleans\",\"value\":\"NOAM-US-LA-NO\",\"locationOptions\":[]},{\"name\":\"Shreveport\",\"value\":\"NOAM-US-LA-SH\",\"locationOptions\":[]}]}]},{\"name\":\"MA\",\"value\":\"MA\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Chicopee\",\"value\":\"NOAM-US-MA-CH\",\"locationOptions\":[]}]}]},{\"name\":\"ME\",\"value\":\"ME\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Portland\",\"value\":\"NOAM-US-ME-PO\",\"locationOptions\":[]}]}]},{\"name\":\"MI\",\"value\":\"MI\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Detroit\",\"value\":\"NOAM-US-MI-DE\",\"locationOptions\":[]},{\"name\":\"Flint\",\"value\":\"NOAM-US-MI-FL\",\"locationOptions\":[]},{\"name\":\"Grand Rapids\",\"value\":\"NOAM-US-MI-GP\",\"locationOptions\":[]},{\"name\":\"Grant\",\"value\":\"NOAM-US-MI-GR\",\"locationOptions\":[]},{\"name\":\"Lansing\",\"value\":\"NOAM-US-MI-LA\",\"locationOptions\":[]},{\"name\":\"Saginaw\",\"value\":\"NOAM-US-MI-SA\",\"locationOptions\":[]},{\"name\":\"Sault Ste Marie\",\"value\":\"NOAM-US-MI-SS\",\"locationOptions\":[]},{\"name\":\"Troy\",\"value\":\"NOAM-US-MI-TR\",\"locationOptions\":[]}]}]},{\"name\":\"MN\",\"value\":\"MN\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Duluth\",\"value\":\"NOAM-US-MN-DU\",\"locationOptions\":[]},{\"name\":\"Minneapolis\",\"value\":\"NOAM-US-MN-MI\",\"locationOptions\":[]},{\"name\":\"St. Paul\",\"value\":\"NOAM-US-MN-SP\",\"locationOptions\":[]}]}]},{\"name\":\"MO\",\"value\":\"MO\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Columbia\",\"value\":\"NOAM-US-MO-CO\",\"locationOptions\":[]},{\"name\":\"Kansas City\",\"value\":\"NOAM-US-MO-KS\",\"locationOptions\":[]},{\"name\":\"Marshall\",\"value\":\"NOAM-US-MO-MA\",\"locationOptions\":[]},{\"name\":\"Springfield\",\"value\":\"NOAM-US-MO-SP\",\"locationOptions\":[]},{\"name\":\"St. Charles\",\"value\":\"NOAM-US-MO-SC\",\"locationOptions\":[]},{\"name\":\"St. Louis\",\"value\":\"NOAM-US-MO-SL\",\"locationOptions\":[]}]}]},{\"name\":\"MS\",\"value\":\"MS\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Biloxi\",\"value\":\"NOAM-US-MS-BI\",\"locationOptions\":[]},{\"name\":\"Jackson\",\"value\":\"NOAM-US-MS-JA\",\"locationOptions\":[]},{\"name\":\"Starkville\",\"value\":\"NOAM-US-MS-ST\",\"locationOptions\":[]}]}]},{\"name\":\"MT\",\"value\":\"MT\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Billings\",\"value\":\"NOAM-US-MT-BI\",\"locationOptions\":[]}]}]},{\"name\":\"NC\",\"value\":\"NC\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Charlotte\",\"value\":\"NOAM-US-NC-CH\",\"locationOptions\":[]},{\"name\":\"Fayetteville\",\"value\":\"NOAM-US-NC-FA\",\"locationOptions\":[]},{\"name\":\"Greensboro\",\"value\":\"NOAM-US-NC-GR\",\"locationOptions\":[]},{\"name\":\"Raleigh\",\"value\":\"NOAM-US-NC-RA\",\"locationOptions\":[]}]}]},{\"name\":\"ND\",\"value\":\"ND\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Fargo\",\"value\":\"NOAM-US-ND-FA\",\"locationOptions\":[]}]}]},{\"name\":\"NE\",\"value\":\"NE\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Kearney\",\"value\":\"NOAM-US-NE-KE\",\"locationOptions\":[]},{\"name\":\"Omaha\",\"value\":\"NOAM-US-NE-OM\",\"locationOptions\":[]}]}]},{\"name\":\"NJ\",\"value\":\"NJ\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Atlantic City\",\"value\":\"NOAM-US-NJ-AC\",\"locationOptions\":[]},{\"name\":\"Camden\",\"value\":\"NOAM-US-NJ-CA\",\"locationOptions\":[]},{\"name\":\"Newark\",\"value\":\"NOAM-US-NJ-NE\",\"locationOptions\":[]}]}]},{\"name\":\"NM\",\"value\":\"NM\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Las Cruces\",\"value\":\"NOAM-US-NM-LC\",\"locationOptions\":[]}]}]},{\"name\":\"NV\",\"value\":\"NV\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Las Vegas\",\"value\":\"NOAM-US-NV-LV\",\"locationOptions\":[]},{\"name\":\"Reno\",\"value\":\"NOAM-US-NV-RE\",\"locationOptions\":[]}]}]},{\"name\":\"NY\",\"value\":\"NY\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Albany\",\"value\":\"NOAM-US-NY-AL\",\"locationOptions\":[]},{\"name\":\"Elmira\",\"value\":\"NOAM-US-NY-EL\",\"locationOptions\":[]},{\"name\":\"Kingston\",\"value\":\"NOAM-US-NY-KI\",\"locationOptions\":[]},{\"name\":\"New York City\",\"value\":\"NOAM-US-NY-NY\",\"locationOptions\":[]},{\"name\":\"Niagara Falls\",\"value\":\"NOAM-US-NY-NF\",\"locationOptions\":[]},{\"name\":\"Rochester\",\"value\":\"NOAM-US-NY-RO\",\"locationOptions\":[]},{\"name\":\"Syracuse\",\"value\":\"NOAM-US-NY-SY\",\"locationOptions\":[]}]}]},{\"name\":\"OH\",\"value\":\"OH\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Akron\",\"value\":\"NOAM-US-OH-AK\",\"locationOptions\":[]},{\"name\":\"Cincinnati\",\"value\":\"NOAM-US-OH-CI\",\"locationOptions\":[]},{\"name\":\"Columbus\",\"value\":\"NOAM-US-OH-CO\",\"locationOptions\":[]},{\"name\":\"Dayton\",\"value\":\"NOAM-US-OH-DA\",\"locationOptions\":[]},{\"name\":\"Toledo\",\"value\":\"NOAM-US-OH-TO\",\"locationOptions\":[]}]}]},{\"name\":\"OK\",\"value\":\"OK\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Lawton\",\"value\":\"NOAM-US-OK-LA\",\"locationOptions\":[]},{\"name\":\"Oklahoma City\",\"value\":\"NOAM-US-OK-OC\",\"locationOptions\":[]},{\"name\":\"Tulsa\",\"value\":\"NOAM-US-OK-TU\",\"locationOptions\":[]}]}]},{\"name\":\"PA\",\"value\":\"PA\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Erie\",\"value\":\"NOAM-US-PA-ER\",\"locationOptions\":[]},{\"name\":\"Lancaster\",\"value\":\"NOAM-US-PA-LA\",\"locationOptions\":[]},{\"name\":\"New Castle\",\"value\":\"NOAM-US-PA-NC\",\"locationOptions\":[]},{\"name\":\"Philadelphia\",\"value\":\"NOAM-US-PA-PI\",\"locationOptions\":[]},{\"name\":\"Pittsburgh\",\"value\":\"NOAM-US-PA-PT\",\"locationOptions\":[]},{\"name\":\"Scranton\",\"value\":\"NOAM-US-PA-SC\",\"locationOptions\":[]}]}]},{\"name\":\"RI\",\"value\":\"RI\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Providence\",\"value\":\"NOAM-US-RI-PR\",\"locationOptions\":[]}]}]},{\"name\":\"SC\",\"value\":\"SC\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Charleston\",\"value\":\"NOAM-US-SC-CH\",\"locationOptions\":[]},{\"name\":\"Columbia\",\"value\":\"NOAM-US-SC-CO\",\"locationOptions\":[]},{\"name\":\"Greenville\",\"value\":\"NOAM-US-SC-GR\",\"locationOptions\":[]}]}]},{\"name\":\"SD\",\"value\":\"SD\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Sioux Falls\",\"value\":\"NOAM-US-SD-SF\",\"locationOptions\":[]}]}]},{\"name\":\"TN\",\"value\":\"TN\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Chattanooga\",\"value\":\"NOAM-US-TN-CH\",\"locationOptions\":[]},{\"name\":\"Clarksville\",\"value\":\"NOAM-US-TN-CL\",\"locationOptions\":[]},{\"name\":\"Jackson\",\"value\":\"NOAM-US-TN-JA\",\"locationOptions\":[]},{\"name\":\"Knoxville\",\"value\":\"NOAM-US-TN-KN\",\"locationOptions\":[]},{\"name\":\"Memphis\",\"value\":\"NOAM-US-TN-ME\",\"locationOptions\":[]},{\"name\":\"Nashville\",\"value\":\"NOAM-US-TN-NA\",\"locationOptions\":[]}]}]},{\"name\":\"TX\",\"value\":\"TX\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Austin\",\"value\":\"NOAM-US-TX-AU\",\"locationOptions\":[]},{\"name\":\"Corpus Christi\",\"value\":\"NOAM-US-TX-CC\",\"locationOptions\":[]},{\"name\":\"Denton\",\"value\":\"NOAM-US-TX-DE\",\"locationOptions\":[]},{\"name\":\"El Paso\",\"value\":\"NOAM-US-TX-EP\",\"locationOptions\":[]},{\"name\":\"Galveston\",\"value\":\"NOAM-US-TX-GA\",\"locationOptions\":[]},{\"name\":\"Hamilton\",\"value\":\"NOAM-US-TX-HA\",\"locationOptions\":[]},{\"name\":\"Houston\",\"value\":\"NOAM-US-TX-HO\",\"locationOptions\":[]},{\"name\":\"Lubbock\",\"value\":\"NOAM-US-TX-LU\",\"locationOptions\":[]},{\"name\":\"Tyler\",\"value\":\"NOAM-US-TX-TY\",\"locationOptions\":[]}]}]},{\"name\":\"UT\",\"value\":\"UT\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Salt Lake City\",\"value\":\"NOAM-US-UT-SL\",\"locationOptions\":[]},{\"name\":\"St. George\",\"value\":\"NOAM-US-UT-SG\",\"locationOptions\":[]}]}]},{\"name\":\"VA\",\"value\":\"VA\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Lynchburg\",\"value\":\"NOAM-US-VA-LY\",\"locationOptions\":[]},{\"name\":\"Richmond\",\"value\":\"NOAM-US-VA-RI\",\"locationOptions\":[]},{\"name\":\"Roanoke\",\"value\":\"NOAM-US-VA-RO\",\"locationOptions\":[]},{\"name\":\"Virginia Beach\",\"value\":\"NOAM-US-VA-VB\",\"locationOptions\":[]}]}]},{\"name\":\"VT\",\"value\":\"VT\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Bennington\",\"value\":\"NOAM-US-VT-BE\",\"locationOptions\":[]},{\"name\":\"Brattleboro\",\"value\":\"NOAM-US-VT-BR\",\"locationOptions\":[]},{\"name\":\"Burlington\",\"value\":\"NOAM-US-VT-BU\",\"locationOptions\":[]},{\"name\":\"Middlebury\",\"value\":\"NOAM-US-VT-MB\",\"locationOptions\":[]},{\"name\":\"Montpelier\",\"value\":\"NOAM-US-VT-MP\",\"locationOptions\":[]},{\"name\":\"Newport\",\"value\":\"NOAM-US-VT-NE\",\"locationOptions\":[]}]}]},{\"name\":\"WI\",\"value\":\"WI\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Green Bay\",\"value\":\"NOAM-US-WI-GB\",\"locationOptions\":[]},{\"name\":\"Kenosha\",\"value\":\"NOAM-US-WI-KE\",\"locationOptions\":[]},{\"name\":\"Madison\",\"value\":\"NOAM-US-WI-MA\",\"locationOptions\":[]},{\"name\":\"Milwaukee\",\"value\":\"NOAM-US-WI-MI\",\"locationOptions\":[]}]}]},{\"name\":\"WV\",\"value\":\"WV\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Charleston\",\"value\":\"NOAM-US-WV-CH\",\"locationOptions\":[]}]}]},{\"name\":\"WY\",\"value\":\"WY\",\"locationOptions\":[{\"labelId\":\"city\",\"labelName\":\"City\",\"options\":[{\"name\":\"Laramie\",\"value\":\"NOAM-US-WY-LA\",\"locationOptions\":[]}]}]}]}}", + "Date" : "Tue, 22 Sep 2020 04:23:32 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/getSearchById.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getSearchById.json new file mode 100644 index 000000000000..9b209d8ec463 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getSearchById.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/searches/search-id-1?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "826ms", + "MS-CV" : "PFFFWzMLUkGw4eanwtCtGA.0", + "retry-after" : "0", + "X-Azure-Ref" : "0QnxpXwAAAABqH1xGXYpFT47R4f9VRD8ZWVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"searchId\":\"search-id-1\",\"displayName\":\"testsearch20200021\",\"createdAt\":\"2020-09-21T22:57:25.353001+00:00\",\"description\":\"testsearch20200021\",\"phonePlanIds\":[\"phone-plan-id-1\"],\"areaCode\":\"777\",\"quantity\":1,\"locationOptions\":[],\"status\":\"Success\",\"phoneNumbers\":[\"+17771234567\"],\"reservationExpiryDate\":\"2020-09-21T23:13:42.1721905+00:00\"}", + "Date" : "Tue, 22 Sep 2020 04:23:30 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/getSearchByIdWithResponse.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getSearchByIdWithResponse.json new file mode 100644 index 000000000000..27a37d8c0bf1 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/getSearchByIdWithResponse.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/searches/search-id-1?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "780ms", + "MS-CV" : "W5pJXXQHHE+zpYoSNw6s+Q.0", + "retry-after" : "0", + "X-Azure-Ref" : "0P3xpXwAAAAChXWEiQLP1QbuUKsn8TvaKWVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"searchId\":\"search-id-1\",\"displayName\":\"testsearch20200021\",\"createdAt\":\"2020-09-21T22:57:25.353001+00:00\",\"description\":\"testsearch20200021\",\"phonePlanIds\":[\"phone-plan-id-1\"],\"areaCode\":\"777\",\"quantity\":1,\"locationOptions\":[],\"status\":\"Success\",\"phoneNumbers\":[\"+17771234567\"],\"reservationExpiryDate\":\"2020-09-21T23:13:42.1721905+00:00\"}", + "Date" : "Tue, 22 Sep 2020 04:23:27 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/listAllPhoneNumbers.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/listAllPhoneNumbers.json new file mode 100644 index 000000000000..08fc9649bd81 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/listAllPhoneNumbers.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/phonenumbers?locale=en-us&api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "754ms", + "MS-CV" : "0ZbK/21pm0aqHRtkP9IY9Q.0", + "retry-after" : "0", + "X-Azure-Ref" : "0RXxpXwAAAABGqCLf4L74SZUVmMJpZiI3WVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"phoneNumbers\":[{\"phoneNumber\":\"+17771234567\",\"acquiredCapabilities\":[\"Azure\",\"InboundCalling\",\"ThirdPartyAppAssignment\",\"Geographic\"],\"availableCapabilities\":[\"ConferenceAssignment\",\"Geographic\",\"FirstPartyAppAssignment\",\"ThirdPartyAppAssignment\",\"Azure\",\"Office365\",\"InboundCalling\",\"OutboundCalling\"],\"assignmentStatus\":\"Unassigned\",\"placeName\":\"Los Angeles, United States\",\"activationState\":\"Activated\"}],\"nextLink\":null}", + "Date" : "Tue, 22 Sep 2020 04:23:33 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/listAllReleases.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/listAllReleases.json new file mode 100644 index 000000000000..15bfd85b32ba --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/listAllReleases.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/releases?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "556ms", + "MS-CV" : "ng5PWjRH1UufMooTpHKj9A.0", + "retry-after" : "0", + "X-Azure-Ref" : "0WXxpXwAAAADS9CsLD4nhQqW9AAfc9VhpWVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"entities\":[{\"id\":\"2a893091-d997-40f5-ae36-69228799d9a5\",\"createdAt\":\"2020-09-22T04:23:36.1626946+00:00\",\"displayName\":\"\",\"quantity\":1,\"quantityObtained\":1,\"status\":\"Pending\"},{\"id\":\"1cbc4c35-8318-413c-a4d9-7390aae6bc5a\",\"createdAt\":\"2020-09-22T04:23:25.9748532+00:00\",\"displayName\":\"\",\"quantity\":1,\"quantityObtained\":1,\"status\":\"Failed\"}],\"nextLink\":null}", + "Date" : "Tue, 22 Sep 2020 04:23:53 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/listAllSearches.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/listAllSearches.json new file mode 100644 index 000000000000..1024ad5d8649 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/listAllSearches.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/searches?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "663ms", + "MS-CV" : "+rPsJJosJ0CjM3CZEVmA4Q.0", + "retry-after" : "0", + "X-Azure-Ref" : "0Q3xpXwAAAADlHpcJXzt4Ro/sgAuOKDm4WVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"entities\":[{\"id\":\"search-id-1\",\"createdAt\":\"2020-09-21T22:57:25.353001+00:00\",\"displayName\":\"testsearch20200021\",\"quantity\":1,\"quantityObtained\":1,\"status\":\"Success\"},{\"id\":\"bf9fb6f1-deff-4172-9cc7-4db5afb36995\",\"createdAt\":\"2020-09-21T22:43:32.8257185+00:00\",\"displayName\":\"testsearch20200021\",\"quantity\":1,\"quantityObtained\":0,\"status\":\"Error\"},{\"id\":\"51eacc91-dbda-4443-b770-7c9da4868ed7\",\"createdAt\":\"2020-09-21T22:24:27.3157678+00:00\",\"displayName\":\"testsearch20200021\",\"quantity\":1,\"quantityObtained\":0,\"status\":\"Error\"},{\"id\":\"e84b5a67-fa0e-4866-9fc9-edef5c422af8\",\"createdAt\":\"2020-09-21T22:19:30.5279054+00:00\",\"displayName\":\"testsearch20200021\",\"quantity\":1,\"quantityObtained\":0,\"status\":\"Error\"},{\"id\":\"068fc84c-84dc-4a75-9735-bb58b790560c\",\"createdAt\":\"2020-09-21T21:48:34.7679791+00:00\",\"displayName\":\"testsearch20200021\",\"quantity\":1,\"quantityObtained\":0,\"status\":\"Error\"}],\"nextLink\":null}", + "Date" : "Tue, 22 Sep 2020 04:23:31 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/listAllSupportedCountries.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/listAllSupportedCountries.json new file mode 100644 index 000000000000..2a0f0168d61e --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/listAllSupportedCountries.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/countries?locale=en-us&api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "697ms", + "MS-CV" : "XgD2jD2Zd0WCfrxBvBWi0w.0", + "retry-after" : "0", + "X-Azure-Ref" : "0VHxpXwAAAAAzfAp5Uj81SrWuYPNeKAz4WVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"countries\":[{\"localizedName\":\"Australia\",\"countryCode\":\"AU\"},{\"localizedName\":\"Japan\",\"countryCode\":\"JP\"},{\"localizedName\":\"United States\",\"countryCode\":\"US\"}],\"nextLink\":null}", + "Date" : "Tue, 22 Sep 2020 04:23:49 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/listPhonePlanGroups.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/listPhonePlanGroups.json new file mode 100644 index 000000000000..805cb0a1561b --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/listPhonePlanGroups.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/countries/US/phoneplangroups?locale=en-us&includeRateInformation=true&api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "2726ms", + "MS-CV" : "Ld/dAmH64UuYDz9SprE/IA.0", + "retry-after" : "0", + "X-Azure-Ref" : "0OnxpXwAAAABOjyv6VYUgRoXEK5XCD85BWVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"phonePlanGroups\":[{\"phonePlanGroupId\":\"phone-plan-group-id-1\",\"phoneNumberType\":\"Geographic\",\"localizedName\":\"Azure - Geographic\",\"localizedDescription\":\"These are numbers used by Azure resources.\",\"rateInformation\":{\"monthlyRate\":0.0,\"currencyType\":\"USD\",\"rateErrorMessage\":\"The specified phone number is not eligible for purchase.\"}},{\"phonePlanGroupId\":\"d47a0cdc-8dc1-4e82-a29b-39067f7fc317\",\"phoneNumberType\":\"TollFree\",\"localizedName\":\"Azure - Toll Free\",\"localizedDescription\":\"These are toll free numbers used by Azure resources.\",\"rateInformation\":{\"monthlyRate\":0.0,\"currencyType\":\"USD\",\"rateErrorMessage\":\"The specified phone number is not eligible for purchase.\"}}],\"nextLink\":null}", + "Date" : "Tue, 22 Sep 2020 04:23:25 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/listPhonePlans.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/listPhonePlans.json new file mode 100644 index 000000000000..54d756b040e0 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/listPhonePlans.json @@ -0,0 +1,22 @@ +{ + "networkCallRecords" : [ { + "Method" : "GET", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/countries/US/phoneplangroups/phone-plan-group-id-1/phoneplans?locale=en-us&api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "493ms", + "MS-CV" : "PHyHjd8btU65uKaSCb7bbA.0", + "retry-after" : "0", + "X-Azure-Ref" : "0R3xpXwAAAAA0psO7t4yrQJdHH/Ic2taXWVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"phonePlans\":[{\"phonePlanId\":\"27b53eec-8ff4-4070-8900-fbeaabfd158a\",\"localizedName\":\"Outbound Only PSTN - Geographic\",\"locationType\":\"Selection\",\"areaCodes\":[],\"capabilities\":[\"Azure\",\"OutboundCalling\",\"ThirdPartyAppAssignment\",\"Geographic\"],\"maximumSearchSize\":100},{\"phonePlanId\":\"phone-plan-id-1\",\"localizedName\":\"Inbound Only PSTN - Geographic\",\"locationType\":\"Selection\",\"areaCodes\":[],\"capabilities\":[\"Azure\",\"InboundCalling\",\"ThirdPartyAppAssignment\",\"Geographic\"],\"maximumSearchSize\":100}],\"nextLink\":null}", + "Date" : "Tue, 22 Sep 2020 04:23:35 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/purchaseSearch.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/purchaseSearch.json new file mode 100644 index 000000000000..fa9bd4d65a97 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/purchaseSearch.json @@ -0,0 +1,20 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/searches/search-id-1/purchase?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)" + }, + "Response" : { + "X-Processing-Time" : "974ms", + "MS-CV" : "rT3oEz+mOEilM2AB8V1xBQ.0", + "retry-after" : "0", + "X-Azure-Ref" : "0VnxpXwAAAACIK2T71wNCR5nYacbgOG2/WVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "Content-Length" : "0", + "StatusCode" : "202", + "Date" : "Tue, 22 Sep 2020 04:23:51 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/purchaseSearchWithResponse.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/purchaseSearchWithResponse.json new file mode 100644 index 000000000000..87d720af4e26 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/purchaseSearchWithResponse.json @@ -0,0 +1,20 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/searches/search-id-1/purchase?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)" + }, + "Response" : { + "X-Processing-Time" : "974ms", + "MS-CV" : "rT3oEz+mOEilM2AB8V1xBQ.0", + "retry-after" : "0", + "X-Azure-Ref" : "0VnxpXwAAAACIK2T71wNCR5nYacbgOG2/WVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "Content-Length" : "0", + "StatusCode" : "202", + "Date" : "Tue, 22 Sep 2020 04:23:51 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/releasePhoneNumbers.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/releasePhoneNumbers.json new file mode 100644 index 000000000000..a72405d15911 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/releasePhoneNumbers.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/releases?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "1072ms", + "MS-CV" : "hq1XzlPxzUmtJVSE+FbrdA.0", + "retry-after" : "0", + "X-Azure-Ref" : "0R3xpXwAAAAAqi4SCHk54SrmO/RX/dJorWVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"releaseId\":\"2a893091-d997-40f5-ae36-69228799d9a5\"}", + "Date" : "Tue, 22 Sep 2020 04:23:36 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/releasePhoneNumbersWithResponse.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/releasePhoneNumbersWithResponse.json new file mode 100644 index 000000000000..bb3be37b4156 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/releasePhoneNumbersWithResponse.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/releases?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "1347ms", + "MS-CV" : "B3L80if0GkKppBQaPMaWUA.0", + "retry-after" : "0", + "X-Azure-Ref" : "0PXxpXwAAAAAHuE0mBjdbT7yfjDMPpbKNWVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"releaseId\":\"1cbc4c35-8318-413c-a4d9-7390aae6bc5a\"}", + "Date" : "Tue, 22 Sep 2020 04:23:26 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/unconfigureNumber.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/unconfigureNumber.json new file mode 100644 index 000000000000..ae1be3f9cf1d --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/unconfigureNumber.json @@ -0,0 +1,21 @@ +{ + "networkCallRecords" : [ { + "Method" : "PATCH", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/numberconfiguration/unconfigure?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Processing-Time" : "129ms", + "MS-CV" : "Ppt2RXEEJ0CilpKk3AfoEw.0", + "retry-after" : "0", + "X-Azure-Ref" : "0SXxpXwAAAACzA2zcS3YsSbP9fYFrMoz/WVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "Content-Length" : "0", + "StatusCode" : "202", + "Date" : "Tue, 22 Sep 2020 04:23:36 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/unconfigureNumberWithResponse.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/unconfigureNumberWithResponse.json new file mode 100644 index 000000000000..826078fb6444 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/unconfigureNumberWithResponse.json @@ -0,0 +1,21 @@ +{ + "networkCallRecords" : [ { + "Method" : "PATCH", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/numberconfiguration/unconfigure?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)", + "Content-Type" : "application/json" + }, + "Response" : { + "X-Processing-Time" : "129ms", + "MS-CV" : "Ppt2RXEEJ0CilpKk3AfoEw.0", + "retry-after" : "0", + "X-Azure-Ref" : "0SXxpXwAAAACzA2zcS3YsSbP9fYFrMoz/WVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "Content-Length" : "0", + "StatusCode" : "202", + "Date" : "Tue, 22 Sep 2020 04:23:36 GMT" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/updateCapabilities.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/updateCapabilities.json new file mode 100644 index 000000000000..9ab58aab5963 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/updateCapabilities.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/capabilities?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "1133ms", + "MS-CV" : "Q3nI5VhxL0SgCyX4PUe+rA.0", + "retry-after" : "0", + "X-Azure-Ref" : "0V3xpXwAAAADO7y3O7t0+RJwAoLLEE0zQWVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"capabilitiesUpdateId\":\"capabilities-id-1\"}", + "Date" : "Tue, 22 Sep 2020 04:23:52 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/src/test/resources/session-records/updateCapabilitiesWithResponse.json b/sdk/communication/azure-communication-administration/src/test/resources/session-records/updateCapabilitiesWithResponse.json new file mode 100644 index 000000000000..5289d9816744 --- /dev/null +++ b/sdk/communication/azure-communication-administration/src/test/resources/session-records/updateCapabilitiesWithResponse.json @@ -0,0 +1,23 @@ +{ + "networkCallRecords" : [ { + "Method" : "POST", + "Uri" : "https://REDACTED.communication.azure.com/administration/phonenumbers/capabilities?api-version=2020-07-20-preview1", + "Headers" : { + "User-Agent" : "azsdk-java-azure-communication-administration/1.0.0-beta.1 (11.0.8; Mac OS X 10.15.6)", + "Content-Type" : "application/json" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Processing-Time" : "1759ms", + "MS-CV" : "Gng08Be3wkGfy+8M2sffvg.0", + "retry-after" : "0", + "X-Azure-Ref" : "0QHxpXwAAAAB46lm2ZAxAQJ8Oa5SmDMizWVZSMzBFREdFMDMwOQA5ZmM3YjUxOS1hOGNjLTRmODktOTM1ZS1jOTE0OGFlMDllODE=", + "StatusCode" : "200", + "Body" : "{\"capabilitiesUpdateId\":\"dc823bb2-585d-4943-a8e7-b33cc5c86ea0\"}", + "Date" : "Tue, 22 Sep 2020 04:23:29 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + } ], + "variables" : [ ] +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/swagger/PNM_Swagger.json b/sdk/communication/azure-communication-administration/swagger/PNM_Swagger.json new file mode 100644 index 000000000000..c4e9f78440b9 --- /dev/null +++ b/sdk/communication/azure-communication-administration/swagger/PNM_Swagger.json @@ -0,0 +1,2060 @@ +{ + "swagger": "2.0", + "info": { + "title": "Phone Number Administration Service", + "description": "Phone Number Administration Service", + "contact": { + "email": "acsdevexdisc@microsoft.com" + }, + "version": "2020-07-20-preview1" + }, + "paths": { + "/administration/phonenumbers/phonenumbers": { + "get": { + "tags": [ + "AcquiredNumbers" + ], + "summary": "Gets the list of the acquired phone numbers.", + "operationId": "PhoneNumberAdministration_GetAllPhoneNumbers", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "query", + "name": "locale", + "description": "A language-locale pairing which will be used to localise the names of countries", + "type": "string", + "default": "en-US" + }, + { + "in": "query", + "name": "skip", + "description": "An optional parameter for how many entries to skip, for pagination purposes.", + "type": "integer", + "format": "int32", + "default": 0 + }, + { + "in": "query", + "name": "take", + "description": "An optional parameter for how many entries to return, for pagination purposes.", + "type": "integer", + "format": "int32", + "default": 100 + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/AcquiredPhoneNumbers" + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink", + "itemName": "phoneNumbers" + }, + "x-ms-examples": { + "List acquired phone numbers": { + "$ref": "./examples/GetAcquiredPhoneNumbersAsync.json" + } + } + } + }, + "/administration/phonenumbers/countries/{countryCode}/areacodes": { + "post": { + "tags": [ + "AreaCodes" + ], + "summary": "Gets a list of the supported area codes", + "operationId": "PhoneNumberAdministration_GetAllAreaCodes", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "query", + "name": "locationType", + "description": "The type of location information required by the plan.", + "required": true, + "type": "string" + }, + { + "in": "path", + "name": "countryCode", + "description": "The ISO 3166-2 country code", + "required": true, + "type": "string" + }, + { + "in": "query", + "name": "phonePlanId", + "description": "The plan id from which to search area codes.", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "Location options for when location type is selection.", + "schema": { + "$ref": "#/definitions/LocationOptionsQueries" + } + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/AreaCodes" + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get area codes": { + "$ref": "./examples/GetAreaCodesAsync.json" + } + } + } + }, + "/administration/phonenumbers/capabilities/{capabilitiesUpdateId}": { + "get": { + "tags": [ + "Capabilities" + ], + "summary": "Get capabilities by capabilities update id.", + "operationId": "PhoneNumberAdministration_GetCapabilitiesUpdate", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "capabilitiesUpdateId", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/UpdatePhoneNumberCapabilitiesResponse" + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get number capabilities update": { + "$ref": "./examples/GetNumberCapabilitiesUpdateAsync.json" + } + } + } + }, + "/administration/phonenumbers/capabilities": { + "post": { + "tags": [ + "Capabilities" + ], + "summary": "Adds or removes phone number capabilities", + "operationId": "PhoneNumberAdministration_UpdateCapabilities", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "", + "schema": { + "$ref": "#/definitions/UpdateNumberCapabilitiesRequest" + } + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/UpdateNumberCapabilitiesResponse" + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Update number capabilities": { + "$ref": "./examples/UpdateNumberCapabilitiesAsync.json" + } + } + } + }, + "/administration/phonenumbers/countries": { + "get": { + "tags": [ + "Countries" + ], + "summary": "Gets a list of supported countries", + "operationId": "PhoneNumberAdministration_GetAllSupportedCountries", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "query", + "name": "locale", + "description": "A language-locale pairing which will be used to localise the names of countries", + "type": "string", + "default": "en-US" + }, + { + "in": "query", + "name": "skip", + "description": "An optional parameter for how many entries to skip, for pagination purposes.", + "type": "integer", + "format": "int32", + "default": 0 + }, + { + "in": "query", + "name": "take", + "description": "An optional parameter for how many entries to return, for pagination purposes.", + "type": "integer", + "format": "int32", + "default": 100 + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/PhoneNumberCountries" + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink", + "itemName": "countries" + }, + "x-ms-examples": { + "Get countries": { + "$ref": "./examples/GetCountriesAsync.json" + } + } + } + }, + "/administration/phonenumbers/numberconfiguration": { + "post": { + "tags": [ + "NumberConfiguration" + ], + "summary": "Endpoint for getting number configurations", + "operationId": "PhoneNumberAdministration_GetNumberConfiguration", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "The phone number whose configuration is to be fetched", + "schema": { + "$ref": "#/definitions/NumberConfigurationPhoneNumber" + } + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/NumberConfigurationResponse" + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get number configuration for phone number": { + "$ref": "./examples/GetNumberConfigurationAsync.json" + } + } + } + }, + "/administration/phonenumbers/numberconfiguration/configure": { + "patch": { + "tags": [ + "NumberConfiguration" + ], + "summary": "Endpoint for configuring a pstn number", + "operationId": "PhoneNumberAdministration_ConfigureNumber", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "Details of pstn number configuration of the given phoneNumber", + "schema": { + "$ref": "#/definitions/NumberConfiguration" + } + } + ], + "responses": { + "202": { + "description": "Success" + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Configure phone number": { + "$ref": "./examples/ConfigurePhoneNumberAsync.json" + } + } + } + }, + "/administration/phonenumbers/numberconfiguration/unconfigure": { + "patch": { + "tags": [ + "NumberConfiguration" + ], + "summary": "Endpoint for unconfiguring a pstn number by removing the configuration", + "operationId": "PhoneNumberAdministration_UnconfigureNumber", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "The phone number to un-configure", + "schema": { + "$ref": "#/definitions/NumberConfigurationPhoneNumber" + } + } + ], + "responses": { + "202": { + "description": "Success" + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Unconfigure phone number": { + "$ref": "./examples/UnconfigurePhoneNumberAsync.json" + } + } + } + }, + "/administration/phonenumbers/countries/{countryCode}/phoneplangroups": { + "get": { + "tags": [ + "Plans" + ], + "summary": "Gets a list of phone plan groups for the given country", + "operationId": "PhoneNumberAdministration_GetPhonePlanGroups", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "countryCode", + "description": "The ISO 3166-2 country code.", + "required": true, + "type": "string" + }, + { + "in": "query", + "name": "locale", + "description": "A language-locale pairing which will be used to localise the names of countries", + "type": "string", + "default": "en-US" + }, + { + "in": "query", + "name": "includeRateInformation", + "type": "boolean", + "default": false + }, + { + "in": "query", + "name": "skip", + "description": "An optional parameter for how many entries to skip, for pagination purposes.", + "type": "integer", + "format": "int32", + "default": 0 + }, + { + "in": "query", + "name": "take", + "description": "An optional parameter for how many entries to return, for pagination purposes.", + "type": "integer", + "format": "int32", + "default": 100 + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/PhonePlanGroups" + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink", + "itemName": "phonePlanGroups" + }, + "x-ms-examples": { + "Get plans": { + "$ref": "./examples/GetPhonePlanGroupsAsync.json" + } + } + } + }, + "/administration/phonenumbers/countries/{countryCode}/phoneplangroups/{phonePlanGroupId}/phoneplans": { + "get": { + "tags": [ + "Plans" + ], + "summary": "Gets a list of phone plans for a phone plan group", + "operationId": "PhoneNumberAdministration_GetPhonePlans", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "countryCode", + "description": "The ISO 3166-2 country code.", + "required": true, + "type": "string" + }, + { + "in": "path", + "name": "phonePlanGroupId", + "required": true, + "type": "string" + }, + { + "in": "query", + "name": "locale", + "description": "A language-locale pairing which will be used to localise the names of countries", + "type": "string", + "default": "en-US" + }, + { + "in": "query", + "name": "skip", + "description": "An optional parameter for how many entries to skip, for pagination purposes.", + "type": "integer", + "format": "int32", + "default": 0 + }, + { + "in": "query", + "name": "take", + "description": "An optional parameter for how many entries to return, for pagination purposes.", + "type": "integer", + "format": "int32", + "default": 100 + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/PhonePlansResponse" + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink", + "itemName": "phonePlans" + }, + "x-ms-examples": { + "Get plans": { + "$ref": "./examples/GetPhonePlansAsync.json" + } + } + } + }, + "/administration/phonenumbers/countries/{countryCode}/phoneplangroups/{phonePlanGroupId}/phoneplans/{phonePlanId}/locationoptions": { + "get": { + "tags": [ + "Plans" + ], + "summary": "Gets a list of location options for a phone plan", + "operationId": "PhoneNumberAdministration_GetPhonePlanLocationOptions", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "countryCode", + "description": "The ISO 3166-2 country code.", + "required": true, + "type": "string" + }, + { + "in": "path", + "name": "phonePlanGroupId", + "required": true, + "type": "string" + }, + { + "in": "path", + "name": "phonePlanId", + "required": true, + "type": "string" + }, + { + "in": "query", + "name": "locale", + "description": "A language-locale pairing which will be used to localise the names of countries", + "type": "string", + "default": "en-US" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/LocationOptionsResponse" + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get plans": { + "$ref": "./examples/GetLocationOptionsAsync.json" + } + } + } + }, + "/administration/phonenumbers/releases/{releaseId}": { + "get": { + "tags": [ + "Release" + ], + "summary": "Gets a release by a release id", + "operationId": "PhoneNumberAdministration_GetReleaseById", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "releaseId", + "description": "Represents the release id", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/PhoneNumberRelease" + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get release by id": { + "$ref": "./examples/GetReleaseByIdAsync.json" + } + } + } + }, + "/administration/phonenumbers/releases": { + "post": { + "tags": [ + "Release" + ], + "summary": "Creates a release for the given phone numbers", + "operationId": "PhoneNumberAdministration_ReleasePhoneNumbers", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "Config api Release request", + "schema": { + "$ref": "#/definitions/ReleaseRequest" + } + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/ReleaseResponse" + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get release": { + "$ref": "./examples/CreateReleaseAsync.json" + } + } + }, + "get": { + "tags": [ + "Release" + ], + "summary": "Gets a list of all releases", + "operationId": "PhoneNumberAdministration_GetAllReleases", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "query", + "name": "skip", + "description": "An optional parameter for how many entries to skip, for pagination purposes.", + "type": "integer", + "format": "int32", + "default": 0 + }, + { + "in": "query", + "name": "take", + "description": "An optional parameter for how many entries to return, for pagination purposes.", + "type": "integer", + "format": "int32", + "default": 100 + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/PhoneNumberEntities" + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink", + "itemName": "entities" + }, + "x-ms-examples": { + "Get all releases": { + "$ref": "./examples/GetAllReleasesAsync.json" + } + } + } + }, + "/administration/phonenumbers/searches/{searchId}": { + "get": { + "tags": [ + "Search" + ], + "summary": "Get search by search id", + "operationId": "PhoneNumberAdministration_GetSearchById", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "searchId", + "description": "The search id to be searched for", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/PhoneNumberSearch" + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get search by search id": { + "$ref": "./examples/GetSearchByIdAsync.json" + } + } + } + }, + "/administration/phonenumbers/searches": { + "post": { + "tags": [ + "Search" + ], + "summary": "Creates a phone number search", + "operationId": "PhoneNumberAdministration_CreateSearch", + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "parameters": [ + { + "$ref": "#/parameters/ApiVersionParameter" + }, + { + "in": "body", + "name": "body", + "description": "Defines the search options", + "schema": { + "$ref": "#/definitions/CreateSearchOptions" + } + } + ], + "responses": { + "201": { + "description": "Success", + "schema": { + "$ref": "#/definitions/CreateSearchResponse" + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Create search": { + "$ref": "./examples/CreateSearchAsync.json" + } + } + }, + "get": { + "tags": [ + "Search" + ], + "summary": "Gets a list of all searches", + "operationId": "PhoneNumberAdministration_GetAllSearches", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "query", + "name": "skip", + "description": "An optional parameter for how many entries to skip, for pagination purposes.", + "type": "integer", + "format": "int32", + "default": 0 + }, + { + "in": "query", + "name": "take", + "description": "An optional parameter for how many entries to return, for pagination purposes.", + "type": "integer", + "format": "int32", + "default": 100 + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Success", + "schema": { + "$ref": "#/definitions/PhoneNumberEntities" + } + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink", + "itemName": "entities" + }, + "x-ms-examples": { + "Get all searches": { + "$ref": "./examples/GetAllSearchesAsync.json" + } + } + } + }, + "/administration/phonenumbers/searches/{searchId}/cancel": { + "post": { + "tags": [ + "Search" + ], + "summary": "Cancels the search. This means existing numbers in the search will be made available.", + "operationId": "PhoneNumberAdministration_CancelSearch", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "searchId", + "description": "The search id to be canceled", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "202": { + "description": "Success" + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Cancel phone number search": { + "$ref": "./examples/CancelSearchAsync.json" + } + } + } + }, + "/administration/phonenumbers/searches/{searchId}/purchase": { + "post": { + "tags": [ + "Search" + ], + "summary": "Purchases the phone number search.", + "operationId": "PhoneNumberAdministration_PurchaseSearch", + "produces": [ + "application/json" + ], + "parameters": [ + { + "in": "path", + "name": "searchId", + "description": "The search id to be purchased", + "required": true, + "type": "string" + }, + { + "$ref": "#/parameters/ApiVersionParameter" + } + ], + "responses": { + "202": { + "description": "Success" + }, + "default": { + "description": "Failure", + "schema": { + "$ref": "#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Purchase phone number search": { + "$ref": "./examples/PurchaseSearchAsync.json" + } + } + } + } + }, + "definitions": { + "AcquiredPhoneNumber": { + "description": "Represents an acquired phone number.", + "required": [ + "acquiredCapabilities", + "availableCapabilities", + "phoneNumber" + ], + "type": "object", + "properties": { + "phoneNumber": { + "description": "String of the E.164 format of the phone number", + "type": "string" + }, + "acquiredCapabilities": { + "description": "The set of all acquired capabilities of the phone number.", + "type": "array", + "items": { + "description": "Represents the capabilities of a phone number.", + "enum": [ + "UserAssignment", + "FirstPartyVoiceAppAssignment", + "ConferenceAssignment", + "P2PSmsEnabled", + "Geographic", + "NonGeographic", + "TollCalling", + "TollFreeCalling", + "Premium", + "P2PSmsCapable", + "A2PSmsCapable", + "A2PSmsEnabled", + "Calling", + "TollFree", + "FirstPartyAppAssignment", + "ThirdPartyAppAssignment", + "Azure", + "Office365", + "InboundCalling", + "OutboundCalling", + "InboundA2PSms", + "OutboundA2PSms", + "InboundP2PSms", + "OutboundP2PSms" + ], + "type": "string", + "x-ms-enum": { + "name": "Capability", + "modelAsString": true + } + } + }, + "availableCapabilities": { + "description": "The set of all available capabilities that can be acquired for this phone number.", + "type": "array", + "items": { + "description": "Represents the capabilities of a phone number.", + "enum": [ + "UserAssignment", + "FirstPartyVoiceAppAssignment", + "ConferenceAssignment", + "P2PSmsEnabled", + "Geographic", + "NonGeographic", + "TollCalling", + "TollFreeCalling", + "Premium", + "P2PSmsCapable", + "A2PSmsCapable", + "A2PSmsEnabled", + "Calling", + "TollFree", + "FirstPartyAppAssignment", + "ThirdPartyAppAssignment", + "Azure", + "Office365", + "InboundCalling", + "OutboundCalling", + "InboundA2PSms", + "OutboundA2PSms", + "InboundP2PSms", + "OutboundP2PSms" + ], + "type": "string", + "x-ms-enum": { + "name": "Capability", + "modelAsString": true + } + } + }, + "assignmentStatus": { + "description": "The assignment status of the phone number. Conveys what type of entity the number is assigned to.", + "enum": [ + "Unassigned", + "Unknown", + "UserAssigned", + "ConferenceAssigned", + "FirstPartyAppAssigned", + "ThirdPartyAppAssigned" + ], + "type": "string", + "x-ms-enum": { + "name": "AssignmentStatus", + "modelAsString": true + } + }, + "placeName": { + "description": "The name of the place of the phone number.", + "type": "string" + }, + "activationState": { + "description": "The activation state of the phone number. Can be \"Activated\", \"AssignmentPending\", \"AssignmentFailed\", \"UpdatePending\", \"UpdateFailed\"", + "enum": [ + "Activated", + "AssignmentPending", + "AssignmentFailed", + "UpdatePending", + "UpdateFailed" + ], + "type": "string", + "x-ms-enum": { + "name": "ActivationState", + "modelAsString": true + } + } + } + }, + "AcquiredPhoneNumbers": { + "description": "A wrapper of list of phone numbers", + "type": "object", + "properties": { + "phoneNumbers": { + "description": "Represents a list of phone numbers", + "type": "array", + "items": { + "$ref": "#/definitions/AcquiredPhoneNumber" + } + }, + "nextLink": { + "description": "Represents the URL link to the next page", + "type": "string" + } + } + }, + "ErrorBody": { + "description": "Represents a service error response body.", + "type": "object", + "properties": { + "code": { + "description": "The error code in the error response.", + "type": "string" + }, + "message": { + "description": "The error message in the error response.", + "type": "string" + } + } + }, + "ErrorResponse": { + "description": "Represents a service error response.", + "type": "object", + "properties": { + "error": { + "$ref": "#/definitions/ErrorBody" + } + } + }, + "LocationOptionsQuery": { + "description": "Represents a location options parameter, used for fetching area codes.", + "type": "object", + "properties": { + "labelId": { + "description": "Represents the location option label id, returned from the GetLocationOptions API.", + "type": "string" + }, + "optionsValue": { + "description": "Represents the location options value, returned from the GetLocationOptions API.", + "type": "string" + } + } + }, + "LocationOptionsQueries": { + "description": "Represents a list of location option queries, used for fetching area codes.", + "type": "object", + "properties": { + "locationOptions": { + "description": "Represents the underlying list of countries.", + "type": "array", + "items": { + "$ref": "#/definitions/LocationOptionsQuery" + } + } + } + }, + "AreaCodes": { + "description": "Represents a list of area codes.", + "type": "object", + "properties": { + "primaryAreaCodes": { + "description": "Represents the list of primary area codes.", + "type": "array", + "items": { + "type": "string" + } + }, + "secondaryAreaCodes": { + "description": "Represents the list of secondary area codes.", + "type": "array", + "items": { + "type": "string" + } + }, + "nextLink": { + "description": "Represents the URL link to the next page", + "type": "string" + } + } + }, + "NumberUpdateCapabilities": { + "description": "Represents an individual number capabilities update request", + "type": "object", + "properties": { + "add": { + "description": "Capabilities to be added to a phone number", + "type": "array", + "items": { + "description": "Represents the capabilities of a phone number.", + "enum": [ + "UserAssignment", + "FirstPartyVoiceAppAssignment", + "ConferenceAssignment", + "P2PSmsEnabled", + "Geographic", + "NonGeographic", + "TollCalling", + "TollFreeCalling", + "Premium", + "P2PSmsCapable", + "A2PSmsCapable", + "A2PSmsEnabled", + "Calling", + "TollFree", + "FirstPartyAppAssignment", + "ThirdPartyAppAssignment", + "Azure", + "Office365", + "InboundCalling", + "OutboundCalling", + "InboundA2PSms", + "OutboundA2PSms", + "InboundP2PSms", + "OutboundP2PSms" + ], + "type": "string", + "x-ms-enum": { + "name": "Capability", + "modelAsString": true + } + } + }, + "remove": { + "description": "Capabilities to be removed from a phone number", + "type": "array", + "items": { + "description": "Represents the capabilities of a phone number.", + "enum": [ + "UserAssignment", + "FirstPartyVoiceAppAssignment", + "ConferenceAssignment", + "P2PSmsEnabled", + "Geographic", + "NonGeographic", + "TollCalling", + "TollFreeCalling", + "Premium", + "P2PSmsCapable", + "A2PSmsCapable", + "A2PSmsEnabled", + "Calling", + "TollFree", + "FirstPartyAppAssignment", + "ThirdPartyAppAssignment", + "Azure", + "Office365", + "InboundCalling", + "OutboundCalling", + "InboundA2PSms", + "OutboundA2PSms", + "InboundP2PSms", + "OutboundP2PSms" + ], + "type": "string", + "x-ms-enum": { + "name": "Capability", + "modelAsString": true + } + } + } + } + }, + "UpdatePhoneNumberCapabilitiesResponse": { + "description": "Response for getting a phone number update capabilities.", + "type": "object", + "properties": { + "capabilitiesUpdateId": { + "description": "The id of the phone number capabilties update", + "type": "string" + }, + "createdAt": { + "format": "date-time", + "description": "The time the capabilities update was created", + "type": "string" + }, + "capabilitiesUpdateStatus": { + "description": "Status of the capabilities update.", + "enum": [ + "Pending", + "InProgress", + "Complete", + "Error" + ], + "type": "string", + "x-ms-enum": { + "name": "CapabilitiesUpdateStatus", + "modelAsString": true + } + }, + "phoneNumberCapabilitiesUpdates": { + "description": "The capabilities update for each of a set of phone numbers.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/NumberUpdateCapabilities" + } + } + } + }, + "UpdateNumberCapabilitiesRequest": { + "description": "Represents a numbers capabilities update request", + "required": [ + "phoneNumberCapabilitiesUpdate" + ], + "type": "object", + "properties": { + "phoneNumberCapabilitiesUpdate": { + "description": "The map of phone numbers to the capabilities update applied to the phone number.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/NumberUpdateCapabilities" + } + } + } + }, + "UpdateNumberCapabilitiesResponse": { + "description": "Represents a number capability update response.", + "required": [ + "capabilitiesUpdateId" + ], + "type": "object", + "properties": { + "capabilitiesUpdateId": { + "description": "The capabilities id", + "type": "string" + } + } + }, + "PhoneNumberCountry": { + "description": "Represents a country.", + "required": [ + "countryCode", + "localizedName" + ], + "type": "object", + "properties": { + "localizedName": { + "description": "Represents the name of the country.", + "type": "string" + }, + "countryCode": { + "description": "Represents the abbreviated name of the country.", + "type": "string" + } + } + }, + "PhoneNumberCountries": { + "description": "Represents a wrapper around a list of countries.", + "type": "object", + "properties": { + "countries": { + "description": "Represents the underlying list of countries.", + "type": "array", + "items": { + "$ref": "#/definitions/PhoneNumberCountry" + } + }, + "nextLink": { + "description": "Represents the URL link to the next page", + "type": "string" + } + } + }, + "NumberConfigurationPhoneNumber": { + "description": "The phone number wrapper representing a number configuration request", + "required": [ + "phoneNumber" + ], + "type": "object", + "properties": { + "phoneNumber": { + "description": "The phone number in the E.164 format", + "type": "string" + } + } + }, + "PstnConfiguration": { + "description": "Definition for pstn number configuration", + "required": [ + "callbackUrl" + ], + "type": "object", + "properties": { + "callbackUrl": { + "description": "The webhook URL on the phone number configuration.", + "type": "string" + }, + "applicationId": { + "description": "The application id of the application to which to configure", + "type": "string" + }, + "azurePstnTargetId": { + "description": "Routable TargetId for the ACS Number", + "type": "string" + } + } + }, + "NumberConfigurationResponse": { + "description": "Definition for number configuration", + "required": [ + "pstnConfiguration" + ], + "type": "object", + "properties": { + "pstnConfiguration": { + "$ref": "#/definitions/PstnConfiguration" + } + } + }, + "NumberConfiguration": { + "description": "Definition for number configuration", + "required": [ + "phoneNumber", + "pstnConfiguration" + ], + "type": "object", + "properties": { + "pstnConfiguration": { + "$ref": "#/definitions/PstnConfiguration" + }, + "phoneNumber": { + "description": "The phone number to configure", + "type": "string" + } + } + }, + "CarrierDetails": { + "description": "Represents carrier details.", + "type": "object", + "properties": { + "name": { + "description": "Name of carrier details", + "type": "string" + }, + "localizedName": { + "description": "Display name of carrier details", + "type": "string" + } + } + }, + "RateInformation": { + "description": "Represents a wrapper of rate information", + "type": "object", + "properties": { + "monthlyRate": { + "format": "double", + "description": "The monthly rate of a phone plan group", + "type": "number" + }, + "currencyType": { + "description": "The currency of a phone plan group", + "enum": [ + "USD" + ], + "type": "string", + "x-ms-enum": { + "name": "CurrencyType", + "modelAsString": true + } + }, + "rateErrorMessage": { + "description": "The error code of a phone plan group", + "type": "string" + } + } + }, + "PhonePlanGroup": { + "description": "Represents a plan group.", + "required": [ + "localizedDescription", + "localizedName", + "phonePlanGroupId" + ], + "type": "object", + "properties": { + "phonePlanGroupId": { + "description": "The id of the plan group", + "type": "string" + }, + "phoneNumberType": { + "description": "The phone number type of the plan group", + "enum": [ + "Unknown", + "Geographic", + "TollFree", + "Indirect" + ], + "type": "string", + "x-ms-enum": { + "name": "PhoneNumberType", + "modelAsString": true + } + }, + "localizedName": { + "description": "The name of the plan group.", + "type": "string" + }, + "localizedDescription": { + "description": "The description of the plan group.", + "type": "string" + }, + "carrierDetails": { + "$ref": "#/definitions/CarrierDetails" + }, + "rateInformation": { + "$ref": "#/definitions/RateInformation" + } + } + }, + "PhonePlanGroups": { + "description": "Represents a wrapper of list of plan groups.", + "type": "object", + "properties": { + "phonePlanGroups": { + "description": "The underlying list of phone plan groups.", + "type": "array", + "items": { + "$ref": "#/definitions/PhonePlanGroup" + } + }, + "nextLink": { + "description": "Represents the URL link to the next page", + "type": "string" + } + } + }, + "PhonePlan": { + "description": "Represents a phone plan.", + "required": [ + "localizedName", + "locationType", + "phonePlanId" + ], + "type": "object", + "properties": { + "phonePlanId": { + "description": "The phone plan id", + "type": "string" + }, + "localizedName": { + "description": "The name of the phone plan", + "type": "string" + }, + "locationType": { + "description": "The location type of the phone plan.", + "enum": [ + "CivicAddress", + "NotRequired", + "Selection" + ], + "type": "string", + "x-ms-enum": { + "name": "LocationType", + "modelAsString": true + } + }, + "areaCodes": { + "description": "The list of available area codes in the phone plan.", + "type": "array", + "items": { + "type": "string" + } + }, + "capabilities": { + "description": "Capabilities of the phone plan.", + "type": "array", + "items": { + "description": "Represents the capabilities of a phone number.", + "enum": [ + "UserAssignment", + "FirstPartyVoiceAppAssignment", + "ConferenceAssignment", + "P2PSmsEnabled", + "Geographic", + "NonGeographic", + "TollCalling", + "TollFreeCalling", + "Premium", + "P2PSmsCapable", + "A2PSmsCapable", + "A2PSmsEnabled", + "Calling", + "TollFree", + "FirstPartyAppAssignment", + "ThirdPartyAppAssignment", + "Azure", + "Office365", + "InboundCalling", + "OutboundCalling", + "InboundA2PSms", + "OutboundA2PSms", + "InboundP2PSms", + "OutboundP2PSms" + ], + "type": "string", + "x-ms-enum": { + "name": "Capability", + "modelAsString": true + } + } + }, + "maximumSearchSize": { + "format": "int32", + "description": "The maximum number of phone numbers one can acquire in a search in this phone plan.", + "type": "integer" + } + } + }, + "PhonePlansResponse": { + "description": "Represents a wrapper around a list of countries.", + "type": "object", + "properties": { + "phonePlans": { + "description": "Represents the underlying list of phone plans.", + "type": "array", + "items": { + "$ref": "#/definitions/PhonePlan" + } + }, + "nextLink": { + "description": "Represents the URL link to the next page", + "type": "string" + } + } + }, + "LocationOptionsDetails": { + "description": "Represents location options deatils.", + "type": "object", + "properties": { + "name": { + "description": "The name of the location options", + "type": "string" + }, + "value": { + "description": "The abbreviated name of the location options", + "type": "string" + }, + "locationOptions": { + "description": "The underlying location options", + "type": "array", + "items": { + "$ref": "#/definitions/LocationOptions" + } + } + } + }, + "LocationOptions": { + "description": "Represents a location options.", + "type": "object", + "properties": { + "labelId": { + "description": "The label id of the location.", + "type": "string" + }, + "labelName": { + "description": "The display name of the location.", + "type": "string" + }, + "options": { + "description": "The underlying location option details.", + "type": "array", + "items": { + "$ref": "#/definitions/LocationOptionsDetails" + } + } + } + }, + "LocationOptionsResponse": { + "description": "Represents a wrapper around a list of location options.", + "type": "object", + "properties": { + "locationOptions": { + "$ref": "#/definitions/LocationOptions" + } + } + }, + "PhoneNumberReleaseDetails": { + "type": "object", + "properties": { + "status": { + "description": "The release status of a phone number.", + "enum": [ + "Pending", + "Success", + "Error", + "InProgress" + ], + "type": "string", + "x-ms-enum": { + "name": "PhoneNumberReleaseStatus", + "modelAsString": true + } + }, + "errorCode": { + "format": "int32", + "description": "The error code in the case the status is error.", + "type": "integer" + } + } + }, + "PhoneNumberRelease": { + "description": "Represents a release", + "type": "object", + "properties": { + "releaseId": { + "description": "The id of the release.", + "type": "string" + }, + "createdAt": { + "format": "date-time", + "description": "The creation time of the release.", + "type": "string" + }, + "status": { + "description": "The release status.", + "enum": [ + "Pending", + "InProgress", + "Complete", + "Failed", + "Expired" + ], + "type": "string", + "x-ms-enum": { + "name": "ReleaseStatus", + "modelAsString": true + } + }, + "errorMessage": { + "description": "The underlying error message of a release.", + "type": "string" + }, + "phoneNumberReleaseStatusDetails": { + "description": "The list of phone numbers in the release, mapped to its individual statuses.", + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/PhoneNumberReleaseDetails" + } + } + } + }, + "ReleaseRequest": { + "description": "Represents a release request.", + "required": [ + "phoneNumbers" + ], + "type": "object", + "properties": { + "phoneNumbers": { + "description": "The list of phone numbers in the release request.", + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "ReleaseResponse": { + "description": "Represents a release response.", + "required": [ + "releaseId" + ], + "type": "object", + "properties": { + "releaseId": { + "description": "The release id of a created release.", + "type": "string" + } + } + }, + "PhoneNumberEntity": { + "description": "Represents a phone number entity, as part of the response when calling get all searches or releases.", + "type": "object", + "properties": { + "id": { + "description": "The id of the entity. It is the search id of a searc. It is the release id of a release.", + "type": "string" + }, + "createdAt": { + "format": "date-time", + "description": "Date and time the entity is created.", + "type": "string" + }, + "displayName": { + "description": "Name of the entity.", + "type": "string" + }, + "quantity": { + "format": "int32", + "description": "Quantity of requested phone numbers in the entity.", + "type": "integer" + }, + "quantityObtained": { + "format": "int32", + "description": "Quantity of acquired phone numbers in the entity.", + "type": "integer" + }, + "status": { + "description": "Status of the entity.", + "type": "string" + }, + "focDate": { + "format": "date-time", + "description": "The Firm Order Confirmation date of the phone number entity.", + "type": "string" + } + } + }, + "PhoneNumberEntities": { + "description": "Represents a list of searchs or releases, as part of the response when fetching all searches or releases.", + "type": "object", + "properties": { + "entities": { + "description": "The underlying list of entities.", + "type": "array", + "items": { + "$ref": "#/definitions/PhoneNumberEntity" + } + }, + "nextLink": { + "description": "Represents the URL link to the next page", + "type": "string" + } + } + }, + "PhoneNumberSearch": { + "description": "Represents a phone number search", + "type": "object", + "properties": { + "searchId": { + "description": "The id of the search.", + "type": "string" + }, + "displayName": { + "description": "The name of the search.", + "type": "string" + }, + "createdAt": { + "format": "date-time", + "description": "The creation time of the search.", + "type": "string" + }, + "description": { + "description": "The description of the search.", + "type": "string" + }, + "phonePlanIds": { + "description": "The phone plan ids of the search.", + "type": "array", + "items": { + "type": "string" + } + }, + "areaCode": { + "description": "The area code of the search.", + "type": "string" + }, + "quantity": { + "format": "int32", + "description": "The quantity of phone numbers in the search.", + "type": "integer" + }, + "locationOptions": { + "description": "The location options of the search.", + "type": "array", + "items": { + "$ref": "#/definitions/LocationOptionsDetails" + } + }, + "status": { + "description": "The status of the search.", + "enum": [ + "Pending", + "InProgress", + "Reserved", + "Expired", + "Expiring", + "Completing", + "Refreshing", + "Success", + "Manual", + "Cancelled", + "Cancelling", + "Error", + "PurchasePending" + ], + "type": "string", + "x-ms-enum": { + "name": "SearchStatus", + "modelAsString": true + } + }, + "phoneNumbers": { + "description": "The list of phone numbers in the search, in the case the status is reserved or success.", + "type": "array", + "items": { + "type": "string" + } + }, + "reservationExpiryDate": { + "format": "date-time", + "description": "The date that search expires and the numbers become available.", + "type": "string" + }, + "errorCode": { + "format": "int32", + "description": "The error code of the search.", + "type": "integer" + } + } + }, + "CreateSearchOptions": { + "description": "Represents a search creation option.", + "required": [ + "areaCode", + "description", + "displayName", + "phonePlanIds" + ], + "type": "object", + "properties": { + "displayName": { + "description": "Display name of the search.", + "maxLength": 255, + "type": "string" + }, + "description": { + "description": "Description of the search.", + "maxLength": 255, + "type": "string" + }, + "phonePlanIds": { + "description": "The plan subtype ids from which to create the search.", + "type": "array", + "items": { + "type": "string" + } + }, + "areaCode": { + "description": "The area code from which to create the search.", + "type": "string" + }, + "quantity": { + "format": "int32", + "description": "The quantity of phone numbers to request.", + "maximum": 2147483647, + "minimum": 1, + "type": "integer" + }, + "locationOptions": { + "description": "The location options of the search.", + "type": "array", + "items": { + "$ref": "#/definitions/LocationOptionsDetails" + } + } + } + }, + "CreateSearchResponse": { + "description": "Represents a search creation response.", + "required": [ + "searchId" + ], + "type": "object", + "properties": { + "searchId": { + "description": "The search id of the search that was created.", + "type": "string" + } + } + } + }, + "parameters": { + "ApiVersionParameter": { + "in": "query", + "name": "api-version", + "description": "Version of API to invoke", + "required": true, + "type": "string" + }, + "Endpoint": { + "in": "path", + "name": "endpoint", + "description": "The endpoint of the Azure Communication resource.", + "required": true, + "type": "string", + "x-ms-skip-url-encoding": true, + "x-ms-parameter-location": "client" + } + }, + "securityDefinitions": { + "azure_auth": { + "type": "oauth2", + "flow": "implicit", + "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "scopes": { + "user_impersonation": "impersonate your user account" + }, + "description": "Azure Active Directory OAuth2 Flow" + } + }, + "x-ms-parameterized-host": { + "hostTemplate": "{endpoint}", + "useSchemePrefix": false, + "parameters": [ + { + "$ref": "#/parameters/Endpoint" + } + ] + } +} \ No newline at end of file diff --git a/sdk/communication/azure-communication-administration/swagger/README.md b/sdk/communication/azure-communication-administration/swagger/README.md index ff6d37dca467..8d8cb048e6ac 100644 --- a/sdk/communication/azure-communication-administration/swagger/README.md +++ b/sdk/communication/azure-communication-administration/swagger/README.md @@ -3,7 +3,7 @@ > see https://aka.ms/autorest ## Getting Started -To build the SDK for CommunicationIdentity Client, simply Install AutoRest and in this folder, run: +To build the SDK for Communication Administration library, simply Install AutoRest and in this folder, run: ### Setup ```ps @@ -17,28 +17,43 @@ npm install -g autorest ### Generation -There is one swagger for Administration management APIs. +There are two swaggers for Administration management APIs, `identity` and `phonenumber`. ```ps cd -autorest --use=@autorest/java@4.0.1 +autorest --use=@autorest/java@4.0.1 --tag=identity +autorest --use=@autorest/java@4.0.1 --tag=phonenumber ``` -## Update generated files for Administration service -To update generated files for Administration service, run the following command -> autorest --use=@autorest/java@4.0.1 + +### Tag: identity + +These settings apply only when `--tag=identity` is specified on the command line. + +``` yaml $(tag) == 'identity' +input-file: swagger.json +add-context-parameter: true +``` + +### Tag: phonenumber + +These settings apply only when `--tag=phonenumber` is specified on the command line. + +``` yaml $(tag) == 'phonenumber' +input-file: ./PNM_Swagger.json +override-client-name: PhoneNumberAdminClient +``` ### Code generation settings + ``` yaml -input-file: swagger.json java: true output-folder: ..\ -sync-methods: all -license-header: MICROSOFT_MIT_SMALL -namespace: com.azure.communication.administration -generate-client-as-impl: true +license-header: MICROSOFT_MIT_SMALL +namespace: com.azure.communication.administration +generate-client-as-impl: true custom-types-subpackage: models -add-context-parameter: true +sync-methods: all context-client-method-parameter: true ``` \ No newline at end of file From 7b0eea40b121f99ba0ac2aecee91672732069bec Mon Sep 17 00:00:00 2001 From: Wayne Mo Date: Tue, 22 Sep 2020 16:34:36 -0700 Subject: [PATCH 2/6] Update checkstyle suppressions --- .../main/resources/checkstyle/checkstyle-suppressions.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml index 6b611791a0d6..dca577c888ba 100755 --- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml +++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml @@ -528,6 +528,12 @@ + + + + + + From 5a92026f81757117b93a9f162e4bd3cda171cc5c Mon Sep 17 00:00:00 2001 From: Wayne Mo Date: Tue, 22 Sep 2020 19:23:56 -0700 Subject: [PATCH 3/6] Add missing copyright header --- .../administration/PhoneNumberAsyncClientPlaybackTest.java | 2 ++ .../administration/PhoneNumberClientPlaybackTest.java | 2 ++ .../administration/PhoneNumberPlaybackTestBase.java | 2 ++ 3 files changed, 6 insertions(+) diff --git a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientPlaybackTest.java b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientPlaybackTest.java index f8d38728940a..c98c514c6cd4 100644 --- a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientPlaybackTest.java +++ b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientPlaybackTest.java @@ -1,3 +1,5 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. package com.azure.communication.administration; import com.azure.communication.administration.models.AcquiredPhoneNumber; diff --git a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientPlaybackTest.java b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientPlaybackTest.java index 3c723e6b30ba..760e0364a082 100644 --- a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientPlaybackTest.java +++ b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientPlaybackTest.java @@ -1,3 +1,5 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. package com.azure.communication.administration; import com.azure.communication.administration.models.AcquiredPhoneNumber; diff --git a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberPlaybackTestBase.java b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberPlaybackTestBase.java index 8b657473f2cb..c1cae2a98590 100644 --- a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberPlaybackTestBase.java +++ b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberPlaybackTestBase.java @@ -1,3 +1,5 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. package com.azure.communication.administration; import com.azure.communication.common.CommunicationClientCredential; From a97ccae37eadf6a30e0e5a5c1edaca218406e995 Mon Sep 17 00:00:00 2001 From: Wayne Mo Date: Thu, 24 Sep 2020 14:48:36 -0700 Subject: [PATCH 4/6] Updated class naming for integration tests --- ...ckTest.java => PhoneNumberAsyncClientIntegrationTest.java} | 2 +- ...laybackTest.java => PhoneNumberClientIntegrationTest.java} | 4 ++-- ...ybackTestBase.java => PhoneNumberIntegrationTestBase.java} | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/{PhoneNumberAsyncClientPlaybackTest.java => PhoneNumberAsyncClientIntegrationTest.java} (99%) rename sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/{PhoneNumberClientPlaybackTest.java => PhoneNumberClientIntegrationTest.java} (99%) rename sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/{PhoneNumberPlaybackTestBase.java => PhoneNumberIntegrationTestBase.java} (98%) diff --git a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientPlaybackTest.java b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientIntegrationTest.java similarity index 99% rename from sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientPlaybackTest.java rename to sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientIntegrationTest.java index c98c514c6cd4..7b10d8f0efcf 100644 --- a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientPlaybackTest.java +++ b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientIntegrationTest.java @@ -36,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -public class PhoneNumberAsyncClientPlaybackTest extends PhoneNumberPlaybackTestBase { +public class PhoneNumberAsyncClientIntegrationTest extends PhoneNumberIntegrationTestBase { @Test() public void listAllPhoneNumbers() { PagedFlux pagedFlux = this.getClient().listAllPhoneNumbers(LOCALE); diff --git a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientPlaybackTest.java b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientIntegrationTest.java similarity index 99% rename from sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientPlaybackTest.java rename to sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientIntegrationTest.java index 760e0364a082..a9b81cc43c02 100644 --- a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientPlaybackTest.java +++ b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientIntegrationTest.java @@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -public class PhoneNumberClientPlaybackTest extends PhoneNumberPlaybackTestBase { +public class PhoneNumberClientIntegrationTest extends PhoneNumberIntegrationTestBase { @Test() public void listAllPhoneNumbers() { PagedIterable pagedIterable = this.getClient().listAllPhoneNumbers(LOCALE); @@ -284,7 +284,7 @@ public void getNumberConfiguration() { PhoneNumber number = new PhoneNumber(PHONENUMBER_TO_GET_CONFIG); NumberConfigurationResponse numberConfig = this.getClient().getNumberConfiguration(number); - + assertEquals("ApplicationId", numberConfig.getPstnConfiguration().getApplicationId()); } diff --git a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberPlaybackTestBase.java b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberIntegrationTestBase.java similarity index 98% rename from sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberPlaybackTestBase.java rename to sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberIntegrationTestBase.java index c1cae2a98590..10015563d238 100644 --- a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberPlaybackTestBase.java +++ b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberIntegrationTestBase.java @@ -14,7 +14,7 @@ import static org.junit.jupiter.api.Assertions.fail; -public class PhoneNumberPlaybackTestBase extends TestBase { +public class PhoneNumberIntegrationTestBase extends TestBase { private static final String PLAYBACK_ACCESS_KEY = "QWNjZXNzS2V5"; private static final String PLAYBACK_ENDPOINT = "https://REDACTED.communication.azure.com"; private static final String ENV_ACCESS_KEY = From 749ae4b354cd75e74c793360dbd4e135cb977be3 Mon Sep 17 00:00:00 2001 From: Wayne Mo Date: Thu, 24 Sep 2020 15:01:39 -0700 Subject: [PATCH 5/6] Simplify calls to autorest generated client --- .../PhoneNumberAsyncClient.java | 132 ++++++++---------- 1 file changed, 55 insertions(+), 77 deletions(-) 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 index 7a7af34262d0..19eef5650590 100644 --- 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 @@ -3,6 +3,7 @@ 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.CreateSearchOptions; @@ -46,10 +47,10 @@ @ServiceClient(builder = PhoneNumberClientBuilder.class, isAsync = true) public final class PhoneNumberAsyncClient { - private final PhoneNumberAdminClientImpl phoneNumberAdminClient; + private final PhoneNumberAdministrationsImpl phoneNumberAdministrations; PhoneNumberAsyncClient(PhoneNumberAdminClientImpl phoneNumberAdminClient) { - this.phoneNumberAdminClient = phoneNumberAdminClient; + this.phoneNumberAdministrations = phoneNumberAdminClient.getPhoneNumberAdministrations(); } /** @@ -60,13 +61,11 @@ public final class PhoneNumberAsyncClient { */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listAllPhoneNumbers(String locale) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getAllPhoneNumbersAsync( - locale, null, null); + return phoneNumberAdministrations.getAllPhoneNumbersAsync(locale, null, null); } PagedFlux listAllPhoneNumbers(String locale, Context context) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getAllPhoneNumbersAsync( - locale, null, null, context); + return phoneNumberAdministrations.getAllPhoneNumbersAsync(locale, null, null, context); } /** @@ -83,7 +82,7 @@ public Mono getAllAreaCodes( String locationType, String countryCode, String phonePlanId, List locationOptions) { LocationOptionsQueries locationOptionsQueries = new LocationOptionsQueries(); locationOptionsQueries.setLocationOptions(locationOptions); - return phoneNumberAdminClient.getPhoneNumberAdministrations().getAllAreaCodesAsync( + return phoneNumberAdministrations.getAllAreaCodesAsync( locationType, countryCode, phonePlanId, locationOptionsQueries); } @@ -102,7 +101,7 @@ public Mono> getAllAreaCodesWithResponse( String locationType, String countryCode, String phonePlanId, List locationOptions) { LocationOptionsQueries locationOptionsQueries = new LocationOptionsQueries(); locationOptionsQueries.setLocationOptions(locationOptions); - return phoneNumberAdminClient.getPhoneNumberAdministrations().getAllAreaCodesWithResponseAsync( + return phoneNumberAdministrations.getAllAreaCodesWithResponseAsync( locationType, countryCode, phonePlanId, locationOptionsQueries); } @@ -111,7 +110,7 @@ Mono> getAllAreaCodesWithResponse( Context context) { LocationOptionsQueries locationOptionsQueries = new LocationOptionsQueries(); locationOptionsQueries.setLocationOptions(locationOptions); - return phoneNumberAdminClient.getPhoneNumberAdministrations().getAllAreaCodesWithResponseAsync( + return phoneNumberAdministrations.getAllAreaCodesWithResponseAsync( locationType, countryCode, phonePlanId, locationOptionsQueries, context); } @@ -124,7 +123,7 @@ Mono> getAllAreaCodesWithResponse( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getCapabilitiesUpdate(String capabilitiesId) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getCapabilitiesUpdateAsync(capabilitiesId); + return phoneNumberAdministrations.getCapabilitiesUpdateAsync(capabilitiesId); } /** @@ -137,14 +136,12 @@ public Mono getCapabilitiesUpdate(String @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getCapabilitiesUpdateWithResponse( String capabilitiesId) { - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .getCapabilitiesUpdateWithResponseAsync(capabilitiesId); + return phoneNumberAdministrations.getCapabilitiesUpdateWithResponseAsync(capabilitiesId); } Mono> getCapabilitiesUpdateWithResponse( String capabilitiesId, Context context) { - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .getCapabilitiesUpdateWithResponseAsync(capabilitiesId, context); + return phoneNumberAdministrations.getCapabilitiesUpdateWithResponseAsync(capabilitiesId, context); } /** @@ -164,8 +161,7 @@ public Mono updateCapabilities( UpdateNumberCapabilitiesRequest updateNumberCapabilitiesRequest = new UpdateNumberCapabilitiesRequest(); updateNumberCapabilitiesRequest.setPhoneNumberCapabilitiesUpdate(capabilitiesMap); - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .updateCapabilitiesAsync(updateNumberCapabilitiesRequest); + return phoneNumberAdministrations.updateCapabilitiesAsync(updateNumberCapabilitiesRequest); } /** @@ -185,8 +181,7 @@ public Mono> updateCapabilitiesWithRe UpdateNumberCapabilitiesRequest updateNumberCapabilitiesRequest = new UpdateNumberCapabilitiesRequest(); updateNumberCapabilitiesRequest.setPhoneNumberCapabilitiesUpdate(capabilitiesMap); - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .updateCapabilitiesWithResponseAsync(updateNumberCapabilitiesRequest); + return phoneNumberAdministrations.updateCapabilitiesWithResponseAsync(updateNumberCapabilitiesRequest); } Mono> updateCapabilitiesWithResponse( @@ -198,8 +193,7 @@ Mono> updateCapabilitiesWithResponse( UpdateNumberCapabilitiesRequest updateNumberCapabilitiesRequest = new UpdateNumberCapabilitiesRequest(); updateNumberCapabilitiesRequest.setPhoneNumberCapabilitiesUpdate(capabilitiesMap); - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .updateCapabilitiesWithResponseAsync(updateNumberCapabilitiesRequest, context); + return phoneNumberAdministrations.updateCapabilitiesWithResponseAsync(updateNumberCapabilitiesRequest, context); } /** @@ -210,13 +204,11 @@ Mono> updateCapabilitiesWithResponse( */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listAllSupportedCountries(String locale) { - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .getAllSupportedCountriesAsync(locale, null, null); + return phoneNumberAdministrations.getAllSupportedCountriesAsync(locale, null, null); } PagedFlux listAllSupportedCountries(String locale, Context context) { - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .getAllSupportedCountriesAsync(locale, null, null, context); + return phoneNumberAdministrations.getAllSupportedCountriesAsync(locale, null, null, context); } @@ -230,8 +222,7 @@ PagedFlux listAllSupportedCountries(String locale, Context c public Mono getNumberConfiguration(PhoneNumber phoneNumber) { NumberConfigurationPhoneNumber configurationPhoneNumber = new NumberConfigurationPhoneNumber(); configurationPhoneNumber.setPhoneNumber(phoneNumber.getValue()); - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .getNumberConfigurationAsync(configurationPhoneNumber); + return phoneNumberAdministrations.getNumberConfigurationAsync(configurationPhoneNumber); } /** @@ -245,16 +236,14 @@ public Mono getNumberConfiguration(PhoneNumber phon public Mono> getNumberConfigurationWithResponse(PhoneNumber phoneNumber) { NumberConfigurationPhoneNumber configurationPhoneNumber = new NumberConfigurationPhoneNumber(); configurationPhoneNumber.setPhoneNumber(phoneNumber.getValue()); - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .getNumberConfigurationWithResponseAsync(configurationPhoneNumber); + return phoneNumberAdministrations.getNumberConfigurationWithResponseAsync(configurationPhoneNumber); } Mono> getNumberConfigurationWithResponse( PhoneNumber phoneNumber, Context context) { NumberConfigurationPhoneNumber configurationPhoneNumber = new NumberConfigurationPhoneNumber(); configurationPhoneNumber.setPhoneNumber(phoneNumber.getValue()); - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .getNumberConfigurationWithResponseAsync(configurationPhoneNumber, context); + return phoneNumberAdministrations.getNumberConfigurationWithResponseAsync(configurationPhoneNumber, context); } /** @@ -268,7 +257,7 @@ Mono> getNumberConfigurationWithResponse( public Mono configureNumber(PhoneNumber phoneNumber, PstnConfiguration pstnConfiguration) { NumberConfiguration numberConfiguration = new NumberConfiguration(); numberConfiguration.setPhoneNumber(phoneNumber.getValue()).setPstnConfiguration(pstnConfiguration); - return phoneNumberAdminClient.getPhoneNumberAdministrations().configureNumberAsync(numberConfiguration); + return phoneNumberAdministrations.configureNumberAsync(numberConfiguration); } /** @@ -283,16 +272,14 @@ public Mono> configureNumberWithResponse( PhoneNumber phoneNumber, PstnConfiguration pstnConfiguration) { NumberConfiguration numberConfiguration = new NumberConfiguration(); numberConfiguration.setPhoneNumber(phoneNumber.getValue()).setPstnConfiguration(pstnConfiguration); - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .configureNumberWithResponseAsync(numberConfiguration); + return phoneNumberAdministrations.configureNumberWithResponseAsync(numberConfiguration); } Mono> configureNumberWithResponse( PhoneNumber phoneNumber, PstnConfiguration pstnConfiguration, Context context) { NumberConfiguration numberConfiguration = new NumberConfiguration(); numberConfiguration.setPhoneNumber(phoneNumber.getValue()).setPstnConfiguration(pstnConfiguration); - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .configureNumberWithResponseAsync(numberConfiguration, context); + return phoneNumberAdministrations.configureNumberWithResponseAsync(numberConfiguration, context); } /** @@ -305,7 +292,7 @@ Mono> configureNumberWithResponse( public Mono unconfigureNumber(PhoneNumber phoneNumber) { NumberConfigurationPhoneNumber configurationPhoneNumber = new NumberConfigurationPhoneNumber(); configurationPhoneNumber.setPhoneNumber(phoneNumber.getValue()); - return phoneNumberAdminClient.getPhoneNumberAdministrations().unconfigureNumberAsync(configurationPhoneNumber); + return phoneNumberAdministrations.unconfigureNumberAsync(configurationPhoneNumber); } /** @@ -318,15 +305,13 @@ public Mono unconfigureNumber(PhoneNumber phoneNumber) { public Mono> unconfigureNumberWithResponse(PhoneNumber phoneNumber) { NumberConfigurationPhoneNumber configurationPhoneNumber = new NumberConfigurationPhoneNumber(); configurationPhoneNumber.setPhoneNumber(phoneNumber.getValue()); - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .unconfigureNumberWithResponseAsync(configurationPhoneNumber); + return phoneNumberAdministrations.unconfigureNumberWithResponseAsync(configurationPhoneNumber); } Mono> unconfigureNumberWithResponse(PhoneNumber phoneNumber, Context context) { NumberConfigurationPhoneNumber configurationPhoneNumber = new NumberConfigurationPhoneNumber(); configurationPhoneNumber.setPhoneNumber(phoneNumber.getValue()); - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .unconfigureNumberWithResponseAsync(configurationPhoneNumber, context); + return phoneNumberAdministrations.unconfigureNumberWithResponseAsync(configurationPhoneNumber, context); } /** @@ -340,13 +325,13 @@ Mono> unconfigureNumberWithResponse(PhoneNumber phoneNumber, Cont @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listPhonePlanGroups( String countryCode, String locale, Boolean includeRateInformation) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getPhonePlanGroupsAsync( + return phoneNumberAdministrations.getPhonePlanGroupsAsync( countryCode, locale, includeRateInformation, null, null); } PagedFlux listPhonePlanGroups( String countryCode, String locale, Boolean includeRateInformation, Context context) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getPhonePlanGroupsAsync( + return phoneNumberAdministrations.getPhonePlanGroupsAsync( countryCode, locale, includeRateInformation, null, null, context); } @@ -360,12 +345,12 @@ PagedFlux listPhonePlanGroups( */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listPhonePlans(String countryCode, String phonePlanGroupId, String locale) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getPhonePlansAsync( + return phoneNumberAdministrations.getPhonePlansAsync( countryCode, phonePlanGroupId, locale, null, null); } PagedFlux listPhonePlans(String countryCode, String phonePlanGroupId, String locale, Context context) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getPhonePlansAsync( + return phoneNumberAdministrations.getPhonePlansAsync( countryCode, phonePlanGroupId, locale, null, null, context); } @@ -381,13 +366,13 @@ PagedFlux listPhonePlans(String countryCode, String phonePlanGroupId, @ServiceMethod(returns = ReturnType.SINGLE) public Mono getPhonePlanLocationOptions( String countryCode, String phonePlanGroupId, String phonePlanId, String locale) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getPhonePlanLocationOptionsAsync( + return phoneNumberAdministrations.getPhonePlanLocationOptionsAsync( countryCode, phonePlanGroupId, phonePlanId, locale); } Mono getPhonePlanLocationOptions( String countryCode, String phonePlanGroupId, String phonePlanId, String locale, Context context) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getPhonePlanLocationOptionsAsync( + return phoneNumberAdministrations.getPhonePlanLocationOptionsAsync( countryCode, phonePlanGroupId, phonePlanId, locale, context); } @@ -404,13 +389,13 @@ Mono getPhonePlanLocationOptions( @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getPhonePlanLocationOptionsWithResponse( String countryCode, String phonePlanGroupId, String phonePlanId, String locale) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getPhonePlanLocationOptionsWithResponseAsync( + return phoneNumberAdministrations.getPhonePlanLocationOptionsWithResponseAsync( countryCode, phonePlanGroupId, phonePlanId, locale); } Mono> getPhonePlanLocationOptionsWithResponse( String countryCode, String phonePlanGroupId, String phonePlanId, String locale, Context context) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getPhonePlanLocationOptionsWithResponseAsync( + return phoneNumberAdministrations.getPhonePlanLocationOptionsWithResponseAsync( countryCode, phonePlanGroupId, phonePlanId, locale, context); } @@ -422,7 +407,7 @@ Mono> getPhonePlanLocationOptionsWithResponse( */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getReleaseById(String releaseId) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getReleaseByIdAsync(releaseId); + return phoneNumberAdministrations.getReleaseByIdAsync(releaseId); } /** @@ -434,12 +419,11 @@ public Mono getReleaseById(String releaseId) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getReleaseByIdWithResponse(String releaseId) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getReleaseByIdWithResponseAsync(releaseId); + return phoneNumberAdministrations.getReleaseByIdWithResponseAsync(releaseId); } Mono> getReleaseByIdWithResponse(String releaseId, Context context) { - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .getReleaseByIdWithResponseAsync(releaseId, context); + return phoneNumberAdministrations.getReleaseByIdWithResponseAsync(releaseId, context); } /** @@ -453,7 +437,7 @@ public Mono releasePhoneNumbers(List phoneNumbers) List phoneNumberStrings = phoneNumbers.stream().map(PhoneNumber::getValue).collect(Collectors.toList()); ReleaseRequest releaseRequest = new ReleaseRequest(); releaseRequest.setPhoneNumbers(phoneNumberStrings); - return phoneNumberAdminClient.getPhoneNumberAdministrations().releasePhoneNumbersAsync(releaseRequest); + return phoneNumberAdministrations.releasePhoneNumbersAsync(releaseRequest); } /** @@ -468,16 +452,14 @@ public Mono> releasePhoneNumbersWithResponse(List phoneNumberStrings = phoneNumbers.stream().map(PhoneNumber::getValue).collect(Collectors.toList()); ReleaseRequest releaseRequest = new ReleaseRequest(); releaseRequest.setPhoneNumbers(phoneNumberStrings); - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .releasePhoneNumbersWithResponseAsync(releaseRequest); + return phoneNumberAdministrations.releasePhoneNumbersWithResponseAsync(releaseRequest); } Mono> releasePhoneNumbersWithResponse(List phoneNumbers, Context context) { List phoneNumberStrings = phoneNumbers.stream().map(PhoneNumber::getValue).collect(Collectors.toList()); ReleaseRequest releaseRequest = new ReleaseRequest(); releaseRequest.setPhoneNumbers(phoneNumberStrings); - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .releasePhoneNumbersWithResponseAsync(releaseRequest, context); + return phoneNumberAdministrations.releasePhoneNumbersWithResponseAsync(releaseRequest, context); } /** @@ -487,12 +469,11 @@ Mono> releasePhoneNumbersWithResponse(List listAllReleases() { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getAllReleasesAsync(null, null); + return phoneNumberAdministrations.getAllReleasesAsync(null, null); } PagedFlux listAllReleases(Context context) { - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .getAllReleasesAsync(null, null, context); + return phoneNumberAdministrations.getAllReleasesAsync(null, null, context); } /** @@ -503,7 +484,7 @@ PagedFlux listAllReleases(Context context) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono getSearchById(String searchId) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getSearchByIdAsync(searchId); + return phoneNumberAdministrations.getSearchByIdAsync(searchId); } /** @@ -515,11 +496,11 @@ public Mono getSearchById(String searchId) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> getSearchByIdWithResponse(String searchId) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getSearchByIdWithResponseAsync(searchId); + return phoneNumberAdministrations.getSearchByIdWithResponseAsync(searchId); } Mono> getSearchByIdWithResponse(String searchId, Context context) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getSearchByIdWithResponseAsync(searchId, context); + return phoneNumberAdministrations.getSearchByIdWithResponseAsync(searchId, context); } /** @@ -530,7 +511,7 @@ Mono> getSearchByIdWithResponse(String searchId, Con */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono createSearch(CreateSearchOptions searchOptions) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().createSearchAsync(searchOptions); + return phoneNumberAdministrations.createSearchAsync(searchOptions); } /** @@ -542,12 +523,11 @@ public Mono createSearch(CreateSearchOptions searchOptions */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> createSearchWithResponse(CreateSearchOptions searchOptions) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().createSearchWithResponseAsync(searchOptions); + return phoneNumberAdministrations.createSearchWithResponseAsync(searchOptions); } Mono> createSearchWithResponse(CreateSearchOptions searchOptions, Context context) { - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .createSearchWithResponseAsync(searchOptions, context); + return phoneNumberAdministrations.createSearchWithResponseAsync(searchOptions, context); } /** @@ -557,12 +537,11 @@ Mono> createSearchWithResponse(CreateSearchOption */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedFlux listAllSearches() { - return phoneNumberAdminClient.getPhoneNumberAdministrations().getAllSearchesAsync(null, null); + return phoneNumberAdministrations.getAllSearchesAsync(null, null); } PagedFlux listAllSearches(Context context) { - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .getAllSearchesAsync(null, null, context); + return phoneNumberAdministrations.getAllSearchesAsync(null, null, context); } /** @@ -573,7 +552,7 @@ PagedFlux listAllSearches(Context context) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono cancelSearch(String searchId) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().cancelSearchAsync(searchId); + return phoneNumberAdministrations.cancelSearchAsync(searchId); } /** @@ -584,11 +563,11 @@ public Mono cancelSearch(String searchId) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> cancelSearchWithResponse(String searchId) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().cancelSearchWithResponseAsync(searchId); + return phoneNumberAdministrations.cancelSearchWithResponseAsync(searchId); } Mono> cancelSearchWithResponse(String searchId, Context context) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().cancelSearchWithResponseAsync(searchId, context); + return phoneNumberAdministrations.cancelSearchWithResponseAsync(searchId, context); } /** @@ -599,7 +578,7 @@ Mono> cancelSearchWithResponse(String searchId, Context context) */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono purchaseSearch(String searchId) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().purchaseSearchAsync(searchId); + return phoneNumberAdministrations.purchaseSearchAsync(searchId); } /** @@ -610,11 +589,10 @@ public Mono purchaseSearch(String searchId) { */ @ServiceMethod(returns = ReturnType.SINGLE) public Mono> purchaseSearchWithResponse(String searchId) { - return phoneNumberAdminClient.getPhoneNumberAdministrations().purchaseSearchWithResponseAsync(searchId); + return phoneNumberAdministrations.purchaseSearchWithResponseAsync(searchId); } Mono> purchaseSearchWithResponse(String searchId, Context context) { - return phoneNumberAdminClient.getPhoneNumberAdministrations() - .purchaseSearchWithResponseAsync(searchId, context); + return phoneNumberAdministrations.purchaseSearchWithResponseAsync(searchId, context); } } From 4770006d052434eb171b9ccd7529ccc1df0cdb46 Mon Sep 17 00:00:00 2001 From: Wayne Mo Date: Thu, 24 Sep 2020 15:58:55 -0700 Subject: [PATCH 6/6] Update async client tests to use StepVerifier --- ...PhoneNumberAsyncClientIntegrationTest.java | 188 +++++++++++++----- 1 file changed, 140 insertions(+), 48 deletions(-) diff --git a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientIntegrationTest.java b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientIntegrationTest.java index 7b10d8f0efcf..c27320dc03b2 100644 --- a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientIntegrationTest.java +++ b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberAsyncClientIntegrationTest.java @@ -26,6 +26,7 @@ import com.azure.core.util.Context; import org.junit.jupiter.api.Test; import reactor.core.publisher.Mono; +import reactor.test.StepVerifier; import java.util.ArrayList; import java.util.HashMap; @@ -41,7 +42,11 @@ public class PhoneNumberAsyncClientIntegrationTest extends PhoneNumberIntegratio public void listAllPhoneNumbers() { PagedFlux pagedFlux = this.getClient().listAllPhoneNumbers(LOCALE); - assertNotNull(pagedFlux.blockFirst().getPhoneNumber()); + StepVerifier.create(pagedFlux.next()) + .assertNext(item -> { + assertNotNull(item.getPhoneNumber()); + }) + .verifyComplete(); } @Test() @@ -49,7 +54,11 @@ public void listPhonePlanGroups() { PagedFlux pagedFlux = this.getClient().listPhonePlanGroups(COUNTRY_CODE, LOCALE, true); - assertNotNull(pagedFlux.blockFirst().getPhonePlanGroupId()); + StepVerifier.create(pagedFlux.next()) + .assertNext(item -> { + assertNotNull(item.getPhonePlanGroupId()); + }) + .verifyComplete(); } @Test() @@ -57,28 +66,44 @@ public void listPhonePlans() { PagedFlux pagedFlux = this.getClient().listPhonePlans(COUNTRY_CODE, PHONE_PLAN_GROUP_ID, LOCALE); - assertNotNull(pagedFlux.blockFirst().getPhonePlanId()); + StepVerifier.create(pagedFlux.next()) + .assertNext(item -> { + assertNotNull(item.getPhonePlanId()); + }) + .verifyComplete(); } @Test() public void listAllReleases() { PagedFlux pagedFlux = this.getClient().listAllReleases(); - assertNotNull(pagedFlux.blockFirst().getId()); + StepVerifier.create(pagedFlux.next()) + .assertNext(item -> { + assertNotNull(item.getId()); + }) + .verifyComplete(); } @Test() public void listAllSearches() { PagedFlux pagedFlux = this.getClient().listAllSearches(); - assertNotNull(pagedFlux.blockFirst().getId()); + StepVerifier.create(pagedFlux.next()) + .assertNext(item -> { + assertNotNull(item.getId()); + }) + .verifyComplete(); } @Test() public void listAllSupportedCountries() { PagedFlux pagedFlux = this.getClient().listAllSupportedCountries(LOCALE); - assertNotNull(pagedFlux.blockFirst().getCountryCode()); + StepVerifier.create(pagedFlux.next()) + .assertNext(item -> { + assertNotNull(item.getCountryCode()); + }) + .verifyComplete(); } @Test() @@ -86,7 +111,11 @@ public void getPhonePlanLocationOptions() { Mono mono = this.getClient().getPhonePlanLocationOptions(COUNTRY_CODE, PHONE_PLAN_GROUP_ID, PHONE_PLAN_ID, LOCALE); - assertNotNull(mono.block().getLocationOptions().getLabelId()); + StepVerifier.create(mono) + .assertNext(item -> { + assertNotNull(item.getLocationOptions().getLabelId()); + }) + .verifyComplete(); } @Test() @@ -105,7 +134,11 @@ public void getAllAreaCodes() { Mono mono = this.getClient().getAllAreaCodes("selection", COUNTRY_CODE, PHONE_PLAN_ID, locationOptions); - assertTrue(mono.block().getPrimaryAreaCodes().size() > 0); + StepVerifier.create(mono) + .assertNext(item -> { + assertTrue(item.getPrimaryAreaCodes().size() > 0); + }) + .verifyComplete(); } @Test() @@ -124,9 +157,12 @@ public void getAllAreaCodesWithResponse() { Mono> mono = this.getClient().getAllAreaCodesWithResponse( "selection", COUNTRY_CODE, PHONE_PLAN_ID, locationOptions, Context.NONE); - Response response = mono.block(); - assertEquals(200, response.getStatusCode()); - assertTrue(response.getValue().getPrimaryAreaCodes().size() > 0); + StepVerifier.create(mono) + .assertNext(item -> { + assertEquals(200, item.getStatusCode()); + assertTrue(item.getValue().getPrimaryAreaCodes().size() > 0); + }) + .verifyComplete(); } @Test() @@ -142,7 +178,11 @@ public void updateCapabilities() { Mono mono = this.getClient().updateCapabilities(updateMap); - assertNotNull(mono.block().getCapabilitiesUpdateId()); + StepVerifier.create(mono) + .assertNext(item -> { + assertNotNull(item.getCapabilitiesUpdateId()); + }) + .verifyComplete(); } @Test() @@ -159,16 +199,24 @@ public void updateCapabilitiesWithResponse() { Mono> mono = this.getClient().updateCapabilitiesWithResponse(updateMap, Context.NONE); - Response response = mono.block(); - assertEquals(200, response.getStatusCode()); - assertNotNull(response.getValue().getCapabilitiesUpdateId()); + StepVerifier.create(mono) + .assertNext(item -> { + assertEquals(200, item.getStatusCode()); + assertNotNull(item.getValue().getCapabilitiesUpdateId()); + }) + .verifyComplete(); } @Test() public void getCapabilitiesUpdate() { Mono mono = this.getClient().getCapabilitiesUpdate(CAPABILITIES_ID); - assertNotNull(mono.block().getCapabilitiesUpdateId()); + + StepVerifier.create(mono) + .assertNext(item -> { + assertNotNull(item.getCapabilitiesUpdateId()); + }) + .verifyComplete(); } @Test() @@ -176,9 +224,12 @@ public void getCapabilitiesUpdateWithResponse() { Mono> mono = this.getClient().getCapabilitiesUpdateWithResponse(CAPABILITIES_ID, Context.NONE); - Response response = mono.block(); - assertEquals(200, response.getStatusCode()); - assertNotNull(response.getValue().getCapabilitiesUpdateId()); + StepVerifier.create(mono) + .assertNext(item -> { + assertEquals(200, item.getStatusCode()); + assertNotNull(item.getValue().getCapabilitiesUpdateId()); + }) + .verifyComplete(); } @Test() @@ -196,7 +247,11 @@ public void createSearch() { Mono mono = this.getClient().createSearch(createSearchOptions); - assertNotNull(mono.block().getSearchId()); + StepVerifier.create(mono) + .assertNext(item -> { + assertNotNull(item.getSearchId()); + }) + .verifyComplete(); } @Test() @@ -215,54 +270,71 @@ public void createSearchWithResponse() { Mono> mono = this.getClient().createSearchWithResponse(createSearchOptions, Context.NONE); - Response response = mono.block(); - - assertEquals(201, response.getStatusCode()); - assertNotNull(response.getValue().getSearchId()); + StepVerifier.create(mono) + .assertNext(item -> { + assertEquals(201, item.getStatusCode()); + assertNotNull(item.getValue().getSearchId()); + }) + .verifyComplete(); } @Test() public void getSearchById() { Mono mono = this.getClient().getSearchById(SEARCH_ID); - assertEquals(SEARCH_ID, mono.block().getSearchId()); + StepVerifier.create(mono) + .assertNext(item -> { + assertEquals(SEARCH_ID, item.getSearchId()); + }) + .verifyComplete(); } @Test() public void getSearchByIdWithResponse() { Mono> mono = this.getClient().getSearchByIdWithResponse(SEARCH_ID, Context.NONE); - Response response = mono.block(); - assertEquals(200, response.getStatusCode()); - assertEquals(SEARCH_ID, response.getValue().getSearchId()); + StepVerifier.create(mono) + .assertNext(item -> { + assertEquals(200, item.getStatusCode()); + assertEquals(SEARCH_ID, item.getValue().getSearchId()); + }) + .verifyComplete(); } @Test() public void purchaseSearch() { Mono mono = this.getClient().purchaseSearch(SEARCH_ID_TO_PURCHASE); - mono.block(); + + StepVerifier.create(mono).verifyComplete(); } @Test() public void purchaseSearchWithResponse() { Mono> mono = this.getClient().purchaseSearchWithResponse(SEARCH_ID_TO_PURCHASE, Context.NONE); - Response response = mono.block(); - assertEquals(202, response.getStatusCode()); + StepVerifier.create(mono) + .assertNext(item -> { + assertEquals(202, item.getStatusCode()); + }) + .verifyComplete(); } @Test() public void cancelSearch() { Mono mono = this.getClient().cancelSearch(SEARCH_ID_TO_CANCEL); - mono.block(); + + StepVerifier.create(mono).verifyComplete(); } @Test() public void cancelSearchWithResponse() { Mono> mono = this.getClient().cancelSearchWithResponse(SEARCH_ID_TO_CANCEL, Context.NONE); - Response response = mono.block(); - assertEquals(202, response.getStatusCode()); + StepVerifier.create(mono) + .assertNext(item -> { + assertEquals(202, item.getStatusCode()); + }) + .verifyComplete(); } @Test() @@ -275,7 +347,7 @@ public void configureNumber() { Mono mono = this.getClient().configureNumber(number, pstnConfiguration); - mono.block(); + StepVerifier.create(mono).verifyComplete(); } @Test() @@ -288,8 +360,11 @@ public void configureNumberWithResponse() { Mono> mono = this.getClient().configureNumberWithResponse(number, pstnConfiguration, Context.NONE); - Response response = mono.block(); - assertEquals(202, response.getStatusCode()); + StepVerifier.create(mono) + .assertNext(item -> { + assertEquals(202, item.getStatusCode()); + }) + .verifyComplete(); } @Test() @@ -298,7 +373,11 @@ public void getNumberConfiguration() { Mono mono = this.getClient().getNumberConfiguration(number); - assertEquals("ApplicationId", mono.block().getPstnConfiguration().getApplicationId()); + StepVerifier.create(mono) + .assertNext(item -> { + assertEquals("ApplicationId", item.getPstnConfiguration().getApplicationId()); + }) + .verifyComplete(); } @Test() @@ -308,9 +387,12 @@ public void getNumberConfigurationWithResponse() { Mono> mono = this.getClient().getNumberConfigurationWithResponse(number, Context.NONE); - Response response = mono.block(); - assertEquals(200, response.getStatusCode()); - assertEquals("ApplicationId", response.getValue().getPstnConfiguration().getApplicationId()); + StepVerifier.create(mono) + .assertNext(item -> { + assertEquals(200, item.getStatusCode()); + assertEquals("ApplicationId", item.getValue().getPstnConfiguration().getApplicationId()); + }) + .verifyComplete(); } @Test() @@ -319,7 +401,7 @@ public void unconfigureNumber() { Mono mono = this.getClient().unconfigureNumber(number); - mono.block(); + StepVerifier.create(mono).verifyComplete(); } @Test() @@ -328,8 +410,11 @@ public void unconfigureNumberWithResponse() { Mono> mono = this.getClient().unconfigureNumberWithResponse(number, Context.NONE); - Response response = mono.block(); - assertEquals(202, response.getStatusCode()); + StepVerifier.create(mono) + .assertNext(item -> { + assertEquals(202, item.getStatusCode()); + }) + .verifyComplete(); } @Test() @@ -339,7 +424,11 @@ public void releasePhoneNumbers() { Mono mono = this.getClient().releasePhoneNumbers(phoneNumbers); - assertNotNull(mono.block().getReleaseId()); + StepVerifier.create(mono) + .assertNext(item -> { + assertNotNull(item.getReleaseId()); + }) + .verifyComplete(); } @Test() @@ -350,9 +439,12 @@ public void releasePhoneNumbersWithResponse() { Mono> mono = this.getClient().releasePhoneNumbersWithResponse(phoneNumbers, Context.NONE); - Response response = mono.block(); - assertEquals(200, response.getStatusCode()); - assertNotNull(response.getValue().getReleaseId()); + StepVerifier.create(mono) + .assertNext(item -> { + assertEquals(200, item.getStatusCode()); + assertNotNull(item.getValue().getReleaseId()); + }) + .verifyComplete(); } private PhoneNumberAsyncClient getClient() {