Skip to content

Commit

Permalink
[ COmmunication] - Phone Numbers - Address Api View Comments (Azure#1…
Browse files Browse the repository at this point in the history
…9822)

* Phone Numbers Address Api View Comments

* Update changelog and code coverage requirements

* Address review comments

* Address comments

Co-authored-by: Minnie Liu <peiliu@microsoft.com>
  • Loading branch information
minnieliu and Minnie Liu authored Mar 13, 2021
1 parent 56074ff commit bdead65
Show file tree
Hide file tree
Showing 14 changed files with 1,370 additions and 127 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Release History

## 1.0.0-beta.7 (Unreleased)
### Added
- Added `PollerFlux<PhoneNumberOperation, PhoneNumberSearchResult> beginSearchAvailablePhoneNumbers(String countryCode, PhoneNumberType phoneNumberType, PhoneNumberAssignmentType assignmentType, PhoneNumberCapabilities capabilities)` in PhoneNumbersAsyncClient.
- Added `PagedIterable<PurchasedPhoneNumber> listPurchasedPhoneNumbers()` in PhoneNumbersClient.
- Added `SyncPoller<PhoneNumberOperation, PhoneNumberSearchResult> beginSearchAvailablePhoneNumbers(String countryCode, PhoneNumberType phoneNumberType, PhoneNumberAssignmentType assignmentType, PhoneNumberCapabilities capabilities)` in PhoneNumbersClient.
- Added `SyncPoller<PhoneNumberOperation, Void> beginPurchasePhoneNumbers(String searchId)` in PhoneNumbersClient.
- Added `SyncPoller<PhoneNumberOperation, Void> beginReleasePhoneNumber(String phoneNumber)` in PhoneNumbersClient.
- Added `SyncPoller<PhoneNumberOperation, PurchasedPhoneNumber> beginUpdatePhoneNumberCapabilities(String phoneNumber, PhoneNumberCapabilitiesRequest capabilitiesUpdateRequest)` in PhoneNumbersClient.

### Breaking Changes
- Renamed AcquiredPhoneNumber to PurchasedPhoneNumber.
- Renamed PhoneNumbersAsyncClient.getPhoneNumber and PhoneNumbersClient.getPhoneNumber to PhoneNumbersAsyncClient.getPurchasedPhoneNumber and PhoneNumbersClient.getPurchasedPhoneNumber.
Expand Down
4 changes: 2 additions & 2 deletions sdk/communication/azure-communication-phonenumbers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
<properties>
<src.dir>src/main</src.dir>
<test.dir>src/test</test.dir>
<jacoco.min.linecoverage>0.40</jacoco.min.linecoverage>
<jacoco.min.branchcoverage>0.50</jacoco.min.branchcoverage>
<jacoco.min.linecoverage>0.64</jacoco.min.linecoverage>
<jacoco.min.branchcoverage>0.68</jacoco.min.branchcoverage>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,22 @@ public PagedFlux<PurchasedPhoneNumber> listPurchasedPhoneNumbers() {
}
}

