Skip to content

Commit 6198111

Browse files
author
stlc-bot
committed
feat(api): sync OpenAPI spec from production
Stainless-Generated-From: 0f4a4a9e6f3b2de888965047e1d96c6042ff2add
1 parent d6f5e66 commit 6198111

8 files changed

Lines changed: 299 additions & 3 deletions

src/sent_dm/types/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
from .template import Template as Template
99
from .error_detail import ErrorDetail as ErrorDetail
1010
from .tcr_vertical import TcrVertical as TcrVertical
11+
from .message_event import MessageEvent as MessageEvent
1112
from .user_response import UserResponse as UserResponse
1213
from .profile_detail import ProfileDetail as ProfileDetail
14+
from .template_event import TemplateEvent as TemplateEvent
1315
from .pagination_meta import PaginationMeta as PaginationMeta
1416
from .contact_response import ContactResponse as ContactResponse
1517
from .profile_settings import ProfileSettings as ProfileSettings
@@ -33,6 +35,8 @@
3335
from .contact_delete_params import ContactDeleteParams as ContactDeleteParams
3436
from .contact_list_response import ContactListResponse as ContactListResponse
3537
from .contact_update_params import ContactUpdateParams as ContactUpdateParams
38+
from .inbound_message_event import InboundMessageEvent as InboundMessageEvent
39+
from .message_event_payload import MessageEventPayload as MessageEventPayload
3640
from .message_send_response import MessageSendResponse as MessageSendResponse
3741
from .payment_details_param import PaymentDetailsParam as PaymentDetailsParam
3842
from .profile_create_params import ProfileCreateParams as ProfileCreateParams
@@ -50,6 +54,7 @@
5054
from .tcr_brand_relationship import TcrBrandRelationship as TcrBrandRelationship
5155
from .template_create_params import TemplateCreateParams as TemplateCreateParams
5256
from .template_delete_params import TemplateDeleteParams as TemplateDeleteParams
57+
from .template_event_payload import TemplateEventPayload as TemplateEventPayload
5358
from .template_list_response import TemplateListResponse as TemplateListResponse
5459
from .template_update_params import TemplateUpdateParams as TemplateUpdateParams
5560
from .api_response_of_contact import APIResponseOfContact as APIResponseOfContact
@@ -74,6 +79,7 @@
7479
from .webhook_list_events_response import WebhookListEventsResponse as WebhookListEventsResponse
7580
from .webhook_rotate_secret_params import WebhookRotateSecretParams as WebhookRotateSecretParams
7681
from .webhook_toggle_status_params import WebhookToggleStatusParams as WebhookToggleStatusParams
82+
from .inbound_message_event_payload import InboundMessageEventPayload as InboundMessageEventPayload
7783
from .api_response_of_profile_detail import APIResponseOfProfileDetail as APIResponseOfProfileDetail
7884
from .webhook_rotate_secret_response import WebhookRotateSecretResponse as WebhookRotateSecretResponse
7985
from .message_retrieve_status_response import MessageRetrieveStatusResponse as MessageRetrieveStatusResponse
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
from .inbound_message_event_payload import InboundMessageEventPayload
7+
8+
__all__ = ["InboundMessageEvent"]
9+
10+
11+
class InboundMessageEvent(BaseModel):
12+
"""The envelope Sent POSTs to a subscribed webhook endpoint.
13+
14+
Every event shares this shape and
15+
varies only in Payload.
16+
"""
17+
18+
event: Optional[str] = None
19+
"""
20+
The specific event within the family, for example message.delivered or
21+
message.received. Absent on events that have no subtype, so treat it as
22+
optional.
23+
"""
24+
25+
field: Optional[str] = None
26+
"""The event family, for example message or templates.
27+
28+
Route on this first, then on event for the specific change.
29+
"""
30+
31+
payload: Optional[InboundMessageEventPayload] = None
32+
"""Body of a message.received event.
33+
34+
Delivered when a contact messages one of your numbers.
35+
"""
36+
37+
timestamp: Optional[str] = None
38+
"""When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ).
39+
40+
This is the emission time, not the time the underlying change happened. Use the
41+
timestamp inside the payload for the latter.
42+
"""
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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__ = ["InboundMessageEventPayload"]
8+
9+
10+
class InboundMessageEventPayload(BaseModel):
11+
"""Body of a message.received event.
12+
13+
Delivered when a contact messages one of your numbers.
14+
"""
15+
16+
account_id: Optional[str] = None
17+
"""The account the message belongs to."""
18+
19+
channel: Optional[str] = None
20+
"""The channel the message arrived on, for example sms or whatsapp."""
21+
22+
inbound_number: Optional[str] = None
23+
"""The contact's number in E.164 format, meaning the number the message came from."""
24+
25+
message_id: Optional[str] = None
26+
"""The inbound message."""
27+
28+
outbound_number: Optional[str] = None
29+
"""Your number in E.164 format, meaning the number the message was addressed to."""
30+
31+
received_at: Optional[str] = None
32+
"""When the message was received, in UTC (yyyy-MM-ddTHH:mm:ssZ)."""
33+
34+
text: Optional[str] = None
35+
"""The message body.
36+
37+
Sent as null when the inbound message carried no text, for example a media-only
38+
message. The field is always present, so read it and check for null rather than
39+
checking whether the key exists.
40+
"""
41+
42+
updated_at: Optional[str] = None
43+
"""When the message was received, in UTC (yyyy-MM-ddTHH:mm:ssZ).
44+
45+
Same value as ReceivedAt, kept for envelope consistency with outbound events.
46+
"""

