From 7b52a49026a45bad6cb4e2840cb8f77d51a216f8 Mon Sep 17 00:00:00 2001 From: Shubham Date: Fri, 23 Feb 2024 18:27:15 +0530 Subject: [PATCH] * feat: json content type (#737) * feat: add application/json support for client * feat: add application/json support for client * feat: add application/json support for client * feat: add application/json support for client * feat: add application/json support for client * chore: updated changelogs for rc-branch * 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 * corrected rc version * Update setup.py * Update setup.py * chore: corrected cluster test * chore: disables cluster test (#765) * chore: disables cluster test * chore: added make prettier to workflow * feat!: MVR release preparation (#766) * feat!: MVR release preparation * fix: added test for json data in http client --------- Co-authored-by: Manisha Singh Co-authored-by: sbansla Co-authored-by: Twilio --- UPGRADE.md | 9 + tests/unit/http/test_http_client.py | 26 +++ twilio/http/http_client.py | 13 +- twilio/rest/__init__.py | 15 ++ .../rest/api/v2010/account/call/__init__.py | 72 ------- .../api/v2010/account/conference/__init__.py | 72 ------- .../api/v2010/account/message/__init__.py | 46 +--- .../content/v1/content/approval_create.py | 138 ++++++++++++ twilio/rest/flex_api/v1/configuration.py | 52 +++++ twilio/rest/numbers/v1/__init__.py | 16 ++ twilio/rest/numbers/v1/bulk_eligibility.py | 32 +++ twilio/rest/numbers/v1/eligibility.py | 91 ++++++++ twilio/rest/numbers/v1/porting_port_in.py | 93 ++++++++ .../numbers/v2/bulk_hosted_number_order.py | 32 +++ .../regulatory_compliance/bundle/__init__.py | 36 ---- .../preview_messaging/PreviewMessagingBase.py | 44 ++++ twilio/rest/preview_messaging/__init__.py | 13 ++ twilio/rest/preview_messaging/v1/__init__.py | 51 +++++ twilio/rest/preview_messaging/v1/broadcast.py | 125 +++++++++++ twilio/rest/preview_messaging/v1/message.py | 203 ++++++++++++++++++ .../v1/workspace/task_queue/__init__.py | 17 ++ .../task_queue_bulk_real_time_statistics.py | 123 +++++++++++ 22 files changed, 1089 insertions(+), 230 deletions(-) create mode 100644 twilio/rest/content/v1/content/approval_create.py create mode 100644 twilio/rest/numbers/v1/eligibility.py create mode 100644 twilio/rest/numbers/v1/porting_port_in.py create mode 100644 twilio/rest/preview_messaging/PreviewMessagingBase.py create mode 100644 twilio/rest/preview_messaging/__init__.py create mode 100644 twilio/rest/preview_messaging/v1/__init__.py create mode 100644 twilio/rest/preview_messaging/v1/broadcast.py create mode 100644 twilio/rest/preview_messaging/v1/message.py create mode 100644 twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_bulk_real_time_statistics.py diff --git a/UPGRADE.md b/UPGRADE.md index 79bdb48cc..03c196bf5 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -3,6 +3,15 @@ _`MAJOR` version bumps will have upgrade notes posted here._ +## [2024-02-20] 8.x.x to 9.x.x +### Overview + +##### Twilio Python Helper Library’s major version 9.0.0 is now available. We ensured that you can upgrade to Python helper Library 9.0.0 version without any breaking changes of existing apis + +Behind the scenes Python Helper is now auto-generated via OpenAPI with this release. This enables us to rapidly add new features and enhance consistency across versions and languages. +We're pleased to inform you that version 9.0.0 adds support for the application/json content type in the request body. + + ## [2023-04-05] 7.x.x to 8.x.x - **Supported Python versions updated** diff --git a/tests/unit/http/test_http_client.py b/tests/unit/http/test_http_client.py index e599aaaf0..8484e57b1 100644 --- a/tests/unit/http/test_http_client.py +++ b/tests/unit/http/test_http_client.py @@ -145,6 +145,32 @@ def test_last_request_last_response_exist(self): "testing-unicode: Ω≈ç√, 💩", self.client._test_only_last_response.text ) + def test_request_with_json(self): + self.request_mock.url = "https://api.twilio.com/" + self.request_mock.headers = {"Host": "other.twilio.com"} + + self.client.request( + "doesnt-matter-method", + "doesnt-matter-url", + {"params-value": "params-key"}, + {"json-key": "json-value"}, + {"Content-Type": "application/json"}, + ) + + self.assertIsNotNone(self.client._test_only_last_request) + self.assertEqual( + {"Content-Type": "application/json"}, + self.client._test_only_last_request.headers, + ) + + self.assertIsNotNone(self.client._test_only_last_response) + + if self.client._test_only_last_response is not None: + self.assertEqual(200, self.client._test_only_last_response.status_code) + self.assertEqual( + "testing-unicode: Ω≈ç√, 💩", self.client._test_only_last_response.text + ) + def test_last_response_empty_on_error(self): self.session_mock.send.side_effect = Exception("voltron") diff --git a/twilio/http/http_client.py b/twilio/http/http_client.py index bfc38feaf..7a1715ad4 100644 --- a/twilio/http/http_client.py +++ b/twilio/http/http_client.py @@ -27,11 +27,10 @@ def __init__( ): """ Constructor for the TwilioHttpClient - :param pool_connections :param request_hooks :param timeout: Timeout for the requests. - Timeout should never be zero (0) or less. + Timeout should never be zero (0) or less :param logger :param proxy: Http proxy for the requests session :param max_retries: Maximum number of retries each request should attempt @@ -65,10 +64,10 @@ def request( :param headers: HTTP Headers to send with the request :param auth: Basic Auth arguments :param timeout: Socket/Read timeout for the request - :param allow_redirects: Whether or not to allow redirects + :param allow_redirects: Whether to allow redirects See the requests documentation for explanation of all these parameters - :return: An http response + :return: An HTTP response """ if timeout is None: timeout = self.timeout @@ -79,12 +78,14 @@ def request( "method": method.upper(), "url": url, "params": params, - "data": data, "headers": headers, "auth": auth, "hooks": self.request_hooks, } - + if headers and headers.get("Content-Type") == "application/json": + kwargs["json"] = data + else: + kwargs["data"] = data self.log_request(kwargs) self._test_only_last_response = None diff --git a/twilio/rest/__init__.py b/twilio/rest/__init__.py index 3e895271f..818688e39 100644 --- a/twilio/rest/__init__.py +++ b/twilio/rest/__init__.py @@ -28,6 +28,7 @@ from twilio.rest.ip_messaging import IpMessaging from twilio.rest.lookups import Lookups from twilio.rest.media import Media + from twilio.rest.preview_messaging import PreviewMessaging from twilio.rest.messaging import Messaging from twilio.rest.microvisor import Microvisor from twilio.rest.monitor import Monitor @@ -135,6 +136,7 @@ def __init__( self._ip_messaging: Optional["IpMessaging"] = None self._lookups: Optional["Lookups"] = None self._media: Optional["Media"] = None + self._preview_messaging: Optional["PreviewMessaging"] = None self._messaging: Optional["Messaging"] = None self._microvisor: Optional["Microvisor"] = None self._monitor: Optional["Monitor"] = None @@ -338,6 +340,19 @@ def media(self) -> "Media": self._media = Media(self) return self._media + @property + def preview_messaging(self) -> "PreviewMessaging": + """ + Access the PreviewMessaging Twilio Domain + + :returns: PreviewMessaging 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 messaging(self) -> "Messaging": """ diff --git a/twilio/rest/api/v2010/account/call/__init__.py b/twilio/rest/api/v2010/account/call/__init__.py index 406db2760..21c4e9c27 100644 --- a/twilio/rest/api/v2010/account/call/__init__.py +++ b/twilio/rest/api/v2010/account/call/__init__.py @@ -984,11 +984,7 @@ def stream( parent_call_sid: Union[str, object] = values.unset, status: Union["CallInstance.Status", object] = values.unset, start_time: Union[datetime, object] = values.unset, - start_time_before: Union[datetime, object] = values.unset, - start_time_after: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, - end_time_before: Union[datetime, object] = values.unset, - end_time_after: Union[datetime, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> Iterator[CallInstance]: @@ -1003,11 +999,7 @@ def stream( :param str parent_call_sid: Only include calls spawned by calls with this SID. :param "CallInstance.Status" status: The status of the calls to include. Can be: `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`. :param datetime start_time: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. - :param datetime start_time_before: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. - :param datetime start_time_after: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. :param datetime end_time: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. - :param datetime end_time_before: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. - :param datetime end_time_after: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1024,11 +1016,7 @@ def stream( parent_call_sid=parent_call_sid, status=status, start_time=start_time, - start_time_before=start_time_before, - start_time_after=start_time_after, end_time=end_time, - end_time_before=end_time_before, - end_time_after=end_time_after, page_size=limits["page_size"], ) @@ -1041,11 +1029,7 @@ async def stream_async( parent_call_sid: Union[str, object] = values.unset, status: Union["CallInstance.Status", object] = values.unset, start_time: Union[datetime, object] = values.unset, - start_time_before: Union[datetime, object] = values.unset, - start_time_after: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, - end_time_before: Union[datetime, object] = values.unset, - end_time_after: Union[datetime, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> AsyncIterator[CallInstance]: @@ -1060,11 +1044,7 @@ async def stream_async( :param str parent_call_sid: Only include calls spawned by calls with this SID. :param "CallInstance.Status" status: The status of the calls to include. Can be: `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`. :param datetime start_time: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. - :param datetime start_time_before: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. - :param datetime start_time_after: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. :param datetime end_time: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. - :param datetime end_time_before: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. - :param datetime end_time_after: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1081,11 +1061,7 @@ async def stream_async( parent_call_sid=parent_call_sid, status=status, start_time=start_time, - start_time_before=start_time_before, - start_time_after=start_time_after, end_time=end_time, - end_time_before=end_time_before, - end_time_after=end_time_after, page_size=limits["page_size"], ) @@ -1098,11 +1074,7 @@ def list( parent_call_sid: Union[str, object] = values.unset, status: Union["CallInstance.Status", object] = values.unset, start_time: Union[datetime, object] = values.unset, - start_time_before: Union[datetime, object] = values.unset, - start_time_after: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, - end_time_before: Union[datetime, object] = values.unset, - end_time_after: Union[datetime, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[CallInstance]: @@ -1116,11 +1088,7 @@ def list( :param str parent_call_sid: Only include calls spawned by calls with this SID. :param "CallInstance.Status" status: The status of the calls to include. Can be: `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`. :param datetime start_time: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. - :param datetime start_time_before: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. - :param datetime start_time_after: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. :param datetime end_time: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. - :param datetime end_time_before: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. - :param datetime end_time_after: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1137,11 +1105,7 @@ def list( parent_call_sid=parent_call_sid, status=status, start_time=start_time, - start_time_before=start_time_before, - start_time_after=start_time_after, end_time=end_time, - end_time_before=end_time_before, - end_time_after=end_time_after, limit=limit, page_size=page_size, ) @@ -1154,11 +1118,7 @@ async def list_async( parent_call_sid: Union[str, object] = values.unset, status: Union["CallInstance.Status", object] = values.unset, start_time: Union[datetime, object] = values.unset, - start_time_before: Union[datetime, object] = values.unset, - start_time_after: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, - end_time_before: Union[datetime, object] = values.unset, - end_time_after: Union[datetime, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[CallInstance]: @@ -1172,11 +1132,7 @@ async def list_async( :param str parent_call_sid: Only include calls spawned by calls with this SID. :param "CallInstance.Status" status: The status of the calls to include. Can be: `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`. :param datetime start_time: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. - :param datetime start_time_before: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. - :param datetime start_time_after: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. :param datetime end_time: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. - :param datetime end_time_before: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. - :param datetime end_time_after: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -1194,11 +1150,7 @@ async def list_async( parent_call_sid=parent_call_sid, status=status, start_time=start_time, - start_time_before=start_time_before, - start_time_after=start_time_after, end_time=end_time, - end_time_before=end_time_before, - end_time_after=end_time_after, limit=limit, page_size=page_size, ) @@ -1211,11 +1163,7 @@ def page( parent_call_sid: Union[str, object] = values.unset, status: Union["CallInstance.Status", object] = values.unset, start_time: Union[datetime, object] = values.unset, - start_time_before: Union[datetime, object] = values.unset, - start_time_after: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, - end_time_before: Union[datetime, object] = values.unset, - end_time_after: Union[datetime, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -1229,11 +1177,7 @@ def page( :param parent_call_sid: Only include calls spawned by calls with this SID. :param status: The status of the calls to include. Can be: `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`. :param start_time: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. - :param start_time_before: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. - :param start_time_after: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. :param end_time: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. - :param end_time_before: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. - :param end_time_after: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state :param page_size: Number of records to return, defaults to 50 @@ -1247,11 +1191,7 @@ def page( "ParentCallSid": parent_call_sid, "Status": status, "StartTime": serialize.iso8601_datetime(start_time), - "StartTime<": serialize.iso8601_datetime(start_time_before), - "StartTime>": serialize.iso8601_datetime(start_time_after), "EndTime": serialize.iso8601_datetime(end_time), - "EndTime<": serialize.iso8601_datetime(end_time_before), - "EndTime>": serialize.iso8601_datetime(end_time_after), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -1268,11 +1208,7 @@ async def page_async( parent_call_sid: Union[str, object] = values.unset, status: Union["CallInstance.Status", object] = values.unset, start_time: Union[datetime, object] = values.unset, - start_time_before: Union[datetime, object] = values.unset, - start_time_after: Union[datetime, object] = values.unset, end_time: Union[datetime, object] = values.unset, - end_time_before: Union[datetime, object] = values.unset, - end_time_after: Union[datetime, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -1286,11 +1222,7 @@ async def page_async( :param parent_call_sid: Only include calls spawned by calls with this SID. :param status: The status of the calls to include. Can be: `queued`, `ringing`, `in-progress`, `canceled`, `completed`, `failed`, `busy`, or `no-answer`. :param start_time: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. - :param start_time_before: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. - :param start_time_after: Only include calls that started on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that started on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read calls that started on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read calls that started on or after midnight of this date. :param end_time: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. - :param end_time_before: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. - :param end_time_after: Only include calls that ended on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read only calls that ended on this date. You can also specify an inequality, such as `EndTime<=YYYY-MM-DD`, to read calls that ended on or before midnight of this date, and `EndTime>=YYYY-MM-DD` to read calls that ended on or after midnight of this date. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state :param page_size: Number of records to return, defaults to 50 @@ -1304,11 +1236,7 @@ async def page_async( "ParentCallSid": parent_call_sid, "Status": status, "StartTime": serialize.iso8601_datetime(start_time), - "StartTime<": serialize.iso8601_datetime(start_time_before), - "StartTime>": serialize.iso8601_datetime(start_time_after), "EndTime": serialize.iso8601_datetime(end_time), - "EndTime<": serialize.iso8601_datetime(end_time_before), - "EndTime>": serialize.iso8601_datetime(end_time_after), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/api/v2010/account/conference/__init__.py b/twilio/rest/api/v2010/account/conference/__init__.py index fff75dea5..36cd390c6 100644 --- a/twilio/rest/api/v2010/account/conference/__init__.py +++ b/twilio/rest/api/v2010/account/conference/__init__.py @@ -412,11 +412,7 @@ def __init__(self, version: Version, account_sid: str): def stream( self, date_created: Union[date, object] = values.unset, - date_created_before: Union[date, object] = values.unset, - date_created_after: Union[date, object] = values.unset, date_updated: Union[date, object] = values.unset, - date_updated_before: Union[date, object] = values.unset, - date_updated_after: Union[date, object] = values.unset, friendly_name: Union[str, object] = values.unset, status: Union["ConferenceInstance.Status", object] = values.unset, limit: Optional[int] = None, @@ -429,11 +425,7 @@ def stream( The results are returned as a generator, so this operation is memory efficient. :param date date_created: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. - :param date date_created_before: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. - :param date date_created_after: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. :param date date_updated: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. - :param date date_updated_before: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. - :param date date_updated_after: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. :param str friendly_name: The string that identifies the Conference resources to read. :param "ConferenceInstance.Status" status: The status of the resources to read. Can be: `init`, `in-progress`, or `completed`. :param limit: Upper limit for the number of records to return. stream() @@ -448,11 +440,7 @@ def stream( limits = self._version.read_limits(limit, page_size) page = self.page( date_created=date_created, - date_created_before=date_created_before, - date_created_after=date_created_after, date_updated=date_updated, - date_updated_before=date_updated_before, - date_updated_after=date_updated_after, friendly_name=friendly_name, status=status, page_size=limits["page_size"], @@ -463,11 +451,7 @@ def stream( async def stream_async( self, date_created: Union[date, object] = values.unset, - date_created_before: Union[date, object] = values.unset, - date_created_after: Union[date, object] = values.unset, date_updated: Union[date, object] = values.unset, - date_updated_before: Union[date, object] = values.unset, - date_updated_after: Union[date, object] = values.unset, friendly_name: Union[str, object] = values.unset, status: Union["ConferenceInstance.Status", object] = values.unset, limit: Optional[int] = None, @@ -480,11 +464,7 @@ async def stream_async( The results are returned as a generator, so this operation is memory efficient. :param date date_created: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. - :param date date_created_before: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. - :param date date_created_after: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. :param date date_updated: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. - :param date date_updated_before: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. - :param date date_updated_after: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. :param str friendly_name: The string that identifies the Conference resources to read. :param "ConferenceInstance.Status" status: The status of the resources to read. Can be: `init`, `in-progress`, or `completed`. :param limit: Upper limit for the number of records to return. stream() @@ -499,11 +479,7 @@ async def stream_async( limits = self._version.read_limits(limit, page_size) page = await self.page_async( date_created=date_created, - date_created_before=date_created_before, - date_created_after=date_created_after, date_updated=date_updated, - date_updated_before=date_updated_before, - date_updated_after=date_updated_after, friendly_name=friendly_name, status=status, page_size=limits["page_size"], @@ -514,11 +490,7 @@ async def stream_async( def list( self, date_created: Union[date, object] = values.unset, - date_created_before: Union[date, object] = values.unset, - date_created_after: Union[date, object] = values.unset, date_updated: Union[date, object] = values.unset, - date_updated_before: Union[date, object] = values.unset, - date_updated_after: Union[date, object] = values.unset, friendly_name: Union[str, object] = values.unset, status: Union["ConferenceInstance.Status", object] = values.unset, limit: Optional[int] = None, @@ -530,11 +502,7 @@ def list( memory before returning. :param date date_created: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. - :param date date_created_before: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. - :param date date_created_after: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. :param date date_updated: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. - :param date date_updated_before: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. - :param date date_updated_after: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. :param str friendly_name: The string that identifies the Conference resources to read. :param "ConferenceInstance.Status" status: The status of the resources to read. Can be: `init`, `in-progress`, or `completed`. :param limit: Upper limit for the number of records to return. list() guarantees @@ -549,11 +517,7 @@ def list( return list( self.stream( date_created=date_created, - date_created_before=date_created_before, - date_created_after=date_created_after, date_updated=date_updated, - date_updated_before=date_updated_before, - date_updated_after=date_updated_after, friendly_name=friendly_name, status=status, limit=limit, @@ -564,11 +528,7 @@ def list( async def list_async( self, date_created: Union[date, object] = values.unset, - date_created_before: Union[date, object] = values.unset, - date_created_after: Union[date, object] = values.unset, date_updated: Union[date, object] = values.unset, - date_updated_before: Union[date, object] = values.unset, - date_updated_after: Union[date, object] = values.unset, friendly_name: Union[str, object] = values.unset, status: Union["ConferenceInstance.Status", object] = values.unset, limit: Optional[int] = None, @@ -580,11 +540,7 @@ async def list_async( memory before returning. :param date date_created: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. - :param date date_created_before: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. - :param date date_created_after: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. :param date date_updated: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. - :param date date_updated_before: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. - :param date date_updated_after: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. :param str friendly_name: The string that identifies the Conference resources to read. :param "ConferenceInstance.Status" status: The status of the resources to read. Can be: `init`, `in-progress`, or `completed`. :param limit: Upper limit for the number of records to return. list() guarantees @@ -600,11 +556,7 @@ async def list_async( record async for record in await self.stream_async( date_created=date_created, - date_created_before=date_created_before, - date_created_after=date_created_after, date_updated=date_updated, - date_updated_before=date_updated_before, - date_updated_after=date_updated_after, friendly_name=friendly_name, status=status, limit=limit, @@ -615,11 +567,7 @@ async def list_async( def page( self, date_created: Union[date, object] = values.unset, - date_created_before: Union[date, object] = values.unset, - date_created_after: Union[date, object] = values.unset, date_updated: Union[date, object] = values.unset, - date_updated_before: Union[date, object] = values.unset, - date_updated_after: Union[date, object] = values.unset, friendly_name: Union[str, object] = values.unset, status: Union["ConferenceInstance.Status", object] = values.unset, page_token: Union[str, object] = values.unset, @@ -631,11 +579,7 @@ def page( Request is executed immediately :param date_created: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. - :param date_created_before: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. - :param date_created_after: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. :param date_updated: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. - :param date_updated_before: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. - :param date_updated_after: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. :param friendly_name: The string that identifies the Conference resources to read. :param status: The status of the resources to read. Can be: `init`, `in-progress`, or `completed`. :param page_token: PageToken provided by the API @@ -647,11 +591,7 @@ def page( data = values.of( { "DateCreated": serialize.iso8601_date(date_created), - "DateCreated<": serialize.iso8601_date(date_created_before), - "DateCreated>": serialize.iso8601_date(date_created_after), "DateUpdated": serialize.iso8601_date(date_updated), - "DateUpdated<": serialize.iso8601_date(date_updated_before), - "DateUpdated>": serialize.iso8601_date(date_updated_after), "FriendlyName": friendly_name, "Status": status, "PageToken": page_token, @@ -666,11 +606,7 @@ def page( async def page_async( self, date_created: Union[date, object] = values.unset, - date_created_before: Union[date, object] = values.unset, - date_created_after: Union[date, object] = values.unset, date_updated: Union[date, object] = values.unset, - date_updated_before: Union[date, object] = values.unset, - date_updated_after: Union[date, object] = values.unset, friendly_name: Union[str, object] = values.unset, status: Union["ConferenceInstance.Status", object] = values.unset, page_token: Union[str, object] = values.unset, @@ -682,11 +618,7 @@ async def page_async( Request is executed immediately :param date_created: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. - :param date_created_before: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. - :param date_created_after: The `date_created` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that started on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that started on or after midnight on a date, use `>=YYYY-MM-DD`. :param date_updated: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. - :param date_updated_before: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. - :param date_updated_after: The `date_updated` value, specified as `YYYY-MM-DD`, of the resources to read. To read conferences that were last updated on or before midnight on a date, use `<=YYYY-MM-DD`, and to specify conferences that were last updated on or after midnight on a given date, use `>=YYYY-MM-DD`. :param friendly_name: The string that identifies the Conference resources to read. :param status: The status of the resources to read. Can be: `init`, `in-progress`, or `completed`. :param page_token: PageToken provided by the API @@ -698,11 +630,7 @@ async def page_async( data = values.of( { "DateCreated": serialize.iso8601_date(date_created), - "DateCreated<": serialize.iso8601_date(date_created_before), - "DateCreated>": serialize.iso8601_date(date_created_after), "DateUpdated": serialize.iso8601_date(date_updated), - "DateUpdated<": serialize.iso8601_date(date_updated_before), - "DateUpdated>": serialize.iso8601_date(date_updated_after), "FriendlyName": friendly_name, "Status": status, "PageToken": page_token, diff --git a/twilio/rest/api/v2010/account/message/__init__.py b/twilio/rest/api/v2010/account/message/__init__.py index 9706e80cf..8d8144d33 100644 --- a/twilio/rest/api/v2010/account/message/__init__.py +++ b/twilio/rest/api/v2010/account/message/__init__.py @@ -674,8 +674,6 @@ def stream( to: Union[str, object] = values.unset, from_: Union[str, object] = values.unset, date_sent: Union[datetime, object] = values.unset, - date_sent_before: Union[datetime, object] = values.unset, - date_sent_after: Union[datetime, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> Iterator[MessageInstance]: @@ -688,8 +686,6 @@ def stream( :param str to: Filter by recipient. For example: Set this `to` parameter to `+15558881111` to retrieve a list of Message resources with `to` properties of `+15558881111` :param str from_: Filter by sender. For example: Set this `from` parameter to `+15552229999` to retrieve a list of Message resources with `from` properties of `+15552229999` :param datetime date_sent: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). - :param datetime date_sent_before: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). - :param datetime date_sent_after: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -701,12 +697,7 @@ def stream( """ limits = self._version.read_limits(limit, page_size) page = self.page( - to=to, - from_=from_, - date_sent=date_sent, - date_sent_before=date_sent_before, - date_sent_after=date_sent_after, - page_size=limits["page_size"], + to=to, from_=from_, date_sent=date_sent, page_size=limits["page_size"] ) return self._version.stream(page, limits["limit"]) @@ -716,8 +707,6 @@ async def stream_async( to: Union[str, object] = values.unset, from_: Union[str, object] = values.unset, date_sent: Union[datetime, object] = values.unset, - date_sent_before: Union[datetime, object] = values.unset, - date_sent_after: Union[datetime, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> AsyncIterator[MessageInstance]: @@ -730,8 +719,6 @@ async def stream_async( :param str to: Filter by recipient. For example: Set this `to` parameter to `+15558881111` to retrieve a list of Message resources with `to` properties of `+15558881111` :param str from_: Filter by sender. For example: Set this `from` parameter to `+15552229999` to retrieve a list of Message resources with `from` properties of `+15552229999` :param datetime date_sent: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). - :param datetime date_sent_before: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). - :param datetime date_sent_after: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -743,12 +730,7 @@ async def stream_async( """ limits = self._version.read_limits(limit, page_size) page = await self.page_async( - to=to, - from_=from_, - date_sent=date_sent, - date_sent_before=date_sent_before, - date_sent_after=date_sent_after, - page_size=limits["page_size"], + to=to, from_=from_, date_sent=date_sent, page_size=limits["page_size"] ) return self._version.stream_async(page, limits["limit"]) @@ -758,8 +740,6 @@ def list( to: Union[str, object] = values.unset, from_: Union[str, object] = values.unset, date_sent: Union[datetime, object] = values.unset, - date_sent_before: Union[datetime, object] = values.unset, - date_sent_after: Union[datetime, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[MessageInstance]: @@ -771,8 +751,6 @@ def list( :param str to: Filter by recipient. For example: Set this `to` parameter to `+15558881111` to retrieve a list of Message resources with `to` properties of `+15558881111` :param str from_: Filter by sender. For example: Set this `from` parameter to `+15552229999` to retrieve a list of Message resources with `from` properties of `+15552229999` :param datetime date_sent: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). - :param datetime date_sent_before: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). - :param datetime date_sent_after: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -787,8 +765,6 @@ def list( to=to, from_=from_, date_sent=date_sent, - date_sent_before=date_sent_before, - date_sent_after=date_sent_after, limit=limit, page_size=page_size, ) @@ -799,8 +775,6 @@ async def list_async( to: Union[str, object] = values.unset, from_: Union[str, object] = values.unset, date_sent: Union[datetime, object] = values.unset, - date_sent_before: Union[datetime, object] = values.unset, - date_sent_after: Union[datetime, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[MessageInstance]: @@ -812,8 +786,6 @@ async def list_async( :param str to: Filter by recipient. For example: Set this `to` parameter to `+15558881111` to retrieve a list of Message resources with `to` properties of `+15558881111` :param str from_: Filter by sender. For example: Set this `from` parameter to `+15552229999` to retrieve a list of Message resources with `from` properties of `+15552229999` :param datetime date_sent: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). - :param datetime date_sent_before: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). - :param datetime date_sent_after: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -829,8 +801,6 @@ async def list_async( to=to, from_=from_, date_sent=date_sent, - date_sent_before=date_sent_before, - date_sent_after=date_sent_after, limit=limit, page_size=page_size, ) @@ -841,8 +811,6 @@ def page( to: Union[str, object] = values.unset, from_: Union[str, object] = values.unset, date_sent: Union[datetime, object] = values.unset, - date_sent_before: Union[datetime, object] = values.unset, - date_sent_after: Union[datetime, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -854,8 +822,6 @@ def page( :param to: Filter by recipient. For example: Set this `to` parameter to `+15558881111` to retrieve a list of Message resources with `to` properties of `+15558881111` :param from_: Filter by sender. For example: Set this `from` parameter to `+15552229999` to retrieve a list of Message resources with `from` properties of `+15552229999` :param date_sent: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). - :param date_sent_before: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). - :param date_sent_after: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state :param page_size: Number of records to return, defaults to 50 @@ -867,8 +833,6 @@ def page( "To": to, "From": from_, "DateSent": serialize.iso8601_datetime(date_sent), - "DateSent<": serialize.iso8601_datetime(date_sent_before), - "DateSent>": serialize.iso8601_datetime(date_sent_after), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -883,8 +847,6 @@ async def page_async( to: Union[str, object] = values.unset, from_: Union[str, object] = values.unset, date_sent: Union[datetime, object] = values.unset, - date_sent_before: Union[datetime, object] = values.unset, - date_sent_after: Union[datetime, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -896,8 +858,6 @@ async def page_async( :param to: Filter by recipient. For example: Set this `to` parameter to `+15558881111` to retrieve a list of Message resources with `to` properties of `+15558881111` :param from_: Filter by sender. For example: Set this `from` parameter to `+15552229999` to retrieve a list of Message resources with `from` properties of `+15552229999` :param date_sent: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). - :param date_sent_before: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). - :param date_sent_after: Filter by Message `sent_date`. Accepts GMT dates in the following formats: `YYYY-MM-DD` (to find Messages with a specific `sent_date`), `<=YYYY-MM-DD` (to find Messages with `sent_date`s on and before a specific date), and `>=YYYY-MM-DD` (to find Messages with `sent_dates` on and after a specific date). :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state :param page_size: Number of records to return, defaults to 50 @@ -909,8 +869,6 @@ async def page_async( "To": to, "From": from_, "DateSent": serialize.iso8601_datetime(date_sent), - "DateSent<": serialize.iso8601_datetime(date_sent_before), - "DateSent>": serialize.iso8601_datetime(date_sent_after), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/content/v1/content/approval_create.py b/twilio/rest/content/v1/content/approval_create.py new file mode 100644 index 000000000..63a447430 --- /dev/null +++ b/twilio/rest/content/v1/content/approval_create.py @@ -0,0 +1,138 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Content + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Any, Dict, Optional + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class ApprovalCreateInstance(InstanceResource): + """ + :ivar name: + :ivar category: + :ivar content_type: + :ivar status: + :ivar rejection_reason: + :ivar allow_category_change: + """ + + def __init__(self, version: Version, payload: Dict[str, Any], sid: str): + super().__init__(version) + + self.name: Optional[str] = payload.get("name") + self.category: Optional[str] = payload.get("category") + self.content_type: Optional[str] = payload.get("content_type") + self.status: Optional[str] = payload.get("status") + self.rejection_reason: Optional[str] = payload.get("rejection_reason") + self.allow_category_change: Optional[bool] = payload.get( + "allow_category_change" + ) + + self._solution = { + "sid": sid, + } + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return "".format(context) + + +class ApprovalCreateList(ListResource): + + class ContentApprovalRequest(object): + """ + :ivar name: Name of the template. + :ivar category: A WhatsApp recognized template category. + """ + + def __init__(self, payload: Dict[str, Any], sid: str): + + self.name: Optional[str] = payload.get("name") + self.category: Optional[str] = payload.get("category") + + def to_dict(self): + return { + "name": self.name, + "category": self.category, + } + + def __init__(self, version: Version, sid: str): + """ + Initialize the ApprovalCreateList + + :param version: Version that contains the resource + :param sid: + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "sid": sid, + } + self._uri = "/Content/{sid}/ApprovalRequests/whatsapp".format(**self._solution) + + def create( + self, content_approval_request: ContentApprovalRequest + ) -> ApprovalCreateInstance: + """ + Create the ApprovalCreateInstance + + :param content_approval_request: + + :returns: The created ApprovalCreateInstance + """ + data = content_approval_request.to_dict() + + headers = {"Content-Type": "application/json"} + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ApprovalCreateInstance(self._version, payload, sid=self._solution["sid"]) + + async def create_async( + self, content_approval_request: ContentApprovalRequest + ) -> ApprovalCreateInstance: + """ + Asynchronously create the ApprovalCreateInstance + + :param content_approval_request: + + :returns: The created ApprovalCreateInstance + """ + + data = content_approval_request.to_dict() + headers = {"Content-Type": "application/json"} + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return ApprovalCreateInstance(self._version, payload, sid=self._solution["sid"]) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/flex_api/v1/configuration.py b/twilio/rest/flex_api/v1/configuration.py index 511321a58..b35808151 100644 --- a/twilio/rest/flex_api/v1/configuration.py +++ b/twilio/rest/flex_api/v1/configuration.py @@ -237,6 +237,24 @@ async def fetch_async( ui_version=ui_version, ) + def update(self) -> "ConfigurationInstance": + """ + Update the ConfigurationInstance + + + :returns: The updated ConfigurationInstance + """ + return self._proxy.update() + + async def update_async(self) -> "ConfigurationInstance": + """ + Asynchronous coroutine to update the ConfigurationInstance + + + :returns: The updated ConfigurationInstance + """ + return await self._proxy.update_async() + def __repr__(self) -> str: """ Provide a friendly representation @@ -309,6 +327,40 @@ async def fetch_async( payload, ) + def update(self) -> ConfigurationInstance: + """ + Update the ConfigurationInstance + + + :returns: The updated ConfigurationInstance + """ + data = values.of({}) + + payload = self._version.update( + method="POST", + uri=self._uri, + data=data, + ) + + return ConfigurationInstance(self._version, payload) + + async def update_async(self) -> ConfigurationInstance: + """ + Asynchronous coroutine to update the ConfigurationInstance + + + :returns: The updated ConfigurationInstance + """ + data = values.of({}) + + payload = await self._version.update_async( + method="POST", + uri=self._uri, + data=data, + ) + + return ConfigurationInstance(self._version, payload) + def __repr__(self) -> str: """ Provide a friendly representation diff --git a/twilio/rest/numbers/v1/__init__.py b/twilio/rest/numbers/v1/__init__.py index 384b0d95e..95223e161 100644 --- a/twilio/rest/numbers/v1/__init__.py +++ b/twilio/rest/numbers/v1/__init__.py @@ -16,7 +16,9 @@ from twilio.base.version import Version from twilio.base.domain import Domain from twilio.rest.numbers.v1.bulk_eligibility import BulkEligibilityList +from twilio.rest.numbers.v1.eligibility import EligibilityList from twilio.rest.numbers.v1.porting_bulk_portability import PortingBulkPortabilityList +from twilio.rest.numbers.v1.porting_port_in import PortingPortInList from twilio.rest.numbers.v1.porting_port_in_fetch import PortingPortInFetchList from twilio.rest.numbers.v1.porting_portability import PortingPortabilityList @@ -31,7 +33,9 @@ def __init__(self, domain: Domain): """ super().__init__(domain, "v1") self._bulk_eligibilities: Optional[BulkEligibilityList] = None + self._eligibilities: Optional[EligibilityList] = None self._porting_bulk_portabilities: Optional[PortingBulkPortabilityList] = None + self._porting_port_ins: Optional[PortingPortInList] = None self._porting_port_ins: Optional[PortingPortInFetchList] = None self._porting_portabilities: Optional[PortingPortabilityList] = None @@ -41,12 +45,24 @@ def bulk_eligibilities(self) -> BulkEligibilityList: self._bulk_eligibilities = BulkEligibilityList(self) return self._bulk_eligibilities + @property + def eligibilities(self) -> EligibilityList: + if self._eligibilities is None: + self._eligibilities = EligibilityList(self) + return self._eligibilities + @property def porting_bulk_portabilities(self) -> PortingBulkPortabilityList: if self._porting_bulk_portabilities is None: self._porting_bulk_portabilities = PortingBulkPortabilityList(self) return self._porting_bulk_portabilities + @property + def porting_port_ins(self) -> PortingPortInList: + if self._porting_port_ins is None: + self._porting_port_ins = PortingPortInList(self) + return self._porting_port_ins + @property def porting_port_ins(self) -> PortingPortInFetchList: if self._porting_port_ins is None: diff --git a/twilio/rest/numbers/v1/bulk_eligibility.py b/twilio/rest/numbers/v1/bulk_eligibility.py index 64be314b4..c13f42c79 100644 --- a/twilio/rest/numbers/v1/bulk_eligibility.py +++ b/twilio/rest/numbers/v1/bulk_eligibility.py @@ -178,6 +178,38 @@ def __init__(self, version: Version): """ super().__init__(version) + self._uri = "/HostedNumber/Eligibility/Bulk" + + def create(self) -> BulkEligibilityInstance: + """ + Create the BulkEligibilityInstance + + + :returns: The created BulkEligibilityInstance + """ + + payload = self._version.create( + method="POST", + uri=self._uri, + ) + + return BulkEligibilityInstance(self._version, payload) + + async def create_async(self) -> BulkEligibilityInstance: + """ + Asynchronously create the BulkEligibilityInstance + + + :returns: The created BulkEligibilityInstance + """ + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + ) + + return BulkEligibilityInstance(self._version, payload) + def get(self, request_id: str) -> BulkEligibilityContext: """ Constructs a BulkEligibilityContext diff --git a/twilio/rest/numbers/v1/eligibility.py b/twilio/rest/numbers/v1/eligibility.py new file mode 100644 index 000000000..99461374e --- /dev/null +++ b/twilio/rest/numbers/v1/eligibility.py @@ -0,0 +1,91 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Any, Dict, List, Optional + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class EligibilityInstance(InstanceResource): + """ + :ivar results: The result set that contains the eligibility check response for the requested number, each result has at least the following attributes: phone_number: The requested phone number ,hosting_account_sid: The account sid where the phone number will be hosted, date_last_checked: Datetime (ISO 8601) when the PN was last checked for eligibility, country: Phone number’s country, eligibility_status: Indicates the eligibility status of the PN (Eligible/Ineligible), eligibility_sub_status: Indicates the sub status of the eligibility , ineligibility_reason: Reason for number's ineligibility (if applicable), next_step: Suggested next step in the hosting process based on the eligibility status. + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.results: Optional[List[Dict[str, object]]] = payload.get("results") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class EligibilityList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the EligibilityList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/HostedNumber/Eligibility" + + def create(self) -> EligibilityInstance: + """ + Create the EligibilityInstance + + + :returns: The created EligibilityInstance + """ + + payload = self._version.create( + method="POST", + uri=self._uri, + ) + + return EligibilityInstance(self._version, payload) + + async def create_async(self) -> EligibilityInstance: + """ + Asynchronously create the EligibilityInstance + + + :returns: The created EligibilityInstance + """ + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + ) + + return EligibilityInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/numbers/v1/porting_port_in.py b/twilio/rest/numbers/v1/porting_port_in.py new file mode 100644 index 000000000..ad3140a0b --- /dev/null +++ b/twilio/rest/numbers/v1/porting_port_in.py @@ -0,0 +1,93 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Numbers + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Any, Dict, Optional + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class PortingPortInInstance(InstanceResource): + """ + :ivar port_in_request_sid: The SID of the Port In request. This is a unique identifier of the port in request. + :ivar url: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.port_in_request_sid: Optional[str] = payload.get("port_in_request_sid") + self.url: Optional[str] = payload.get("url") + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class PortingPortInList(ListResource): + + def __init__(self, version: Version): + """ + Initialize the PortingPortInList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Porting/PortIn" + + def create(self) -> PortingPortInInstance: + """ + Create the PortingPortInInstance + + + :returns: The created PortingPortInInstance + """ + + payload = self._version.create( + method="POST", + uri=self._uri, + ) + + return PortingPortInInstance(self._version, payload) + + async def create_async(self) -> PortingPortInInstance: + """ + Asynchronously create the PortingPortInInstance + + + :returns: The created PortingPortInInstance + """ + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + ) + + return PortingPortInInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/numbers/v2/bulk_hosted_number_order.py b/twilio/rest/numbers/v2/bulk_hosted_number_order.py index 31f95814f..f7f6026c5 100644 --- a/twilio/rest/numbers/v2/bulk_hosted_number_order.py +++ b/twilio/rest/numbers/v2/bulk_hosted_number_order.py @@ -216,6 +216,38 @@ def __init__(self, version: Version): """ super().__init__(version) + self._uri = "/HostedNumber/Orders/Bulk" + + def create(self) -> BulkHostedNumberOrderInstance: + """ + Create the BulkHostedNumberOrderInstance + + + :returns: The created BulkHostedNumberOrderInstance + """ + + payload = self._version.create( + method="POST", + uri=self._uri, + ) + + return BulkHostedNumberOrderInstance(self._version, payload) + + async def create_async(self) -> BulkHostedNumberOrderInstance: + """ + Asynchronously create the BulkHostedNumberOrderInstance + + + :returns: The created BulkHostedNumberOrderInstance + """ + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + ) + + return BulkHostedNumberOrderInstance(self._version, payload) + def get(self, bulk_hosting_sid: str) -> BulkHostedNumberOrderContext: """ Constructs a BulkHostedNumberOrderContext diff --git a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py index 5e1eec5b1..8215bb95b 100644 --- a/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py +++ b/twilio/rest/numbers/v2/regulatory_compliance/bundle/__init__.py @@ -578,8 +578,6 @@ def stream( sort_by: Union["BundleInstance.SortBy", object] = values.unset, sort_direction: Union["BundleInstance.SortDirection", object] = values.unset, valid_until_date: Union[datetime, object] = values.unset, - valid_until_date_before: Union[datetime, object] = values.unset, - valid_until_date_after: Union[datetime, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> Iterator[BundleInstance]: @@ -598,8 +596,6 @@ def stream( :param "BundleInstance.SortBy" sort_by: Can be `valid-until` or `date-updated`. Defaults to `date-created`. :param "BundleInstance.SortDirection" sort_direction: Default is `DESC`. Can be `ASC` or `DESC`. :param datetime valid_until_date: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. - :param datetime valid_until_date_before: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. - :param datetime valid_until_date_after: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -620,8 +616,6 @@ def stream( sort_by=sort_by, sort_direction=sort_direction, valid_until_date=valid_until_date, - valid_until_date_before=valid_until_date_before, - valid_until_date_after=valid_until_date_after, page_size=limits["page_size"], ) @@ -638,8 +632,6 @@ async def stream_async( sort_by: Union["BundleInstance.SortBy", object] = values.unset, sort_direction: Union["BundleInstance.SortDirection", object] = values.unset, valid_until_date: Union[datetime, object] = values.unset, - valid_until_date_before: Union[datetime, object] = values.unset, - valid_until_date_after: Union[datetime, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> AsyncIterator[BundleInstance]: @@ -658,8 +650,6 @@ async def stream_async( :param "BundleInstance.SortBy" sort_by: Can be `valid-until` or `date-updated`. Defaults to `date-created`. :param "BundleInstance.SortDirection" sort_direction: Default is `DESC`. Can be `ASC` or `DESC`. :param datetime valid_until_date: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. - :param datetime valid_until_date_before: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. - :param datetime valid_until_date_after: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. :param limit: Upper limit for the number of records to return. stream() guarantees to never return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -680,8 +670,6 @@ async def stream_async( sort_by=sort_by, sort_direction=sort_direction, valid_until_date=valid_until_date, - valid_until_date_before=valid_until_date_before, - valid_until_date_after=valid_until_date_after, page_size=limits["page_size"], ) @@ -698,8 +686,6 @@ def list( sort_by: Union["BundleInstance.SortBy", object] = values.unset, sort_direction: Union["BundleInstance.SortDirection", object] = values.unset, valid_until_date: Union[datetime, object] = values.unset, - valid_until_date_before: Union[datetime, object] = values.unset, - valid_until_date_after: Union[datetime, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[BundleInstance]: @@ -717,8 +703,6 @@ def list( :param "BundleInstance.SortBy" sort_by: Can be `valid-until` or `date-updated`. Defaults to `date-created`. :param "BundleInstance.SortDirection" sort_direction: Default is `DESC`. Can be `ASC` or `DESC`. :param datetime valid_until_date: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. - :param datetime valid_until_date_before: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. - :param datetime valid_until_date_after: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -739,8 +723,6 @@ def list( sort_by=sort_by, sort_direction=sort_direction, valid_until_date=valid_until_date, - valid_until_date_before=valid_until_date_before, - valid_until_date_after=valid_until_date_after, limit=limit, page_size=page_size, ) @@ -757,8 +739,6 @@ async def list_async( sort_by: Union["BundleInstance.SortBy", object] = values.unset, sort_direction: Union["BundleInstance.SortDirection", object] = values.unset, valid_until_date: Union[datetime, object] = values.unset, - valid_until_date_before: Union[datetime, object] = values.unset, - valid_until_date_after: Union[datetime, object] = values.unset, limit: Optional[int] = None, page_size: Optional[int] = None, ) -> List[BundleInstance]: @@ -776,8 +756,6 @@ async def list_async( :param "BundleInstance.SortBy" sort_by: Can be `valid-until` or `date-updated`. Defaults to `date-created`. :param "BundleInstance.SortDirection" sort_direction: Default is `DESC`. Can be `ASC` or `DESC`. :param datetime valid_until_date: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. - :param datetime valid_until_date_before: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. - :param datetime valid_until_date_after: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. :param limit: Upper limit for the number of records to return. list() guarantees never to return more than limit. Default is no limit :param page_size: Number of records to fetch per request, when not set will use @@ -799,8 +777,6 @@ async def list_async( sort_by=sort_by, sort_direction=sort_direction, valid_until_date=valid_until_date, - valid_until_date_before=valid_until_date_before, - valid_until_date_after=valid_until_date_after, limit=limit, page_size=page_size, ) @@ -817,8 +793,6 @@ def page( sort_by: Union["BundleInstance.SortBy", object] = values.unset, sort_direction: Union["BundleInstance.SortDirection", object] = values.unset, valid_until_date: Union[datetime, object] = values.unset, - valid_until_date_before: Union[datetime, object] = values.unset, - valid_until_date_after: Union[datetime, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -836,8 +810,6 @@ def page( :param sort_by: Can be `valid-until` or `date-updated`. Defaults to `date-created`. :param sort_direction: Default is `DESC`. Can be `ASC` or `DESC`. :param valid_until_date: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. - :param valid_until_date_before: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. - :param valid_until_date_after: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state :param page_size: Number of records to return, defaults to 50 @@ -855,8 +827,6 @@ def page( "SortBy": sort_by, "SortDirection": sort_direction, "ValidUntilDate": serialize.iso8601_datetime(valid_until_date), - "ValidUntilDate<": serialize.iso8601_datetime(valid_until_date_before), - "ValidUntilDate>": serialize.iso8601_datetime(valid_until_date_after), "PageToken": page_token, "Page": page_number, "PageSize": page_size, @@ -877,8 +847,6 @@ async def page_async( sort_by: Union["BundleInstance.SortBy", object] = values.unset, sort_direction: Union["BundleInstance.SortDirection", object] = values.unset, valid_until_date: Union[datetime, object] = values.unset, - valid_until_date_before: Union[datetime, object] = values.unset, - valid_until_date_after: Union[datetime, object] = values.unset, page_token: Union[str, object] = values.unset, page_number: Union[int, object] = values.unset, page_size: Union[int, object] = values.unset, @@ -896,8 +864,6 @@ async def page_async( :param sort_by: Can be `valid-until` or `date-updated`. Defaults to `date-created`. :param sort_direction: Default is `DESC`. Can be `ASC` or `DESC`. :param valid_until_date: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. - :param valid_until_date_before: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. - :param valid_until_date_after: Date to filter Bundles having their `valid_until_date` before or after the specified date. Can be `ValidUntilDate>=` or `ValidUntilDate<=`. Both can be used in conjunction as well. [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) is the acceptable date format. :param page_token: PageToken provided by the API :param page_number: Page Number, this value is simply for client state :param page_size: Number of records to return, defaults to 50 @@ -915,8 +881,6 @@ async def page_async( "SortBy": sort_by, "SortDirection": sort_direction, "ValidUntilDate": serialize.iso8601_datetime(valid_until_date), - "ValidUntilDate<": serialize.iso8601_datetime(valid_until_date_before), - "ValidUntilDate>": serialize.iso8601_datetime(valid_until_date_after), "PageToken": page_token, "Page": page_number, "PageSize": page_size, diff --git a/twilio/rest/preview_messaging/PreviewMessagingBase.py b/twilio/rest/preview_messaging/PreviewMessagingBase.py new file mode 100644 index 000000000..12b19f4cf --- /dev/null +++ b/twilio/rest/preview_messaging/PreviewMessagingBase.py @@ -0,0 +1,44 @@ +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 PreviewMessaging Domain + + :returns: Domain for PreviewMessaging + """ + super().__init__(twilio, "https://preview.messaging.twilio.com") + self._v1: Optional[V1] = None + + @property + def v1(self) -> V1: + """ + :returns: Versions v1 of PreviewMessaging + """ + 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 "" diff --git a/twilio/rest/preview_messaging/__init__.py b/twilio/rest/preview_messaging/__init__.py new file mode 100644 index 000000000..73bf67969 --- /dev/null +++ b/twilio/rest/preview_messaging/__init__.py @@ -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 diff --git a/twilio/rest/preview_messaging/v1/__init__.py b/twilio/rest/preview_messaging/v1/__init__.py new file mode 100644 index 000000000..424af648e --- /dev/null +++ b/twilio/rest/preview_messaging/v1/__init__.py @@ -0,0 +1,51 @@ +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 "" diff --git a/twilio/rest/preview_messaging/v1/broadcast.py b/twilio/rest/preview_messaging/v1/broadcast.py new file mode 100644 index 000000000..e41e066ba --- /dev/null +++ b/twilio/rest/preview_messaging/v1/broadcast.py @@ -0,0 +1,125 @@ +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 "" + + +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 "" diff --git a/twilio/rest/preview_messaging/v1/message.py b/twilio/rest/preview_messaging/v1/message.py new file mode 100644 index 000000000..c6212c7f4 --- /dev/null +++ b/twilio/rest/preview_messaging/v1/message.py @@ -0,0 +1,203 @@ +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 Any, Dict, List, Optional +from twilio.base import deserialize + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class MessageInstance(InstanceResource): + """ + :ivar total_message_count: The number of Messages processed in the request, equal to the sum of success_count and error_count. + :ivar success_count: The number of Messages successfully created. + :ivar error_count: The number of Messages unsuccessfully processed in the request. + :ivar message_receipts: + :ivar failed_message_receipts: + """ + + def __init__(self, version: Version, payload: Dict[str, Any]): + super().__init__(version) + + self.total_message_count: Optional[int] = deserialize.integer( + payload.get("total_message_count") + ) + self.success_count: Optional[int] = deserialize.integer( + payload.get("success_count") + ) + self.error_count: Optional[int] = deserialize.integer( + payload.get("error_count") + ) + self.message_receipts: Optional[List[str]] = payload.get("message_receipts") + self.failed_message_receipts: Optional[List[str]] = payload.get( + "failed_message_receipts" + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + + return "" + + +class MessageList(ListResource): + + class CreateMessagesRequest(object): + """ + :ivar messages: + :ivar from_: A Twilio phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, an [alphanumeric sender ID](https://www.twilio.com/docs/sms/send-messages#use-an-alphanumeric-sender-id), or a [Channel Endpoint address](https://www.twilio.com/docs/sms/channels#channel-addresses) that is enabled for the type of message you want to send. Phone numbers or [short codes](https://www.twilio.com/docs/sms/api/short-code) purchased from Twilio also work here. You cannot, for example, spoof messages from a private cell phone number. If you are using `messaging_service_sid`, this parameter must be empty. + :ivar messaging_service_sid: The SID of the [Messaging Service](https://www.twilio.com/docs/sms/services#send-a-message-with-copilot) you want to associate with the Message. Set this parameter to use the [Messaging Service Settings and Copilot Features](https://www.twilio.com/console/sms/services) you have configured and leave the `from` parameter empty. When only this parameter is set, Twilio will use your enabled Copilot Features to select the `from` phone number for delivery. + :ivar body: The text of the message you want to send. Can be up to 1,600 characters in length. + :ivar content_sid: The SID of the preconfigured [Content Template](https://www.twilio.com/docs/content-api/create-and-send-your-first-content-api-template#create-a-template) you want to associate with the Message. Must be used in conjuction with a preconfigured [Messaging Service Settings and Copilot Features](https://www.twilio.com/console/sms/services) When this parameter is set, Twilio will use your configured content template and the provided `ContentVariables`. This Twilio product is currently in Private Beta. + :ivar media_url: The URL of the media to send with the message. The media can be of type `gif`, `png`, and `jpeg` and will be formatted correctly on the recipient's device. The media size limit is 5MB for supported file types (JPEG, PNG, GIF) and 500KB for [other types](https://www.twilio.com/docs/sms/accepted-mime-types) of accepted media. To send more than one image in the message body, provide multiple `media_url` parameters in the POST request. You can include up to 10 `media_url` parameters per message. You can send images in an SMS message in only the US and Canada. + :ivar status_callback: The URL we should call using the \"status_callback_method\" to send status information to your application. If specified, we POST these message status changes to the URL - queued, failed, sent, delivered, or undelivered. Twilio will POST its [standard request parameters](https://www.twilio.com/docs/messaging/twiml#request-parameters) as well as some additional parameters including \"MessageSid\", \"MessageStatus\", and \"ErrorCode\". If you include this parameter with the \"messaging_service_sid\", we use this URL instead of the Status Callback URL of the [Messaging Service](https://www.twilio.com/docs/messaging/services/api). URLs must contain a valid hostname and underscores are not allowed. + :ivar validity_period: How long in seconds the message can remain in our outgoing message queue. After this period elapses, the message fails and we call your status callback. Can be between 1 and the default value of 14,400 seconds. After a message has been accepted by a carrier, however, we cannot guarantee that the message will not be queued after this period. We recommend that this value be at least 5 seconds. + :ivar send_at: The time at which Twilio will send the message. This parameter can be used to schedule a message to be sent at a particular time. Must be in ISO 8601 format. + :ivar schedule_type: This parameter indicates your intent to schedule a message. Pass the value `fixed` to schedule a message at a fixed time. This parameter works in conjuction with the `SendAt` parameter. + :ivar shorten_urls: Determines the usage of Click Tracking. Setting it to `true` will instruct Twilio to replace all links in the Message with a shortened version based on the associated Domain Sid and track clicks on them. If this parameter is not set on an API call, we will use the value set on the Messaging Service. If this parameter is not set and the value is not configured on the Messaging Service used this will default to `false`. + :ivar send_as_mms: If set to True, Twilio will deliver the message as a single MMS message, regardless of the presence of media. + :ivar max_price: The maximum total price in US dollars that you will pay for the message to be delivered. Can be a decimal value that has up to 4 decimal places. All messages are queued for delivery and the message cost is checked before the message is sent. If the cost exceeds max_price, the message will fail and a status of Failed is sent to the status callback. If MaxPrice is not set, the message cost is not checked. + :ivar attempt: Total number of attempts made ( including this ) to send out the message regardless of the provider used + :ivar smart_encoded: This parameter indicates whether to detect Unicode characters that have a similar GSM-7 character and replace them. Can be true or false. + :ivar force_delivery: This parameter allows Twilio to send SMS traffic to carriers without checking/caring whether the destination number is a mobile or a landline. + :ivar application_sid: The SID of the application that should receive message status. We POST a message_sid parameter and a message_status parameter with a value of sent or failed to the application's message_status_callback. If a status_callback parameter is also passed, it will be ignored and the application's message_status_callback parameter will be used. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.messages: Optional[List[MessageList.MessagingV1Message]] = payload.get( + "messages" + ) + self.from_: Optional[str] = payload.get("from_") + self.messaging_service_sid: Optional[str] = payload.get( + "messaging_service_sid" + ) + self.body: Optional[str] = payload.get("body") + self.content_sid: Optional[str] = payload.get("content_sid") + self.media_url: Optional[List[str]] = payload.get("media_url") + self.status_callback: Optional[str] = payload.get("status_callback") + self.validity_period: Optional[int] = payload.get("validity_period") + self.send_at: Optional[str] = payload.get("send_at") + self.schedule_type: Optional[str] = payload.get("schedule_type") + self.shorten_urls: Optional[bool] = payload.get("shorten_urls") + self.send_as_mms: Optional[bool] = payload.get("send_as_mms") + self.max_price: Optional[float] = payload.get("max_price") + self.attempt: Optional[int] = payload.get("attempt") + self.smart_encoded: Optional[bool] = payload.get("smart_encoded") + self.force_delivery: Optional[bool] = payload.get("force_delivery") + self.application_sid: Optional[str] = payload.get("application_sid") + + def to_dict(self): + return { + "messages": [messages.to_dict() for messages in self.messages], + "from": self.from_, + "messaging_service_sid": self.messaging_service_sid, + "body": self.body, + "content_sid": self.content_sid, + "media_url": self.media_url, + "status_callback": self.status_callback, + "validity_period": self.validity_period, + "send_at": self.send_at, + "schedule_type": self.schedule_type, + "shorten_urls": self.shorten_urls, + "send_as_mms": self.send_as_mms, + "max_price": self.max_price, + "attempt": self.attempt, + "smart_encoded": self.smart_encoded, + "force_delivery": self.force_delivery, + "application_sid": self.application_sid, + } + + class MessagingV1Message(object): + """ + :ivar to: The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format for SMS/MMS or [Channel user address](https://www.twilio.com/docs/sms/channels#channel-addresses) for other 3rd-party channels. + :ivar body: The text of the message you want to send. Can be up to 1,600 characters in length. Overrides the request-level body and content template if provided. + :ivar content_variables: Key-value pairs of variable names to substitution values. Refer to the [Twilio Content API Resources](https://www.twilio.com/docs/content-api/content-api-resources#send-a-message-with-preconfigured-content) for more details. + """ + + def __init__(self, payload: Dict[str, Any]): + + self.to: Optional[str] = payload.get("to") + self.body: Optional[str] = payload.get("body") + self.content_variables: Optional[dict[str, str]] = payload.get( + "content_variables" + ) + + def to_dict(self): + return { + "to": self.to, + "body": self.body, + "content_variables": self.content_variables, + } + + def __init__(self, version: Version): + """ + Initialize the MessageList + + :param version: Version that contains the resource + + """ + super().__init__(version) + + self._uri = "/Messages" + + def create(self, create_messages_request: CreateMessagesRequest) -> MessageInstance: + """ + Create the MessageInstance + + :param create_messages_request: + + :returns: The created MessageInstance + """ + data = create_messages_request.to_dict() + + headers = {"Content-Type": "application/json"} + payload = self._version.create( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return MessageInstance(self._version, payload) + + async def create_async( + self, create_messages_request: CreateMessagesRequest + ) -> MessageInstance: + """ + Asynchronously create the MessageInstance + + :param create_messages_request: + + :returns: The created MessageInstance + """ + + data = create_messages_request.to_dict() + headers = {"Content-Type": "application/json"} + + payload = await self._version.create_async( + method="POST", uri=self._uri, data=data, headers=headers + ) + + return MessageInstance(self._version, payload) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return "" diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py index 5c750d94c..794fd216d 100644 --- a/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/__init__.py @@ -20,6 +20,9 @@ from twilio.base.list_resource import ListResource from twilio.base.version import Version from twilio.base.page import Page +from twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_bulk_real_time_statistics import ( + TaskQueueBulkRealTimeStatisticsList, +) from twilio.rest.taskrouter.v1.workspace.task_queue.task_queue_cumulative_statistics import ( TaskQueueCumulativeStatisticsList, ) @@ -515,6 +518,9 @@ def __init__(self, version: Version, workspace_sid: str): } self._uri = "/Workspaces/{workspace_sid}/TaskQueues".format(**self._solution) + self._bulk_real_time_statistics: Optional[ + TaskQueueBulkRealTimeStatisticsList + ] = None self._statistics: Optional[TaskQueuesStatisticsList] = None def create( @@ -862,6 +868,17 @@ async def get_page_async(self, target_url: str) -> TaskQueuePage: response = await self._version.domain.twilio.request_async("GET", target_url) return TaskQueuePage(self._version, response, self._solution) + @property + def bulk_real_time_statistics(self) -> TaskQueueBulkRealTimeStatisticsList: + """ + Access the bulk_real_time_statistics + """ + if self._bulk_real_time_statistics is None: + self._bulk_real_time_statistics = TaskQueueBulkRealTimeStatisticsList( + self._version, workspace_sid=self._solution["workspace_sid"] + ) + return self._bulk_real_time_statistics + @property def statistics(self) -> TaskQueuesStatisticsList: """ diff --git a/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_bulk_real_time_statistics.py b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_bulk_real_time_statistics.py new file mode 100644 index 000000000..90552babf --- /dev/null +++ b/twilio/rest/taskrouter/v1/workspace/task_queue/task_queue_bulk_real_time_statistics.py @@ -0,0 +1,123 @@ +r""" + This code was generated by + ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ + | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ + | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ + + Twilio - Taskrouter + This is the public Twilio REST API. + + NOTE: This class is auto generated by OpenAPI Generator. + https://openapi-generator.tech + Do not edit the class manually. +""" + +from typing import Any, Dict, List, Optional +from twilio.base import deserialize + +from twilio.base.instance_resource import InstanceResource +from twilio.base.list_resource import ListResource +from twilio.base.version import Version + + +class TaskQueueBulkRealTimeStatisticsInstance(InstanceResource): + """ + :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the TaskQueue resource. + :ivar workspace_sid: The SID of the Workspace that contains the TaskQueue. + :ivar task_queue_data: The real-time statistics for each requested TaskQueue SID. `task_queue_data` returns the following attributes: `task_queue_sid`: The SID of the TaskQueue from which these statistics were calculated. `total_available_workers`: The total number of Workers available for Tasks in the TaskQueue. `total_eligible_workers`: The total number of Workers eligible for Tasks in the TaskQueue, regardless of their Activity state. `total_tasks`: The total number of Tasks. `longest_task_waiting_age`: The age of the longest waiting Task. `longest_task_waiting_sid`: The SID of the longest waiting Task. `tasks_by_status`: The number of Tasks grouped by their current status. `tasks_by_priority`: The number of Tasks grouped by priority. `activity_statistics`: The number of current Workers grouped by Activity. + :ivar task_queue_response_count: The number of TaskQueue statistics received in task_queue_data. + :ivar url: The absolute URL of the TaskQueue statistics resource. + """ + + def __init__(self, version: Version, payload: Dict[str, Any], workspace_sid: str): + super().__init__(version) + + self.account_sid: Optional[str] = payload.get("account_sid") + self.workspace_sid: Optional[str] = payload.get("workspace_sid") + self.task_queue_data: Optional[List[Dict[str, object]]] = payload.get( + "task_queue_data" + ) + self.task_queue_response_count: Optional[int] = deserialize.integer( + payload.get("task_queue_response_count") + ) + self.url: Optional[str] = payload.get("url") + + self._solution = { + "workspace_sid": workspace_sid, + } + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + context = " ".join("{}={}".format(k, v) for k, v in self._solution.items()) + return ( + "".format( + context + ) + ) + + +class TaskQueueBulkRealTimeStatisticsList(ListResource): + + def __init__(self, version: Version, workspace_sid: str): + """ + Initialize the TaskQueueBulkRealTimeStatisticsList + + :param version: Version that contains the resource + :param workspace_sid: The unique SID identifier of the Workspace. + + """ + super().__init__(version) + + # Path Solution + self._solution = { + "workspace_sid": workspace_sid, + } + self._uri = "/Workspaces/{workspace_sid}/TaskQueues/RealTimeStatistics".format( + **self._solution + ) + + def create(self) -> TaskQueueBulkRealTimeStatisticsInstance: + """ + Create the TaskQueueBulkRealTimeStatisticsInstance + + + :returns: The created TaskQueueBulkRealTimeStatisticsInstance + """ + + payload = self._version.create( + method="POST", + uri=self._uri, + ) + + return TaskQueueBulkRealTimeStatisticsInstance( + self._version, payload, workspace_sid=self._solution["workspace_sid"] + ) + + async def create_async(self) -> TaskQueueBulkRealTimeStatisticsInstance: + """ + Asynchronously create the TaskQueueBulkRealTimeStatisticsInstance + + + :returns: The created TaskQueueBulkRealTimeStatisticsInstance + """ + + payload = await self._version.create_async( + method="POST", + uri=self._uri, + ) + + return TaskQueueBulkRealTimeStatisticsInstance( + self._version, payload, workspace_sid=self._solution["workspace_sid"] + ) + + def __repr__(self) -> str: + """ + Provide a friendly representation + + :returns: Machine friendly representation + """ + return ""