PhoneNumberClient Class

  • java.lang.Object
    • com.azure.communication.administration.PhoneNumberClient

public final class PhoneNumberClient

Synchronous client for Communication service phone number operations

Method Summary

Modifier and Type Method and Description
SyncPoller<PhoneNumberReservation,PhoneNumberReservation> beginCreateReservation(CreateReservationOptions options, Duration pollInterval)

Initiates a reservation and returns a PhoneNumberReservation usable by other functions This function returns a Long Running Operation poller.

SyncPoller<Void,Void> beginPurchaseReservation(String reservationId, Duration pollInterval)

Initiates a purchase process and polls until a terminal state is reached This function returns a Long Running Operation poller

SyncPoller<PhoneNumberRelease,PhoneNumberRelease> beginReleasePhoneNumbers(List<PhoneNumber> phoneNumbers, Duration pollInterval)

Releases the given phone numbers.

void cancelReservation(String reservationId)

Cancels the reservation.

Response<Void> cancelReservationWithResponse(String reservationId, Context context)

Cancels the reservation.

void configureNumber(PhoneNumber phoneNumber, PstnConfiguration pstnConfiguration)

Associates a phone number with a PSTN Configuration.

Response<Void> configureNumberWithResponse(PhoneNumber phoneNumber, PstnConfiguration pstnConfiguration, Context context)

Associates a phone number with a PSTN Configuration.

AreaCodes getAllAreaCodes(String locationType, String countryCode, String phonePlanId, List<LocationOptionsQuery> locationOptions)

Gets a list of the supported area codes.

Response<AreaCodes> getAllAreaCodesWithResponse(String locationType, String countryCode, String phonePlanId, List<LocationOptionsQuery> locationOptions, Context context)

Gets a list of the supported area codes.

UpdatePhoneNumberCapabilitiesResponse getCapabilitiesUpdate(String capabilitiesId)

Gets the information for a phone number capabilities update

Response<UpdatePhoneNumberCapabilitiesResponse> getCapabilitiesUpdateWithResponse(String capabilitiesId, Context context)

Gets the information for a phone number capabilities update

NumberConfigurationResponse getNumberConfiguration(PhoneNumber phoneNumber)

Gets the configuration of a given phone number.

Response<NumberConfigurationResponse> getNumberConfigurationWithResponse(PhoneNumber phoneNumber, Context context)

Gets the configuration of a given phone number.

LocationOptionsResponse getPhonePlanLocationOptions(String countryCode, String phonePlanGroupId, String phonePlanId, String locale)

Gets the location options for a phone plan.

Response<LocationOptionsResponse> getPhonePlanLocationOptionsWithResponse(String countryCode, String phonePlanGroupId, String phonePlanId, String locale, Context context)

Gets the location options for a phone plan.

PhoneNumberRelease getReleaseById(String releaseId)

Gets a release by ID.

Response<PhoneNumberRelease> getReleaseByIdWithResponse(String releaseId, Context context)

Gets a release by ID.

PhoneNumberReservation getReservationById(String reservationId)

Gets a reservation by ID.

Response<PhoneNumberReservation> getReservationByIdWithResponse(String reservationId, Context context)

Gets a reservation by ID.

PagedIterable<AcquiredPhoneNumber> listAllPhoneNumbers(String locale)

Gets the list of the acquired phone numbers.

PagedIterable<AcquiredPhoneNumber> listAllPhoneNumbers(String locale, Context context)

Gets the list of the acquired phone numbers.

PagedIterable<PhoneNumberEntity> listAllReleases()

Gets the list of all releases

PagedIterable<PhoneNumberEntity> listAllReleases(Context context)

Gets the list of all releases

PagedIterable<PhoneNumberEntity> listAllReservations()

Gets the list of all reservations

PagedIterable<PhoneNumberEntity> listAllReservations(Context context)

Gets the list of all reservationes

PagedIterable<PhoneNumberCountry> listAllSupportedCountries(String locale)

Gets a list of supported countries.

PagedIterable<PhoneNumberCountry> listAllSupportedCountries(String locale, Context context)

Gets a list of supported countries.

PagedIterable<PhonePlanGroup> listPhonePlanGroups(String countryCode, String locale, Boolean includeRateInformation)

Gets a list of phone plan groups for the given country.

PagedIterable<PhonePlanGroup> listPhonePlanGroups(String countryCode, String locale, Boolean includeRateInformation, Context context)

Gets a list of phone plan groups for the given country.

PagedIterable<PhonePlan> listPhonePlans(String countryCode, String phonePlanGroupId, String locale)

Gets a list of phone plans for a phone plan group

