Skip to content

Commit 480bb4d

Browse files
committed
[types] rename messaging_limit_tier to whatsapp_business_manager_messaging_limit and add deprecation warning. resolves #221
1 parent e6a8561 commit 480bb4d

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

pywa/types/others.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ class BusinessPhoneNumber(helpers.APIObject):
10781078
is_official_business_account: Indicates if phone number is associated with an Official Business Account.
10791079
is_pin_enabled: Returns True if a pin for two-step verification is enabled.
10801080
is_preverified_number: Returns true if the phone number was pre-verified
1081-
messaging_limit_tier: Current messaging limit tier.
1081+
whatsapp_business_manager_messaging_limit: Current messaging limit tier.
10821082
search_visibility: The availability of the phone_number in the WhatsApp Business search.
10831083
platform_type: Platform the business phone number is registered with. Values can be CLOUD_API, ON_PREMISE, or NOT_APPLICABLE.
10841084
If NOT_APPLICABLE, the number is not registered with Cloud API or On-Premises API.
@@ -1109,7 +1109,6 @@ class BusinessPhoneNumber(helpers.APIObject):
11091109
is_official_business_account: bool
11101110
is_pin_enabled: bool
11111111
is_preverified_number: bool
1112-
messaging_limit_tier: str | None
11131112
search_visibility: str | None
11141113
platform_type: str | None
11151114
throughput: dict[str, str] | None
@@ -1121,6 +1120,7 @@ class BusinessPhoneNumber(helpers.APIObject):
11211120
# username: str | None
11221121
country_code: str | None
11231122
country_dial_code: str | None
1123+
whatsapp_business_manager_messaging_limit: str | None
11241124

11251125
@classmethod
11261126
def from_dict(cls, data: dict):
@@ -1147,7 +1147,9 @@ def from_dict(cls, data: dict):
11471147
),
11481148
is_pin_enabled=data.get("is_pin_enabled", False),
11491149
is_preverified_number=data.get("is_preverified_number", False),
1150-
messaging_limit_tier=data.get("messaging_limit_tier"),
1150+
whatsapp_business_manager_messaging_limit=data.get(
1151+
"whatsapp_business_manager_messaging_limit"
1152+
),
11511153
search_visibility=data.get("search_visibility"),
11521154
platform_type=data.get("platform_type"),
11531155
throughput=data.get("throughput"),
@@ -1175,6 +1177,17 @@ def username(self) -> None:
11751177
stacklevel=2,
11761178
)
11771179

1180+
@property
1181+
def messaging_limit_tier(self) -> None:
1182+
"""
1183+
This property is deprecated and will always return None.
1184+
"""
1185+
warnings.warn(
1186+
"BusinessPhoneNumber.messaging_limit_tier is deprecated, use BusinessPhoneNumber.whatsapp_business_manager_messaging_limit instead",
1187+
PywaDeprecationWarning,
1188+
stacklevel=2,
1189+
)
1190+
11781191

11791192
class QRCodeImageType(helpers.StrEnum):
11801193
"""

tests/test_types.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ def test_business_phone_number():
142142
"is_official_business_account": False,
143143
"is_pin_enabled": True,
144144
"is_preverified_number": False,
145-
"messaging_limit_tier": "TIER_1K",
146145
"search_visibility": "NON_VISIBLE",
147146
"platform_type": "CLOUD_API",
148147
"throughput": {"level": "STANDARD"},
@@ -204,7 +203,6 @@ def test_business_phone_number():
204203
is_official_business_account=False,
205204
is_pin_enabled=True,
206205
is_preverified_number=False,
207-
messaging_limit_tier="TIER_1K",
208206
search_visibility="NON_VISIBLE",
209207
platform_type="CLOUD_API",
210208
throughput={"level": "STANDARD"},
@@ -247,6 +245,7 @@ def test_business_phone_number():
247245
# username=None,
248246
country_code=None,
249247
country_dial_code=None,
248+
whatsapp_business_manager_messaging_limit=None,
250249
)
251250

252251

0 commit comments

Comments
 (0)