Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PhoneNumbersClient

Package version

Client class for interacting with Azure Communication Services Phone Number Administration.

Hierarchy

Index

Constructors

constructor

Properties

apiVersion

apiVersion: string

endpoint

endpoint: string

phoneNumbers

phoneNumbers: PhoneNumbers

Methods

beginPurchasePhoneNumbers

  • Starts the purchase of the phone number(s) in the search associated with a given id.

    This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.

    Example usage:

    const client = new PhoneNumbersClient(CONNECTION_STRING);
    const purchasePoller = await client.beginPurchasePhoneNumbers(SEARCH_ID);
    
    // Serializing the poller
    const serialized = purchasePoller.toString();
    
    // Waiting until it's done
    const results = await purchasePoller.pollUntilDone();
    console.log(results);

    Parameters

    • searchId: string

      The id of the search to purchase. Returned from beginSearchAvailablePhoneNumbers

    • Default value options: BeginPurchasePhoneNumbersOptions = {}

      Additional request options.

    Returns Promise<PollerLike<PollOperationState<PurchasePhoneNumbersResult>, PurchasePhoneNumbersResult>>

beginReleasePhoneNumber

  • Starts the release of a purchased phone number.

    This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.

    Example usage:

    const client = new PhoneNumbersClient(CONNECTION_STRING);
    const releasePoller = await client.beginReleasePhoneNumber("+14125550100");
    
    // Serializing the poller
    const serialized = releasePoller.toString();
    
    // Waiting until it's done
    const results = await releasePoller.pollUntilDone();
    console.log(results);

    Parameters

    • phoneNumber: string

      The E.164 formatted phone number being released. The leading plus can be either + or encoded as %2B.

    • Default value options: BeginReleasePhoneNumberOptions = {}

      Additional request options.

    Returns Promise<PollerLike<PollOperationState<ReleasePhoneNumberResult>, ReleasePhoneNumberResult>>

beginSearchAvailablePhoneNumbers

  • Starts a search for phone numbers given some constraints such as name or area code. The phone numbers that are found are reserved until you cancel, purchase or the reservation expires.

    This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.

    Example usage:

    const client = new PhoneNumberAdministrationClient(CONNECTION_STRING);
    const searchPoller = await client.beginSearchAvailablePhoneNumbers(SEARCH_REQUEST);
    
    // Serializing the poller
    const serialized = searchPoller.toString();
    
    // Waiting until it's done
    const results = await searchPoller.pollUntilDone();
    console.log(results);

    Parameters

    Returns Promise<PollerLike<PollOperationState<PhoneNumberSearchResult>, PhoneNumberSearchResult>>

beginUpdatePhoneNumberCapabilities

  • Starts the update of a purchased phone number's capabilities.

    This function returns a Long Running Operation poller that allows you to wait indefinitely until the operation is complete.

    Example usage:

    const client = new PhoneNumbersClient(CONNECTION_STRING);
    const updatePoller = await client.beginUpdatePhoneNumberCapabilities("+14125550100", UPDATE_REQUEST);
    
    // Serializing the poller
    const serialized = updatePoller.toString();
    
    // Waiting until it's done
    const results = await updatePoller.pollUntilDone();
    console.log(results);

    Parameters

    Returns Promise<PollerLike<PollOperationState<PurchasedPhoneNumber>, PurchasedPhoneNumber>>

getPurchasedPhoneNumber

  • Gets the details of a purchased phone number. Includes phone number, cost, country code, etc.

    Parameters

    • phoneNumber: string

      The E.164 formatted phone number being fetched. The leading plus can be either + or encoded as %2B.

    • Default value options: GetPurchasedPhoneNumberOptions = {}

      Additional request options.

    Returns Promise<PurchasedPhoneNumber>

listPurchasedPhoneNumbers

  • Iterates the purchased phone numbers.

    Example usage:

    let client = new PhoneNumbersClient(credentials);
    for await (const purchased of client.listPhoneNumbers()) {
      console.log("phone number: ", purchased.phoneNumber);
    }

    List all purchased phone numbers.

    Parameters

    Returns PagedAsyncIterableIterator<PurchasedPhoneNumber>

Generated using TypeDoc