Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add domain detail #739

Merged
merged 4 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions twilio/rest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
from twilio.rest.notify import Notify
from twilio.rest.numbers import Numbers
from twilio.rest.preview import Preview
from twilio.rest.preview_messaging import PreviewMessaging
from twilio.rest.pricing import Pricing
from twilio.rest.proxy import Proxy
from twilio.rest.routes import Routes
Expand Down Expand Up @@ -142,6 +143,7 @@ def __init__(
self._notify: Optional["Notify"] = None
self._numbers: Optional["Numbers"] = None
self._preview: Optional["Preview"] = None
self._preview_messaging: Optional["PreviewMessaging"] = None
self._pricing: Optional["Pricing"] = None
self._proxy: Optional["Proxy"] = None
self._routes: Optional["Routes"] = None
Expand Down Expand Up @@ -430,6 +432,19 @@ def preview(self) -> "Preview":
self._preview = Preview(self)
return self._preview

@property
def preview_messaging(self) -> "PreviewMessaging":
"""
Access the Preview Messaging Twilio Domain

:returns: Preview Messaging Twilio Domain
"""
if self._preview_messaging is None:
from twilio.rest.preview_messaging import PreviewMessaging

self._preview_messaging = PreviewMessaging(self)
return self._preview_messaging

@property
def pricing(self) -> "Pricing":
"""
Expand Down
43 changes: 43 additions & 0 deletions twilio/rest/preview_messaging/PreviewMessagingBase.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
r"""
This code was generated by
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \

NOTE: This class is auto generated by OpenAPI Generator.
https://openapi-generator.tech
Do not edit the class manually.
"""

from typing import Optional

from twilio.base.domain import Domain
from twilio.rest import Client
from twilio.rest.preview_messaging.v1 import V1


class PreviewMessagingBase(Domain):
def __init__(self, twilio: Client):
"""
Initialize the Preview Messaging Domain

:returns: Domain for Preview Messaging
"""
super().__init__(twilio, "https://preview.messaging.twilio.com")
self._v1: Optional[V1] = None

@property
def v1(self) -> V1:
"""
:returns: Versions v1 of Preview Messaging
"""
if self._v1 is None:
self._v1 = V1(self)
return self._v1

def __repr__(self) -> str:
"""
Provide a friendly representation
:returns: Machine friendly representation
"""
return "<Twilio.PreviewMessaging>"
13 changes: 13 additions & 0 deletions twilio/rest/preview_messaging/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from twilio.rest.preview_messaging.PreviewMessagingBase import PreviewMessagingBase
from twilio.rest.preview_messaging.v1.broadcast import BroadcastList
from twilio.rest.preview_messaging.v1.message import MessageList


class PreviewMessaging(PreviewMessagingBase):
@property
def broadcast(self) -> BroadcastList:
return self.v1.broadcasts

@property
def messages(self) -> MessageList:
return self.v1.messages
50 changes: 50 additions & 0 deletions twilio/rest/preview_messaging/v1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
r"""
This code was generated by
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \

Bulk Messaging and Broadcast
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.

NOTE: This class is auto generated by OpenAPI Generator.
https://openapi-generator.tech
Do not edit the class manually.
"""

from typing import Optional
from twilio.base.version import Version
from twilio.base.domain import Domain
from twilio.rest.preview_messaging.v1.broadcast import BroadcastList
from twilio.rest.preview_messaging.v1.message import MessageList


class V1(Version):
def __init__(self, domain: Domain):
"""
Initialize the V1 version of PreviewMessaging

:param domain: The Twilio.preview_messaging domain
"""
super().__init__(domain, "v1")
self._broadcasts: Optional[BroadcastList] = None
self._messages: Optional[MessageList] = None

@property
def broadcasts(self) -> BroadcastList:
if self._broadcasts is None:
self._broadcasts = BroadcastList(self)
return self._broadcasts

@property
def messages(self) -> MessageList:
if self._messages is None:
self._messages = MessageList(self)
return self._messages

def __repr__(self) -> str:
"""
Provide a friendly representation
:returns: Machine friendly representation
"""
return "<Twilio.PreviewMessaging.V1>"
126 changes: 126 additions & 0 deletions twilio/rest/preview_messaging/v1/broadcast.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
r"""
This code was generated by
___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __
| | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/
| |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \

Bulk Messaging and Broadcast
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.

NOTE: This class is auto generated by OpenAPI Generator.
https://openapi-generator.tech
Do not edit the class manually.
"""


from datetime import datetime
from typing import Any, Dict, Optional, Union
from twilio.base import deserialize, values

from twilio.base.instance_resource import InstanceResource
from twilio.base.list_resource import ListResource
from twilio.base.version import Version


class BroadcastInstance(InstanceResource):

"""
:ivar broadcast_sid: Numeric ID indentifying individual Broadcast requests
:ivar created_date: Timestamp of when the Broadcast was created
:ivar updated_date: Timestamp of when the Broadcast was last updated
: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
:ivar execution_details:
:ivar results_file: Path to a file detailing successful requests and errors from Broadcast execution
"""

def __init__(self, version: Version, payload: Dict[str, Any]):
super().__init__(version)

self.broadcast_sid: Optional[str] = payload.get("broadcast_sid")
self.created_date: Optional[datetime] = deserialize.iso8601_datetime(
payload.get("created_date")
)
self.updated_date: Optional[datetime] = deserialize.iso8601_datetime(
payload.get("updated_date")
)
self.broadcast_status: Optional[str] = payload.get("broadcast_status")
self.execution_details: Optional[str] = payload.get("execution_details")
self.results_file: Optional[str] = payload.get("results_file")

def __repr__(self) -> str:
"""
Provide a friendly representation

:returns: Machine friendly representation
"""

return "<Twilio.PreviewMessaging.V1.BroadcastInstance>"


class BroadcastList(ListResource):
def __init__(self, version: Version):
"""
Initialize the BroadcastList

:param version: Version that contains the resource

"""
super().__init__(version)

self._uri = "/Broadcasts"

def create(
self, x_twilio_request_key: Union[str, object] = values.unset
) -> BroadcastInstance:
"""
Create the BroadcastInstance

:param x_twilio_request_key: Idempotency key provided by the client

:returns: The created BroadcastInstance
"""

data = values.of({})
headers = values.of(
{
"X-Twilio-Request-Key": x_twilio_request_key,
}
)

payload = self._version.create(
method="POST", uri=self._uri, data=data, headers=headers
)

return BroadcastInstance(self._version, payload)

async def create_async(
self, x_twilio_request_key: Union[str, object] = values.unset
) -> BroadcastInstance:
"""
Asynchronously create the BroadcastInstance

:param x_twilio_request_key: Idempotency key provided by the client

:returns: The created BroadcastInstance
"""

data = values.of({})
headers = values.of(
{
"X-Twilio-Request-Key": x_twilio_request_key,
}
)

payload = await self._version.create_async(
method="POST", uri=self._uri, data=data, headers=headers
)

return BroadcastInstance(self._version, payload)

def __repr__(self) -> str:
"""
Provide a friendly representation

:returns: Machine friendly representation
"""
return "<Twilio.PreviewMessaging.V1.BroadcastList>"
Loading