src/sent_dm/types/message_event.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
from .message_event_payload import MessageEventPayload
7+
8+
__all__ = ["MessageEvent"]
9+
10+
11+
class MessageEvent(BaseModel):
12+
"""The envelope Sent POSTs to a subscribed webhook endpoint.
13+
14+
Every event shares this shape and
15+
varies only in Payload.
16+
"""
17+
18+
event: Optional[str] = None
19+
"""
20+
The specific event within the family, for example message.delivered or
21+
message.received. Absent on events that have no subtype, so treat it as
22+
optional.
23+
"""
24+
25+
field: Optional[str] = None
26+
"""The event family, for example message or templates.
27+
28+
Route on this first, then on event for the specific change.
29+
"""
30+
31+
payload: Optional[MessageEventPayload] = None
32+
"""Body of an outbound message lifecycle event.
33+
34+
Delivered once per status change, so a single message produces several of these
35+
as it moves toward a terminal status.
36+
"""
37+
38+
timestamp: Optional[str] = None
39+
"""When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ).
40+
41+
This is the emission time, not the time the underlying change happened. Use the
42+
timestamp inside the payload for the latter.
43+
"""
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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__ = ["MessageEventPayload"]
8+
9+
10+
class MessageEventPayload(BaseModel):
11+
"""Body of an outbound message lifecycle event.
12+
13+
Delivered once per status change, so a single
14+
message produces several of these as it moves toward a terminal status.
15+
"""
16+
17+
account_id: Optional[str] = None
18+
"""The account the message belongs to."""
19+
20+
agent_id: Optional[str] = None
21+
"""The agent attributed to the send, when the send was attributed to one."""
22+
23+
channel: Optional[str] = None
24+
"""The channel the message went out on, for example sms or whatsapp.
25+
26+
A message that falls back to another channel reports the channel actually used.
27+
"""
28+
29+
message_id: Optional[str] = None
30+
"""The message this event describes.
31+
32+
Stable across every event in the message's lifecycle, so use it to correlate
33+
them.
34+
"""
35+
36+
message_status: Optional[str] = None
37+
"""The status the message just reached, for example SENT, DELIVERED, or FAILED.
38+
39+
Sent means dispatched and delivered means confirmed, so treat them as distinct
40+
outcomes.
41+
"""
42+
43+
outbound_number: Optional[str] = None
44+
"""The recipient's number in E.164 format."""
45+
46+
template_id: Optional[str] = None
47+
"""The template the message was sent from, when it was sent from one."""
48+
49+
template_name: Optional[str] = None
50+
"""Name of the template the message was sent from.
51+
52+
Omitted when the message wasn't template-based.
53+
"""
54+
55+
updated_at: Optional[str] = None
56+
"""When the message reached MessageStatus, in UTC (yyyy-MM-ddTHH:mm:ssZ)."""
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
from .template_event_payload import TemplateEventPayload
7+
8+
__all__ = ["TemplateEvent"]
9+
10+
11+
class TemplateEvent(BaseModel):
12+
"""The envelope Sent POSTs to a subscribed webhook endpoint.
13+
14+
Every event shares this shape and
15+
varies only in Payload.
16+
"""
17+
18+
event: Optional[str] = None
19+
"""
20+
The specific event within the family, for example message.delivered or
21+
message.received. Absent on events that have no subtype, so treat it as
22+
optional.
23+
"""
24+
25+
field: Optional[str] = None
26+
"""The event family, for example message or templates.
27+
28+
Route on this first, then on event for the specific change.
29+
"""
30+
31+
payload: Optional[TemplateEventPayload] = None
32+
"""Body of a template status event.
33+
34+
Delivered when a template's review outcome changes, so you can react without
35+
polling.
36+
"""
37+
38+
timestamp: Optional[str] = None
39+
"""When Sent emitted the event, in UTC (yyyy-MM-ddTHH:mm:ssZ).
40+
41+
This is the emission time, not the time the underlying change happened. Use the
42+
timestamp inside the payload for the latter.
43+
"""
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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__ = ["TemplateEventPayload"]
8+
9+
10+
class TemplateEventPayload(BaseModel):
11+
"""Body of a template status event.
12+
13+
Delivered when a template's review outcome changes, so you can
14+
react without polling.
15+
"""
16+
17+
account_id: Optional[str] = None
18+
"""The account the template belongs to."""
19+
20+
category: Optional[str] = None
21+
"""The template's category, for example UTILITY, MARKETING, or AUTHENTICATION."""
22+
23+
channel: Optional[str] = None
24+
"""The channel the template applies to."""
25+
26+
language: Optional[str] = None
27+
"""The template's language code, for example en_US."""
28+
29+
reason: Optional[str] = None
30+
"""Why the template reached Status, when a reason was given.
31+
32+
Populated on a rejection.
33+
"""
34+
35+
status: Optional[str] = None
36+
"""The review status the template just reached, for example APPROVED or REJECTED."""
37+
38+
template_id: Optional[str] = None
39+
"""The template in Sent."""
40+
41+
template_name: Optional[str] = None
42+
"""The template's display name."""
43+
44+
whatsapp_template_id: Optional[str] = None
45+
"""
46+
The template's identifier with Meta, assigned when the template is submitted for
47+
review.
48+
"""

