Package version:

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

Hierarchy

  • PhoneNumbersClient

Constructors

Methods

  • 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

    • options: BeginPurchasePhoneNumbersOptions = {}

      Additional request options.

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

  • 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.

    • options: BeginReleasePhoneNumberOptions = {}

      Additional request options.

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

  • 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.

    • options: OperationOptions = {}

      Additional request options.

    Returns Promise<PurchasedPhoneNumber>

  • Iterates the available Geographic area codes.

    Example usage:

    let client = new PhoneNumbersClient(credentials);
    for await (const areaCodeItem of client.listGeographicAreaCodes()) {
    console.log("area code: ", areaCodeItem.areaCode);
    }

    List all available Geographic area codes.

    Parameters

    Returns PagedAsyncIterableIterator<PhoneNumberAreaCode>

  • Iterates the available localities.

    Example usage:

    let client = new PhoneNumbersClient(credentials);
    for await (const locality of client.listAvailableLocalities()) {
    console.log("locality: ", locality.localizedName);
    }

    List all available localities.

    Parameters

    • countryCode: string

      The ISO 3166-2 country code.

    • options: ListLocalitiesOptions = {}

      The optional parameters.

    Returns PagedAsyncIterableIterator<PhoneNumberLocality>

  • Iterates the available offerings.

    Example usage:

    let client = new PhoneNumbersClient(credentials);
    for await (const offering of client.listAvailableOfferings()) {
    console.log("phone number type: ", offering.phoneNumberType);
    console.log("cost: ", offering.cost.amount);
    }

    List all available offerings.

    Parameters

    • countryCode: string

      The ISO 3166-2 country code.

    • options: ListOfferingsOptions = {}

      The optional parameters.

    Returns PagedAsyncIterableIterator<PhoneNumberOffering>

  • Iterates the available Toll-Free area codes.

    Example usage:

    let client = new PhoneNumbersClient(credentials);
    for await (const areaCodeItem of client.listTollFreeAreaCodes()) {
    console.log("area code: ", areaCodeItem.areaCode);
    }

    List all available Toll-Free area codes.

    Parameters

    Returns PagedAsyncIterableIterator<PhoneNumberAreaCode>

Generated using TypeDoc