ha number feature#371
Conversation
📝 WalkthroughWalkthroughAdds an optional haEnable parameter to phone number purchase methods, includes ha_enable in request payloads, exposes a new fallbackNumber field on BuyNumberResponse, and bumps package version to 4.75.6. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
types/resources/numbers.d.ts (1)
1-7: MakefallbackNumberoptional in BuyNumberResponse.The runtime code assigns it directly from the API response without validation, meaning it can be
undefinedif not present. The TypeScript type should reflect this possibility:Suggested change
export class BuyNumberResponse { constructor(params: object); apiId: string; numbers: object; status: string; - fallbackNumber: string; + fallbackNumber?: string; }
🤖 Fix all issues with AI agents
In `@CHANGELOG.md`:
- Around line 2-5: Replace the bolded feature descriptor "**Feature - HA Number
support**" with a proper markdown heading (e.g., "### Feature - HA Number
support" or the project's existing changelog heading level) so it is not treated
as emphasis-as-heading (MD036); update the line in CHANGELOG.md where the
feature block appears and keep the rest of the list items unchanged.
In `@types/resources/numbers.d.ts`:
- Around line 46-55: The TypeScript declaration for PhoneNumber.buy is missing
the mandatory leading phone number parameter; update the signature in the
numbers.d.ts declaration for PhoneNumber.buy to include the first parameter
(e.g., phoneNumber: string) and make it required so it matches the runtime and
the other interfaces (PhoneNumberInterface.buy and NumberInterface.buy),
preserving the existing cnamLookup?: string and haEnabled?: boolean and
returning Promise<any>.
| ## [v4.75.6](https://github.com/plivo/plivo-node/tree/v4.75.6) (2026-01-21) | ||
| **Feature - HA Number support** | ||
| - Added `haEnabled` optional parameter to phone number `buy` method | ||
| - Added `fallbackNumber` field to `BuyNumberResponse` |
There was a problem hiding this comment.
Use a heading instead of bold text (MD036).
markdownlint flags emphasis-as-heading for the feature line.
🔧 Proposed markdown tweak
-**Feature - HA Number support**
+### Feature - HA Number support📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| ## [v4.75.6](https://github.com/plivo/plivo-node/tree/v4.75.6) (2026-01-21) | |
| **Feature - HA Number support** | |
| - Added `haEnabled` optional parameter to phone number `buy` method | |
| - Added `fallbackNumber` field to `BuyNumberResponse` | |
| ## [v4.75.6](https://github.com/plivo/plivo-node/tree/v4.75.6) (2026-01-21) | |
| ### Feature - HA Number support | |
| - Added `haEnabled` optional parameter to phone number `buy` method | |
| - Added `fallbackNumber` field to `BuyNumberResponse` |
🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
3-3: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
🤖 Prompt for AI Agents
In `@CHANGELOG.md` around lines 2 - 5, Replace the bolded feature descriptor
"**Feature - HA Number support**" with a proper markdown heading (e.g., "###
Feature - HA Number support" or the project's existing changelog heading level)
so it is not treated as emphasis-as-heading (MD036); update the line in
CHANGELOG.md where the feature block appears and keep the rest of the list items
unchanged.
5059498
into
master
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@types/resources/numbers.d.ts`:
- Line 93: Update the unrent method signatures in types/resources/numbers.d.ts
from Promise<any> to Promise<boolean> to reflect runtime behavior and JSDoc;
locate the two unrent declarations (the one at the earlier occurrence and the
second at the later occurrence) and change their return types to
Promise<boolean> so consumers get correct boolean typing.
- Line 125: The TypeScript declaration for addOwnNumber requires optionalParams
even though runtime uses optionalParams || {}, so update the method signature in
types/resources/numbers.d.ts by making the last parameter optional (change
optionalParams: object to optionalParams?: object) so the typings match runtime
behavior for addOwnNumber.
🧹 Nitpick comments (1)
lib/resources/numbers.js (1)
120-130: Consider preserving explicitfalseforcnamLookup.
if (cnamLookup)dropsfalse. If the API distinguishesfalsefrom “unset,” align with thehaEnablecheck.♻️ Proposed tweak
- if (cnamLookup) { - params.cnam_lookup = cnamLookup; - } + if (cnamLookup !== undefined) { + params.cnam_lookup = cnamLookup; + }
| * @fail {Error} return Error | ||
| */ | ||
| unrent(number: string): Promise < any > ; | ||
| unrent(number: string): Promise<any>; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, locate and examine the TypeScript definition file
find . -name "numbers.d.ts" -type fRepository: plivo/plivo-node
Length of output: 90
🏁 Script executed:
# Once found, check the content around lines 93 and 158
if [ -f "types/resources/numbers.d.ts" ]; then
echo "=== Line 93 context ===" && sed -n '85,100p' types/resources/numbers.d.ts
echo ""
echo "=== Line 158 context ===" && sed -n '150,165p' types/resources/numbers.d.ts
fiRepository: plivo/plivo-node
Length of output: 827
🏁 Script executed:
# Search for the actual implementation or documentation of unrent
rg -i "unrent" -B 2 -A 5 --type js --type tsRepository: plivo/plivo-node
Length of output: 9196
Change unrent return type to Promise<boolean> to match runtime behavior and documentation.
The method's JSDoc already specifies @promise {boolean}, the implementation resolves true on success, and tests assert the return value is true. The current Promise<any> type annotation loses this type safety.
Suggested typing fix
- unrent(number: string): Promise<any>;
+ unrent(number: string): Promise<boolean>;Also applies to: 158-158
🤖 Prompt for AI Agents
In `@types/resources/numbers.d.ts` at line 93, Update the unrent method signatures
in types/resources/numbers.d.ts from Promise<any> to Promise<boolean> to reflect
runtime behavior and JSDoc; locate the two unrent declarations (the one at the
earlier occurrence and the second at the later occurrence) and change their
return types to Promise<boolean> so consumers get correct boolean typing.
| * @fail {Error} return Error | ||
| */ | ||
| addOwnNumber(numbers: string, carrier: string, region: string, optionalParams: object): Promise < UpdateNumberResponse > ; | ||
| addOwnNumber(numbers: string, carrier: string, region: string, optionalParams: object): Promise<UpdateNumberResponse>; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Locate the types file and read relevant lines
find . -name "numbers.d.ts" -type fRepository: plivo/plivo-node
Length of output: 90
🏁 Script executed:
# Also search for the implementation to understand runtime behavior
find . -name "*.js" -o -name "*.ts" | grep -E "(numbers|resources)" | grep -v "\.d\.ts" | head -20Repository: plivo/plivo-node
Length of output: 681
🏁 Script executed:
# Search more specifically for numbers implementation
find . -path "*/lib/resources/numbers.js" -o -path "*/resources/numbers.js" | grep -v ".d.ts"Repository: plivo/plivo-node
Length of output: 86
🏁 Script executed:
# Read the types file to see current state
cat -n ./types/resources/numbers.d.tsRepository: plivo/plivo-node
Length of output: 6237
🏁 Script executed:
# Read the implementation to verify runtime behavior
cat -n ./lib/resources/numbers.js | head -300Repository: plivo/plivo-node
Length of output: 10988
🏁 Script executed:
# Continue reading to see the search and update methods
cat -n ./lib/resources/numbers.js | tail -n +300Repository: plivo/plivo-node
Length of output: 3053
Make optional params truly optional in typings.
Runtime treats these as optional (line 293 uses optionalParams || {}, line 330 uses optionalParams || {}, and update params are conditionally accessed), but the type definitions currently require them. Update the method signatures to match the actual runtime behavior.
🔧 Suggested typing fix
- addOwnNumber(numbers: string, carrier: string, region: string, optionalParams: object): Promise<UpdateNumberResponse>;
+ addOwnNumber(numbers: string, carrier: string, region: string, optionalParams?: object): Promise<UpdateNumberResponse>;
...
- search(countryISO: string, optionalParams: object): Promise<SearchNumberResponse[]>;
+ search(countryISO: string, optionalParams?: object): Promise<SearchNumberResponse[]>;
...
- update(number: string, params: {
- appId: string;
- subAccount: string;
- alias: string;
- }): Promise<UpdateNumberResponse>;
+ update(number: string, params: {
+ appId?: string;
+ subAccount?: string;
+ alias?: string;
+ }): Promise<UpdateNumberResponse>;🤖 Prompt for AI Agents
In `@types/resources/numbers.d.ts` at line 125, The TypeScript declaration for
addOwnNumber requires optionalParams even though runtime uses optionalParams ||
{}, so update the method signature in types/resources/numbers.d.ts by making the
last parameter optional (change optionalParams: object to optionalParams?:
object) so the typings match runtime behavior for addOwnNumber.
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.