PagedIterable<PhonePlan> listPhonePlans(String countryCode, String phonePlanGroupId, String locale, Context context)

Gets a list of phone plans for a phone plan group

void unconfigureNumber(PhoneNumber phoneNumber)

Removes the PSTN Configuration from a phone number.

Response<Void> unconfigureNumberWithResponse(PhoneNumber phoneNumber, Context context)

Removes the PSTN Configuration from a phone number.

UpdateNumberCapabilitiesResponse updateCapabilities(Map<PhoneNumber,NumberUpdateCapabilities> phoneNumberCapabilitiesUpdate)

Adds or removes phone number capabilities.

Response<UpdateNumberCapabilitiesResponse> updateCapabilitiesWithResponse(Map<PhoneNumber,NumberUpdateCapabilities> phoneNumberCapabilitiesUpdate, Context context)

Adds or removes phone number capabilities.

Methods inherited from java.lang.Object

Method Details

beginCreateReservation

public SyncPoller<PhoneNumberReservation,PhoneNumberReservation> beginCreateReservation(CreateReservationOptions options, Duration pollInterval)

Initiates a reservation and returns a PhoneNumberReservation usable by other functions This function returns a Long Running Operation poller.

Parameters:

options - A CreateReservationOptions with the reservation options
pollInterval - The time our long running operation will keep on polling until it gets a result from the server

Returns:

A SyncPoller<T,U> object with the reservation result

beginPurchaseReservation

public SyncPoller<Void,Void> beginPurchaseReservation(String reservationId, Duration pollInterval)

Initiates a purchase process and polls until a terminal state is reached This function returns a Long Running Operation poller

Parameters:

reservationId - ID of the reservation
pollInterval - The time our long running operation will keep on polling until it gets a result from the server

Returns:

A SyncPoller<T,U> object with the reservation result

beginReleasePhoneNumbers

public SyncPoller<PhoneNumberRelease,PhoneNumberRelease> beginReleasePhoneNumbers(List<PhoneNumber> phoneNumbers, Duration pollInterval)

Releases the given phone numbers. This function returns a Long Running Operation poller

Parameters:

phoneNumbers - A list of PhoneNumber with the desired numbers to release
pollInterval - The time our long running operation will keep on polling until it gets a result from the server

Returns:

A SyncPoller<T,U> object with the reservation result

cancelReservation

public void cancelReservation(String reservationId)

Cancels the reservation. This means existing numbers in the reservation will be made available.

Parameters:

reservationId - ID of the reservation

cancelReservationWithResponse

public Response<Void> cancelReservationWithResponse(String reservationId, Context context)

Cancels the reservation. This means existing numbers in the reservation will be made available.

Parameters:

reservationId - ID of the reservation
context - A Context representing the request context.

Returns:

A Response<T> for the operation

configureNumber

public void configureNumber(PhoneNumber phoneNumber, PstnConfiguration pstnConfiguration)

Associates a phone number with a PSTN Configuration.

Parameters:

phoneNumber - A PhoneNumber representing the phone number.
pstnConfiguration - A PstnConfiguration containing the pstn number configuration options.

configureNumberWithResponse

public Response<Void> configureNumberWithResponse(PhoneNumber phoneNumber, PstnConfiguration pstnConfiguration, Context context)

Associates a phone number with a PSTN Configuration.

Parameters:

phoneNumber - A PhoneNumber representing the phone number.
pstnConfiguration - A PstnConfiguration containing the pstn number configuration options.
context - A Context representing the request context.

Returns:

A Response<T> for the operation.

getAllAreaCodes

public AreaCodes getAllAreaCodes(String locationType, String countryCode, String phonePlanId, List<LocationOptionsQuery> locationOptions)

Gets a list of the supported area codes.

Parameters:

locationType - The type of location information required by the plan.
countryCode - The ISO 3166-2 country code.
phonePlanId - The plan id from which to search area codes.
locationOptions - A List of LocationOptionsQuery for querying the area codes.

Returns:

A AreaCodes representing area codes.

getAllAreaCodesWithResponse

public Response<AreaCodes> getAllAreaCodesWithResponse(String locationType, String countryCode, String phonePlanId, List<LocationOptionsQuery> locationOptions, Context context)

Gets a list of the supported area codes.

Parameters:

locationType - The type of location information required by the plan.
countryCode - The ISO 3166-2 country code.
phonePlanId - The plan id from which to search area codes.
locationOptions - A List of LocationOptionsQuery for querying the area codes.
context - A Context representing the request context.

Returns:

A Response<T> whose Response#getValue() value returns a AreaCodes representing area codes.

getCapabilitiesUpdate

public UpdatePhoneNumberCapabilitiesResponse getCapabilitiesUpdate(String capabilitiesId)

