-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Communication] -Administration- Renaming the model from PhoneNumberSearch to PhoneNumberReservation #17253
[Communication] -Administration- Renaming the model from PhoneNumberSearch to PhoneNumberReservation #17253
Changes from 4 commits
0ee3a0c
ebafcf2
083e60e
eaf8c47
3dc2629
017c08b
4492314
8370590
2d66060
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -271,12 +271,12 @@ createSearchOptions | |
Duration duration = Duration.ofSeconds(1); | ||
PhoneNumberClient phoneNumberClient = createPhoneNumberClient(); | ||
|
||
SyncPoller<PhoneNumberSearch, PhoneNumberSearch> res = | ||
SyncPoller<PhoneNumberReservation, PhoneNumberReservation> res = | ||
phoneNumberClient.beginCreateSearch(createSearchOptions, duration); | ||
res.waitForCompletion(); | ||
PhoneNumberSearch result = res.getFinalResult(); | ||
PhoneNumberReservation result = res.getFinalResult(); | ||
|
||
System.out.println("Search Id: " + result.getSearchId()); | ||
System.out.println("Reservation Id: " + result.getReservationId()); | ||
for (String phoneNumber: result.getPhoneNumbers()) { | ||
System.out.println("Phone Number: " + phoneNumber); | ||
} | ||
|
@@ -289,7 +289,7 @@ Duration duration = Duration.ofSeconds(1); | |
String phoneNumberSearchId = "SEARCH_ID_TO_PURCHASE"; | ||
PhoneNumberClient phoneNumberClient = createPhoneNumberClient(); | ||
|
||
SyncPoller<Void, Void> res = | ||
SyncPoller<Void, Void> res = | ||
phoneNumberClient.beginPurchaseSearch(phoneNumberSearchId, duration); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also method names There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed please take a look |
||
res.waitForCompletion(); | ||
``` | ||
|
@@ -303,7 +303,7 @@ List<PhoneNumber> phoneNumbers = new ArrayList<>(); | |
phoneNumbers.add(phoneNumber); | ||
PhoneNumberClient phoneNumberClient = createPhoneNumberClient(); | ||
|
||
SyncPoller<PhoneNumberRelease, PhoneNumberRelease> res = | ||
SyncPoller<PhoneNumberRelease, PhoneNumberRelease> res = | ||
phoneNumberClient.beginReleasePhoneNumbers(phoneNumbers, duration); | ||
res.waitForCompletion(); | ||
PhoneNumberRelease result = res.getFinalResult(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ | |
import com.azure.communication.administration.models.ReleaseStatus; | ||
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.PhoneNumberReservation; | ||
import com.azure.communication.administration.models.SearchStatus; | ||
import com.azure.communication.administration.models.UpdateNumberCapabilitiesRequest; | ||
import com.azure.communication.administration.models.UpdatePhoneNumberCapabilitiesResponse; | ||
|
@@ -602,10 +602,10 @@ PagedFlux<PhoneNumberEntity> listAllReleases(Context context) { | |
* Gets a search by ID. | ||
* | ||
* @param searchId ID of the search | ||
* @return A {@link Mono} containing a {@link PhoneNumberSearch} representing the search. | ||
* @return A {@link Mono} containing a {@link PhoneNumberReservation} representing the search. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "... representing the reservation" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed please take a look |
||
*/ | ||
@ServiceMethod(returns = ReturnType.SINGLE) | ||
public Mono<PhoneNumberSearch> getSearchById(String searchId) { | ||
public Mono<PhoneNumberReservation> getSearchById(String searchId) { | ||
return getSearchByIdWithResponse(searchId).flatMap(FluxUtil::toMono); | ||
} | ||
|
||
|
@@ -614,14 +614,14 @@ public Mono<PhoneNumberSearch> getSearchById(String searchId) { | |
* | ||
* @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. | ||
* a {@link PhoneNumberReservation} representing the search. | ||
*/ | ||
@ServiceMethod(returns = ReturnType.SINGLE) | ||
public Mono<Response<PhoneNumberSearch>> getSearchByIdWithResponse(String searchId) { | ||
public Mono<Response<PhoneNumberReservation>> getSearchByIdWithResponse(String searchId) { | ||
return getSearchByIdWithResponse(searchId, null); | ||
} | ||
|
||
Mono<Response<PhoneNumberSearch>> getSearchByIdWithResponse(String searchId, Context context) { | ||
Mono<Response<PhoneNumberReservation>> getSearchByIdWithResponse(String searchId, Context context) { | ||
Objects.requireNonNull(searchId, "'searchId' cannot be null."); | ||
|
||
try { | ||
|
@@ -765,51 +765,51 @@ private Mono<Response<Void>> purchaseSearchWithResponse(String searchId, Context | |
} | ||
|
||
/** | ||
* Initiates a search and returns a {@link PhoneNumberSearch} usable by other functions | ||
* This function returns a Long Running Operation poller that allows you to | ||
* Initiates a search and returns a {@link PhoneNumberReservation} usable by other functions | ||
* This function returns a Long Running Operation poller that allows you to | ||
* wait indefinitely until the operation is complete. | ||
* | ||
* | ||
* @param options A {@link CreateSearchOptions} with the search options | ||
* @param pollInterval The time our long running operation will keep on polling | ||
* @param pollInterval The time our long running operation will keep on polling | ||
* until it gets a result from the server | ||
* @return A {@link PollerFlux} object with the search result | ||
*/ | ||
@ServiceMethod(returns = ReturnType.COLLECTION) | ||
public PollerFlux<PhoneNumberSearch, PhoneNumberSearch> beginCreateSearch( | ||
public PollerFlux<PhoneNumberReservation, PhoneNumberReservation> beginCreateSearch( | ||
CreateSearchOptions options, Duration pollInterval) { | ||
Objects.requireNonNull(options, "'options' cannot be null."); | ||
|
||
if (pollInterval == null) { | ||
pollInterval = defaultPollInterval; | ||
} | ||
|
||
return new PollerFlux<PhoneNumberSearch, PhoneNumberSearch>(pollInterval, | ||
return new PollerFlux<PhoneNumberReservation, PhoneNumberReservation>(pollInterval, | ||
createSearchActivationOperation(options), | ||
createSearchPollOperation(), | ||
cancelSearchOperation(), | ||
createSearchFetchResultOperation()); | ||
} | ||
|
||
private Function<PollingContext<PhoneNumberSearch>, Mono<PhoneNumberSearch>> | ||
private Function<PollingContext<PhoneNumberReservation>, Mono<PhoneNumberReservation>> | ||
createSearchActivationOperation(CreateSearchOptions options) { | ||
return (pollingContext) -> { | ||
Mono<PhoneNumberSearch> response = createSearch(options).flatMap(createSearchResponse -> { | ||
Mono<PhoneNumberReservation> response = createSearch(options).flatMap(createSearchResponse -> { | ||
String searchId = createSearchResponse.getSearchId(); | ||
Mono<PhoneNumberSearch> phoneNumberSearch = getSearchById(searchId); | ||
Mono<PhoneNumberReservation> phoneNumberSearch = getSearchById(searchId); | ||
return phoneNumberSearch; | ||
}); | ||
return response; | ||
}; | ||
} | ||
|
||
private Function<PollingContext<PhoneNumberSearch>, Mono<PollResponse<PhoneNumberSearch>>> | ||
private Function<PollingContext<PhoneNumberReservation>, Mono<PollResponse<PhoneNumberReservation>>> | ||
createSearchPollOperation() { | ||
return pollingContext -> | ||
getSearchById(pollingContext.getLatestResponse().getValue().getSearchId()) | ||
getSearchById(pollingContext.getLatestResponse().getValue().getReservationId()) | ||
.flatMap(getSearchResponse -> { | ||
SearchStatus status = getSearchResponse.getStatus(); | ||
if (status.equals(SearchStatus.EXPIRED) | ||
|| status.equals(SearchStatus.CANCELLED) | ||
if (status.equals(SearchStatus.EXPIRED) | ||
|| status.equals(SearchStatus.CANCELLED) | ||
|| status.equals(SearchStatus.RESERVED)) { | ||
return Mono.just(new PollResponse<>( | ||
LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, getSearchResponse)); | ||
|
@@ -822,37 +822,37 @@ public PollerFlux<PhoneNumberSearch, PhoneNumberSearch> beginCreateSearch( | |
}); | ||
} | ||
|
||
private BiFunction<PollingContext<PhoneNumberSearch>, | ||
PollResponse<PhoneNumberSearch>, Mono<PhoneNumberSearch>> | ||
private BiFunction<PollingContext<PhoneNumberReservation>, | ||
PollResponse<PhoneNumberReservation>, Mono<PhoneNumberReservation>> | ||
cancelSearchOperation() { | ||
return (pollingContext, firstResponse) -> { | ||
cancelSearch(pollingContext.getLatestResponse().getValue().getSearchId()); | ||
cancelSearch(pollingContext.getLatestResponse().getValue().getReservationId()); | ||
return Mono.just(pollingContext.getLatestResponse().getValue()); | ||
}; | ||
} | ||
|
||
private Function<PollingContext<PhoneNumberSearch>, | ||
Mono<PhoneNumberSearch>> createSearchFetchResultOperation() { | ||
private Function<PollingContext<PhoneNumberReservation>, | ||
Mono<PhoneNumberReservation>> createSearchFetchResultOperation() { | ||
return pollingContext -> { | ||
return Mono.just(pollingContext.getLatestResponse().getValue()); | ||
}; | ||
} | ||
|
||
/** | ||
* Initiates a purchase process and polls until a terminal state is reached | ||
* This function returns a Long Running Operation poller that allows you to | ||
* 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 | ||
* @param pollInterval The time our long running operation will keep on polling | ||
* @param pollInterval The time our long running operation will keep on polling | ||
* until it gets a result from the server | ||
* @return A {@link PollerFlux} object. | ||
*/ | ||
|
||
@ServiceMethod(returns = ReturnType.COLLECTION) | ||
public PollerFlux<Void, Void> beginPurchaseSearch(String searchId, Duration pollInterval) { | ||
Objects.requireNonNull(searchId, "'searchId' can not be null."); | ||
|
||
if (pollInterval == null) { | ||
pollInterval = defaultPollInterval; | ||
} | ||
|
@@ -864,7 +864,7 @@ public PollerFlux<Void, Void> beginPurchaseSearch(String searchId, Duration poll | |
purchaseSearchFetchResultOperation()); | ||
} | ||
|
||
private Function<PollingContext<Void>, | ||
private Function<PollingContext<Void>, | ||
Mono<Void>> purchaseSearchActivationOperation(String searchId) { | ||
return (pollingContext) -> { | ||
return purchaseSearch(searchId); | ||
|
@@ -880,7 +880,7 @@ Mono<Void>> purchaseSearchActivationOperation(String searchId) { | |
return Mono.just(new PollResponse<>( | ||
LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, null)); | ||
} | ||
if (statusResponse.equals(SearchStatus.ERROR) | ||
if (statusResponse.equals(SearchStatus.ERROR) | ||
|| statusResponse.equals(SearchStatus.EXPIRED)) { | ||
return Mono.just(new PollResponse<>( | ||
LongRunningOperationStatus.FAILED, null)); | ||
|
@@ -899,16 +899,16 @@ Mono<Void>> purchaseSearchFetchResultOperation() { | |
|
||
/** | ||
* Releases the given phone numbers. | ||
* This function returns a Long Running Operation poller that allows you to | ||
* This function returns a Long Running Operation poller that allows you to | ||
* wait indefinitely until the operation is complete. | ||
* | ||
* | ||
* @param phoneNumbers A list of {@link PhoneNumber} with the desired numbers to release | ||
* @param pollInterval The time our long running operation will keep on polling | ||
* @param pollInterval The time our long running operation will keep on polling | ||
* until it gets a result from the server | ||
* @return A {@link PollerFlux} object with the release entity | ||
*/ | ||
@ServiceMethod(returns = ReturnType.COLLECTION) | ||
public PollerFlux<PhoneNumberRelease, PhoneNumberRelease> | ||
public PollerFlux<PhoneNumberRelease, PhoneNumberRelease> | ||
beginReleasePhoneNumbers(List<PhoneNumber> phoneNumbers, Duration pollInterval) { | ||
Objects.requireNonNull(phoneNumbers, "'phoneNumbers' cannot be null."); | ||
|
||
|
@@ -924,7 +924,7 @@ Mono<Void>> purchaseSearchFetchResultOperation() { | |
releaseNumbersFetchResultOperation()); | ||
} | ||
|
||
private Function<PollingContext<PhoneNumberRelease>, Mono<PhoneNumberRelease>> | ||
private Function<PollingContext<PhoneNumberRelease>, Mono<PhoneNumberRelease>> | ||
releaseNumbersActivationOperation(List<PhoneNumber> phoneNumbers) { | ||
return (pollingContext) -> { | ||
Mono<PhoneNumberRelease> response = releasePhoneNumbers(phoneNumbers) | ||
|
@@ -937,13 +937,13 @@ Mono<Void>> purchaseSearchFetchResultOperation() { | |
}; | ||
} | ||
|
||
private Function<PollingContext<PhoneNumberRelease>, Mono<PollResponse<PhoneNumberRelease>>> | ||
private Function<PollingContext<PhoneNumberRelease>, Mono<PollResponse<PhoneNumberRelease>>> | ||
releaseNumbersPollOperation() { | ||
return pollingContext -> | ||
getReleaseById(pollingContext.getLatestResponse().getValue().getReleaseId()) | ||
.flatMap(getReleaseResponse -> { | ||
ReleaseStatus status = getReleaseResponse.getStatus(); | ||
if (status.equals(ReleaseStatus.COMPLETE) | ||
if (status.equals(ReleaseStatus.COMPLETE) | ||
|| status.equals(ReleaseStatus.EXPIRED)) { | ||
return Mono.just(new PollResponse<>( | ||
LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, getReleaseResponse)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
import com.azure.communication.administration.models.PhonePlanGroup; | ||
import com.azure.communication.administration.models.PstnConfiguration; | ||
import com.azure.communication.administration.models.UpdateNumberCapabilitiesResponse; | ||
import com.azure.communication.administration.models.PhoneNumberSearch; | ||
import com.azure.communication.administration.models.PhoneNumberReservation; | ||
import com.azure.communication.administration.models.UpdatePhoneNumberCapabilitiesResponse; | ||
import com.azure.communication.common.PhoneNumber; | ||
import com.azure.core.annotation.ReturnType; | ||
|
@@ -391,10 +391,10 @@ public PagedIterable<PhoneNumberEntity> listAllReleases(Context context) { | |
* Gets a search by ID. | ||
* | ||
* @param searchId ID of the search | ||
* @return A {@link PhoneNumberSearch} representing the search. | ||
* @return A {@link PhoneNumberReservation} representing the search. | ||
*/ | ||
@ServiceMethod(returns = ReturnType.SINGLE) | ||
public PhoneNumberSearch getSearchById(String searchId) { | ||
public PhoneNumberReservation getSearchById(String searchId) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return phoneNumberAsyncClient.getSearchById(searchId).block(); | ||
} | ||
|
||
|
@@ -404,10 +404,10 @@ public PhoneNumberSearch getSearchById(String searchId) { | |
* @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. | ||
* a {@link PhoneNumberReservation} representing the search. | ||
*/ | ||
@ServiceMethod(returns = ReturnType.SINGLE) | ||
public Response<PhoneNumberSearch> getSearchByIdWithResponse(String searchId, Context context) { | ||
public Response<PhoneNumberReservation> getSearchByIdWithResponse(String searchId, Context context) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here too; both method name and param name? |
||
return phoneNumberAsyncClient.getSearchByIdWithResponse(searchId, context).block(); | ||
} | ||
|
||
|
@@ -479,26 +479,26 @@ public Response<Void> cancelSearchWithResponse(String searchId, Context context) | |
} | ||
|
||
/** | ||
* Initiates a search and returns a {@link PhoneNumberSearch} usable by other functions | ||
* Initiates a search and returns a {@link PhoneNumberReservation} usable by other functions | ||
* This function returns a Long Running Operation poller. | ||
* | ||
* | ||
* @param options A {@link CreateSearchOptions} with the search options | ||
* @param pollInterval The time our long running operation will keep on polling | ||
* @param pollInterval The time our long running operation will keep on polling | ||
* until it gets a result from the server | ||
* @return A {@link SyncPoller} object with the search result | ||
*/ | ||
@ServiceMethod(returns = ReturnType.COLLECTION) | ||
public SyncPoller<PhoneNumberSearch, PhoneNumberSearch> beginCreateSearch( | ||
public SyncPoller<PhoneNumberReservation, PhoneNumberReservation> beginCreateSearch( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
CreateSearchOptions options, Duration pollInterval) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are we changing this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it is now changed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: |
||
return phoneNumberAsyncClient.beginCreateSearch(options, pollInterval).getSyncPoller(); | ||
} | ||
|
||
/** | ||
* Initiates a purchase process and polls until a terminal state is reached | ||
* This function returns a Long Running Operation poller | ||
* | ||
* @param searchId ID of the search | ||
* @param pollInterval The time our long running operation will keep on polling | ||
* | ||
* @param searchId ID of the search | ||
* @param pollInterval The time our long running operation will keep on polling | ||
* until it gets a result from the server | ||
* @return A {@link SyncPoller} object with the search result | ||
*/ | ||
|
@@ -511,9 +511,9 @@ public SyncPoller<Void, Void> beginPurchaseSearch( | |
/** | ||
* Releases the given phone numbers. | ||
* This function returns a Long Running Operation poller | ||
* | ||
* | ||
* @param phoneNumbers A list of {@link PhoneNumber} with the desired numbers to release | ||
* @param pollInterval The time our long running operation will keep on polling | ||
* @param pollInterval The time our long running operation will keep on polling | ||
* until it gets a result from the server | ||
* @return A {@link SyncPoller} object with the search result | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also change variable names that reference the previous name of the model?