src/sent_dm/types/webhook_list_events_response.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import List, Optional
3+
from typing import List, Union, Optional
44
from datetime import datetime
5+
from typing_extensions import TypeAlias
56

67
from .._models import BaseModel
78
from .api_meta import APIMeta
89
from .error_detail import ErrorDetail
10+
from .message_event import MessageEvent
11+
from .template_event import TemplateEvent
912
from .pagination_meta import PaginationMeta
13+
from .inbound_message_event import InboundMessageEvent
1014

11-
__all__ = ["WebhookListEventsResponse", "Data", "DataEvent"]
15+
__all__ = ["WebhookListEventsResponse", "Data", "DataEvent", "DataEventEventData"]
16+
17+
DataEventEventData: TypeAlias = Union[MessageEvent, InboundMessageEvent, TemplateEvent]
1218

1319

1420
class DataEvent(BaseModel):
@@ -22,7 +28,13 @@ class DataEvent(BaseModel):
2228

2329
error_message: Optional[str] = None
2430

25-
event_data: Optional[object] = None
31+
event_data: Optional[DataEventEventData] = None
32+
"""The exact event body that was delivered, or attempted, for this record.
33+
34+
One of the three webhook envelopes: a message status change, an inbound message,
35+
or a template status change. Read field and event to tell which, the same way
36+
your endpoint does.
37+
"""
2638

2739
event_type: Optional[str] = None
2840

0 commit comments

Comments
 (0)