Skip to content

Commit 568048c

Browse files
authored
chore: add domain detail (#739)
* feat: add domain detail to twilio python * feat: add domain detail to twilio python * feat: add domain detail to twilio python * feat: add domain detail to twilio python
1 parent 0107799 commit 568048c

File tree

6 files changed

+484
-0
lines changed

6 files changed

+484
-0
lines changed

twilio/rest/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from twilio.rest.notify import Notify
3535
from twilio.rest.numbers import Numbers
3636
from twilio.rest.preview import Preview
37+
from twilio.rest.preview_messaging import PreviewMessaging
3738
from twilio.rest.pricing import Pricing
3839
from twilio.rest.proxy import Proxy
3940
from twilio.rest.routes import Routes
@@ -142,6 +143,7 @@ def __init__(
142143
self._notify: Optional["Notify"] = None
143144
self._numbers: Optional["Numbers"] = None
144145
self._preview: Optional["Preview"] = None
146+
self._preview_messaging: Optional["PreviewMessaging"] = None
145147
self._pricing: Optional["Pricing"] = None
146148
self._proxy: Optional["Proxy"] = None
147149
self._routes: Optional["Routes"] = None
@@ -430,6 +432,19 @@ def preview(self) -> "Preview":
430432
self._preview = Preview(self)
431433
return self._preview
432434

435+
@property
436+
def preview_messaging(self) -> "PreviewMessaging":
437+
"""
438+
Access the Preview Messaging Twilio Domain
439+
440+
:returns: Preview Messaging Twilio Domain
441+
"""
442+
if self._preview_messaging is None:
443+
from twilio.rest.preview_messaging import PreviewMessaging
444+
445+
self._preview_messaging = PreviewMessaging(self)
446+
return self._preview_messaging
447+
433448
@property
434449
def pricing(self) -> "Pricing":
435450
"""
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
r"""
2+
This code was generated by
3+
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4+
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5+
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6+
7+
NOTE: This class is auto generated by OpenAPI Generator.
8+
https://openapi-generator.tech
9+
Do not edit the class manually.
10+
"""
11+
12+
from typing import Optional
13+
14+
from twilio.base.domain import Domain
15+
from twilio.rest import Client
16+
from twilio.rest.preview_messaging.v1 import V1
17+
18+
19+
class PreviewMessagingBase(Domain):
20+
def __init__(self, twilio: Client):
21+
"""
22+
Initialize the Preview Messaging Domain
23+
24+
:returns: Domain for Preview Messaging
25+
"""
26+
super().__init__(twilio, "https://preview.messaging.twilio.com")
27+
self._v1: Optional[V1] = None
28+
29+
@property
30+
def v1(self) -> V1:
31+
"""
32+
:returns: Versions v1 of Preview Messaging
33+
"""
34+
if self._v1 is None:
35+
self._v1 = V1(self)
36+
return self._v1
37+
38+
def __repr__(self) -> str:
39+
"""
40+
Provide a friendly representation
41+
:returns: Machine friendly representation
42+
"""
43+
return "<Twilio.PreviewMessaging>"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from twilio.rest.preview_messaging.PreviewMessagingBase import PreviewMessagingBase
2+
from twilio.rest.preview_messaging.v1.broadcast import BroadcastList
3+
from twilio.rest.preview_messaging.v1.message import MessageList
4+
5+
6+
class PreviewMessaging(PreviewMessagingBase):
7+
@property
8+
def broadcast(self) -> BroadcastList:
9+
return self.v1.broadcasts
10+
11+
@property
12+
def messages(self) -> MessageList:
13+
return self.v1.messages
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
r"""
2+
This code was generated by
3+
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4+
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5+
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6+
7+
Bulk Messaging and Broadcast
8+
Bulk Sending is a public Twilio REST API for 1:Many Message creation up to 100 recipients. Broadcast is a public Twilio REST API for 1:Many Message creation up to 10,000 recipients via file upload.
9+
10+
NOTE: This class is auto generated by OpenAPI Generator.
11+
https://openapi-generator.tech
12+
Do not edit the class manually.
13+
"""
14+
15+
from typing import Optional
16+
from twilio.base.version import Version
17+
from twilio.base.domain import Domain
18+
from twilio.rest.preview_messaging.v1.broadcast import BroadcastList
19+
from twilio.rest.preview_messaging.v1.message import MessageList
20+
21+
22+
class V1(Version):
23+
def __init__(self, domain: Domain):
24+
"""
25+
Initialize the V1 version of PreviewMessaging
26+
27+
:param domain: The Twilio.preview_messaging domain
28+
"""
29+
super().__init__(domain, "v1")
30+
self._broadcasts: Optional[BroadcastList] = None
31+
self._messages: Optional[MessageList] = None
32+
33+
@property
34+
def broadcasts(self) -> BroadcastList:
35+
if self._broadcasts is None:
36+
self._broadcasts = BroadcastList(self)
37+
return self._broadcasts
38+
39+
@property
40+
def messages(self) -> MessageList:
41+
if self._messages is None:
42+
self._messages = MessageList(self)
43+
return self._messages
44+
45+
def __repr__(self) -> str:
46+
"""
47+
Provide a friendly representation
48+
:returns: Machine friendly representation
49+
"""
50+
return "<Twilio.PreviewMessaging.V1>"
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
r"""
2+
This code was generated by
3+
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
4+
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
5+
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \
6+
7+
Bulk Messaging and Broadcast
8+
Bulk Sending is a public Twilio REST API for 1:Many Message creation up to 100 recipients. Broadcast is a public Twilio REST API for 1:Many Message creation up to 10,000 recipients via file upload.
9+
10+
NOTE: This class is auto generated by OpenAPI Generator.
11+
https://openapi-generator.tech
12+
Do not edit the class manually.
13+
"""
14+
15+
16+
from datetime import datetime
17+
from typing import Any, Dict, Optional, Union
18+
from twilio.base import deserialize, values
19+
20+
from twilio.base.instance_resource import InstanceResource
21+
from twilio.base.list_resource import ListResource
22+
from twilio.base.version import Version
23+
24+
25+
class BroadcastInstance(InstanceResource):
26+
27+
"""
28+
:ivar broadcast_sid: Numeric ID indentifying individual Broadcast requests
29+
:ivar created_date: Timestamp of when the Broadcast was created
30+
:ivar updated_date: Timestamp of when the Broadcast was last updated
31+
:ivar broadcast_status: Status of the Broadcast request. Valid values are None, Pending-Upload, Uploaded, Queued, Executing, Execution-Failure, Execution-Completed, Cancelation-Requested, and Canceled
32+
:ivar execution_details:
33+
:ivar results_file: Path to a file detailing successful requests and errors from Broadcast execution
34+
"""
35+
36+
def __init__(self, version: Version, payload: Dict[str, Any]):
37+
super().__init__(version)
38+
39+
self.broadcast_sid: Optional[str] = payload.get("broadcast_sid")
40+
self.created_date: Optional[datetime] = deserialize.iso8601_datetime(
41+
payload.get("created_date")
42+
)
43+
self.updated_date: Optional[datetime] = deserialize.iso8601_datetime(
44+
payload.get("updated_date")
45+
)
46+
self.broadcast_status: Optional[str] = payload.get("broadcast_status")
47+
self.execution_details: Optional[str] = payload.get("execution_details")
48+
self.results_file: Optional[str] = payload.get("results_file")
49+
50+
def __repr__(self) -> str:
51+
"""
52+
Provide a friendly representation
53+
54+
:returns: Machine friendly representation
55+
"""
56+
57+
return "<Twilio.PreviewMessaging.V1.BroadcastInstance>"
58+
59+
60+
class BroadcastList(ListResource):
61+
def __init__(self, version: Version):
62+
"""
63+
Initialize the BroadcastList
64+
65+
:param version: Version that contains the resource
66+
67+
"""
68+
super().__init__(version)
69+
70+
self._uri = "/Broadcasts"
71+
72+
def create(
73+
self, x_twilio_request_key: Union[str, object] = values.unset
74+
) -> BroadcastInstance:
75+
"""
76+
Create the BroadcastInstance
77+
78+
:param x_twilio_request_key: Idempotency key provided by the client
79+
80+
:returns: The created BroadcastInstance
81+
"""
82+
83+
data = values.of({})
84+
headers = values.of(
85+
{
86+
"X-Twilio-Request-Key": x_twilio_request_key,
87+
}
88+
)
89+
90+
payload = self._version.create(
91+
method="POST", uri=self._uri, data=data, headers=headers
92+
)
93+
94+
return BroadcastInstance(self._version, payload)
95+
96+
async def create_async(
97+
self, x_twilio_request_key: Union[str, object] = values.unset
98+
) -> BroadcastInstance:
99+
"""
100+
Asynchronously create the BroadcastInstance
101+
102+
:param x_twilio_request_key: Idempotency key provided by the client
103+
104+
:returns: The created BroadcastInstance
105+
"""
106+
107+
data = values.of({})
108+
headers = values.of(
109+
{
110+
"X-Twilio-Request-Key": x_twilio_request_key,
111+
}
112+
)
113+
114+
payload = await self._version.create_async(
115+
method="POST", uri=self._uri, data=data, headers=headers
116+
)
117+
118+
return BroadcastInstance(self._version, payload)
119+
120+
def __repr__(self) -> str:
121+
"""
122+
Provide a friendly representation
123+
124+
:returns: Machine friendly representation
125+
"""
126+
return "<Twilio.PreviewMessaging.V1.BroadcastList>"

0 commit comments

Comments
 (0)