diff --git a/sdk/communication/azure-communication-administration/README.md b/sdk/communication/azure-communication-administration/README.md index 0dfe67cdedc4b..b1dd91903f29b 100644 --- a/sdk/communication/azure-communication-administration/README.md +++ b/sdk/communication/azure-communication-administration/README.md @@ -22,7 +22,7 @@ Acquired phone numbers can come with many capabilities, depending on the country com.azure azure-communication-administration - 1.0.0-beta.2 + 1.0.0-beta.3 ``` @@ -242,7 +242,7 @@ for (String areaCode ### Configure Phone Number - + ```java phoneNumberClient.configureNumber(phoneNumber, pstnConfiguration); ``` @@ -253,7 +253,7 @@ The Phone Number Client supports a variety of long running operations that allow ### Create Search - + ```java String phonePlanId = "PHONE_PLAN_ID"; @@ -283,7 +283,7 @@ for (String phoneNumber: result.getPhoneNumbers()) { ``` ### Purchase Search - + ```java Duration duration = Duration.ofSeconds(1); String phoneNumberReservationId = "RESERVATION_ID_TO_PURCHASE"; @@ -295,7 +295,7 @@ res.waitForCompletion(); ``` ### Release Phone Numbers - + ```java Duration duration = Duration.ofSeconds(1); PhoneNumber phoneNumber = new PhoneNumber("PHONE_NUMBER_TO_RELEASE"); 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 5a46c23cc88d6..ef5bc575e0e6b 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 @@ -640,8 +640,7 @@ Mono> getReservationByIdWithResponse(String res * @param reservationOptions A {@link CreateReservationOptions} with the reservation options * @return A {@link Mono} containing a {@link CreateReservationResponse} representing the reservation. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono createReservation(CreateReservationOptions reservationOptions) { + private Mono createReservation(CreateReservationOptions reservationOptions) { return createReservationWithResponse(reservationOptions).flatMap(FluxUtil::toMono); } @@ -652,8 +651,7 @@ public Mono createReservation(CreateReservationOption * @return A {@link Mono} containing a {@link Response} whose {@link Response#getValue()} value returns * a {@link CreateReservationResponse} representing the reservation. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> createReservationWithResponse( + private Mono> createReservationWithResponse( CreateReservationOptions reservationOptions) { return createReservationWithResponse(reservationOptions, null); } 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 index 09bc5ae8eeba6..897d2136cdb20 100644 --- 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 @@ -5,7 +5,6 @@ import com.azure.communication.administration.models.AcquiredPhoneNumber; import com.azure.communication.administration.models.AreaCodes; import com.azure.communication.administration.models.CreateReservationOptions; -import com.azure.communication.administration.models.CreateReservationResponse; import com.azure.communication.administration.models.LocationOptionsQuery; import com.azure.communication.administration.models.LocationOptionsResponse; import com.azure.communication.administration.models.NumberConfigurationResponse; @@ -411,31 +410,6 @@ public Response getReservationByIdWithResponse(String re return phoneNumberAsyncClient.getReservationByIdWithResponse(reservationId, context).block(); } - /** - * Create a phone number reservation. - * - * @param reservationOptions A {@link CreateReservationOptions} with the reservation options - * @return A {@link CreateReservationResponse} representing the reservation. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public CreateReservationResponse createReservation(CreateReservationOptions reservationOptions) { - return phoneNumberAsyncClient.createReservation(reservationOptions).block(); - } - - /** - * Create a phone number reservation. - * - * @param reservationOptions A {@link CreateReservationOptions} with the reservation options - * @param context A {@link Context} representing the request context. - * @return A {@link Response} whose {@link Response#getValue()} value returns - * a {@link CreateReservationResponse} representing the reservation. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response createReservationWithResponse( - CreateReservationOptions reservationOptions, Context context) { - return phoneNumberAsyncClient.createReservationWithResponse(reservationOptions, context).block(); - } - /** * Gets the list of all reservations * diff --git a/sdk/communication/azure-communication-administration/src/samples/java/com/azure/communication/administration/ReadmeSamples.java b/sdk/communication/azure-communication-administration/src/samples/java/com/azure/communication/administration/ReadmeSamples.java index 47fd34a516e70..7e96370984f2d 100644 --- a/sdk/communication/azure-communication-administration/src/samples/java/com/azure/communication/administration/ReadmeSamples.java +++ b/sdk/communication/azure-communication-administration/src/samples/java/com/azure/communication/administration/ReadmeSamples.java @@ -10,7 +10,6 @@ import com.azure.communication.administration.models.AcquiredPhoneNumber; import com.azure.communication.administration.models.AreaCodes; import com.azure.communication.administration.models.CreateReservationOptions; -import com.azure.communication.administration.models.CreateReservationResponse; import com.azure.communication.administration.models.LocationOptions; import com.azure.communication.administration.models.LocationOptionsDetails; import com.azure.communication.administration.models.LocationOptionsQuery; @@ -27,6 +26,7 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.polling.SyncPoller; + public class ReadmeSamples { /** * Sample code for creating a sync Communication Identity Client. @@ -294,38 +294,6 @@ public AreaCodes getAreaCodes() { return areaCodes; } - /** - * Sample code to create a phone number reservation - * - * @return PhoneNumberReservation for the phone plan - */ - public PhoneNumberReservation createPhoneNumberReservation() { - String phonePlanId = "PHONE_PLAN_ID"; - - List phonePlanIds = new ArrayList<>(); - phonePlanIds.add(phonePlanId); - - CreateReservationOptions createReservationOptions = new CreateReservationOptions(); - createReservationOptions - .setAreaCode("AREA_CODE_FOR_RESERVATION") - .setDescription("DESCRIPTION_FOR_RESERVATION") - .setDisplayName("NAME_FOR_RESERVATION") - .setPhonePlanIds(phonePlanIds) - .setQuantity(2); - PhoneNumberClient phoneNumberClient = createPhoneNumberClient(); - CreateReservationResponse createReservationResponse = phoneNumberClient.createReservation(createReservationOptions); - - System.out.println("ReservationId: " + createReservationResponse.getReservationId()); - PhoneNumberReservation phoneNumberReservation = phoneNumberClient.getReservationById(createReservationResponse.getReservationId()); - - for (String phoneNumber - : phoneNumberReservation.getPhoneNumbers()) { - System.out.println("Phone Number: " + phoneNumber); - } - - return phoneNumberReservation; - } - /** * Sample code to configure a phone number */ 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 e1545141b452e..0bd41d5a27dd9 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 @@ -273,29 +273,6 @@ public void getCapabilitiesUpdateWithResponse(HttpClient httpClient) { .verifyComplete(); } - @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void createReservation(HttpClient httpClient) { - List phonePlanIds = new ArrayList<>(); - phonePlanIds.add(PHONE_PLAN_ID); - - CreateReservationOptions createReservationOptions = new CreateReservationOptions(); - createReservationOptions - .setAreaCode(AREA_CODE_FOR_SEARCH) - .setDescription("testreservation20200014") - .setDisplayName("testreservation20200014") - .setPhonePlanIds(phonePlanIds) - .setQuantity(1); - - Mono mono = this.getClient(httpClient).createReservation(createReservationOptions); - - StepVerifier.create(mono) - .assertNext(item -> { - assertNotNull(item.getReservationId()); - }) - .verifyComplete(); - } - @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void createReservationWithResponse(HttpClient httpClient) { diff --git a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientIntegrationTest.java b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientIntegrationTest.java index 7d444489f76b0..f165e282a842e 100644 --- a/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientIntegrationTest.java +++ b/sdk/communication/azure-communication-administration/src/test/java/com/azure/communication/administration/PhoneNumberClientIntegrationTest.java @@ -5,8 +5,6 @@ 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.CreateReservationOptions; -import com.azure.communication.administration.models.CreateReservationResponse; import com.azure.communication.administration.models.LocationOptionsQuery; import com.azure.communication.administration.models.LocationOptionsResponse; import com.azure.communication.administration.models.NumberConfigurationResponse; @@ -196,46 +194,6 @@ public void getCapabilitiesUpdateWithResponse(HttpClient httpClient) { assertNotNull(response.getValue().getCapabilitiesUpdateId()); } - @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void createReservation(HttpClient httpClient) { - List phonePlanIds = new ArrayList<>(); - phonePlanIds.add(PHONE_PLAN_ID); - - CreateReservationOptions createReservationOptions = new CreateReservationOptions(); - createReservationOptions - .setAreaCode(AREA_CODE_FOR_SEARCH) - .setDescription("318362fa-2b19-4062-92af-fa0673914f30") - .setDisplayName("318362fa-2b19-4062-92af-fa0673914f30") - .setPhonePlanIds(phonePlanIds) - .setQuantity(1); - - CreateReservationResponse createReservationResponse = this.getClient(httpClient).createReservation(createReservationOptions); - - assertNotNull(createReservationResponse.getReservationId()); - } - - @ParameterizedTest - @MethodSource("com.azure.core.test.TestBase#getHttpClients") - public void createReservationWithResponse(HttpClient httpClient) { - List phonePlanIds = new ArrayList<>(); - phonePlanIds.add(PHONE_PLAN_ID); - - CreateReservationOptions createReservationOptions = new CreateReservationOptions(); - createReservationOptions - .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(httpClient).createReservationWithResponse(createReservationOptions, Context.NONE); - - assertEquals(201, response.getStatusCode()); - assertNotNull(response.getValue().getReservationId()); - } - @ParameterizedTest @MethodSource("com.azure.core.test.TestBase#getHttpClients") public void getReservationById(HttpClient httpClient) {