Gets the information for a phone number capabilities update

Parameters:

capabilitiesId - ID of the capabilities update.

Returns:

A UpdatePhoneNumberCapabilitiesResponse representing the capabilities update.

getCapabilitiesUpdateWithResponse

public Response<UpdatePhoneNumberCapabilitiesResponse> getCapabilitiesUpdateWithResponse(String capabilitiesId, Context context)

Gets the information for a phone number capabilities update

Parameters:

capabilitiesId - ID of the capabilities update.
context - A Context representing the request context.

Returns:

A Response<T> whose Response#getValue() value returns a UpdatePhoneNumberCapabilitiesResponse representing the capabilities update.

getNumberConfiguration

public NumberConfigurationResponse getNumberConfiguration(PhoneNumber phoneNumber)

Gets the configuration of a given phone number.

Parameters:

phoneNumber - A PhoneNumber representing the phone number.

Returns:

A NumberConfigurationResponse representing the configuration.

getNumberConfigurationWithResponse

public Response<NumberConfigurationResponse> getNumberConfigurationWithResponse(PhoneNumber phoneNumber, Context context)

Gets the configuration of a given phone number.

Parameters:

phoneNumber - A PhoneNumber representing the phone number.
context - A Context representing the request context.

Returns:

A Response<T> whose Response#getValue() value returns a NumberConfigurationResponse representing the configuration.

getPhonePlanLocationOptions

public LocationOptionsResponse getPhonePlanLocationOptions(String countryCode, String phonePlanGroupId, String phonePlanId, String locale)

Gets the location options for a phone plan.

Parameters:

countryCode - The ISO 3166-2 country code.
phonePlanGroupId - ID of the Phone Plan Group
phonePlanId - ID of the Phone Plan
locale - A language-locale pairing which will be used to localise the names of countries.

Returns:

A LocationOptionsResponse representing the location options

getPhonePlanLocationOptionsWithResponse

public Response<LocationOptionsResponse> getPhonePlanLocationOptionsWithResponse(String countryCode, String phonePlanGroupId, String phonePlanId, String locale, Context context)

Gets the location options for a phone plan.

Parameters:

countryCode - The ISO 3166-2 country code.
phonePlanGroupId - ID of the Phone Plan Group
phonePlanId - ID of the Phone Plan
locale - A language-locale pairing which will be used to localise the names of countries.
context - A Context representing the request context.

Returns:

A Response<T> whose Response#getValue() value returns a LocationOptionsResponse representing the location options

getReleaseById

public PhoneNumberRelease getReleaseById(String releaseId)

Gets a release by ID.

Parameters:

releaseId - ID of the Release

Returns:

A PhoneNumberRelease representing the release.

getReleaseByIdWithResponse

public Response<PhoneNumberRelease> getReleaseByIdWithResponse(String releaseId, Context context)

Gets a release by ID.

Parameters:

releaseId - ID of the Release
context - A Context representing the request context.

Returns:

A Response<T> whose Response#getValue() value returns a PhoneNumberRelease representing the release.

getReservationById

public PhoneNumberReservation getReservationById(String reservationId)

Gets a reservation by ID.

Parameters:

reservationId - ID of the reservation

Returns:

A PhoneNumberReservation representing the reservation.

getReservationByIdWithResponse

public Response<PhoneNumberReservation> getReservationByIdWithResponse(String reservationId, Context context)

Gets a reservation by ID.

Parameters:

reservationId - ID of the reservation
context - A Context representing the request context.

Returns:

A Response<T> whose Response#getValue() value returns a PhoneNumberReservation representing the reservation.

listAllPhoneNumbers

public PagedIterable<AcquiredPhoneNumber> listAllPhoneNumbers(String locale)

Gets the list of the acquired phone numbers.

Parameters:

locale - A language-locale pairing which will be used to localise the names of countries.

Returns:

A PagedIterable<T> of AcquiredPhoneNumber instances representing acquired telephone numbers.

listAllPhoneNumbers

public PagedIterable<AcquiredPhoneNumber> listAllPhoneNumbers(String locale, Context context)

Gets the list of the acquired phone numbers.

Parameters:

locale - A language-locale pairing which will be used to localise the names of countries.
context - A Context representing the request context.

Returns:

A PagedIterable<T> of AcquiredPhoneNumber instances representing acquired telephone numbers.

listAllReleases

public PagedIterable<PhoneNumberEntity> listAllReleases()

Gets the list of all releases

Returns:

A PagedIterable<T> of PhoneNumberEntity instances representing releases.

listAllReleases

public PagedIterable<PhoneNumberEntity> listAllReleases(Context context)

Gets the list of all releases

Parameters:

