Description
The line_type_intelligence field in PhoneNumberInstance for the Lookup v2 API is incorrectly typed as Optional[str] when it should be Optional[Dict].
I mainly noticed this as my linter was failing the type check of one of my files because it thought the field was string.
Current Behavior
The type annotation for line_type_intelligence is:
|
self.line_type_intelligence: Optional[str] = payload.get( |
|
"line_type_intelligence" |
|
) |
Expected Behavior
According to the official Twilio documentation, line_type_intelligence should be typed as:
line_type_intelligence: Optional[Dict[str, Any]]
Evidence from Official Documentation
The Twilio Lookup v2 Line Type Intelligence documentation clearly shows that line_type_intelligence is an object (dictionary) containing the following properties:
mobile_country_code (string)
mobile_network_code (string)
carrier_name (string)
type (string)
error_code (nullable)
Example response from the official docs:
"line_type_intelligence": {
"error_code": null,
"mobile_country_code": "240",
"mobile_network_code": "38",
"carrier_name": "Twilio - SMS/MMS-SVR",
"type": "nonFixedVoip"
}
Impact
This incorrect typing can lead to:
- Type checking errors when accessing nested properties (e.g.,
phone_number.line_type_intelligence["type"])
If possible, I'd like to make this change and contribute.
Description
The
line_type_intelligencefield inPhoneNumberInstancefor the Lookup v2 API is incorrectly typed asOptional[str]when it should beOptional[Dict].I mainly noticed this as my linter was failing the type check of one of my files because it thought the field was string.
Current Behavior
The type annotation for
line_type_intelligenceis:twilio-python/twilio/rest/lookups/v2/phone_number.py
Lines 70 to 72 in 615fb81
Expected Behavior
According to the official Twilio documentation,
line_type_intelligenceshould be typed as:Evidence from Official Documentation
The Twilio Lookup v2 Line Type Intelligence documentation clearly shows that
line_type_intelligenceis an object (dictionary) containing the following properties:mobile_country_code(string)mobile_network_code(string)carrier_name(string)type(string)error_code(nullable)Example response from the official docs:
Impact
This incorrect typing can lead to:
phone_number.line_type_intelligence["type"])If possible, I'd like to make this change and contribute.