Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
## 1.2.0-beta.1 (Unreleased)

### Features Added

### Breaking Changes

### Bugs Fixed

### Other Changes
- Number Lookup API public preview
- API version `2023-05-01-preview` is the default

## 1.1.4 (2023-07-25)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/communication/azure-communication-phonenumbers",
"Tag": "java/communication/azure-communication-phonenumbers_3083b8b6c8"
"Tag": "java/communication/azure-communication-phonenumbers_04198d656b"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import com.azure.communication.phonenumbers.implementation.models.PhoneNumbersReleasePhoneNumberResponse;
import com.azure.communication.phonenumbers.implementation.models.PhoneNumberCapabilitiesRequest;
import com.azure.communication.phonenumbers.implementation.models.PhoneNumbersUpdateCapabilitiesResponse;
import com.azure.communication.phonenumbers.implementation.models.OperatorInformationRequest;
import com.azure.communication.phonenumbers.models.OperatorInformationResult;
import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode;
import com.azure.communication.phonenumbers.models.PurchasedPhoneNumber;
import com.azure.communication.phonenumbers.models.ReleasePhoneNumberResult;
Expand Down Expand Up @@ -45,6 +47,7 @@
import reactor.core.publisher.Mono;

import java.time.Duration;
import java.util.List;
import java.util.Objects;
import java.util.function.BiFunction;
import java.util.function.Function;
Expand All @@ -61,15 +64,15 @@
*
* <!-- src_embed com.azure.communication.phonenumbers.asyncclient.instantiation
* -->
*
*
* <pre>
* PhoneNumbersAsyncClient phoneNumberAsyncClient = new PhoneNumbersClientBuilder&#40;&#41;
* .endpoint&#40;endpoint&#41;
* .credential&#40;keyCredential&#41;
* .httpClient&#40;httpClient&#41;
* .buildAsyncClient&#40;&#41;;
* </pre>
*
*
* <!-- end com.azure.communication.phonenumbers.asyncclient.instantiation -->
*
* @see PhoneNumbersClientBuilder
Expand Down Expand Up @@ -99,13 +102,13 @@ public final class PhoneNumbersAsyncClient {
*
* <!-- src_embed com.azure.communication.phonenumbers.asyncclient.getPurchased
* -->
*
*
* <pre>
* PurchasedPhoneNumber phoneNumber = phoneNumberAsyncClient.getPurchasedPhoneNumber&#40;&quot;+18001234567&quot;&#41;.block&#40;&#41;;
* System.out.println&#40;&quot;Phone Number Value: &quot; + phoneNumber.getPhoneNumber&#40;&#41;&#41;;
* System.out.println&#40;&quot;Phone Number Country Code: &quot; + phoneNumber.getCountryCode&#40;&#41;&#41;;
* </pre>
*
*
* <!-- end com.azure.communication.phonenumbers.asyncclient.getPurchased -->
*
* @param phoneNumber The phone number id in E.164 format. The leading plus can
Expand Down Expand Up @@ -133,15 +136,15 @@ public Mono<PurchasedPhoneNumber> getPurchasedPhoneNumber(String phoneNumber) {
*
* <!-- src_embed
* com.azure.communication.phonenumbers.asyncclient.getPurchasedWithResponse -->
*
*
* <pre>
* Response&lt;PurchasedPhoneNumber&gt; response = phoneNumberAsyncClient
* .getPurchasedPhoneNumberWithResponse&#40;&quot;+18001234567&quot;&#41;.block&#40;&#41;;
* PurchasedPhoneNumber phoneNumber = response.getValue&#40;&#41;;
* System.out.println&#40;&quot;Phone Number Value: &quot; + phoneNumber.getPhoneNumber&#40;&#41;&#41;;
* System.out.println&#40;&quot;Phone Number Country Code: &quot; + phoneNumber.getCountryCode&#40;&#41;&#41;;
* </pre>
*
*
* <!-- end
* com.azure.communication.phonenumbers.asyncclient.getPurchasedWithResponse -->
*
Expand Down Expand Up @@ -170,14 +173,14 @@ public Mono<Response<PurchasedPhoneNumber>> getPurchasedPhoneNumberWithResponse(
*
* <!-- src_embed com.azure.communication.phonenumbers.asyncclient.listPurchased
* -->
*
*
* <pre>
* PagedFlux&lt;PurchasedPhoneNumber&gt; phoneNumbers = phoneNumberAsyncClient.listPurchasedPhoneNumbers&#40;&#41;;
* PurchasedPhoneNumber phoneNumber = phoneNumbers.blockFirst&#40;&#41;;
* System.out.println&#40;&quot;Phone Number Value: &quot; + phoneNumber.getPhoneNumber&#40;&#41;&#41;;
* System.out.println&#40;&quot;Phone Number Country Code: &quot; + phoneNumber.getCountryCode&#40;&#41;&#41;;
* </pre>
*
*
* <!-- end com.azure.communication.phonenumbers.asyncclient.listPurchased -->
*
* @return A {@link PagedFlux} of {@link PurchasedPhoneNumber} instances
Expand All @@ -201,7 +204,7 @@ public PagedFlux<PurchasedPhoneNumber> listPurchasedPhoneNumbers() {
*
* <!-- src_embed
* com.azure.communication.phonenumbers.asyncclient.beginSearchAvailable -->
*
*
* <pre>
* PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities&#40;&#41;
* .setCalling&#40;PhoneNumberCapabilityType.INBOUND&#41;
Expand All @@ -221,7 +224,7 @@ public PagedFlux<PurchasedPhoneNumber> listPurchasedPhoneNumbers() {
* System.out.println&#40;&quot;Phone number costs:&quot; + searchResult.getCost&#40;&#41;.getAmount&#40;&#41;&#41;;
* &#125;
* </pre>
*
*
* <!-- end
* com.azure.communication.phonenumbers.asyncclient.beginSearchAvailable -->
*
Expand Down Expand Up @@ -252,7 +255,7 @@ public PollerFlux<PhoneNumberOperation, PhoneNumberSearchResult> beginSearchAvai
* <!-- src_embed
* com.azure.communication.phonenumbers.asyncclient.beginSearchAvailableWithOptions
* -->
*
*
* <pre>
* PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities&#40;&#41;
* .setCalling&#40;PhoneNumberCapabilityType.INBOUND&#41;
Expand All @@ -272,7 +275,7 @@ public PollerFlux<PhoneNumberOperation, PhoneNumberSearchResult> beginSearchAvai
* System.out.println&#40;&quot;Phone number costs:&quot; + searchResult.getCost&#40;&#41;.getAmount&#40;&#41;&#41;;
* &#125;
* </pre>
*
*
* <!-- end
* com.azure.communication.phonenumbers.asyncclient.beginSearchAvailableWithOptions
* -->
Expand Down Expand Up @@ -406,13 +409,13 @@ private Function<PollingContext<PhoneNumberOperation>, Mono<PhoneNumberSearchRes
*
* <!-- src_embed com.azure.communication.phonenumbers.asyncclient.beginPurchase
* -->
*
*
* <pre>
* AsyncPollResponse&lt;PhoneNumberOperation, PurchasePhoneNumbersResult&gt; purchaseResponse = phoneNumberAsyncClient
* .beginPurchasePhoneNumbers&#40;searchId&#41;.blockFirst&#40;&#41;;
* System.out.println&#40;&quot;Purchase phone numbers is complete: &quot; + purchaseResponse.getStatus&#40;&#41;&#41;;
* </pre>
*
*
* <!-- end com.azure.communication.phonenumbers.asyncclient.beginPurchase -->
*
* @param searchId ID of the search.
Expand Down Expand Up @@ -472,13 +475,13 @@ private Function<PollingContext<PhoneNumberOperation>, Mono<PhoneNumberOperation
*
* <!-- src_embed com.azure.communication.phonenumbers.asyncclient.beginRelease
* -->
*
*
* <pre>
* AsyncPollResponse&lt;PhoneNumberOperation, ReleasePhoneNumberResult&gt; releaseResponse = phoneNumberAsyncClient
* .beginReleasePhoneNumber&#40;&quot;+18001234567&quot;&#41;.blockFirst&#40;&#41;;
* System.out.println&#40;&quot;Release phone number is complete: &quot; + releaseResponse.getStatus&#40;&#41;&#41;;
* </pre>
*
*
* <!-- end com.azure.communication.phonenumbers.asyncclient.beginRelease -->
*
* @param phoneNumber The phone number id in E.164 format. The leading plus can
Expand Down Expand Up @@ -534,7 +537,7 @@ private Function<PollingContext<PhoneNumberOperation>, Mono<PhoneNumberOperation
*
* <!-- src_embed
* com.azure.communication.phonenumbers.asyncclient.beginUpdateCapabilities -->
*
*
* <pre>
* PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities&#40;&#41;;
* capabilities
Expand All @@ -551,7 +554,7 @@ private Function<PollingContext<PhoneNumberOperation>, Mono<PhoneNumberOperation
* System.out.println&#40;&quot;Phone Number SMS capabilities: &quot; + phoneNumber.getCapabilities&#40;&#41;.getSms&#40;&#41;&#41;;
* &#125;
* </pre>
*
*
* <!-- end
* com.azure.communication.phonenumbers.asyncclient.beginUpdateCapabilities -->
*
Expand Down Expand Up @@ -715,6 +718,21 @@ public PagedFlux<PhoneNumberOffering> listAvailableOfferings(String countryCode,
}
}

/**
* Searches for operator information for a given list of phone numbers.
*
* @param phoneNumbers The phone number(s) whose operator information should be searched.
*
* @return A {@link OperatorInformationResult} which contains the results of the search.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<OperatorInformationResult> searchOperatorInformation(List<String> phoneNumbers) {
OperatorInformationRequest request = new OperatorInformationRequest();
request.setPhoneNumbers(phoneNumbers);
return client.operatorInformationSearchAsync(request)
.onErrorMap(CommunicationErrorResponseException.class, e -> translateException(e));
}

private Mono<PhoneNumberOperation> getOperation(String operationId) {
return client.getOperationAsync(operationId)
.onErrorMap(CommunicationErrorResponseException.class, e -> translateException(e))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
// Licensed under the MIT License.
package com.azure.communication.phonenumbers;

import java.util.List;
import java.util.Objects;

import com.azure.communication.phonenumbers.implementation.PhoneNumberAdminClientImpl;
import com.azure.communication.phonenumbers.implementation.PhoneNumbersImpl;
import com.azure.communication.phonenumbers.implementation.models.OperatorInformationRequest;
import com.azure.communication.phonenumbers.models.OperatorInformationResult;
import com.azure.communication.phonenumbers.models.PhoneNumberAreaCode;
import com.azure.communication.phonenumbers.models.PhoneNumberAssignmentType;
import com.azure.communication.phonenumbers.models.PhoneNumberCapabilities;
Expand Down Expand Up @@ -104,15 +107,15 @@ public PurchasedPhoneNumber getPurchasedPhoneNumber(String phoneNumber) {
*
* <!-- src_embed
* com.azure.communication.phonenumbers.client.getPurchasedWithResponse -->
*
*
* <pre>
* Response&lt;PurchasedPhoneNumber&gt; response = phoneNumberClient
* .getPurchasedPhoneNumberWithResponse&#40;&quot;+18001234567&quot;, Context.NONE&#41;;
* PurchasedPhoneNumber phoneNumber = response.getValue&#40;&#41;;
* System.out.println&#40;&quot;Phone Number Value: &quot; + phoneNumber.getPhoneNumber&#40;&#41;&#41;;
* System.out.println&#40;&quot;Phone Number Country Code: &quot; + phoneNumber.getCountryCode&#40;&#41;&#41;;
* </pre>
*
*
* <!-- end com.azure.communication.phonenumbers.client.getPurchasedWithResponse
* -->
*
Expand Down Expand Up @@ -164,14 +167,14 @@ public PagedIterable<PurchasedPhoneNumber> listPurchasedPhoneNumbers() {
*
* <!-- src_embed
* com.azure.communication.phonenumbers.client.listPurchasedWithContext -->
*
*
* <pre>
* PagedIterable&lt;PurchasedPhoneNumber&gt; phoneNumbers = phoneNumberClient.listPurchasedPhoneNumbers&#40;Context.NONE&#41;;
* PurchasedPhoneNumber phoneNumber = phoneNumbers.iterator&#40;&#41;.next&#40;&#41;;
* System.out.println&#40;&quot;Phone Number Value: &quot; + phoneNumber.getPhoneNumber&#40;&#41;&#41;;
* System.out.println&#40;&quot;Phone Number Country Code: &quot; + phoneNumber.getCountryCode&#40;&#41;&#41;;
* </pre>
*
*
* <!-- end com.azure.communication.phonenumbers.client.listPurchasedWithContext
* -->
*
Expand All @@ -198,7 +201,7 @@ public PagedIterable<PurchasedPhoneNumber> listPurchasedPhoneNumbers(Context con
*
* <!-- src_embed
* com.azure.communication.phonenumbers.client.beginSearchAvailable -->
*
*
* <pre>
* PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities&#40;&#41;
* .setCalling&#40;PhoneNumberCapabilityType.INBOUND&#41;
Expand All @@ -218,7 +221,7 @@ public PagedIterable<PurchasedPhoneNumber> listPurchasedPhoneNumbers(Context con
* System.out.println&#40;&quot;Phone number costs:&quot; + searchResult.getCost&#40;&#41;.getAmount&#40;&#41;&#41;;
* &#125;
* </pre>
*
*
* <!-- end com.azure.communication.phonenumbers.client.beginSearchAvailable -->
*
* @param countryCode The ISO 3166-2 country code.
Expand Down Expand Up @@ -253,7 +256,7 @@ public SyncPoller<PhoneNumberOperation, PhoneNumberSearchResult> beginSearchAvai
* <!-- src_embed
* com.azure.communication.phonenumbers.client.beginSearchAvailableWithOptions
* -->
*
*
* <pre>
* PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities&#40;&#41;
* .setCalling&#40;PhoneNumberCapabilityType.INBOUND&#41;
Expand All @@ -274,7 +277,7 @@ public SyncPoller<PhoneNumberOperation, PhoneNumberSearchResult> beginSearchAvai
* System.out.println&#40;&quot;Phone number costs:&quot; + searchResult.getCost&#40;&#41;.getAmount&#40;&#41;&#41;;
* &#125;
* </pre>
*
*
* <!-- end
* com.azure.communication.phonenumbers.client.beginSearchAvailableWithOptions
* -->
Expand Down Expand Up @@ -342,13 +345,13 @@ public SyncPoller<PhoneNumberOperation, PurchasePhoneNumbersResult> beginPurchas
*
* <!-- src_embed
* com.azure.communication.phonenumbers.client.beginPurchaseWithContext -->
*
*
* <pre>
* PollResponse&lt;PhoneNumberOperation&gt; purchaseResponse = phoneNumberClient
* .beginPurchasePhoneNumbers&#40;searchId, Context.NONE&#41;.waitForCompletion&#40;&#41;;
* System.out.println&#40;&quot;Purchase phone numbers is complete: &quot; + purchaseResponse.getStatus&#40;&#41;&#41;;
* </pre>
*
*
* <!-- end com.azure.communication.phonenumbers.client.beginPurchaseWithContext
* -->
*
Expand Down Expand Up @@ -406,13 +409,13 @@ public SyncPoller<PhoneNumberOperation, ReleasePhoneNumberResult> beginReleasePh
*
* <!-- src_embed
* com.azure.communication.phonenumbers.client.beginReleaseWithContext -->
*
*
* <pre>
* PollResponse&lt;PhoneNumberOperation&gt; releaseResponse = phoneNumberClient
* .beginReleasePhoneNumber&#40;&quot;+18001234567&quot;, Context.NONE&#41;.waitForCompletion&#40;&#41;;
* System.out.println&#40;&quot;Release phone number is complete: &quot; + releaseResponse.getStatus&#40;&#41;&#41;;
* </pre>
*
*
* <!-- end com.azure.communication.phonenumbers.client.beginReleaseWithContext
* -->
*
Expand Down Expand Up @@ -442,7 +445,7 @@ public SyncPoller<PhoneNumberOperation, ReleasePhoneNumberResult> beginReleasePh
*
* <!-- src_embed
* com.azure.communication.phonenumbers.client.beginUpdateCapabilities -->
*
*
* <pre>
* PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities&#40;&#41;;
* capabilities
Expand All @@ -459,7 +462,7 @@ public SyncPoller<PhoneNumberOperation, ReleasePhoneNumberResult> beginReleasePh
* System.out.println&#40;&quot;Phone Number SMS capabilities: &quot; + phoneNumber.getCapabilities&#40;&#41;.getSms&#40;&#41;&#41;;
* &#125;
* </pre>
*
*
* <!-- end com.azure.communication.phonenumbers.client.beginUpdateCapabilities
* -->
*
Expand Down Expand Up @@ -491,7 +494,7 @@ public SyncPoller<PhoneNumberOperation, PurchasedPhoneNumber> beginUpdatePhoneNu
* <!-- src_embed
* com.azure.communication.phonenumbers.client.beginUpdateCapabilitiesWithContext
* -->
*
*
* <pre>
* PhoneNumberCapabilities capabilities = new PhoneNumberCapabilities&#40;&#41;;
* capabilities
Expand All @@ -508,7 +511,7 @@ public SyncPoller<PhoneNumberOperation, PurchasedPhoneNumber> beginUpdatePhoneNu
* System.out.println&#40;&quot;Phone Number SMS capabilities: &quot; + phoneNumber.getCapabilities&#40;&#41;.getSms&#40;&#41;&#41;;
* &#125;
* </pre>
*
*
* <!-- end
* com.azure.communication.phonenumbers.client.beginUpdateCapabilitiesWithContext
* -->
Expand Down Expand Up @@ -695,4 +698,18 @@ public PagedIterable<PhoneNumberOffering> listAvailableOfferings(String countryC
context = context == null ? Context.NONE : context;
return client.listOfferings(countryCode, null, null, phoneNumberType, assignmentType, acceptLanguage, context);
}

/**
* Searches for operator information for a given list of phone numbers.
*
* @param phoneNumbers The phone number(s) whose operator information should be searched.
*
* @return A {@link OperatorInformationResult} which contains the results of the search.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public OperatorInformationResult searchOperatorInformation(List<String> phoneNumbers) {
OperatorInformationRequest request = new OperatorInformationRequest();
request.setPhoneNumbers(phoneNumbers);
return client.operatorInformationSearch(request);
}
}
Loading