linq-python 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- linq/__init__.py +102 -0
- linq/_base_client.py +2149 -0
- linq/_client.py +2479 -0
- linq/_compat.py +226 -0
- linq/_constants.py +14 -0
- linq/_exceptions.py +108 -0
- linq/_files.py +123 -0
- linq/_models.py +878 -0
- linq/_qs.py +153 -0
- linq/_resource.py +43 -0
- linq/_response.py +833 -0
- linq/_streaming.py +338 -0
- linq/_types.py +271 -0
- linq/_utils/__init__.py +65 -0
- linq/_utils/_compat.py +45 -0
- linq/_utils/_datetime_parse.py +136 -0
- linq/_utils/_json.py +35 -0
- linq/_utils/_logs.py +25 -0
- linq/_utils/_path.py +127 -0
- linq/_utils/_proxy.py +65 -0
- linq/_utils/_reflection.py +42 -0
- linq/_utils/_resources_proxy.py +24 -0
- linq/_utils/_streams.py +12 -0
- linq/_utils/_sync.py +58 -0
- linq/_utils/_transform.py +457 -0
- linq/_utils/_typing.py +156 -0
- linq/_utils/_utils.py +421 -0
- linq/_version.py +4 -0
- linq/lib/.keep +4 -0
- linq/pagination.py +95 -0
- linq/py.typed +0 -0
- linq/resources/__init__.py +134 -0
- linq/resources/attachments.py +589 -0
- linq/resources/capability.py +297 -0
- linq/resources/chats/__init__.py +61 -0
- linq/resources/chats/chats.py +1492 -0
- linq/resources/chats/messages.py +416 -0
- linq/resources/chats/participants.py +322 -0
- linq/resources/chats/typing.py +299 -0
- linq/resources/contact_card.py +472 -0
- linq/resources/messages.py +686 -0
- linq/resources/phone_numbers.py +163 -0
- linq/resources/phonenumbers.py +165 -0
- linq/resources/webhook_events.py +319 -0
- linq/resources/webhook_subscriptions.py +776 -0
- linq/resources/webhooks.py +34 -0
- linq/types/__init__.py +90 -0
- linq/types/attachment_create_params.py +42 -0
- linq/types/attachment_create_response.py +44 -0
- linq/types/attachment_retrieve_response.py +55 -0
- linq/types/capability_check_RCS_params.py +20 -0
- linq/types/capability_check_i_message_params.py +20 -0
- linq/types/chat.py +44 -0
- linq/types/chat_create_params.py +33 -0
- linq/types/chat_create_response.py +44 -0
- linq/types/chat_created_webhook_event.py +87 -0
- linq/types/chat_group_icon_update_failed_webhook_event.py +65 -0
- linq/types/chat_group_icon_updated_webhook_event.py +66 -0
- linq/types/chat_group_name_update_failed_webhook_event.py +65 -0
- linq/types/chat_group_name_updated_webhook_event.py +66 -0
- linq/types/chat_leave_chat_response.py +15 -0
- linq/types/chat_list_chats_params.py +36 -0
- linq/types/chat_send_voicememo_params.py +23 -0
- linq/types/chat_send_voicememo_response.py +79 -0
- linq/types/chat_typing_indicator_started_webhook_event.py +52 -0
- linq/types/chat_typing_indicator_stopped_webhook_event.py +52 -0
- linq/types/chat_update_params.py +15 -0
- linq/types/chat_update_response.py +13 -0
- linq/types/chats/__init__.py +12 -0
- linq/types/chats/message_list_params.py +15 -0
- linq/types/chats/message_send_params.py +18 -0
- linq/types/chats/message_send_response.py +16 -0
- linq/types/chats/participant_add_params.py +12 -0
- linq/types/chats/participant_add_response.py +15 -0
- linq/types/chats/participant_remove_params.py +12 -0
- linq/types/chats/participant_remove_response.py +15 -0
- linq/types/chats/sent_message.py +69 -0
- linq/types/contact_card_create_params.py +24 -0
- linq/types/contact_card_retrieve_params.py +15 -0
- linq/types/contact_card_retrieve_response.py +23 -0
- linq/types/contact_card_update_params.py +21 -0
- linq/types/events_webhook_event.py +50 -0
- linq/types/handle_check_response.py +13 -0
- linq/types/link_part_param.py +22 -0
- linq/types/media_part_param.py +54 -0
- linq/types/message.py +87 -0
- linq/types/message_add_reaction_params.py +32 -0
- linq/types/message_add_reaction_response.py +15 -0
- linq/types/message_content_param.py +82 -0
- linq/types/message_delivered_webhook_event.py +65 -0
- linq/types/message_edited_webhook_event.py +100 -0
- linq/types/message_effect.py +23 -0
- linq/types/message_effect_param.py +22 -0
- linq/types/message_event_v2.py +116 -0
- linq/types/message_failed_webhook_event.py +72 -0
- linq/types/message_list_messages_thread_params.py +18 -0
- linq/types/message_read_webhook_event.py +65 -0
- linq/types/message_received_webhook_event.py +65 -0
- linq/types/message_sent_webhook_event.py +65 -0
- linq/types/message_update_params.py +15 -0
- linq/types/participant_added_webhook_event.py +66 -0
- linq/types/participant_removed_webhook_event.py +66 -0
- linq/types/phone_number_list_response.py +20 -0
- linq/types/phone_number_status_updated_webhook_event.py +82 -0
- linq/types/phonenumber_list_response.py +39 -0
- linq/types/reaction_added_webhook_event.py +46 -0
- linq/types/reaction_event_base.py +85 -0
- linq/types/reaction_removed_webhook_event.py +46 -0
- linq/types/reply_to.py +21 -0
- linq/types/reply_to_param.py +21 -0
- linq/types/schemas_media_part_response.py +29 -0
- linq/types/schemas_message_effect.py +18 -0
- linq/types/schemas_text_part_response.py +22 -0
- linq/types/set_contact_card.py +24 -0
- linq/types/shared/__init__.py +9 -0
- linq/types/shared/chat_handle.py +33 -0
- linq/types/shared/media_part_response.py +34 -0
- linq/types/shared/reaction.py +56 -0
- linq/types/shared/reaction_type.py +7 -0
- linq/types/shared/service_type.py +7 -0
- linq/types/shared/text_decoration.py +23 -0
- linq/types/shared/text_part_response.py +26 -0
- linq/types/shared_params/__init__.py +5 -0
- linq/types/shared_params/reaction_type.py +9 -0
- linq/types/shared_params/service_type.py +9 -0
- linq/types/shared_params/text_decoration.py +23 -0
- linq/types/supported_content_type.py +60 -0
- linq/types/text_part_param.py +44 -0
- linq/types/webhook_event_list_response.py +17 -0
- linq/types/webhook_event_type.py +33 -0
- linq/types/webhook_subscription.py +35 -0
- linq/types/webhook_subscription_create_params.py +27 -0
- linq/types/webhook_subscription_create_response.py +46 -0
- linq/types/webhook_subscription_list_response.py +13 -0
- linq/types/webhook_subscription_update_params.py +30 -0
- linq_python-0.1.0.dist-info/METADATA +572 -0
- linq_python-0.1.0.dist-info/RECORD +139 -0
- linq_python-0.1.0.dist-info/WHEEL +4 -0
- linq_python-0.1.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List, Union, Optional
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
from typing_extensions import Literal, Annotated, TypeAlias
|
|
6
|
+
|
|
7
|
+
from .._utils import PropertyInfo
|
|
8
|
+
from .._models import BaseModel
|
|
9
|
+
from .shared.chat_handle import ChatHandle
|
|
10
|
+
from .shared.service_type import ServiceType
|
|
11
|
+
from .schemas_message_effect import SchemasMessageEffect
|
|
12
|
+
from .schemas_text_part_response import SchemasTextPartResponse
|
|
13
|
+
from .schemas_media_part_response import SchemasMediaPartResponse
|
|
14
|
+
|
|
15
|
+
__all__ = ["MessageEventV2", "Chat", "Part", "PartSchemasLinkPartResponse", "ReplyTo"]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Chat(BaseModel):
|
|
19
|
+
"""Chat information"""
|
|
20
|
+
|
|
21
|
+
id: str
|
|
22
|
+
"""Chat identifier"""
|
|
23
|
+
|
|
24
|
+
is_group: Optional[bool] = None
|
|
25
|
+
"""Whether this is a group chat"""
|
|
26
|
+
|
|
27
|
+
owner_handle: Optional[ChatHandle] = None
|
|
28
|
+
"""Your phone number's handle. Always has is_me=true."""
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class PartSchemasLinkPartResponse(BaseModel):
|
|
32
|
+
"""A rich link preview part"""
|
|
33
|
+
|
|
34
|
+
type: Literal["link"]
|
|
35
|
+
"""Indicates this is a rich link preview part"""
|
|
36
|
+
|
|
37
|
+
value: str
|
|
38
|
+
"""The URL"""
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
Part: TypeAlias = Annotated[
|
|
42
|
+
Union[SchemasTextPartResponse, SchemasMediaPartResponse, PartSchemasLinkPartResponse],
|
|
43
|
+
PropertyInfo(discriminator="type"),
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class ReplyTo(BaseModel):
|
|
48
|
+
"""Reference to the message this is replying to (for threaded replies)"""
|
|
49
|
+
|
|
50
|
+
message_id: Optional[str] = None
|
|
51
|
+
"""ID of the message being replied to"""
|
|
52
|
+
|
|
53
|
+
part_index: Optional[int] = None
|
|
54
|
+
"""Index of the part being replied to"""
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class MessageEventV2(BaseModel):
|
|
58
|
+
"""Unified payload for message webhooks when using `webhook_version: "2026-02-03"`.
|
|
59
|
+
|
|
60
|
+
This schema is used for message.sent, message.received, message.delivered, and message.read
|
|
61
|
+
events when the subscription URL includes `?version=2026-02-03`.
|
|
62
|
+
|
|
63
|
+
Key differences from V1 (2025-01-01):
|
|
64
|
+
- `direction`: "inbound" or "outbound" instead of `is_from_me` boolean
|
|
65
|
+
- `sender_handle`: Full handle object for the sender
|
|
66
|
+
- `chat`: Nested object with `id`, `is_group`, and `owner_handle`
|
|
67
|
+
- Message fields (`id`, `parts`, `effect`, etc.) are at the top level, not nested in `message`
|
|
68
|
+
|
|
69
|
+
Timestamps indicate the message state:
|
|
70
|
+
- `message.sent`: sent_at set, delivered_at=null, read_at=null
|
|
71
|
+
- `message.received`: sent_at set, delivered_at=null, read_at=null
|
|
72
|
+
- `message.delivered`: sent_at set, delivered_at set, read_at=null
|
|
73
|
+
- `message.read`: sent_at set, delivered_at set, read_at set
|
|
74
|
+
"""
|
|
75
|
+
|
|
76
|
+
id: str
|
|
77
|
+
"""Message identifier"""
|
|
78
|
+
|
|
79
|
+
chat: Chat
|
|
80
|
+
"""Chat information"""
|
|
81
|
+
|
|
82
|
+
direction: Literal["inbound", "outbound"]
|
|
83
|
+
"""Message direction - "outbound" if sent by you, "inbound" if received"""
|
|
84
|
+
|
|
85
|
+
parts: List[Part]
|
|
86
|
+
"""Message parts (text and/or media)"""
|
|
87
|
+
|
|
88
|
+
sender_handle: ChatHandle
|
|
89
|
+
"""The handle that sent this message"""
|
|
90
|
+
|
|
91
|
+
service: ServiceType
|
|
92
|
+
"""Messaging service type"""
|
|
93
|
+
|
|
94
|
+
delivered_at: Optional[datetime] = None
|
|
95
|
+
"""When the message was delivered. Null if not yet delivered."""
|
|
96
|
+
|
|
97
|
+
effect: Optional[SchemasMessageEffect] = None
|
|
98
|
+
"""iMessage effect applied to a message (screen or bubble animation)"""
|
|
99
|
+
|
|
100
|
+
idempotency_key: Optional[str] = None
|
|
101
|
+
"""Idempotency key for deduplication of outbound messages."""
|
|
102
|
+
|
|
103
|
+
preferred_service: Optional[Literal["iMessage", "SMS", "RCS", "auto"]] = None
|
|
104
|
+
"""Preferred messaging service type.
|
|
105
|
+
|
|
106
|
+
Includes "auto" for default fallback behavior.
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
read_at: Optional[datetime] = None
|
|
110
|
+
"""When the message was read. Null if not yet read."""
|
|
111
|
+
|
|
112
|
+
reply_to: Optional[ReplyTo] = None
|
|
113
|
+
"""Reference to the message this is replying to (for threaded replies)"""
|
|
114
|
+
|
|
115
|
+
sent_at: Optional[datetime] = None
|
|
116
|
+
"""When the message was sent. Null if not yet sent."""
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
|
|
6
|
+
from .._models import BaseModel
|
|
7
|
+
from .webhook_event_type import WebhookEventType
|
|
8
|
+
|
|
9
|
+
__all__ = ["MessageFailedWebhookEvent", "Data"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Data(BaseModel):
|
|
13
|
+
"""
|
|
14
|
+
Error details for message.failed webhook events.
|
|
15
|
+
See [WebhookErrorCode](#/components/schemas/WebhookErrorCode) for the full error code reference.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
code: int
|
|
19
|
+
"""Error codes in webhook failure events (3007, 4001)."""
|
|
20
|
+
|
|
21
|
+
failed_at: datetime
|
|
22
|
+
"""When the failure was detected"""
|
|
23
|
+
|
|
24
|
+
chat_id: Optional[str] = None
|
|
25
|
+
"""Chat identifier (UUID)"""
|
|
26
|
+
|
|
27
|
+
message_id: Optional[str] = None
|
|
28
|
+
"""Message identifier (UUID)"""
|
|
29
|
+
|
|
30
|
+
reason: Optional[str] = None
|
|
31
|
+
"""Human-readable description of the failure"""
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class MessageFailedWebhookEvent(BaseModel):
|
|
35
|
+
"""Complete webhook payload for message.failed events"""
|
|
36
|
+
|
|
37
|
+
api_version: str
|
|
38
|
+
"""API version for the webhook payload format"""
|
|
39
|
+
|
|
40
|
+
created_at: datetime
|
|
41
|
+
"""When the event was created"""
|
|
42
|
+
|
|
43
|
+
data: Data
|
|
44
|
+
"""
|
|
45
|
+
Error details for message.failed webhook events. See
|
|
46
|
+
[WebhookErrorCode](#/components/schemas/WebhookErrorCode) for the full error
|
|
47
|
+
code reference.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
event_id: str
|
|
51
|
+
"""Unique identifier for this event (for deduplication)"""
|
|
52
|
+
|
|
53
|
+
event_type: WebhookEventType
|
|
54
|
+
"""Valid webhook event types that can be subscribed to.
|
|
55
|
+
|
|
56
|
+
**Note:** `message.edited` is only delivered to subscriptions using
|
|
57
|
+
`webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
|
|
58
|
+
subscription will not produce any deliveries.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
partner_id: str
|
|
62
|
+
"""Partner identifier. Present on all webhooks for cross-referencing."""
|
|
63
|
+
|
|
64
|
+
trace_id: str
|
|
65
|
+
"""Trace ID for debugging and correlation across systems."""
|
|
66
|
+
|
|
67
|
+
webhook_version: str
|
|
68
|
+
"""
|
|
69
|
+
Date-based webhook payload version. Determined by the `?version=` query
|
|
70
|
+
parameter in your webhook subscription URL. If no version parameter is
|
|
71
|
+
specified, defaults based on subscription creation date.
|
|
72
|
+
"""
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Literal, TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["MessageListMessagesThreadParams"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class MessageListMessagesThreadParams(TypedDict, total=False):
|
|
11
|
+
cursor: str
|
|
12
|
+
"""Pagination cursor from previous next_cursor response"""
|
|
13
|
+
|
|
14
|
+
limit: int
|
|
15
|
+
"""Maximum number of messages to return"""
|
|
16
|
+
|
|
17
|
+
order: Literal["asc", "desc"]
|
|
18
|
+
"""Sort order for messages (asc = oldest first, desc = newest first)"""
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
|
|
5
|
+
from .._models import BaseModel
|
|
6
|
+
from .message_event_v2 import MessageEventV2
|
|
7
|
+
from .webhook_event_type import WebhookEventType
|
|
8
|
+
|
|
9
|
+
__all__ = ["MessageReadWebhookEvent"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class MessageReadWebhookEvent(BaseModel):
|
|
13
|
+
"""Complete webhook payload for message.read events (2026-02-03 format)"""
|
|
14
|
+
|
|
15
|
+
api_version: str
|
|
16
|
+
"""API version for the webhook payload format"""
|
|
17
|
+
|
|
18
|
+
created_at: datetime
|
|
19
|
+
"""When the event was created"""
|
|
20
|
+
|
|
21
|
+
data: MessageEventV2
|
|
22
|
+
"""Unified payload for message webhooks when using `webhook_version: "2026-02-03"`.
|
|
23
|
+
|
|
24
|
+
This schema is used for message.sent, message.received, message.delivered, and
|
|
25
|
+
message.read events when the subscription URL includes `?version=2026-02-03`.
|
|
26
|
+
|
|
27
|
+
Key differences from V1 (2025-01-01):
|
|
28
|
+
|
|
29
|
+
- `direction`: "inbound" or "outbound" instead of `is_from_me` boolean
|
|
30
|
+
- `sender_handle`: Full handle object for the sender
|
|
31
|
+
- `chat`: Nested object with `id`, `is_group`, and `owner_handle`
|
|
32
|
+
- Message fields (`id`, `parts`, `effect`, etc.) are at the top level, not
|
|
33
|
+
nested in `message`
|
|
34
|
+
|
|
35
|
+
Timestamps indicate the message state:
|
|
36
|
+
|
|
37
|
+
- `message.sent`: sent_at set, delivered_at=null, read_at=null
|
|
38
|
+
- `message.received`: sent_at set, delivered_at=null, read_at=null
|
|
39
|
+
- `message.delivered`: sent_at set, delivered_at set, read_at=null
|
|
40
|
+
- `message.read`: sent_at set, delivered_at set, read_at set
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
event_id: str
|
|
44
|
+
"""Unique identifier for this event (for deduplication)"""
|
|
45
|
+
|
|
46
|
+
event_type: WebhookEventType
|
|
47
|
+
"""Valid webhook event types that can be subscribed to.
|
|
48
|
+
|
|
49
|
+
**Note:** `message.edited` is only delivered to subscriptions using
|
|
50
|
+
`webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
|
|
51
|
+
subscription will not produce any deliveries.
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
partner_id: str
|
|
55
|
+
"""Partner identifier. Present on all webhooks for cross-referencing."""
|
|
56
|
+
|
|
57
|
+
trace_id: str
|
|
58
|
+
"""Trace ID for debugging and correlation across systems."""
|
|
59
|
+
|
|
60
|
+
webhook_version: str
|
|
61
|
+
"""
|
|
62
|
+
Date-based webhook payload version. Determined by the `?version=` query
|
|
63
|
+
parameter in your webhook subscription URL. If no version parameter is
|
|
64
|
+
specified, defaults based on subscription creation date.
|
|
65
|
+
"""
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
|
|
5
|
+
from .._models import BaseModel
|
|
6
|
+
from .message_event_v2 import MessageEventV2
|
|
7
|
+
from .webhook_event_type import WebhookEventType
|
|
8
|
+
|
|
9
|
+
__all__ = ["MessageReceivedWebhookEvent"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class MessageReceivedWebhookEvent(BaseModel):
|
|
13
|
+
"""Complete webhook payload for message.received events (2026-02-03 format)"""
|
|
14
|
+
|
|
15
|
+
api_version: str
|
|
16
|
+
"""API version for the webhook payload format"""
|
|
17
|
+
|
|
18
|
+
created_at: datetime
|
|
19
|
+
"""When the event was created"""
|
|
20
|
+
|
|
21
|
+
data: MessageEventV2
|
|
22
|
+
"""Unified payload for message webhooks when using `webhook_version: "2026-02-03"`.
|
|
23
|
+
|
|
24
|
+
This schema is used for message.sent, message.received, message.delivered, and
|
|
25
|
+
message.read events when the subscription URL includes `?version=2026-02-03`.
|
|
26
|
+
|
|
27
|
+
Key differences from V1 (2025-01-01):
|
|
28
|
+
|
|
29
|
+
- `direction`: "inbound" or "outbound" instead of `is_from_me` boolean
|
|
30
|
+
- `sender_handle`: Full handle object for the sender
|
|
31
|
+
- `chat`: Nested object with `id`, `is_group`, and `owner_handle`
|
|
32
|
+
- Message fields (`id`, `parts`, `effect`, etc.) are at the top level, not
|
|
33
|
+
nested in `message`
|
|
34
|
+
|
|
35
|
+
Timestamps indicate the message state:
|
|
36
|
+
|
|
37
|
+
- `message.sent`: sent_at set, delivered_at=null, read_at=null
|
|
38
|
+
- `message.received`: sent_at set, delivered_at=null, read_at=null
|
|
39
|
+
- `message.delivered`: sent_at set, delivered_at set, read_at=null
|
|
40
|
+
- `message.read`: sent_at set, delivered_at set, read_at set
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
event_id: str
|
|
44
|
+
"""Unique identifier for this event (for deduplication)"""
|
|
45
|
+
|
|
46
|
+
event_type: WebhookEventType
|
|
47
|
+
"""Valid webhook event types that can be subscribed to.
|
|
48
|
+
|
|
49
|
+
**Note:** `message.edited` is only delivered to subscriptions using
|
|
50
|
+
`webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
|
|
51
|
+
subscription will not produce any deliveries.
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
partner_id: str
|
|
55
|
+
"""Partner identifier. Present on all webhooks for cross-referencing."""
|
|
56
|
+
|
|
57
|
+
trace_id: str
|
|
58
|
+
"""Trace ID for debugging and correlation across systems."""
|
|
59
|
+
|
|
60
|
+
webhook_version: str
|
|
61
|
+
"""
|
|
62
|
+
Date-based webhook payload version. Determined by the `?version=` query
|
|
63
|
+
parameter in your webhook subscription URL. If no version parameter is
|
|
64
|
+
specified, defaults based on subscription creation date.
|
|
65
|
+
"""
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
|
|
5
|
+
from .._models import BaseModel
|
|
6
|
+
from .message_event_v2 import MessageEventV2
|
|
7
|
+
from .webhook_event_type import WebhookEventType
|
|
8
|
+
|
|
9
|
+
__all__ = ["MessageSentWebhookEvent"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class MessageSentWebhookEvent(BaseModel):
|
|
13
|
+
"""Complete webhook payload for message.sent events (2026-02-03 format)"""
|
|
14
|
+
|
|
15
|
+
api_version: str
|
|
16
|
+
"""API version for the webhook payload format"""
|
|
17
|
+
|
|
18
|
+
created_at: datetime
|
|
19
|
+
"""When the event was created"""
|
|
20
|
+
|
|
21
|
+
data: MessageEventV2
|
|
22
|
+
"""Unified payload for message webhooks when using `webhook_version: "2026-02-03"`.
|
|
23
|
+
|
|
24
|
+
This schema is used for message.sent, message.received, message.delivered, and
|
|
25
|
+
message.read events when the subscription URL includes `?version=2026-02-03`.
|
|
26
|
+
|
|
27
|
+
Key differences from V1 (2025-01-01):
|
|
28
|
+
|
|
29
|
+
- `direction`: "inbound" or "outbound" instead of `is_from_me` boolean
|
|
30
|
+
- `sender_handle`: Full handle object for the sender
|
|
31
|
+
- `chat`: Nested object with `id`, `is_group`, and `owner_handle`
|
|
32
|
+
- Message fields (`id`, `parts`, `effect`, etc.) are at the top level, not
|
|
33
|
+
nested in `message`
|
|
34
|
+
|
|
35
|
+
Timestamps indicate the message state:
|
|
36
|
+
|
|
37
|
+
- `message.sent`: sent_at set, delivered_at=null, read_at=null
|
|
38
|
+
- `message.received`: sent_at set, delivered_at=null, read_at=null
|
|
39
|
+
- `message.delivered`: sent_at set, delivered_at set, read_at=null
|
|
40
|
+
- `message.read`: sent_at set, delivered_at set, read_at set
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
event_id: str
|
|
44
|
+
"""Unique identifier for this event (for deduplication)"""
|
|
45
|
+
|
|
46
|
+
event_type: WebhookEventType
|
|
47
|
+
"""Valid webhook event types that can be subscribed to.
|
|
48
|
+
|
|
49
|
+
**Note:** `message.edited` is only delivered to subscriptions using
|
|
50
|
+
`webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
|
|
51
|
+
subscription will not produce any deliveries.
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
partner_id: str
|
|
55
|
+
"""Partner identifier. Present on all webhooks for cross-referencing."""
|
|
56
|
+
|
|
57
|
+
trace_id: str
|
|
58
|
+
"""Trace ID for debugging and correlation across systems."""
|
|
59
|
+
|
|
60
|
+
webhook_version: str
|
|
61
|
+
"""
|
|
62
|
+
Date-based webhook payload version. Determined by the `?version=` query
|
|
63
|
+
parameter in your webhook subscription URL. If no version parameter is
|
|
64
|
+
specified, defaults based on subscription creation date.
|
|
65
|
+
"""
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Required, TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["MessageUpdateParams"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class MessageUpdateParams(TypedDict, total=False):
|
|
11
|
+
text: Required[str]
|
|
12
|
+
"""New text content for the message part"""
|
|
13
|
+
|
|
14
|
+
part_index: int
|
|
15
|
+
"""Index of the message part to edit. Defaults to 0."""
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
|
|
6
|
+
from .._models import BaseModel
|
|
7
|
+
from .shared.chat_handle import ChatHandle
|
|
8
|
+
from .webhook_event_type import WebhookEventType
|
|
9
|
+
|
|
10
|
+
__all__ = ["ParticipantAddedWebhookEvent", "Data"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Data(BaseModel):
|
|
14
|
+
"""Payload for participant.added webhook events"""
|
|
15
|
+
|
|
16
|
+
handle: str
|
|
17
|
+
"""DEPRECATED: Use participant instead.
|
|
18
|
+
|
|
19
|
+
Handle (phone number or email address) of the added participant.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
added_at: Optional[datetime] = None
|
|
23
|
+
"""When the participant was added"""
|
|
24
|
+
|
|
25
|
+
chat_id: Optional[str] = None
|
|
26
|
+
"""Chat identifier (UUID) of the group chat"""
|
|
27
|
+
|
|
28
|
+
participant: Optional[ChatHandle] = None
|
|
29
|
+
"""The added participant as a full handle object"""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class ParticipantAddedWebhookEvent(BaseModel):
|
|
33
|
+
"""Complete webhook payload for participant.added events"""
|
|
34
|
+
|
|
35
|
+
api_version: str
|
|
36
|
+
"""API version for the webhook payload format"""
|
|
37
|
+
|
|
38
|
+
created_at: datetime
|
|
39
|
+
"""When the event was created"""
|
|
40
|
+
|
|
41
|
+
data: Data
|
|
42
|
+
"""Payload for participant.added webhook events"""
|
|
43
|
+
|
|
44
|
+
event_id: str
|
|
45
|
+
"""Unique identifier for this event (for deduplication)"""
|
|
46
|
+
|
|
47
|
+
event_type: WebhookEventType
|
|
48
|
+
"""Valid webhook event types that can be subscribed to.
|
|
49
|
+
|
|
50
|
+
**Note:** `message.edited` is only delivered to subscriptions using
|
|
51
|
+
`webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
|
|
52
|
+
subscription will not produce any deliveries.
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
partner_id: str
|
|
56
|
+
"""Partner identifier. Present on all webhooks for cross-referencing."""
|
|
57
|
+
|
|
58
|
+
trace_id: str
|
|
59
|
+
"""Trace ID for debugging and correlation across systems."""
|
|
60
|
+
|
|
61
|
+
webhook_version: str
|
|
62
|
+
"""
|
|
63
|
+
Date-based webhook payload version. Determined by the `?version=` query
|
|
64
|
+
parameter in your webhook subscription URL. If no version parameter is
|
|
65
|
+
specified, defaults based on subscription creation date.
|
|
66
|
+
"""
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
|
|
6
|
+
from .._models import BaseModel
|
|
7
|
+
from .shared.chat_handle import ChatHandle
|
|
8
|
+
from .webhook_event_type import WebhookEventType
|
|
9
|
+
|
|
10
|
+
__all__ = ["ParticipantRemovedWebhookEvent", "Data"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Data(BaseModel):
|
|
14
|
+
"""Payload for participant.removed webhook events"""
|
|
15
|
+
|
|
16
|
+
handle: str
|
|
17
|
+
"""DEPRECATED: Use participant instead.
|
|
18
|
+
|
|
19
|
+
Handle (phone number or email address) of the removed participant.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
chat_id: Optional[str] = None
|
|
23
|
+
"""Chat identifier (UUID) of the group chat"""
|
|
24
|
+
|
|
25
|
+
participant: Optional[ChatHandle] = None
|
|
26
|
+
"""The removed participant as a full handle object"""
|
|
27
|
+
|
|
28
|
+
removed_at: Optional[datetime] = None
|
|
29
|
+
"""When the participant was removed"""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class ParticipantRemovedWebhookEvent(BaseModel):
|
|
33
|
+
"""Complete webhook payload for participant.removed events"""
|
|
34
|
+
|
|
35
|
+
api_version: str
|
|
36
|
+
"""API version for the webhook payload format"""
|
|
37
|
+
|
|
38
|
+
created_at: datetime
|
|
39
|
+
"""When the event was created"""
|
|
40
|
+
|
|
41
|
+
data: Data
|
|
42
|
+
"""Payload for participant.removed webhook events"""
|
|
43
|
+
|
|
44
|
+
event_id: str
|
|
45
|
+
"""Unique identifier for this event (for deduplication)"""
|
|
46
|
+
|
|
47
|
+
event_type: WebhookEventType
|
|
48
|
+
"""Valid webhook event types that can be subscribed to.
|
|
49
|
+
|
|
50
|
+
**Note:** `message.edited` is only delivered to subscriptions using
|
|
51
|
+
`webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
|
|
52
|
+
subscription will not produce any deliveries.
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
partner_id: str
|
|
56
|
+
"""Partner identifier. Present on all webhooks for cross-referencing."""
|
|
57
|
+
|
|
58
|
+
trace_id: str
|
|
59
|
+
"""Trace ID for debugging and correlation across systems."""
|
|
60
|
+
|
|
61
|
+
webhook_version: str
|
|
62
|
+
"""
|
|
63
|
+
Date-based webhook payload version. Determined by the `?version=` query
|
|
64
|
+
parameter in your webhook subscription URL. If no version parameter is
|
|
65
|
+
specified, defaults based on subscription creation date.
|
|
66
|
+
"""
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List
|
|
4
|
+
|
|
5
|
+
from .._models import BaseModel
|
|
6
|
+
|
|
7
|
+
__all__ = ["PhoneNumberListResponse", "PhoneNumber"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PhoneNumber(BaseModel):
|
|
11
|
+
id: str
|
|
12
|
+
"""Unique identifier for the phone number"""
|
|
13
|
+
|
|
14
|
+
phone_number: str
|
|
15
|
+
"""Phone number in E.164 format"""
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class PhoneNumberListResponse(BaseModel):
|
|
19
|
+
phone_numbers: List[PhoneNumber]
|
|
20
|
+
"""List of phone numbers assigned to the partner"""
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from typing_extensions import Literal
|
|
5
|
+
|
|
6
|
+
from .._models import BaseModel
|
|
7
|
+
|
|
8
|
+
__all__ = ["PhoneNumberStatusUpdatedWebhookEvent", "Data"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class Data(BaseModel):
|
|
12
|
+
"""Payload for phone_number.status_updated webhook events"""
|
|
13
|
+
|
|
14
|
+
changed_at: datetime
|
|
15
|
+
"""When the status change occurred"""
|
|
16
|
+
|
|
17
|
+
new_status: Literal["ACTIVE", "FLAGGED"]
|
|
18
|
+
"""The new service status"""
|
|
19
|
+
|
|
20
|
+
phone_number: str
|
|
21
|
+
"""Phone number in E.164 format"""
|
|
22
|
+
|
|
23
|
+
previous_status: Literal["ACTIVE", "FLAGGED"]
|
|
24
|
+
"""The previous service status"""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class PhoneNumberStatusUpdatedWebhookEvent(BaseModel):
|
|
28
|
+
"""Complete webhook payload for phone_number.status_updated events"""
|
|
29
|
+
|
|
30
|
+
api_version: str
|
|
31
|
+
"""API version for the webhook payload format"""
|
|
32
|
+
|
|
33
|
+
created_at: datetime
|
|
34
|
+
"""When the event was created"""
|
|
35
|
+
|
|
36
|
+
data: Data
|
|
37
|
+
"""Payload for phone_number.status_updated webhook events"""
|
|
38
|
+
|
|
39
|
+
event_id: str
|
|
40
|
+
"""Unique identifier for this event (for deduplication)"""
|
|
41
|
+
|
|
42
|
+
event_type: Literal[
|
|
43
|
+
"message.sent",
|
|
44
|
+
"message.received",
|
|
45
|
+
"message.read",
|
|
46
|
+
"message.delivered",
|
|
47
|
+
"message.failed",
|
|
48
|
+
"message.edited",
|
|
49
|
+
"reaction.added",
|
|
50
|
+
"reaction.removed",
|
|
51
|
+
"participant.added",
|
|
52
|
+
"participant.removed",
|
|
53
|
+
"chat.created",
|
|
54
|
+
"chat.group_name_updated",
|
|
55
|
+
"chat.group_icon_updated",
|
|
56
|
+
"chat.group_name_update_failed",
|
|
57
|
+
"chat.group_icon_update_failed",
|
|
58
|
+
"chat.typing_indicator.started",
|
|
59
|
+
"chat.typing_indicator.stopped",
|
|
60
|
+
"phone_number.status_updated",
|
|
61
|
+
"call.initiated",
|
|
62
|
+
"call.ringing",
|
|
63
|
+
"call.answered",
|
|
64
|
+
"call.ended",
|
|
65
|
+
"call.failed",
|
|
66
|
+
"call.declined",
|
|
67
|
+
"call.no_answer",
|
|
68
|
+
]
|
|
69
|
+
"""The type of event"""
|
|
70
|
+
|
|
71
|
+
partner_id: str
|
|
72
|
+
"""Partner identifier. Present on all webhooks for cross-referencing."""
|
|
73
|
+
|
|
74
|
+
trace_id: str
|
|
75
|
+
"""Trace ID for debugging and correlation across systems."""
|
|
76
|
+
|
|
77
|
+
webhook_version: str
|
|
78
|
+
"""
|
|
79
|
+
Date-based webhook payload version. Determined by the `?version=` query
|
|
80
|
+
parameter in your webhook subscription URL. If no version parameter is
|
|
81
|
+
specified, defaults based on subscription creation date.
|
|
82
|
+
"""
|