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,23 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
|
|
5
|
+
from .._models import BaseModel
|
|
6
|
+
|
|
7
|
+
__all__ = ["ContactCardRetrieveResponse", "ContactCard"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ContactCard(BaseModel):
|
|
11
|
+
first_name: str
|
|
12
|
+
|
|
13
|
+
is_active: bool
|
|
14
|
+
|
|
15
|
+
phone_number: str
|
|
16
|
+
|
|
17
|
+
image_url: Optional[str] = None
|
|
18
|
+
|
|
19
|
+
last_name: Optional[str] = None
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class ContactCardRetrieveResponse(BaseModel):
|
|
23
|
+
contact_cards: List[ContactCard]
|
|
@@ -0,0 +1,21 @@
|
|
|
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__ = ["ContactCardUpdateParams"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ContactCardUpdateParams(TypedDict, total=False):
|
|
11
|
+
phone_number: Required[str]
|
|
12
|
+
"""E.164 phone number of the contact card to update"""
|
|
13
|
+
|
|
14
|
+
first_name: str
|
|
15
|
+
"""Updated first name. If omitted, the existing value is kept."""
|
|
16
|
+
|
|
17
|
+
image_url: str
|
|
18
|
+
"""Updated profile image URL. If omitted, the existing image is kept."""
|
|
19
|
+
|
|
20
|
+
last_name: str
|
|
21
|
+
"""Updated last name. If omitted, the existing value is kept."""
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Union
|
|
4
|
+
from typing_extensions import Annotated, TypeAlias
|
|
5
|
+
|
|
6
|
+
from .._utils import PropertyInfo
|
|
7
|
+
from .chat_created_webhook_event import ChatCreatedWebhookEvent
|
|
8
|
+
from .message_read_webhook_event import MessageReadWebhookEvent
|
|
9
|
+
from .message_sent_webhook_event import MessageSentWebhookEvent
|
|
10
|
+
from .message_edited_webhook_event import MessageEditedWebhookEvent
|
|
11
|
+
from .message_failed_webhook_event import MessageFailedWebhookEvent
|
|
12
|
+
from .reaction_added_webhook_event import ReactionAddedWebhookEvent
|
|
13
|
+
from .message_received_webhook_event import MessageReceivedWebhookEvent
|
|
14
|
+
from .reaction_removed_webhook_event import ReactionRemovedWebhookEvent
|
|
15
|
+
from .message_delivered_webhook_event import MessageDeliveredWebhookEvent
|
|
16
|
+
from .participant_added_webhook_event import ParticipantAddedWebhookEvent
|
|
17
|
+
from .participant_removed_webhook_event import ParticipantRemovedWebhookEvent
|
|
18
|
+
from .chat_group_icon_updated_webhook_event import ChatGroupIconUpdatedWebhookEvent
|
|
19
|
+
from .chat_group_name_updated_webhook_event import ChatGroupNameUpdatedWebhookEvent
|
|
20
|
+
from .phone_number_status_updated_webhook_event import PhoneNumberStatusUpdatedWebhookEvent
|
|
21
|
+
from .chat_group_icon_update_failed_webhook_event import ChatGroupIconUpdateFailedWebhookEvent
|
|
22
|
+
from .chat_group_name_update_failed_webhook_event import ChatGroupNameUpdateFailedWebhookEvent
|
|
23
|
+
from .chat_typing_indicator_started_webhook_event import ChatTypingIndicatorStartedWebhookEvent
|
|
24
|
+
from .chat_typing_indicator_stopped_webhook_event import ChatTypingIndicatorStoppedWebhookEvent
|
|
25
|
+
|
|
26
|
+
__all__ = ["EventsWebhookEvent"]
|
|
27
|
+
|
|
28
|
+
EventsWebhookEvent: TypeAlias = Annotated[
|
|
29
|
+
Union[
|
|
30
|
+
MessageSentWebhookEvent,
|
|
31
|
+
MessageReceivedWebhookEvent,
|
|
32
|
+
MessageReadWebhookEvent,
|
|
33
|
+
MessageDeliveredWebhookEvent,
|
|
34
|
+
MessageFailedWebhookEvent,
|
|
35
|
+
MessageEditedWebhookEvent,
|
|
36
|
+
ReactionAddedWebhookEvent,
|
|
37
|
+
ReactionRemovedWebhookEvent,
|
|
38
|
+
ParticipantAddedWebhookEvent,
|
|
39
|
+
ParticipantRemovedWebhookEvent,
|
|
40
|
+
ChatCreatedWebhookEvent,
|
|
41
|
+
ChatGroupNameUpdatedWebhookEvent,
|
|
42
|
+
ChatGroupIconUpdatedWebhookEvent,
|
|
43
|
+
ChatGroupNameUpdateFailedWebhookEvent,
|
|
44
|
+
ChatGroupIconUpdateFailedWebhookEvent,
|
|
45
|
+
ChatTypingIndicatorStartedWebhookEvent,
|
|
46
|
+
ChatTypingIndicatorStoppedWebhookEvent,
|
|
47
|
+
PhoneNumberStatusUpdatedWebhookEvent,
|
|
48
|
+
],
|
|
49
|
+
PropertyInfo(discriminator="event_type"),
|
|
50
|
+
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from .._models import BaseModel
|
|
4
|
+
|
|
5
|
+
__all__ = ["HandleCheckResponse"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class HandleCheckResponse(BaseModel):
|
|
9
|
+
address: str
|
|
10
|
+
"""The recipient address that was checked"""
|
|
11
|
+
|
|
12
|
+
available: bool
|
|
13
|
+
"""Whether the recipient supports the checked messaging service"""
|
|
@@ -0,0 +1,22 @@
|
|
|
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, Required, TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["LinkPartParam"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class LinkPartParam(TypedDict, total=False):
|
|
11
|
+
type: Required[Literal["link"]]
|
|
12
|
+
"""Indicates this is a rich link preview part"""
|
|
13
|
+
|
|
14
|
+
value: Required[str]
|
|
15
|
+
"""URL to send with a rich link preview.
|
|
16
|
+
|
|
17
|
+
The recipient will see an inline card with the page's title, description, and
|
|
18
|
+
preview image (when available).
|
|
19
|
+
|
|
20
|
+
A `link` part must be the **only** part in the message. To send a URL as plain
|
|
21
|
+
text (no preview card), use a `text` part instead.
|
|
22
|
+
"""
|
|
@@ -0,0 +1,54 @@
|
|
|
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, Required, TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["MediaPartParam"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class MediaPartParam(TypedDict, total=False):
|
|
11
|
+
type: Required[Literal["media"]]
|
|
12
|
+
"""Indicates this is a media attachment part"""
|
|
13
|
+
|
|
14
|
+
attachment_id: str
|
|
15
|
+
"""
|
|
16
|
+
Reference to a file pre-uploaded via `POST /v3/attachments` (optional). The file
|
|
17
|
+
is already stored, so sends using this ID skip the download step — useful when
|
|
18
|
+
sending the same file to many recipients.
|
|
19
|
+
|
|
20
|
+
Either `url` or `attachment_id` must be provided, but not both.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
url: str
|
|
24
|
+
"""Any publicly accessible HTTPS URL to the media file.
|
|
25
|
+
|
|
26
|
+
The server downloads and sends the file automatically — no pre-upload step
|
|
27
|
+
required.
|
|
28
|
+
|
|
29
|
+
**Size limit:** 10MB maximum for URL-based downloads. For larger files (up to
|
|
30
|
+
100MB), use the pre-upload flow: `POST /v3/attachments` to get a presigned URL,
|
|
31
|
+
upload directly, then reference by `attachment_id`.
|
|
32
|
+
|
|
33
|
+
**Requirements:**
|
|
34
|
+
|
|
35
|
+
- URL must use HTTPS
|
|
36
|
+
- File content must be a supported format (the server validates the actual file
|
|
37
|
+
content)
|
|
38
|
+
|
|
39
|
+
**Supported formats:**
|
|
40
|
+
|
|
41
|
+
- Images: .jpg, .jpeg, .png, .gif, .heic, .heif, .tif, .tiff, .bmp
|
|
42
|
+
- Videos: .mp4, .mov, .m4v, .mpeg, .mpg, .3gp
|
|
43
|
+
- Audio: .m4a, .mp3, .aac, .caf, .wav, .aiff, .amr
|
|
44
|
+
- Documents: .pdf, .txt, .rtf, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx,
|
|
45
|
+
.pages, .numbers, .key, .epub, .zip, .html, .htm
|
|
46
|
+
- Contact & Calendar: .vcf, .ics
|
|
47
|
+
|
|
48
|
+
**Tip:** Audio sent here appears as a regular file attachment. To send audio as
|
|
49
|
+
an iMessage voice memo bubble (with inline playback), use
|
|
50
|
+
`/v3/chats/{chatId}/voicememo`. For repeated sends of the same file, use
|
|
51
|
+
`attachment_id` to avoid redundant downloads.
|
|
52
|
+
|
|
53
|
+
Either `url` or `attachment_id` must be provided, but not both.
|
|
54
|
+
"""
|
linq/types/message.py
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
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, TypeAlias
|
|
6
|
+
|
|
7
|
+
from pydantic import Field as FieldInfo
|
|
8
|
+
|
|
9
|
+
from .._models import BaseModel
|
|
10
|
+
from .reply_to import ReplyTo
|
|
11
|
+
from .message_effect import MessageEffect
|
|
12
|
+
from .shared.reaction import Reaction
|
|
13
|
+
from .shared.chat_handle import ChatHandle
|
|
14
|
+
from .shared.service_type import ServiceType
|
|
15
|
+
from .shared.text_part_response import TextPartResponse
|
|
16
|
+
from .shared.media_part_response import MediaPartResponse
|
|
17
|
+
|
|
18
|
+
__all__ = ["Message", "Part", "PartLinkPartResponse"]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class PartLinkPartResponse(BaseModel):
|
|
22
|
+
"""A rich link preview part"""
|
|
23
|
+
|
|
24
|
+
reactions: Optional[List[Reaction]] = None
|
|
25
|
+
"""Reactions on this message part"""
|
|
26
|
+
|
|
27
|
+
type: Literal["link"]
|
|
28
|
+
"""Indicates this is a rich link preview part"""
|
|
29
|
+
|
|
30
|
+
value: str
|
|
31
|
+
"""The URL"""
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
Part: TypeAlias = Union[TextPartResponse, MediaPartResponse, PartLinkPartResponse]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class Message(BaseModel):
|
|
38
|
+
id: str
|
|
39
|
+
"""Unique identifier for the message"""
|
|
40
|
+
|
|
41
|
+
chat_id: str
|
|
42
|
+
"""ID of the chat this message belongs to"""
|
|
43
|
+
|
|
44
|
+
created_at: datetime
|
|
45
|
+
"""When the message was created"""
|
|
46
|
+
|
|
47
|
+
is_delivered: bool
|
|
48
|
+
"""Whether the message has been delivered"""
|
|
49
|
+
|
|
50
|
+
is_from_me: bool
|
|
51
|
+
"""Whether this message was sent by the authenticated user"""
|
|
52
|
+
|
|
53
|
+
is_read: bool
|
|
54
|
+
"""Whether the message has been read"""
|
|
55
|
+
|
|
56
|
+
updated_at: datetime
|
|
57
|
+
"""When the message was last updated"""
|
|
58
|
+
|
|
59
|
+
delivered_at: Optional[datetime] = None
|
|
60
|
+
"""When the message was delivered"""
|
|
61
|
+
|
|
62
|
+
effect: Optional[MessageEffect] = None
|
|
63
|
+
"""iMessage effect applied to a message (screen or bubble effect)"""
|
|
64
|
+
|
|
65
|
+
from_: Optional[str] = FieldInfo(alias="from", default=None)
|
|
66
|
+
"""DEPRECATED: Use from_handle instead. Phone number of the message sender."""
|
|
67
|
+
|
|
68
|
+
from_handle: Optional[ChatHandle] = None
|
|
69
|
+
"""The sender of this message as a full handle object"""
|
|
70
|
+
|
|
71
|
+
parts: Optional[List[Part]] = None
|
|
72
|
+
"""Message parts in order (text, media, and link)"""
|
|
73
|
+
|
|
74
|
+
preferred_service: Optional[ServiceType] = None
|
|
75
|
+
"""Messaging service type"""
|
|
76
|
+
|
|
77
|
+
read_at: Optional[datetime] = None
|
|
78
|
+
"""When the message was read"""
|
|
79
|
+
|
|
80
|
+
reply_to: Optional[ReplyTo] = None
|
|
81
|
+
"""Indicates this message is a threaded reply to another message"""
|
|
82
|
+
|
|
83
|
+
sent_at: Optional[datetime] = None
|
|
84
|
+
"""When the message was sent"""
|
|
85
|
+
|
|
86
|
+
service: Optional[ServiceType] = None
|
|
87
|
+
"""Messaging service type"""
|
|
@@ -0,0 +1,32 @@
|
|
|
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, Required, TypedDict
|
|
6
|
+
|
|
7
|
+
from .shared.reaction_type import ReactionType
|
|
8
|
+
|
|
9
|
+
__all__ = ["MessageAddReactionParams"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class MessageAddReactionParams(TypedDict, total=False):
|
|
13
|
+
operation: Required[Literal["add", "remove"]]
|
|
14
|
+
"""Whether to add or remove the reaction"""
|
|
15
|
+
|
|
16
|
+
type: Required[ReactionType]
|
|
17
|
+
"""Type of reaction.
|
|
18
|
+
|
|
19
|
+
Standard iMessage tapbacks are love, like, dislike, laugh, emphasize, question.
|
|
20
|
+
Custom emoji reactions have type "custom" with the actual emoji in the
|
|
21
|
+
custom_emoji field. Sticker reactions have type "sticker" with sticker
|
|
22
|
+
attachment details in the sticker field.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
custom_emoji: str
|
|
26
|
+
"""Custom emoji string. Required when type is "custom"."""
|
|
27
|
+
|
|
28
|
+
part_index: int
|
|
29
|
+
"""
|
|
30
|
+
Optional index of the message part to react to. If not provided, reacts to the
|
|
31
|
+
entire message (part 0).
|
|
32
|
+
"""
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from .._models import BaseModel
|
|
6
|
+
|
|
7
|
+
__all__ = ["MessageAddReactionResponse"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class MessageAddReactionResponse(BaseModel):
|
|
11
|
+
message: Optional[str] = None
|
|
12
|
+
|
|
13
|
+
status: Optional[str] = None
|
|
14
|
+
|
|
15
|
+
trace_id: Optional[str] = None
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Union, Iterable
|
|
6
|
+
from typing_extensions import Required, TypeAlias, TypedDict
|
|
7
|
+
|
|
8
|
+
from .reply_to_param import ReplyToParam
|
|
9
|
+
from .link_part_param import LinkPartParam
|
|
10
|
+
from .text_part_param import TextPartParam
|
|
11
|
+
from .media_part_param import MediaPartParam
|
|
12
|
+
from .shared.service_type import ServiceType
|
|
13
|
+
from .message_effect_param import MessageEffectParam
|
|
14
|
+
|
|
15
|
+
__all__ = ["MessageContentParam", "Part"]
|
|
16
|
+
|
|
17
|
+
Part: TypeAlias = Union[TextPartParam, MediaPartParam, LinkPartParam]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class MessageContentParam(TypedDict, total=False):
|
|
21
|
+
"""Message content container.
|
|
22
|
+
|
|
23
|
+
Groups all message-related fields together,
|
|
24
|
+
separating the "what" (message content) from the "where" (routing fields like from/to).
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
parts: Required[Iterable[Part]]
|
|
28
|
+
"""Array of message parts.
|
|
29
|
+
|
|
30
|
+
Each part can be text, media, or link. Parts are displayed in order. Text and
|
|
31
|
+
media can be mixed freely, but a `link` part must be the only part in the
|
|
32
|
+
message.
|
|
33
|
+
|
|
34
|
+
**Rich Link Previews:**
|
|
35
|
+
|
|
36
|
+
- Use a `link` part to send a URL with a rich preview card
|
|
37
|
+
- A `link` part must be the **only** part in the message
|
|
38
|
+
- To send a URL as plain text (no preview), use a `text` part instead
|
|
39
|
+
|
|
40
|
+
**Supported Media:**
|
|
41
|
+
|
|
42
|
+
- Images: .jpg, .jpeg, .png, .gif, .heic, .heif, .tif, .tiff, .bmp
|
|
43
|
+
- Videos: .mp4, .mov, .m4v, .mpeg, .mpg, .3gp
|
|
44
|
+
- Audio: .m4a, .mp3, .aac, .caf, .wav, .aiff, .amr
|
|
45
|
+
- Documents: .pdf, .txt, .rtf, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx,
|
|
46
|
+
.pages, .numbers, .key, .epub, .zip, .html, .htm
|
|
47
|
+
- Contact & Calendar: .vcf, .ics
|
|
48
|
+
|
|
49
|
+
**Audio:**
|
|
50
|
+
|
|
51
|
+
- Audio files (.m4a, .mp3, .aac, .caf, .wav, .aiff, .amr) are fully supported as
|
|
52
|
+
media parts
|
|
53
|
+
- To send audio as an **iMessage voice memo bubble** (inline playback UI), use
|
|
54
|
+
the dedicated `/v3/chats/{chatId}/voicememo` endpoint instead
|
|
55
|
+
|
|
56
|
+
**Validation Rules:**
|
|
57
|
+
|
|
58
|
+
- A `link` part must be the **only** part in the message. It cannot be combined
|
|
59
|
+
with text or media parts.
|
|
60
|
+
- Consecutive text parts are not allowed. Text parts must be separated by media
|
|
61
|
+
parts. For example, [text, text] is invalid, but [text, media, text] is valid.
|
|
62
|
+
- Maximum of **100 parts** total.
|
|
63
|
+
- Media parts using a public `url` (downloaded by the server on send) are capped
|
|
64
|
+
at **40**. Parts using `attachment_id` or presigned URLs are exempt from this
|
|
65
|
+
sub-limit. For bulk media sends exceeding 40 files, pre-upload via
|
|
66
|
+
`POST /v3/attachments` and reference by `attachment_id` or `download_url`.
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
effect: MessageEffectParam
|
|
70
|
+
"""iMessage effect to apply to this message (screen or bubble effect)"""
|
|
71
|
+
|
|
72
|
+
idempotency_key: str
|
|
73
|
+
"""
|
|
74
|
+
Optional idempotency key for this message. Use this to prevent duplicate sends
|
|
75
|
+
of the same message.
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
preferred_service: ServiceType
|
|
79
|
+
"""Messaging service type"""
|
|
80
|
+
|
|
81
|
+
reply_to: ReplyToParam
|
|
82
|
+
"""Reply to another message to create a threaded conversation"""
|
|
@@ -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__ = ["MessageDeliveredWebhookEvent"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class MessageDeliveredWebhookEvent(BaseModel):
|
|
13
|
+
"""Complete webhook payload for message.delivered 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,100 @@
|
|
|
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
|
+
from .shared.chat_handle import ChatHandle
|
|
8
|
+
from .webhook_event_type import WebhookEventType
|
|
9
|
+
|
|
10
|
+
__all__ = ["MessageEditedWebhookEvent", "Data", "DataChat", "DataPart"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class DataChat(BaseModel):
|
|
14
|
+
"""Chat context"""
|
|
15
|
+
|
|
16
|
+
id: str
|
|
17
|
+
"""Chat identifier"""
|
|
18
|
+
|
|
19
|
+
is_group: bool
|
|
20
|
+
"""Whether this is a group chat"""
|
|
21
|
+
|
|
22
|
+
owner_handle: ChatHandle
|
|
23
|
+
"""The handle that owns this chat (your phone number)"""
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class DataPart(BaseModel):
|
|
27
|
+
"""The edited part"""
|
|
28
|
+
|
|
29
|
+
index: int
|
|
30
|
+
"""Zero-based index of the edited part within the message"""
|
|
31
|
+
|
|
32
|
+
text: str
|
|
33
|
+
"""New text content of the part"""
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class Data(BaseModel):
|
|
37
|
+
"""Payload for `message.edited` events (2026-02-03 format).
|
|
38
|
+
|
|
39
|
+
Describes which part of a message was edited and when. Only text parts can be edited.
|
|
40
|
+
Only available for subscriptions using `webhook_version: "2026-02-03"`.
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
id: str
|
|
44
|
+
"""Message identifier"""
|
|
45
|
+
|
|
46
|
+
chat: DataChat
|
|
47
|
+
"""Chat context"""
|
|
48
|
+
|
|
49
|
+
direction: Literal["outbound", "inbound"]
|
|
50
|
+
"""\"outbound" if you sent the original message, "inbound" if you received it"""
|
|
51
|
+
|
|
52
|
+
edited_at: datetime
|
|
53
|
+
"""When the edit occurred"""
|
|
54
|
+
|
|
55
|
+
part: DataPart
|
|
56
|
+
"""The edited part"""
|
|
57
|
+
|
|
58
|
+
sender_handle: ChatHandle
|
|
59
|
+
"""The handle that sent (and edited) this message"""
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class MessageEditedWebhookEvent(BaseModel):
|
|
63
|
+
"""Complete webhook payload for message.edited events (2026-02-03 format only)"""
|
|
64
|
+
|
|
65
|
+
api_version: str
|
|
66
|
+
"""API version for the webhook payload format"""
|
|
67
|
+
|
|
68
|
+
created_at: datetime
|
|
69
|
+
"""When the event was created"""
|
|
70
|
+
|
|
71
|
+
data: Data
|
|
72
|
+
"""Payload for `message.edited` events (2026-02-03 format).
|
|
73
|
+
|
|
74
|
+
Describes which part of a message was edited and when. Only text parts can be
|
|
75
|
+
edited. Only available for subscriptions using `webhook_version: "2026-02-03"`.
|
|
76
|
+
"""
|
|
77
|
+
|
|
78
|
+
event_id: str
|
|
79
|
+
"""Unique identifier for this event (for deduplication)"""
|
|
80
|
+
|
|
81
|
+
event_type: WebhookEventType
|
|
82
|
+
"""Valid webhook event types that can be subscribed to.
|
|
83
|
+
|
|
84
|
+
**Note:** `message.edited` is only delivered to subscriptions using
|
|
85
|
+
`webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
|
|
86
|
+
subscription will not produce any deliveries.
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
partner_id: str
|
|
90
|
+
"""Partner identifier. Present on all webhooks for cross-referencing."""
|
|
91
|
+
|
|
92
|
+
trace_id: str
|
|
93
|
+
"""Trace ID for debugging and correlation across systems."""
|
|
94
|
+
|
|
95
|
+
webhook_version: str
|
|
96
|
+
"""
|
|
97
|
+
Date-based webhook payload version. Determined by the `?version=` query
|
|
98
|
+
parameter in your webhook subscription URL. If no version parameter is
|
|
99
|
+
specified, defaults based on subscription creation date.
|
|
100
|
+
"""
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
from typing_extensions import Literal
|
|
5
|
+
|
|
6
|
+
from .._models import BaseModel
|
|
7
|
+
|
|
8
|
+
__all__ = ["MessageEffect"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class MessageEffect(BaseModel):
|
|
12
|
+
"""iMessage effect applied to a message (screen or bubble effect)"""
|
|
13
|
+
|
|
14
|
+
name: Optional[str] = None
|
|
15
|
+
"""Name of the effect. Common values:
|
|
16
|
+
|
|
17
|
+
- Screen effects: confetti, fireworks, lasers, sparkles, celebration, hearts,
|
|
18
|
+
love, balloons, happy_birthday, echo, spotlight
|
|
19
|
+
- Bubble effects: slam, loud, gentle, invisible
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
type: Optional[Literal["screen", "bubble"]] = None
|
|
23
|
+
"""Type of effect"""
|
|
@@ -0,0 +1,22 @@
|
|
|
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__ = ["MessageEffectParam"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class MessageEffectParam(TypedDict, total=False):
|
|
11
|
+
"""iMessage effect applied to a message (screen or bubble effect)"""
|
|
12
|
+
|
|
13
|
+
name: str
|
|
14
|
+
"""Name of the effect. Common values:
|
|
15
|
+
|
|
16
|
+
- Screen effects: confetti, fireworks, lasers, sparkles, celebration, hearts,
|
|
17
|
+
love, balloons, happy_birthday, echo, spotlight
|
|
18
|
+
- Bubble effects: slam, loud, gentle, invisible
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
type: Literal["screen", "bubble"]
|
|
22
|
+
"""Type of effect"""
|