context - A Context representing the request context.

Returns:

A PagedIterable<T> of PhoneNumberEntity instances representing releases.

listAllReservations

public PagedIterable<PhoneNumberEntity> listAllReservations()

Gets the list of all reservations

Returns:

A PagedIterable<T> of PhoneNumberEntity instances representing reservations.

listAllReservations

public PagedIterable<PhoneNumberEntity> listAllReservations(Context context)

Gets the list of all reservationes

Parameters:

context - A Context representing the request context.

Returns:

A PagedIterable<T> of PhoneNumberEntity instances representing reservations.

listAllSupportedCountries

public PagedIterable<PhoneNumberCountry> listAllSupportedCountries(String locale)

Gets a list of supported countries.

Parameters:

locale - A language-locale pairing which will be used to localise the names of countries.

Returns:

A PagedIterable<T> of PhoneNumberCountry instances representing supported countries.

listAllSupportedCountries

public PagedIterable<PhoneNumberCountry> listAllSupportedCountries(String locale, Context context)

Gets a list of supported countries.

Parameters:

locale - A language-locale pairing which will be used to localise the names of countries.
context - A Context representing the request context.

Returns:

A PagedIterable<T> of PhoneNumberCountry instances representing supported countries.

listPhonePlanGroups

public PagedIterable<PhonePlanGroup> listPhonePlanGroups(String countryCode, String locale, Boolean includeRateInformation)

Gets a list of phone plan groups for the given country.

Parameters:

countryCode - The ISO 3166-2 country code.
locale - A language-locale pairing which will be used to localise the names of countries.
includeRateInformation - Flag to indicate if rate information should be returned.

Returns:

A PagedIterable<T> of PhonePlanGroup instances representing phone plan groups

listPhonePlanGroups

public PagedIterable<PhonePlanGroup> listPhonePlanGroups(String countryCode, String locale, Boolean includeRateInformation, Context context)

Gets a list of phone plan groups for the given country.

Parameters:

countryCode - The ISO 3166-2 country code.
locale - A language-locale pairing which will be used to localise the names of countries.
includeRateInformation - Flag to indicate if rate information should be returned.
context - A Context representing the request context.

Returns:

A PagedIterable<T> of PhonePlanGroup instances representing phone plan groups

listPhonePlans

public PagedIterable<PhonePlan> listPhonePlans(String countryCode, String phonePlanGroupId, String locale)

Gets a list of phone plans for a phone plan group

Parameters:

countryCode - The ISO 3166-2 country code.
phonePlanGroupId - ID of the Phone Plan Group
locale - A language-locale pairing which will be used to localise the names of countries.

Returns:

A PagedIterable<T> of PhonePlan instances representing phone plans

listPhonePlans

public PagedIterable<PhonePlan> listPhonePlans(String countryCode, String phonePlanGroupId, String locale, Context context)

Gets a list of phone plans for a phone plan group

Parameters:

countryCode - The ISO 3166-2 country code.
phonePlanGroupId - ID of the Phone Plan Group
locale - A language-locale pairing which will be used to localise the names of countries.
context - A Context representing the request context.

Returns:

A PagedIterable<T> of PhonePlan instances representing phone plans

unconfigureNumber

public void unconfigureNumber(PhoneNumber phoneNumber)

Removes the PSTN Configuration from a phone number.

Parameters:

phoneNumber - A PhoneNumber representing the phone number.

unconfigureNumberWithResponse

public Response<Void> unconfigureNumberWithResponse(PhoneNumber phoneNumber, Context context)

Removes the PSTN Configuration from a phone number.

Parameters:

phoneNumber - A PhoneNumber representing the phone number.
context - A Context representing the request context.

Returns:

A Response<T> for the operation.

updateCapabilities

public UpdateNumberCapabilitiesResponse updateCapabilities(Map<PhoneNumber,NumberUpdateCapabilities> phoneNumberCapabilitiesUpdate)

Adds or removes phone number capabilities.

Parameters:

phoneNumberCapabilitiesUpdate - Map with the updates to perform

Returns:

A UpdatePhoneNumberCapabilitiesResponse representing the capabilities update.

updateCapabilitiesWithResponse

public Response<UpdateNumberCapabilitiesResponse> updateCapabilitiesWithResponse(Map<PhoneNumber,NumberUpdateCapabilities> phoneNumberCapabilitiesUpdate, Context context)

Adds or removes phone number capabilities.

Parameters:

phoneNumberCapabilitiesUpdate - Map with the updates to perform
context - A Context representing the request context.

Returns:

A Response<T> whose Response#getValue() value returns a UpdatePhoneNumberCapabilitiesResponse representing the capabilities update.

Applies to