/**
* Starts the search for available phone numbers to purchase.
*
* @param countryCode The ISO 3166-2 country code.
* @param phoneNumberType {@link PhoneNumberType} The phone number type.
* @param assignmentType {@link PhoneNumberAssignmentType} The phone number assignment type.
* @param capabilities {@link PhoneNumberCapabilities} The phone number capabilities.
* @return A {@link PollerFlux} object with the reservation result.
* @throws NullPointerException if {@code countryCode} or {@code searchRequest} is null.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux<PhoneNumberOperation, PhoneNumberSearchResult> beginSearchAvailablePhoneNumbers(
String countryCode, PhoneNumberType phoneNumberType, PhoneNumberAssignmentType assignmentType, PhoneNumberCapabilities capabilities) {
return beginSearchAvailablePhoneNumbers(countryCode, phoneNumberType, assignmentType, capabilities, null, null);
}

/**
* Starts the search for available phone numbers to purchase.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ public Response<PurchasedPhoneNumber> getPurchasedPhoneNumberWithResponse(String
return client.getByNumberWithResponseAsync(phoneNumber, context).block();
}

/**
* Gets the list of the purchased phone numbers.
*
* @return A {@link PagedIterable} of {@link PurchasedPhoneNumber} instances representing purchased telephone numbers.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<PurchasedPhoneNumber> listPurchasedPhoneNumbers() {
return this.listPurchasedPhoneNumbers(null);
}

/**
* Gets the list of the purchased phone numbers with context.
*
Expand All @@ -78,6 +88,25 @@ public PagedIterable<PurchasedPhoneNumber> listPurchasedPhoneNumbers(Context con
return client.listPhoneNumbers(null, null, context);
}

/**
* Starts the search for available phone numbers to purchase.
*
* This function returns a Long Running Operation poller that allows you to wait indefinitely until the
* operation is complete.
*
* @param countryCode The ISO 3166-2 country code.
* @param phoneNumberType {@link PhoneNumberType} The phone number type.
* @param assignmentType {@link PhoneNumberAssignmentType} The phone number assignment type.
* @param capabilities {@link PhoneNumberCapabilities} The phone number capabilities.
* @return A {@link SyncPoller} object with the reservation result.
* @throws NullPointerException if {@code countryCode} or {@code searchRequest} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PhoneNumberOperation, PhoneNumberSearchResult> beginSearchAvailablePhoneNumbers(
String countryCode, PhoneNumberType phoneNumberType, PhoneNumberAssignmentType assignmentType, PhoneNumberCapabilities capabilities) {
return asyncClient.beginSearchAvailablePhoneNumbers(countryCode, phoneNumberType, assignmentType, capabilities).getSyncPoller();
}

/**
* Starts the search for available phone numbers to purchase.
*
Expand All @@ -100,6 +129,21 @@ public SyncPoller<PhoneNumberOperation, PhoneNumberSearchResult> beginSearchAvai
return asyncClient.beginSearchAvailablePhoneNumbers(countryCode, phoneNumberType, assignmentType, capabilities, searchOptions, context).getSyncPoller();
}

/**
* Starts the purchase of the phone number(s) in the search result associated with a given id.
*
* This function returns a Long Running Operation poller that allows you to wait indefinitely until the
* operation is complete.
*
* @param searchId ID of the search
* @return A {@link SyncPoller} object with Void.
* @throws NullPointerException if {@code searchId} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PhoneNumberOperation, Void> beginPurchasePhoneNumbers(String searchId) {
return asyncClient.beginPurchasePhoneNumbers(searchId).getSyncPoller();
}

/**
* Starts the purchase of the phone number(s) in the search result associated with a given id.
*
Expand All @@ -108,14 +152,30 @@ public SyncPoller<PhoneNumberOperation, PhoneNumberSearchResult> beginSearchAvai
*
* @param searchId ID of the search
* @param context A {@link Context} representing the request context.
* @return A {@link SyncPoller} object.
* @return A {@link SyncPoller} object with Void.
* @throws NullPointerException if {@code searchId} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PhoneNumberOperation, Void> beginPurchasePhoneNumbers(String searchId, Context context) {
return asyncClient.beginPurchasePhoneNumbers(searchId, context).getSyncPoller();
}

/**
* Starts the update of capabilities for a purchased phone number.
*
* This function returns a Long Running Operation poller that allows you to wait indefinitely until the
* operation is complete.
*
* @param phoneNumber The phone number id in E.164 format. The leading plus can be either + or encoded
* as %2B.
* @return A {@link SyncPoller} object with Void.
* @throws NullPointerException if {@code phoneNumber} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PhoneNumberOperation, Void> beginReleasePhoneNumber(String phoneNumber) {
return asyncClient.beginReleasePhoneNumber(phoneNumber).getSyncPoller();
}

/**
* Starts the update of capabilities for a purchased phone number.
*
Expand All @@ -126,12 +186,28 @@ public SyncPoller<PhoneNumberOperation, Void> beginPurchasePhoneNumbers(String s
* @param phoneNumber The phone number id in E.164 format. The leading plus can be either + or encoded
* as %2B.
* @param context A {@link Context} representing the request context.
* @return A {@link SyncPoller} object.
* @return A {@link SyncPoller} object with Void.
* @throws NullPointerException if {@code phoneNumber} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PhoneNumberOperation, Void> beginReleasePhoneNumber(String phoneNumber, Context context) {
return asyncClient.beginReleasePhoneNumber(phoneNumber).getSyncPoller();
return asyncClient.beginReleasePhoneNumber(phoneNumber, context).getSyncPoller();
}

/**
* Update capabilities of a purchased phone number.
*
* This function returns a Long Running Operation poller that allows you to wait indefinitely until the
* operation is complete.
* @param phoneNumber The phone number id in E.164 format. The leading plus can be either + or encoded
* as %2B.
* @param capabilitiesUpdateRequest Update capabilities of a purchased phone number.
* @return A {@link SyncPoller} object with purchased phone number.
* @throws NullPointerException if {@code phoneNumber} or {@code capabilitiesUpdateRequest} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public SyncPoller<PhoneNumberOperation, PurchasedPhoneNumber> beginUpdatePhoneNumberCapabilities(String phoneNumber, PhoneNumberCapabilitiesRequest capabilitiesUpdateRequest) {
return asyncClient.beginUpdatePhoneNumberCapabilities(phoneNumber, capabilitiesUpdateRequest).getSyncPoller();
}

/**
Expand All @@ -143,7 +219,7 @@ public SyncPoller<PhoneNumberOperation, Void> beginReleasePhoneNumber(String pho
* as %2B.
* @param capabilitiesUpdateRequest Update capabilities of a purchased phone number.
* @param context A {@link Context} representing the request context.
* @return A {@link SyncPoller} object
* @return A {@link SyncPoller} object with purchased phone number.
* @throws NullPointerException if {@code phoneNumber} or {@code capabilitiesUpdateRequest} is null.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

/** The PhoneNumberSearchOptions model. */
@Fluent
public class PhoneNumberSearchOptions {
public final class PhoneNumberSearchOptions {

private String areaCode;
private Integer quantity;
Expand Down
Loading

0 comments on commit bdead65

Please sign in to comment.