Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(sdk-python): type the required keys of a filter and a preview
Yudhi Armyndharis034b3c01388a
diff --git a/scripts/check-contract-shapes.mjs b/scripts/check-contract-shapes.mjsindex 4e23743cc..4aa5031f0 100644--- a/scripts/check-contract-shapes.mjs+++ b/scripts/check-contract-shapes.mjs@@ -179,7 +179,7 @@ const MAPPINGS = {const MINIMUM_MAPPED = {'sdk/javascript/src/types.ts': 85,'dashboard/src/services/api.ts': 22,- 'sdk/python/openwa/types.py': 81,+ 'sdk/python/openwa/types.py': 84,'sdk/go': 81,'sdk/java': 85,};@@ -236,6 +236,7 @@ const PYTHON_MAPPING = {CreateSessionRequest: 'CreateSessionDto',CreateTemplateRequest: 'CreateTemplateDto',CreateWebhookRequest: 'CreateWebhookDto',+ CustomLinkPreview: 'CustomLinkPreviewDto',DeleteChatRequest: 'DeleteChatDto',DeleteMessageRequest: 'DeleteMessageDto',DemoteChannelAdminRequest: 'DemoteChannelAdminDto',@@ -298,6 +299,8 @@ const PYTHON_MAPPING = {RedriveWebhookDeliveriesRequest: 'RedriveWebhookDeliveriesDto',VotePollRequest: 'VotePollDto',WebhookDeliveryFailure: 'WebhookDeliveryFailureDto',+ WebhookFilterCondition: 'WebhookFilterConditionDto',+ WebhookFilters: 'WebhookFiltersDto',WebhookRedriveResult: 'WebhookRedriveResultDto',WebhookResponse: 'WebhookResponseDto',};diff --git a/sdk/python/openwa/types.py b/sdk/python/openwa/types.pyindex 3de64121c..74864095b 100644--- a/sdk/python/openwa/types.py+++ b/sdk/python/openwa/types.py@@ -214,13 +214,13 @@ class GroupJoinInfo(TypedDict):participantCount: NotRequired[int]-class CustomLinkPreview(TypedDict, total=False):+class CustomLinkPreview(TypedDict):"""A caller-supplied link preview. Nothing is fetched for these."""url: str# Required -- WhatsApp will not render a preview without a title.title: str- description: str+ description: NotRequired[str]# ── Session ───────────────────────────────────────────────────────@@ -903,14 +903,14 @@ class SetProfilePictureRequest(TypedDict, total=False):# ── Webhook ───────────────────────────────────────────────────────-class WebhookFilterCondition(TypedDict, total=False):+class WebhookFilterCondition(TypedDict):# field/operator/value required; caseSensitive optional (text fields only, default false).field: str- operator: str+ operator: Literal["is", "isNot", "contains", "equals"]# Polymorphic per field kind: a single string (text fields), a list of# strings (id/idArray/enum fields), or a bool (boolean fields).value: str | list[str] | bool- caseSensitive: bool+ caseSensitive: NotRequired[bool]class WebhookFilters(TypedDict):@@ -1476,7 +1476,8 @@ class SearchQueryParams(_SearchQueryRequired, _SearchQueryOptional):# `from` is a Python keyword → functional form for the required keys. The builtin# provider returns waMessageId/snippet as "" when absent (always str, never null);-# `score` is provider-dependent (builtin always returns it) → optional.+# `score` is provider-dependent (the builtin provider on SQLite leaves it out for a key restricted to+# sessions or chats) → optional._SearchHitRequired = TypedDict("_SearchHitRequired",{